repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

package.nu: provisioning packages

d17dfa64cfb2f4e2444b8dc13456d1e4786b4806

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (17)

NB-00718.symlinks

Modified
1 +Notes
2 +~/Notes
1 4 wezterm
2 5 ~/.config/wezterm

Notes

Added
new file mode 160000
1 +Subproject commit 569b9633c1a4d46d1715853f793053aa9ca0be43

fedora.symlinks

Modified
1 +Notes
2 +~/Notes
1 4 git/gitconfig
2 5 ~/.config/git/config
19 22 subversion/merge
20 23 ~/.local/bin/svn.merge
22 -tools/git-info
23 -~/.local/bin/git-info
25 25 cargo/config.toml
26 26 ~/.cargo/config.toml

helix/config.toml

Modified
1 -theme = "nugu-light"
1 +theme = "nugu-dark"
3 3 [editor]
4 4 shell = ["nu", "--commands"]

neovim/lua/bugabinga/key_preview.lua

Modified
15 15 -- Built-in completion
16 16 { mode = 'i', keys = '<C-x>' },
18 + -- Movement
19 + { mode = 'n', keys = '[' },
20 + { mode = 'n', keys = ']' },
18 22 -- `g` key
19 23 { mode = 'n', keys = 'g' },
20 24 { mode = 'x', keys = 'g' },

neovim/lua/bugabinga/options/keymaps.lua

Modified
1 1 local map = require 'std.map'
2 -local const = require 'std.const'
3 2 local togglers = require 'bugabinga.options.togglers'
5 4 -- set <SPACE> as leader key
31 30 command = '<nop>',
33 +map.visual {
34 + description = 'Keep visual selection when indenting',
35 + keys = '>',
36 + command = '>gv',
37 + remap = false,
40 +map.visual {
41 + description = 'Keep visual selection when outdenting',
42 + keys = '<',
43 + command = '<gv',
44 + remap = false,
34 47 map.normal {
35 48 description = 'Dismiss current search highlight',
36 49 category = 'search',
53 66 category = 'ui',
54 67 keys = '<leader>tt',
55 68 command = function()
56 - if vim.opt.background:get() == 'dark' then
69 + if vim.opt.background:get() == 'dark' then ---@diagnostic disable-line: undefined-field
57 70 vim.opt.background = 'light'
58 71 else
59 72 vim.opt.background = 'dark'
61 - vim.notify('Toggled background to ' .. vim.opt.background:get() .. '.')
74 + vim.notify('Toggled background to ' .. vim.opt.background:get() .. '.') ---@diagnostic disable-line: undefined-field
62 75 end,

neovim/lua/bugabinga/textobjects.lua

Modified
17 17 ['ac'] = { query = '@comment.outer', description = 'outer comment' },
18 18 ['ic'] = { query = '@comment.inner', description = 'inner comment' },
20 + ['al'] = { query = '@loop.outer', description = 'outer loop' },
21 + ['il'] = { query = '@loop.inner', description = 'inner loop' },
23 + ['ab'] = { query = '@block.outer', description = 'outer block' },
24 + ['ib'] = { query = '@block.inner', description = 'inner block' },
26 + ['as'] = { query = '@statement.outer', description = 'outer statement' },
27 + ['is'] = { query = '@statement.inner', description = 'inner statement' },
29 + ['at'] = { query = '@class.outer', description = 'outer class' },
30 + ['it'] = { query = '@class.inner', description = 'inner class' },
21 33 for keys, maps in pairs(textobject_select_keymaps) do

nushell/modules/package/folders.nu

Modified
25 25 $binaries
28 -const database = $package_home ++ '/Database'
29 -export def database [] {
30 - mkdir $database
31 - $database
32 -}
34 28 const programs = $package_home ++ '/Programs'
35 29 export def programs [] {
36 30 mkdir $programs

nushell/modules/package/installer.nu

Modified
3 3 # Installs manifests.
4 4 # Installign a manifest can mean to download the package and place the files
5 5 # into special folders managed by `package.nu`, or delegating to the native package
6 6 # manager.
7 7 # The precedence of installation method is:
8 -# native package manager > pachages > language package manager
8 +# packages > native package manager > language package manager
10 10 use ./lib.nu *
11 11 use ./extractor.nu

nushell/modules/package/lib.nu

Modified
51 +# Checks any value for the expected type.
52 +# The expected type must be given EXACTLY as reported by `describe`.
53 +# Remember the whitespace!
54 +# If the type does not match, an error is thrown.
55 +export def type-check [
56 + expected_type: string # Expected typ of piped in value
57 +]: any -> nothing {
58 + let actual_type = ($in | describe)
59 + if ( $actual_type != $expected_type) {
60 + error make {
61 + msg: $'Type error'
62 + label: {
63 + text: $'Expected ($expected_type) type, but was ($actual_type)'
64 + span: (metadata $in).span
65 + }
66 + }
67 + }

nushell/modules/package/manifestor.nu

Modified
5 5 # other manifests together.
7 7 use ./folders.nu
8 +use ./lib.nu *
9 10 export def new [
10 11 org: string
99 100 def templatize [
100 101 version: string
101 -]: string -> string {
102 +]: any -> string {
102 103 if ($in | is-not-empty) {
103 - str replace --all $version "{ version }"
104 + $in | type-check 'string'
105 + $in | str replace --all $version "{ version }"
133 135 use ./native-package-manager
135 137 mut version = github fetch-latest-release-version $org $name
136 - let version_extractor = (input --default "v(.*)" $"Github tag version is ($version). Choose version extractor regex: ")
138 + let version_extractor = (input --default "v?(.*)" $"Github tag version is ($version). Choose version extractor regex: ")
137 139 $version = ($version | parse --regex $version_extractor | get capture0.0)
138 140 print $"Extracted version is ($version)"
139 141 let binary_path = $name
295 297 org: string
296 298 name: string
298 - (make-unique-package-name $org $name) ++ '.nu'
300 + (make-unique-package-name $org $name) ++ '.nuon'

nushell/modules/package/mod.nu

Modified
11 11 export module ./manifestor.nu
12 12 export module ./installer.nu
13 +export module ./provider.nu

nushell/modules/package/provider.nu

Modified
3 3 # Provisions a systems by installing/uninstalling packages in provisions.
4 4 # Provisions are a collection of nuon files in PACKAGE_HOME/Provsions/*.
5 5 # All files there are expected to list manifests.
6 6 # They are collected and installed.
7 7 # A precedence order for package sources will be enforced:
8 -# native packages > packages > language packages.
8 +# packages > native packages > language packages.
9 9 # This precedence will be enforced, even if, packages need to be reinstalled.
10 10 # It depends on the availablity of packages in their given source.
12 -# TODO: should i add flatpak to native packages?
14 12 use ./folders.nu
15 13 use ./path.nu
14 +use ./installer.nu
15 +use ./native-package-manager
17 +const INSTALL_ACTION = 'install'
18 +const UNINSTALL_ACTION = 'uninstall'
17 20 export def provision [] {
18 - # scan provisions
21 + cd (folders manifests)
22 + let manifests = ls | get name | str replace '.nuon' '' | wrap manifest
23 + cd (folders provisions)
24 + let provisions = open **/*.nuon | uniq
19 26 # check if installed packages are synced with current manifests
20 27 # check if current installed packages are installed via correct source
21 28 # install all missing. reinstall all with higher precedence
22 29 # uninstall non-provisioned ?
23 30 # setup path

nushell/modules/sy.nu

Modified
1 1 # Check system status
2 2 export def main [] {
3 3 check-deps
5 - let git_status_notes = [ '-C' $env.NOTES status '--short' '--branch' ]
6 4 let git_status_dotfiles = [ '-C' $env.DOTFILES status '--short' '--branch' ]
8 - # print git $git_status_notes
9 - run-external git ...$git_status_notes
10 - # print git $git_status_dotfiles
11 5 run-external git ...$git_status_dotfiles
13 6 macchina
17 10 export def up [] {
18 11 check-deps
20 - let git_add_notes = [ '-C' $env.NOTES add '--all' ]
21 - let git_commit_notes = [ '-C' $env.NOTES commit '--all' ]
22 - let git_push_notes = [ '-C' $env.NOTES push ]
23 13 let git_add_dotfiles = [ '-C' $env.DOTFILES add '--all' ]
24 14 let git_commit_dotfiles = [ '-C' $env.DOTFILES commit '--all' ]
25 15 let git_push_dotfiles = [ '-C' $env.DOTFILES push ]
27 - run-external git ...$git_add_notes
28 - try { run-external git ...$git_commit_notes }
29 - run-external git ...$git_push_notes
31 17 run-external git ...$git_add_dotfiles
32 18 try { run-external git ...$git_commit_dotfiles }
33 19 run-external git ...$git_push_dotfiles
36 22 # Synchronise by downloading
37 23 export def down [] {
38 24 check-deps
40 - let git_pull_notes = [ '-C' $env.NOTES pull ]
41 25 let git_pull_dotfiles = [ '-C' $env.DOTFILES pull ]
43 - # print git $git_pull_notes
44 - run-external git ...$git_pull_notes
45 - # print git $git_pull_dotfiles
46 26 run-external git ...$git_pull_dotfiles
47 - if (not $env.WIN32) {
48 - # print topgrade
49 - run-external topgrade
50 - }
27 + run-external topgrade
53 30 def all-exist [] { all { which $in | is-not-empty } }

termux.symlinks

Modified
1 +Notes
2 +~/Notes
1 4 git/gitconfig
2 5 ~/.config/git/config
19 22 subversion/merge
20 23 ~/.subversion/merge
22 -tools/git-info
23 -~/.local/bin/git-info
25 25 cargo/config.toml
26 26 ~/.cargo/config.toml

wezterm/bugabinga/launch.lua

Modified
7 7 args = { 'topgrade', },
8 8 cwd = wez.home_dir,
10 + {
11 + label = 'Browser',
12 + args = { 'cha', '-V' },
13 + cwd = wez.home_dir,
14 + },
11 16 label = 'Editor',
12 17 args = { 'nvim', },

x230.symlinks

Modified
1 +Notes
2 +~/Notes
1 4 git/gitconfig
2 5 ~/.config/git/config