From 150534c51221c6b8224e0e0b64cef11a368f4864 Mon Sep 17 00:00:00 2001 From: Hung Date: Fri, 20 Jan 2023 14:58:02 -0800 Subject: [PATCH 01/64] add bootstrapping profile for py-poetry --- nix-conf/system/flake.nix | 6 +++--- templates/py-poetry/flake.nix | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/nix-conf/system/flake.nix b/nix-conf/system/flake.nix index e2e7c10..d10d464 100644 --- a/nix-conf/system/flake.nix +++ b/nix-conf/system/flake.nix @@ -16,16 +16,16 @@ agenix.nixosModule { age.secrets.s3fs = { - file = ./secrets/s3fs.age; + file = ../../secrets/s3fs.age; # mode = "600"; # owner + group only # owner = "hungtr"; # group = "users"; }; age.secrets."s3fs.digital-garden" = { - file = ./secrets/s3fs.digital-garden.age; + file = ../../secrets/s3fs.digital-garden.age; }; age.secrets._nhitrl_cred = { - file = ./secrets/_nhitrl.age; + file = ../../secrets/_nhitrl.age; }; environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ]; } diff --git a/templates/py-poetry/flake.nix b/templates/py-poetry/flake.nix index 4e454b9..d8a8e70 100644 --- a/templates/py-poetry/flake.nix +++ b/templates/py-poetry/flake.nix @@ -13,10 +13,15 @@ }); devShells = forAllSystems (system: { + bootstrap = pkgs.${system}.mkShellNoCC { + packages = [ + pkgs.${system}.poetry + ]; + }; default = pkgs.${system}.mkShellNoCC { - packages = with pkgs.${system}; [ - (poetry2nix.mkPoetryEnv { projectDir = self; }) - poetry + packages = [ + (pkgs.${system}.poetry2nix.mkPoetryEnv { projectDir = self; }) + pkgs.${system}.poetry ]; }; }); From d74280a44cb2c65a3cbe89f0167ce72f60de0712 Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 25 Jan 2023 10:44:16 -0800 Subject: [PATCH 02/64] nvim: gopls --- native_configs/neovim/init.lua | 2 +- nix-conf/home-manager/base/neovim.nix | 6 ++++-- nix-conf/home-manager/base/shells.nix | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index b4b3979..4a84496 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -608,7 +608,7 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities() local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'cmake', 'tailwindcss', 'prismals', 'rnix', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels", - "jsonls", "denols" + "jsonls", "denols", "gopls" } require("mason").setup({ ui = { diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix index f9677cd..c59abaf 100644 --- a/nix-conf/home-manager/base/neovim.nix +++ b/nix-conf/home-manager/base/neovim.nix @@ -48,6 +48,8 @@ let pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo pkgs.rust4cargo + pkgs.go + # Language-specific stuffs pkgs.sumneko-lua-language-server @@ -56,8 +58,8 @@ let pkgs.python3Packages.pylint pkgs.python3Packages.flake8 # pkgs.ansible-lint - pkgs.python38Packages.ansible - pkgs.ansible-language-server + # pkgs.python38Packages.ansible + # pkgs.ansible-language-server # TODO: the devShell should provide rust-analyzer so that # cargo test builds binaries compatible with rust-analyzer diff --git a/nix-conf/home-manager/base/shells.nix b/nix-conf/home-manager/base/shells.nix index 6c278ee..e8d4db5 100644 --- a/nix-conf/home-manager/base/shells.nix +++ b/nix-conf/home-manager/base/shells.nix @@ -88,7 +88,8 @@ in "command-not-found" # suggests which package to install; does not support nixos (we have solution already) "gitignore" # `gi list` -> `gi java >>.gitignore` "ripgrep" # adds completion for `rg` - "rust" # compe for rustc/cargo + "rust" # compe for rustc/cargo + "poetry" # compe for poetry - Python's cargo # "vi-mode" # edit promps with vi motions :) ]; }; From c6a69029d7618bae03e5ecd83d2fbbfd3c8826f4 Mon Sep 17 00:00:00 2001 From: Hung Date: Thu, 2 Feb 2023 01:51:09 -0700 Subject: [PATCH 03/64] internal stuffs --- native_configs/ssh/config | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/native_configs/ssh/config b/native_configs/ssh/config index a1b2f67..98b0e7d 100644 --- a/native_configs/ssh/config +++ b/native_configs/ssh/config @@ -52,3 +52,19 @@ Host noami User htran Port 22 +Host sr1 + HostName 10.30.76.46 + User htran + Port 22 + HostKeyAlgorithms=+ssh-dss,ssh-rsa + KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1 + +Host d1-30 + HostName 10.111.103.60 + User htran + Port 22 + +Host dev0 + HostName 10.100.200.230 + User root + Port 22 From 27ed93d41e32157999a867793b16271e7307c0eb Mon Sep 17 00:00:00 2001 From: Hung Date: Sat, 4 Feb 2023 14:48:08 -0700 Subject: [PATCH 04/64] htran work mbp: +slack :D --- native_configs/ssh/config | 5 +++++ nix-conf/home-manager/base/private_chromium.nix | 2 +- nix-conf/home-manager/flake.nix | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/native_configs/ssh/config b/native_configs/ssh/config index 98b0e7d..40383a1 100644 --- a/native_configs/ssh/config +++ b/native_configs/ssh/config @@ -68,3 +68,8 @@ Host dev0 HostName 10.100.200.230 User root Port 22 + +Host dev1 + HostName 10.100.200.220 + User htran + Port 22 diff --git a/nix-conf/home-manager/base/private_chromium.nix b/nix-conf/home-manager/base/private_chromium.nix index 5cb7204..6679332 100644 --- a/nix-conf/home-manager/base/private_chromium.nix +++ b/nix-conf/home-manager/base/private_chromium.nix @@ -14,7 +14,7 @@ in ''; }; }; - config = lib.mkIf cfg.enable { + config = lib.mkIf (cfg.enable) { # home.packages = [pkgs.ungoogled-chromium]; programs.chromium = { enable = true; diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 3b3abda..4ff0355 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -171,6 +171,10 @@ inherit pkgs; modules = base.modules ++ [ ./home.nix + ./base/productive_desktop.nix + { + base.private_chromium.enable = false; + } { base.graphics.enable = false; # don't want to deal with GL stuffs on mac yet :/ From 4283dba3157f943d0740a39702fecd1622843fb7 Mon Sep 17 00:00:00 2001 From: Hung Date: Thu, 9 Feb 2023 21:54:08 -0700 Subject: [PATCH 05/64] ssh: +id_ed25519 --- native_configs/ssh/config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/native_configs/ssh/config b/native_configs/ssh/config index 40383a1..a504d93 100644 --- a/native_configs/ssh/config +++ b/native_configs/ssh/config @@ -1,5 +1,5 @@ Host * - IdentityFile ~/.ssh/id_rsa + IdentityFile ~/.ssh/id_rsa ~/.ssh/id_ed25519 # felia mirror on windows Host felia-win @@ -73,3 +73,4 @@ Host dev1 HostName 10.100.200.220 User htran Port 22 + From 34982b3079211e4dab264d90a0d499c4fecfefe5 Mon Sep 17 00:00:00 2001 From: Hung Date: Sun, 12 Feb 2023 12:02:27 -0700 Subject: [PATCH 06/64] fix ssh and use yq-go instead of yq --- native_configs/ssh/config | 13 ++++++++++++- nix-conf/home-manager/home.nix | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/native_configs/ssh/config b/native_configs/ssh/config index a504d93..34043ac 100644 --- a/native_configs/ssh/config +++ b/native_configs/ssh/config @@ -1,5 +1,6 @@ Host * - IdentityFile ~/.ssh/id_rsa ~/.ssh/id_ed25519 + IdentityFile ~/.ssh/id_rsa + IdentityFile ~/.ssh/id_ed25519 # felia mirror on windows Host felia-win @@ -74,3 +75,13 @@ Host dev1 User htran Port 22 + +Host ztp-egi + HostName 10.23.27.201 + User root + Port 22 + +Host d3l-3 + HostName 10.111.103.65 + User htran + Port 22 diff --git a/nix-conf/home-manager/home.nix b/nix-conf/home-manager/home.nix index b338fcc..f1ac5f9 100644 --- a/nix-conf/home-manager/home.nix +++ b/nix-conf/home-manager/home.nix @@ -33,7 +33,7 @@ in pkgs.zip # compression # cool utilities - pkgs.yq # Yaml adaptor for jq (only pretty print, little query) + pkgs.yq-go # Yaml adaptor for jq (only pretty print, little query) # pkgs.xorg.xclock # TODO: only include if have gui # For testing GL installation # pkgs.logseq # TODO: only include if have GL # Obsidian alt pkgs.mosh # Parsec for SSH From 267d7f829a47da6ab1f25cb25d81ee01ee022f21 Mon Sep 17 00:00:00 2001 From: Hung Date: Mon, 13 Feb 2023 17:04:48 -0700 Subject: [PATCH 07/64] add yang syntax highlight --- native_configs/neovim/init.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 4a84496..e909575 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -58,6 +58,7 @@ Plug('hrsh7th/cmp-cmdline') Plug('hrsh7th/nvim-cmp') Plug('onsails/lspkind-nvim') Plug('yioneko/nvim-yati', { tag = '*' }) -- copium: fix Python indent auto-correct from smart-indent +Plug('nathanalderson/yang.vim') -- Plug('tzachar/cmp-tabnine', { ['do'] = './install.sh' }) -- DevExp From bf22c7527050f8d1889c05ff8f5dda0543a0e8b6 Mon Sep 17 00:00:00 2001 From: Hung Date: Tue, 14 Feb 2023 01:34:17 -0700 Subject: [PATCH 08/64] add sops --- dev-shell.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/dev-shell.nix b/dev-shell.nix index 69b54a4..2a08266 100644 --- a/dev-shell.nix +++ b/dev-shell.nix @@ -16,6 +16,7 @@ # TODO: decompose hm-switch.sh with a base version (where HOME_MANAGER_BIN is injected) # (lib.shellAsDrv {script = builtins.readFile ./scripts/hm-switch.sh; pname = "hm-switch";}) pkgs.rust4cargo + pkgs.sops ]; # env vars From ed84a5a871ee362a17a5dea969e5749fa6f75f4c Mon Sep 17 00:00:00 2001 From: Hung Date: Tue, 14 Feb 2023 01:56:48 -0700 Subject: [PATCH 09/64] clean c_ --- c_.nix | 201 ++++++++++++++++-------------- default.nix | 2 +- nix-conf/home-manager/default.nix | 2 +- shell.nix | 2 +- 4 files changed, 109 insertions(+), 98 deletions(-) diff --git a/c_.nix b/c_.nix index 8e787e9..f3ae7e2 100644 --- a/c_.nix +++ b/c_.nix @@ -1,100 +1,111 @@ # a small helper that only builds on top of builtins functions -{src}@inputs: -builtins // (let -formatSecondsSinceEpoch = t: -let -rem = x: y: x - x / y * y; -days = t / 86400; -secondsInDay = rem t 86400; -hours = secondsInDay / 3600; -minutes = (rem secondsInDay 3600) / 60; -seconds = rem t 60; +_: (builtins // ( + let + formatSecondsSinceEpoch = t: + let + rem = x: y: x - x / y * y; + days = t / 86400; + secondsInDay = rem t 86400; + hours = secondsInDay / 3600; + minutes = (rem secondsInDay 3600) / 60; + seconds = rem t 60; -# Courtesy of https://stackoverflow.com/a/32158604. -z = days + 719468; -era = (if z >= 0 then z else z - 146096) / 146097; -doe = z - era * 146097; -yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; -y = yoe + era * 400; -doy = doe - (365 * yoe + yoe / 4 - yoe / 100); -mp = (5 * doy + 2) / 153; -d = doy - (153 * mp + 2) / 5 + 1; -m = mp + (if mp < 10 then 3 else -9); -y' = y + (if m <= 2 then 1 else 0); + # Courtesy of https://stackoverflow.com/a/32158604. + z = days + 719468; + era = (if z >= 0 then z else z - 146096) / 146097; + doe = z - era * 146097; + yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; + y = yoe + era * 400; + doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + mp = (5 * doy + 2) / 153; + d = doy - (153 * mp + 2) / 5 + 1; + m = mp + (if mp < 10 then 3 else -9); + y' = y + (if m <= 2 then 1 else 0); -pad = s: if builtins.stringLength s < 2 then "0" + s else s; -in "${toString y'}${pad (toString m)}${pad (toString d)}${pad (toString hours)}" -+ "${pad (toString minutes)}${pad (toString seconds)}"; + pad = s: if builtins.stringLength s < 2 then "0" + s else s; + in + "${toString y'}${pad (toString m)}${pad (toString d)}${pad (toString hours)}" + + "${pad (toString minutes)}${pad (toString seconds)}"; -fetchTree = -# this is the value of flake.lock#lock.nodes.${input_name}.locked -{type -, host? "" -, owner? "" -, repo? "" -, rev? "" -, submodules? "" -, path? "" -, narHash? null -, lastModified? 0 -}@info: -if info.type == "github" then -{ outPath = - fetchTarball - ({ url = "https://api.${info.host or "github.com"}/repos/" - + "${info.owner}/${info.repo}/tarball/${info.rev}"; } - // (if info ? narHash then { sha256 = info.narHash; } else {}) - ); - rev = info.rev; - shortRev = builtins.substring 0 7 info.rev; - lastModified = info.lastModified; - lastModifiedDate = formatSecondsSinceEpoch info.lastModified; - narHash = info.narHash; -} -else if info.type == "git" then -{ outPath = - builtins.fetchGit - ({ url = info.url; } - // (if info ? rev then { inherit (info) rev; } else {}) - // (if info ? ref then { inherit (info) ref; } else {}) - // (if info ? submodules then { inherit (info) submodules; } else {}) - ); - lastModified = info.lastModified; - lastModifiedDate = formatSecondsSinceEpoch info.lastModified; - narHash = info.narHash; -} // (if info ? rev then { -rev = info.rev; -shortRev = builtins.substring 0 7 info.rev; -} else { -}) -else if info.type == "path" then -{ outPath = builtins.path { - path = if builtins.substring 0 1 info.path != "/" - then src + ("/" + info.path) # make this absolute path by prepending ./ - else info.path; # it's already an absolute path - }; -narHash = info.narHash; -} -else if info.type == "tarball" then -{ outPath = - fetchTarball - ({ inherit (info) url; } - // (if info ? narHash then { sha256 = info.narHash; } else {}) - ); -} -else if info.type == "gitlab" then -{ inherit (info) rev narHash lastModified; - outPath = - fetchTarball - ({ url = "https://${info.host or "gitlab.com"}/api/v4/projects/${info.owner}%2F${info.repo}/repository/archive.tar.gz?sha=${info.rev}"; } - // (if info ? narHash then { sha256 = info.narHash; } else {}) - ); - shortRev = builtins.substring 0 7 info.rev; -} -else -# FIXME: add Mercurial, tarball inputs. -throw "flake input has unsupported input type '${info.type}'"; -in { - inherit fetchTree; -}) + fetchTree = + # this is the value of flake.lock#lock.nodes.${input_name}.locked + { type + , host ? "" + , owner ? "" + , repo ? "" + , rev ? "" + , submodules ? "" + , path ? "" + , narHash ? null + , lastModified ? 0 + , src ? ./. + }@info: + if info.type == "github" then + { + outPath = + fetchTarball + ({ + url = "https://api.${info.host or "github.com"}/repos/" + + "${info.owner}/${info.repo}/tarball/${info.rev}"; + } + // (if info ? narHash then { sha256 = info.narHash; } else { }) + ); + rev = info.rev; + shortRev = builtins.substring 0 7 info.rev; + lastModified = info.lastModified; + lastModifiedDate = formatSecondsSinceEpoch info.lastModified; + narHash = info.narHash; + } + else if info.type == "git" then + { + outPath = + builtins.fetchGit + ({ url = info.url; } + // (if info ? rev then { inherit (info) rev; } else { }) + // (if info ? ref then { inherit (info) ref; } else { }) + // (if info ? submodules then { inherit (info) submodules; } else { }) + ); + lastModified = info.lastModified; + lastModifiedDate = formatSecondsSinceEpoch info.lastModified; + narHash = info.narHash; + } // (if info ? rev then { + rev = info.rev; + shortRev = builtins.substring 0 7 info.rev; + } else { }) + else if info.type == "path" then + { + outPath = builtins.path { + path = + if builtins.substring 0 1 info.path != "/" + then src + ("/" + info.path) # make this absolute path by prepending ./ + else info.path; # it's already an absolute path + }; + narHash = info.narHash; + } + else if info.type == "tarball" then + { + outPath = + fetchTarball + ({ inherit (info) url; } + // (if info ? narHash then { sha256 = info.narHash; } else { }) + ); + } + else if info.type == "gitlab" then + { + inherit (info) rev narHash lastModified; + outPath = + fetchTarball + ({ url = "https://${info.host or "gitlab.com"}/api/v4/projects/${info.owner}%2F${info.repo}/repository/archive.tar.gz?sha=${info.rev}"; } + // (if info ? narHash then { sha256 = info.narHash; } else { }) + ); + shortRev = builtins.substring 0 7 info.rev; + } + else + # FIXME: add Mercurial, tarball inputs. + throw "flake input has unsupported input type '${info.type}'"; + in + { + inherit fetchTree; + } +)) nil diff --git a/default.nix b/default.nix index 9004ce7..c5e301c 100644 --- a/default.nix +++ b/default.nix @@ -3,7 +3,7 @@ ( let lock = builtins.fromJSON (builtins.readFile ./flake.lock); - c_ = import ./c_.nix {src = ./.;}; + c_ = import ./c_.nix; in c_.fetchTree lock.nodes.flake-compat.locked ) diff --git a/nix-conf/home-manager/default.nix b/nix-conf/home-manager/default.nix index 0a33c79..a58ba64 100644 --- a/nix-conf/home-manager/default.nix +++ b/nix-conf/home-manager/default.nix @@ -3,7 +3,7 @@ ( let lock = builtins.fromJSON (builtins.readFile ./flake.lock); - c_ = import ./../../c_.nix {src = ./.;}; + c_ = import ./../../c_.nix; in c_.fetchTree lock.nodes.flake-compat.locked ) diff --git a/shell.nix b/shell.nix index 0995f35..a521cfd 100644 --- a/shell.nix +++ b/shell.nix @@ -5,7 +5,7 @@ ( let lock = builtins.fromJSON (builtins.readFile ./flake.lock); - in (import ./c_.nix {src = ./.;}).fetchTree lock.nodes.flake-compat.locked + in (import ./c_.nix).fetchTree lock.nodes.flake-compat.locked ) { src = ./.; } ).shellNix From 78b22d31fc1dc23c10e8049a623657c2022621e5 Mon Sep 17 00:00:00 2001 From: Hung Date: Tue, 14 Feb 2023 10:06:39 -0700 Subject: [PATCH 10/64] add nickel lang --- flake.lock | 337 +++++++++++++++++++++++--- flake.nix | 2 + native_configs/neovim/init.lua | 4 +- nix-conf/home-manager/base/neovim.nix | 19 +- nix-conf/home-manager/flake.lock | 260 +++++++++++++++++++- nix-conf/home-manager/flake.nix | 2 + overlays.nix | 7 + 7 files changed, 567 insertions(+), 64 deletions(-) diff --git a/flake.lock b/flake.lock index 4a4f39e..dc4e296 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,17 @@ "nodes": { "agenix": { "inputs": { + "darwin": "darwin", "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1673301561, - "narHash": "sha256-gRUWHbBAtMuPDJQXotoI8u6+3DGBIUZHkyQWpIv7WpM=", + "lastModified": 1676153903, + "narHash": "sha256-uetRyjgMiZCs6srmZ10M764Vn7F53M9mVuqnzHmyBqU=", "owner": "ryantm", "repo": "agenix", - "rev": "42d371d861a227149dc9a7e03350c9ab8b8ddd68", + "rev": "ea17cc71b4e1bc5b2601f210a1c85db9453ad723", "type": "github" }, "original": { @@ -20,6 +21,52 @@ "type": "github" } }, + "crane": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "nickel", + "nixpkgs" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1673405853, + "narHash": "sha256-6Nq9DuOo+gE2I8z5UZaKuumykz2xxZ9JGYmUthOuwSA=", + "owner": "ipetkov", + "repo": "crane", + "rev": "b13963c8c18026aa694acd98d14f66d24666f70b", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1673295039, + "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -34,6 +81,22 @@ } }, "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1668681692, @@ -49,13 +112,29 @@ "type": "github" } }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -80,6 +159,36 @@ } }, "flake-utils_3": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -94,7 +203,7 @@ "type": "github" } }, - "flake-utils_4": { + "flake-utils_6": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -109,6 +218,28 @@ "type": "github" } }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nickel", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -117,11 +248,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1673948101, - "narHash": "sha256-cD0OzFfnLFeeaz4jVszH9QiMTn+PBxmcYzrp+xujpwM=", + "lastModified": 1675935446, + "narHash": "sha256-WajulTn7QdwC7QuXRBavrANuIXE5z+08EdxdRw1qsNs=", "owner": "nix-community", "repo": "home-manager", - "rev": "bd3efacb82c721edad1ce9eda583df5fb62ab00a", + "rev": "2dce7f1a55e785a22d61668516df62899278c9e4", "type": "github" }, "original": { @@ -156,11 +287,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1673937267, - "narHash": "sha256-zixnItZtMZRKK0bEh8UOBeh8JT4jeMzPR2TtacfXmyE=", + "lastModified": 1676361142, + "narHash": "sha256-+nyWJcNRTOPCVqYC7tql7gLzPsNvZFa/wB20X9W9vTg=", "owner": "neovim", "repo": "neovim", - "rev": "2093e574c6c934a718f96d0a173aa965d3958a8b", + "rev": "53968082675cd3b8d1809e53a47c0311b7347ef9", "type": "github" }, "original": { @@ -177,11 +308,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1673943288, - "narHash": "sha256-TDo9wDfZH+MJ/tTeCtZ67jdHqtVvIxetLpFN9+vqZ7g=", + "lastModified": 1676362549, + "narHash": "sha256-FZJb4ty3bdzfsd5dUaW3wR9FN2t1vNJ1IRJJhxErYYA=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "3c0bb335936754a2683a84ddf081594ddb567a89", + "rev": "447052579b7154c5cc61faf9ed6f3f484b9d053f", "type": "github" }, "original": { @@ -190,6 +321,28 @@ "type": "github" } }, + "nickel": { + "inputs": { + "crane": "crane", + "flake-utils": "flake-utils_4", + "nixpkgs": "nixpkgs_2", + "pre-commit-hooks": "pre-commit-hooks", + "rust-overlay": "rust-overlay_2" + }, + "locked": { + "lastModified": 1676039663, + "narHash": "sha256-fkIg8rJcnvT0kEdd4lqwp90rAe5RsxSOrWsmlXzD3Uo=", + "owner": "tweag", + "repo": "nickel", + "rev": "38ca87438918b84ebe7287a040729e4afd8c75b1", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "nickel", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -197,11 +350,11 @@ ] }, "locked": { - "lastModified": 1673752441, - "narHash": "sha256-/g4ImZWV05CrXRWTSJsda6ztIp7LAPxs2L6RCrbQ66U=", + "lastModified": 1676172252, + "narHash": "sha256-Q5yJPpgbvOTgB0NQTJmlx3di1Sj5QQhSrjv38u6MzsQ=", "owner": "mic92", "repo": "nix-index-database", - "rev": "391180f77505c1c8cdd45fe1a59dc89d3e40300a", + "rev": "89e3b689e0ae9bac4c6cdc24d1085d81baeebde4", "type": "github" }, "original": { @@ -212,8 +365,8 @@ }, "nixgl": { "inputs": { - "flake-utils": "flake-utils_3", - "nixpkgs": "nixpkgs_2" + "flake-utils": "flake-utils_5", + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1, @@ -228,11 +381,11 @@ }, "nixlib": { "locked": { - "lastModified": 1673743903, - "narHash": "sha256-sloY6KYyVOozJ1CkbgJPpZ99TKIjIvM+04V48C04sMQ=", + "lastModified": 1676163193, + "narHash": "sha256-6cTwPLtRHsRrIlKnEg3gQ9L+MYdx87eHdRqlTUi4H8Y=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "7555e2dfcbac1533f047021f1744ac8871150f9f", + "rev": "d3e61f845dbbb77f10900603993c6f00bdfa9fd4", "type": "github" }, "original": { @@ -257,7 +410,38 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1673800717, + "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { + "locked": { + "lastModified": 1674211260, + "narHash": "sha256-xU6Rv9sgnwaWK7tgCPadV6HhI2Y/fl4lKxJoG2+m9qs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5ed481943351e9fd354aeb557679624224de38d5", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1660551188, "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", @@ -272,13 +456,13 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { - "lastModified": 1673631141, - "narHash": "sha256-AprpYQ5JvLS4wQG/ghm2UriZ9QZXvAwh1HlgA/6ZEVQ=", + "lastModified": 1676300157, + "narHash": "sha256-1HjRzfp6LOLfcj/HJHdVKWAkX9QRAouoh6AjzJiIerU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "befc83905c965adfd33e5cae49acb0351f6e0404", + "rev": "545c7a31e5dedea4a6d372712a18e00ce097d462", "type": "github" }, "original": { @@ -287,7 +471,7 @@ "type": "indirect" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { "lastModified": 1665296151, "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", @@ -303,6 +487,34 @@ "type": "github" } }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_4", + "flake-utils": [ + "nickel", + "flake-utils" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "nickel", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1674122161, + "narHash": "sha256-9QM4rvgUSEwO8DWtJN9sR/afEqrH1s3b6ACsZT5wiAM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "53e766957b73298fa68b47478c48cbcc005cc18a", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", @@ -311,24 +523,77 @@ "home-manager": "home-manager", "kpcli-py": "kpcli-py", "neovim-nightly-overlay": "neovim-nightly-overlay", + "nickel": "nickel", "nix-index-database": "nix-index-database", "nixgl": "nixgl", "nixlib": "nixlib", - "nixpkgs": "nixpkgs_3", - "rust-overlay": "rust-overlay" + "nixpkgs": "nixpkgs_4", + "rust-overlay": "rust-overlay_3" } }, "rust-overlay": { "inputs": { - "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs_4" + "flake-utils": [ + "nickel", + "crane", + "flake-utils" + ], + "nixpkgs": [ + "nickel", + "crane", + "nixpkgs" + ] }, "locked": { - "lastModified": 1673922364, - "narHash": "sha256-U0XIY/Y/x4fFtlCZKMtWlqOYUnLiXj4F42GQHxWuPow=", + "lastModified": 1672712534, + "narHash": "sha256-8S0DdMPcbITnlOu0uA81mTo3hgX84wK8S9wS34HEFY4=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "4e0f9b8a5102387f8d19901bced16a256a6ccdc7", + "rev": "69fb7bf0a8c40e6c4c197fa1816773774c8ac59f", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_2": { + "inputs": { + "flake-utils": [ + "nickel", + "flake-utils" + ], + "nixpkgs": [ + "nickel", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1674267882, + "narHash": "sha256-53sIczqxA5BbrhgO6l54DSisDqHvQ3UUwbSqBryA/k0=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "1fd6d280c132f4facad8cd023543fb10121e6487", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_3": { + "inputs": { + "flake-utils": "flake-utils_6", + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1676341851, + "narHash": "sha256-T8cmSiriXdpZfqlserNyJ1solTCR0DbD8A75epSDOVY=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "956ddb5047f98ea08b792b22004b94a9971932c4", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 90daf2f..b5d0b7f 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,7 @@ url = "github:mic92/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs"; }; + nickel.url = "github:tweag/nickel"; }; outputs = @@ -51,6 +52,7 @@ , neovim-nightly-overlay , nix-index-database , nixlib + , nickel , ... }@_inputs: let diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index e909575..1617ead 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -366,7 +366,7 @@ require('nvim-treesitter.configs').setup { ensure_installed = { 'tsx', 'toml', 'lua', 'typescript', 'rust', 'go', 'yaml', 'json', 'php', 'css', 'python', 'prisma', 'html', "dockerfile", "c", "cpp", "hcl", "svelte", "astro", - "clojure", "fennel", "bash", "nix", "query", + "clojure", "fennel", "bash", "nix", "query", "nickel" }, sync_install = false, highlight = { @@ -609,7 +609,7 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities() local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'cmake', 'tailwindcss', 'prismals', 'rnix', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels", - "jsonls", "denols", "gopls" + "jsonls", "denols", "gopls", "nickel_ls" } require("mason").setup({ ui = { diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix index c59abaf..b2c9d4c 100644 --- a/nix-conf/home-manager/base/neovim.nix +++ b/nix-conf/home-manager/base/neovim.nix @@ -6,23 +6,6 @@ # might be different from `home-manager`'s { pkgs, lib, config, proj_root, ... }: let - # NOTE: Failure 1: buildInputs is pretty much ignored - # my_neovim = pkgs.neovim-unwrapped.overrideDerivation (old: { - # # TODO: is there a more beautiful way to override propagatedBuildInputs? - # name = "hungtr-" + old.name; - # buildInputs = (old.buildInputs or []) ++ [ - # pkgs.tree-sitter # highlighting - # rust_pkgs # for potentially rust-analyzer - # pkgs.fzf - # pkgs.ripgrep - # pkgs.zk - # pkgs.fd - # ]; - # NOTE: Failure 2: propagatedBuildInputs probably only concerns dyn libs - # }); - # NOTE: Failure 3: must be unwrapped neovim because home-manager does the wrapping - # my_neovim = pkgs.neovim; - # NOTE: Add packages to nvim_pkgs instead, so that it's available at userspace # and is added to the path after wrapping. # check: nix repl `homeConfigurations.hungtr.config.programs.neovim.finalPackage.buildCommand` @@ -47,6 +30,8 @@ let pkgs.stdenv.cc.cc.lib pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo pkgs.rust4cargo + pkgs.nickel + pkgs.lsp-nls pkgs.go diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index 42737ea..831b926 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -1,5 +1,29 @@ { "nodes": { + "crane": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "nickel", + "nixpkgs" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1673405853, + "narHash": "sha256-6Nq9DuOo+gE2I8z5UZaKuumykz2xxZ9JGYmUthOuwSA=", + "owner": "ipetkov", + "repo": "crane", + "rev": "b13963c8c18026aa694acd98d14f66d24666f70b", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -29,6 +53,38 @@ "type": "github" } }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1667395993, @@ -60,6 +116,36 @@ } }, "flake-utils_3": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -74,7 +160,7 @@ "type": "github" } }, - "flake-utils_4": { + "flake-utils_6": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -89,6 +175,28 @@ "type": "github" } }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nickel", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -170,6 +278,28 @@ "type": "github" } }, + "nickel": { + "inputs": { + "crane": "crane", + "flake-utils": "flake-utils_4", + "nixpkgs": "nixpkgs_2", + "pre-commit-hooks": "pre-commit-hooks", + "rust-overlay": "rust-overlay_2" + }, + "locked": { + "lastModified": 1676039663, + "narHash": "sha256-fkIg8rJcnvT0kEdd4lqwp90rAe5RsxSOrWsmlXzD3Uo=", + "owner": "tweag", + "repo": "nickel", + "rev": "38ca87438918b84ebe7287a040729e4afd8c75b1", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "nickel", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -192,8 +322,8 @@ }, "nixgl": { "inputs": { - "flake-utils": "flake-utils_3", - "nixpkgs": "nixpkgs_2" + "flake-utils": "flake-utils_5", + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1, @@ -222,7 +352,38 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1673800717, + "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { + "locked": { + "lastModified": 1674211260, + "narHash": "sha256-xU6Rv9sgnwaWK7tgCPadV6HhI2Y/fl4lKxJoG2+m9qs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5ed481943351e9fd354aeb557679624224de38d5", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1660551188, "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", @@ -237,7 +398,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1673796341, "narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=", @@ -253,7 +414,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { "lastModified": 1665296151, "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", @@ -269,6 +430,34 @@ "type": "github" } }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_4", + "flake-utils": [ + "nickel", + "flake-utils" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "nickel", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1674122161, + "narHash": "sha256-9QM4rvgUSEwO8DWtJN9sR/afEqrH1s3b6ACsZT5wiAM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "53e766957b73298fa68b47478c48cbcc005cc18a", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "flake-compat": "flake-compat", @@ -276,16 +465,69 @@ "home-manager": "home-manager", "kpcli-py": "kpcli-py", "neovim-nightly-overlay": "neovim-nightly-overlay", + "nickel": "nickel", "nix-index-database": "nix-index-database", "nixgl": "nixgl", - "nixpkgs": "nixpkgs_3", - "rust-overlay": "rust-overlay" + "nixpkgs": "nixpkgs_4", + "rust-overlay": "rust-overlay_3" } }, "rust-overlay": { "inputs": { - "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs_4" + "flake-utils": [ + "nickel", + "crane", + "flake-utils" + ], + "nixpkgs": [ + "nickel", + "crane", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1672712534, + "narHash": "sha256-8S0DdMPcbITnlOu0uA81mTo3hgX84wK8S9wS34HEFY4=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "69fb7bf0a8c40e6c4c197fa1816773774c8ac59f", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_2": { + "inputs": { + "flake-utils": [ + "nickel", + "flake-utils" + ], + "nixpkgs": [ + "nickel", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1674267882, + "narHash": "sha256-53sIczqxA5BbrhgO6l54DSisDqHvQ3UUwbSqBryA/k0=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "1fd6d280c132f4facad8cd023543fb10121e6487", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_3": { + "inputs": { + "flake-utils": "flake-utils_6", + "nixpkgs": "nixpkgs_5" }, "locked": { "lastModified": 1673922364, diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 4ff0355..4797189 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -39,6 +39,7 @@ url = "github:mic92/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs"; }; + nickel.url = "github:tweag/nickel"; }; outputs = @@ -49,6 +50,7 @@ , flake-utils , kpcli-py , neovim-nightly-overlay + , nickel , ... }: let diff --git a/overlays.nix b/overlays.nix index 1c570ce..1c308ca 100644 --- a/overlays.nix +++ b/overlays.nix @@ -3,6 +3,7 @@ flake_input@{ kpcli-py , rust-overlay , neovim-nightly-overlay , system +, nickel , ... }: let kpcli-py = (final: prev: { @@ -36,11 +37,17 @@ flake_input@{ kpcli-py rust4cargo = nightlyRustWithExts [ ]; rust4normi = nightlyRustWithExts rust-default-components; }); + + nickel = (final: prev: { + inherit (flake_input.nickel.packages.${system}) + lsp-nls nickel nickelWasm; + }); in [ nixgl.overlays.default rust-overlay.overlays.default neovim-nightly-overlay.overlay rust kpcli-py + nickel ] From 7a37c135eee5264a82653ba42c3c8e5dfdc2671b Mon Sep 17 00:00:00 2001 From: Hung Date: Tue, 14 Feb 2023 11:19:44 -0700 Subject: [PATCH 11/64] add credentials encrypted with sops --- .sops.yaml | 10 ++++++++++ credentials.yml | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 .sops.yaml create mode 100644 credentials.yml diff --git a/.sops.yaml b/.sops.yaml new file mode 100644 index 0000000..0941d5e --- /dev/null +++ b/.sops.yaml @@ -0,0 +1,10 @@ +keys: + - &htran-mbp age1jpm9mtxz6n8vncrk6pk7dppj3r7qxfj5hsgvcdulmp3lxvxez94qvxlgay + - &htran age1jw958shpwu7st8sc4z0fufuswmfpxfc9wl3df9g3f3y57m45j92syr0mng +creation_rules: + - path_regex: .* + key_groups: + - age: + - *htran + - *htran-mbp + diff --git a/credentials.yml b/credentials.yml new file mode 100644 index 0000000..b45496b --- /dev/null +++ b/credentials.yml @@ -0,0 +1,44 @@ +credentials: + - kind: + name_unencrypted: ssh + pubkey_unencrypted: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPNKyGKsVG/jVXwAmZvH8rLQPdGj8VgITMSN+/nbXTEY htran@Hung-Tran-MBP.local + privkey: ENC[AES256_GCM,data:OrurRGlutN1N1YFQvD1XbiF3thV8qO2y1ufRHi3ut1RVA/lxmqg1kYdWnYE7tOCCCITs20ZpcPFAwAjjAXZH6NaS8FgEJiPDUnJ+hg5v0VC7c4GNc+G3B8+9Taz7mggg70EL/s5QwofpuqJspr4EHrildX6eUeE6s9KwSFnw6KTBgO4r0JqBaicbbObhzxPYIYHjhxRxsbYMX4i8ADPeYryhEtL168dHEGENuz/mbw2I/5Qp3R/SwroNpYlTpq6ukGeobW4+j2KD7ZV9Nvcs/FL6/lPdaUKPxNW/bDeRhAaw9Mw3oDxHdTNisvCHJ53GHChdWcoXSMjYNH+zbgXp9YTeCLBMf9/lLnnEwtSEuD2kexcF+WR7gcbu6mdxJ1k3HBU+Xkrl6shGFuQv3hH8eSmfLhIdy+zcY/jb6tokQklrdKsrusFjuHhAuKfNl5uA93Pc0NxTZ4plxEEdbeyzz54cWwBf0HXR6ztSrjqfUtud3bQY667MNB2LHO91QBoQE7U2gUQ2CmI3VG9KVm2eh7LsXUjLoLzccYfg+kkTrQJnAfs=,iv:+4wsk7mUsIOWNe9IoV0TgrBKIsQdiJyzwVb2+hlPVTc=,tag:B9P2bHPh78JuwusZnAsC5A==,type:str] + agepub_unencrypted: age1jpm9mtxz6n8vncrk6pk7dppj3r7qxfj5hsgvcdulmp3lxvxez94qvxlgay + agepriv: ENC[AES256_GCM,data:tE6WLw8/dHsC6rfJpek7czvySW0+S2luc470l9X6UFX+zCOwlwoQpTWpIGPIqmkOFNSaaA0cyZ4BmWnlVz1iWxizh8DYqcE5los=,iv:4jnpibK+0cE1isWu6Zl1CsajMWN9Zgw8LGX5WpkRyy8=,tag:vdi85c3Q29olLGsCwrvmcA==,type:str] + - kind: + name_unencrypted: ssh + pubkey_unencrypted: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH1IiP+d2S152uiD2JjUJfADFv7AS0l3LX2NRgfMTYLe htran@htrandevbox + privkey: ENC[AES256_GCM,data:5lf+Oy0VhsxDLANpBFxtguD5unsZK9yKW/boTlxAOIzlcD1Xf4Nr0iC6YW/4nBB/eJ8xPlUiU5vhRQSLZPqnfc6nQJReqPPafzfugYb3slYBl59EeimBCqTi0qVIUHNFvRpp2agZW0wIQv4hlB3ks+WBVjKixLOdbUBQREZB22DWk6eoKawmekCr7ItDsxGWG7DtHx9A511LyPrT1n/VhAYHTuq6ycbWjDya++bJ/AkYlcqW0jEyQ/Mudo/TYkRt4TpWWDjGPDYVNrjBiwYOSpoM6IwzfRQvimCZnfqyXHrT2gzv9Vqqu9C2Vp2R0FLzbdA8dYoiXwss7opzsI5um6D4AdQv8c16TiVLFF0q0VP2xyRf3j7iqmuwQHIRlkBh2BhnsXT/s35K6cb1dUhIw0aQpFGzL/VuqMKrQW3j3S9pSiiupBuSwdLJ9s8+rkGYTO0Iw+T646L1NFW7oFMP8Fe5ZMC9UuTV/srWNtXHAQaY+L9TwMIQY36P4V0lqaVfCWAiIrBTgLhHQetnzb/Y44Ll/qTdRXHSW6D4,iv:30sivScr8WmFmZx8M/sqTEuGRg72VzJ+bc6AW847xz8=,tag:dJsH+/dhRWQoKwsGAUzqAQ==,type:str] + - kind: + name_unencrypted: age + agepub_unencrypted: age1jw958shpwu7st8sc4z0fufuswmfpxfc9wl3df9g3f3y57m45j92syr0mng + agepriv: ENC[AES256_GCM,data:f66nwYr1WLTejGI2SpHNrf8BYRJJuxpufYLSYVix1uLdBj2TfVJVjN3bLsnHrB1DoeVyaF0nUxrdcL64LhbI38zZC/fNORfXx4E=,iv:J/noycrJlL2+r1ojmUYC/6GUVMGqRFM2ondBm2C7fSE=,tag:pT5z5NQQdS30bucdbPPBng==,type:str] +sops: + kms: [] + gcp_kms: [] + azure_kv: [] + hc_vault: [] + age: + - recipient: age1jw958shpwu7st8sc4z0fufuswmfpxfc9wl3df9g3f3y57m45j92syr0mng + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBKNlFvNTh6WGFVaVBvcGlt + aldQWWtqeWpWWlVTTmRPazJmdjlUT2ZZS2pFCmI2eTRPUDVrTWQ5MFR4Rm9lb0Z3 + VHBCTFBQSkJmbUpPQ21aZWp6dTJXTVEKLS0tIDlpdDJsNGVCSU85ZEMya3RPL09C + b3hXdnNjdmhjRisvV00wbU1TQml6Sk0KJ1NconEwYIvYlrQTd6yLU1uGEAJBPPTp + z1wkrjS21PjEzZnOx8UmJX5X+kfPTSItgMkWexRdW0/zVDzGRs5AoQ== + -----END AGE ENCRYPTED FILE----- + - recipient: age1jpm9mtxz6n8vncrk6pk7dppj3r7qxfj5hsgvcdulmp3lxvxez94qvxlgay + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBCTVNMVm91ZmtzUFVOZm96 + Rm5zQUxGbzlNYXpFbnVlUStUeG05bW9rclI4ClNwZ3htUXFsZlBqNHMvV1NMT3JW + WnlxNGFyclVIV3oyWFNPN3BvRFZ5TzgKLS0tIE1PLzNsYngwMFpFaXdrcll2S0F3 + Q0ZxRXNvTGlJVHNiZFNyMU5XaTM0YTQKUJvYfdyGqPFmONa+8jKjVb9tbke/HsL2 + X33WHFVrQf2uOMRf3yAzRm5SfpdULFQ+JTP3CEUmcZ2nUxTmUs+X6A== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2023-02-14T18:18:41Z" + mac: ENC[AES256_GCM,data:uoPZe9bDmH3u1kvyJ8c468uk0TRA9KEpZN7fnN1Myxpdj50y+CJ75FS/F4jWYFVC8Wz9WLt0uMKORK/wsP1Ww4mTEyQSsD9+uyBwdhZwKPapuPL5vjNP3/O9mVdlOQ6HYi+TBPckIQ9fiwskeQV6P74LFC3rHBattxIHz3d7pKo=,iv:spPlKbev7CoVa6ZU8Y5mJOlLItSANL4U+wREX8SJCF0=,tag:Gd02Q+x/uvVxyhoB3iUeHg==,type:str] + pgp: [] + unencrypted_suffix: _unencrypted + version: 3.7.3 From 20d3325ae9057e21560aaf38faa94e006b000121 Mon Sep 17 00:00:00 2001 From: Hung Date: Tue, 14 Feb 2023 11:27:22 -0700 Subject: [PATCH 12/64] add work gitlab runner deploy key --- credentials.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/credentials.yml b/credentials.yml index b45496b..f405c85 100644 --- a/credentials.yml +++ b/credentials.yml @@ -1,18 +1,27 @@ credentials: - kind: name_unencrypted: ssh + name_unencrypted: egi-htran pubkey_unencrypted: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPNKyGKsVG/jVXwAmZvH8rLQPdGj8VgITMSN+/nbXTEY htran@Hung-Tran-MBP.local privkey: ENC[AES256_GCM,data:OrurRGlutN1N1YFQvD1XbiF3thV8qO2y1ufRHi3ut1RVA/lxmqg1kYdWnYE7tOCCCITs20ZpcPFAwAjjAXZH6NaS8FgEJiPDUnJ+hg5v0VC7c4GNc+G3B8+9Taz7mggg70EL/s5QwofpuqJspr4EHrildX6eUeE6s9KwSFnw6KTBgO4r0JqBaicbbObhzxPYIYHjhxRxsbYMX4i8ADPeYryhEtL168dHEGENuz/mbw2I/5Qp3R/SwroNpYlTpq6ukGeobW4+j2KD7ZV9Nvcs/FL6/lPdaUKPxNW/bDeRhAaw9Mw3oDxHdTNisvCHJ53GHChdWcoXSMjYNH+zbgXp9YTeCLBMf9/lLnnEwtSEuD2kexcF+WR7gcbu6mdxJ1k3HBU+Xkrl6shGFuQv3hH8eSmfLhIdy+zcY/jb6tokQklrdKsrusFjuHhAuKfNl5uA93Pc0NxTZ4plxEEdbeyzz54cWwBf0HXR6ztSrjqfUtud3bQY667MNB2LHO91QBoQE7U2gUQ2CmI3VG9KVm2eh7LsXUjLoLzccYfg+kkTrQJnAfs=,iv:+4wsk7mUsIOWNe9IoV0TgrBKIsQdiJyzwVb2+hlPVTc=,tag:B9P2bHPh78JuwusZnAsC5A==,type:str] agepub_unencrypted: age1jpm9mtxz6n8vncrk6pk7dppj3r7qxfj5hsgvcdulmp3lxvxez94qvxlgay agepriv: ENC[AES256_GCM,data:tE6WLw8/dHsC6rfJpek7czvySW0+S2luc470l9X6UFX+zCOwlwoQpTWpIGPIqmkOFNSaaA0cyZ4BmWnlVz1iWxizh8DYqcE5los=,iv:4jnpibK+0cE1isWu6Zl1CsajMWN9Zgw8LGX5WpkRyy8=,tag:vdi85c3Q29olLGsCwrvmcA==,type:str] - kind: name_unencrypted: ssh + name_unencrypted: dev1-ssh pubkey_unencrypted: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH1IiP+d2S152uiD2JjUJfADFv7AS0l3LX2NRgfMTYLe htran@htrandevbox privkey: ENC[AES256_GCM,data:5lf+Oy0VhsxDLANpBFxtguD5unsZK9yKW/boTlxAOIzlcD1Xf4Nr0iC6YW/4nBB/eJ8xPlUiU5vhRQSLZPqnfc6nQJReqPPafzfugYb3slYBl59EeimBCqTi0qVIUHNFvRpp2agZW0wIQv4hlB3ks+WBVjKixLOdbUBQREZB22DWk6eoKawmekCr7ItDsxGWG7DtHx9A511LyPrT1n/VhAYHTuq6ycbWjDya++bJ/AkYlcqW0jEyQ/Mudo/TYkRt4TpWWDjGPDYVNrjBiwYOSpoM6IwzfRQvimCZnfqyXHrT2gzv9Vqqu9C2Vp2R0FLzbdA8dYoiXwss7opzsI5um6D4AdQv8c16TiVLFF0q0VP2xyRf3j7iqmuwQHIRlkBh2BhnsXT/s35K6cb1dUhIw0aQpFGzL/VuqMKrQW3j3S9pSiiupBuSwdLJ9s8+rkGYTO0Iw+T646L1NFW7oFMP8Fe5ZMC9UuTV/srWNtXHAQaY+L9TwMIQY36P4V0lqaVfCWAiIrBTgLhHQetnzb/Y44Ll/qTdRXHSW6D4,iv:30sivScr8WmFmZx8M/sqTEuGRg72VzJ+bc6AW847xz8=,tag:dJsH+/dhRWQoKwsGAUzqAQ==,type:str] - kind: name_unencrypted: age agepub_unencrypted: age1jw958shpwu7st8sc4z0fufuswmfpxfc9wl3df9g3f3y57m45j92syr0mng agepriv: ENC[AES256_GCM,data:f66nwYr1WLTejGI2SpHNrf8BYRJJuxpufYLSYVix1uLdBj2TfVJVjN3bLsnHrB1DoeVyaF0nUxrdcL64LhbI38zZC/fNORfXx4E=,iv:J/noycrJlL2+r1ojmUYC/6GUVMGqRFM2ondBm2C7fSE=,tag:pT5z5NQQdS30bucdbPPBng==,type:str] + - kind: + name_unencrypted: ssh + name_unencrypted: gl-egi-htran-ed25519 + privkey: ENC[AES256_GCM,data:vM5G2o/syq9YUwqpUONJk5ebwha+UQI0wUCkwkmZTTtx+nB/HTnc4kqxX/eeF9ybSE8vq7YIWuKB8aSjpizOYZjjWIV3qpWBiDmdrWkWfUIl7kDdy75azZjHNRXuXUUExbPYGVjmL7KdDMHY2u1WceDSdEvgB2sNOPw4dNiZ9lcbJ5iDpQzmxaF6zdvZ/rVoXYM2NgSMdM4oTdRtYivcOPuxwRGi39R5XgyPJYwltawSAPFPmNYofszUzYLnD7jPEJqyEQORpcI2oM2qAPab22kDrDLyd51X1F6XT/5chKuPSsidZAVjB6+v2s/yN0quqz3qcP2RTYtaZcFyeEquk6eWA/MWVwCJK8XopNoPVVo0PRppOtq3M9Fss3Z587nQAis8doCbvv9XdUunOFHFWon7k8fGu9cDDMmSOE3KGWCO7Vw0V6dYnBT+OVJnJAxlf7AsUZdXVBo3PK9Zw6+d2XF2N9Jhr0bqA1tpmGqwCygHy41FGbWtuhZBX8JimTPFE1MyT5YvptzwbayONcvps8hZED8zwKbR/64DSF7wn1DAaW0=,iv:JjO6O+FB+W1Gi216bjkVXiIFvxLmIZ4rKLCXcepOIQc=,tag:TxiwbrCZ4vFgw6WMmKrVOg==,type:str] + pubkey_unencrypted: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINOqM08nqvcFhcF6E//dlphXctfck83N0tjKIfil8npY htran@Hung-Tran-MBP.local + agepriv: ENC[AES256_GCM,data:Z4qRvam25nvkNr4DuZhhKtN83NIfNcBW5Wq7SGm0Nb31kAjCS25VfkTrXUtrxWIunMCZEYoIdDLiENjRQPAh/NwffGbZn94/ZKY=,iv:t3YtQvRQPdbDcXgEC/A13W1K9/IIlt6rPceR1lAl0BM=,tag:QmiriOk19fGSPOWj98doUQ==,type:str] + agepub_unencrypted: age1jz7ajxer3fs02uygr8a374jfk7vuklpnnyugrlq4equ285t7nyfqwqdreq sops: kms: [] gcp_kms: [] @@ -37,8 +46,8 @@ sops: Q0ZxRXNvTGlJVHNiZFNyMU5XaTM0YTQKUJvYfdyGqPFmONa+8jKjVb9tbke/HsL2 X33WHFVrQf2uOMRf3yAzRm5SfpdULFQ+JTP3CEUmcZ2nUxTmUs+X6A== -----END AGE ENCRYPTED FILE----- - lastmodified: "2023-02-14T18:18:41Z" - mac: ENC[AES256_GCM,data:uoPZe9bDmH3u1kvyJ8c468uk0TRA9KEpZN7fnN1Myxpdj50y+CJ75FS/F4jWYFVC8Wz9WLt0uMKORK/wsP1Ww4mTEyQSsD9+uyBwdhZwKPapuPL5vjNP3/O9mVdlOQ6HYi+TBPckIQ9fiwskeQV6P74LFC3rHBattxIHz3d7pKo=,iv:spPlKbev7CoVa6ZU8Y5mJOlLItSANL4U+wREX8SJCF0=,tag:Gd02Q+x/uvVxyhoB3iUeHg==,type:str] + lastmodified: "2023-02-14T18:27:01Z" + mac: ENC[AES256_GCM,data:2xzBab7XdYxDj4/kRIBlzRMo4AaEFAKRWz2gf8gYUN5hixS/wKra/itJLRBOVQ4VE7CVvjLWfeiMYib/aSSn0wqsjEbdHA7C2f7L1/anafVxPB4oEVdZ+Nvt9j8qQKP5FaDEkjAEw0X+EV20t3vH50Ct3LXdm5ncWH+mYGdriBc=,iv:6bB5P4svjSTLrnC6J/fn6rdpwI3+qLfxDxzRxHzbiGs=,tag:F55VCE8vRoTqeVPuhtil/g==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.7.3 From 7150eb19c100dcfe80eab02fde733accca414ae6 Mon Sep 17 00:00:00 2001 From: Hung Date: Tue, 21 Feb 2023 08:40:14 -0800 Subject: [PATCH 13/64] misc changes for credentials, updates on py-poetry template --- credentials.yml | 10 ++++++++-- flake.nix | 5 +++-- native_configs/ssh/config | 6 ++++++ templates/py-poetry/README.md | 5 +++++ 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/credentials.yml b/credentials.yml index f405c85..ef9f47c 100644 --- a/credentials.yml +++ b/credentials.yml @@ -22,6 +22,12 @@ credentials: pubkey_unencrypted: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINOqM08nqvcFhcF6E//dlphXctfck83N0tjKIfil8npY htran@Hung-Tran-MBP.local agepriv: ENC[AES256_GCM,data:Z4qRvam25nvkNr4DuZhhKtN83NIfNcBW5Wq7SGm0Nb31kAjCS25VfkTrXUtrxWIunMCZEYoIdDLiENjRQPAh/NwffGbZn94/ZKY=,iv:t3YtQvRQPdbDcXgEC/A13W1K9/IIlt6rPceR1lAl0BM=,tag:QmiriOk19fGSPOWj98doUQ==,type:str] agepub_unencrypted: age1jz7ajxer3fs02uygr8a374jfk7vuklpnnyugrlq4equ285t7nyfqwqdreq + - kind: + name_unencrypted: win-rdp + name_unencrypted: EGNGoat + ip: ENC[AES256_GCM,data:9/FPJM8l4hLvzDc5pg==,iv:ny1LKtgznhzMd3Bhogwu6b6bOk3/uCNarKTmlWRZAes=,tag:PsleUu2ZE4leEMEcEuJdLQ==,type:str] + user_unencrypted: EGN NOC + password: ENC[AES256_GCM,data:YOL5Sw6zaA==,iv:Cs8gySfGIQUBPivkM5N6kflZsRhp2w9xmPwtl7RrEZE=,tag:LXYKdsX++IP+jQyjL6JBrg==,type:str] sops: kms: [] gcp_kms: [] @@ -46,8 +52,8 @@ sops: Q0ZxRXNvTGlJVHNiZFNyMU5XaTM0YTQKUJvYfdyGqPFmONa+8jKjVb9tbke/HsL2 X33WHFVrQf2uOMRf3yAzRm5SfpdULFQ+JTP3CEUmcZ2nUxTmUs+X6A== -----END AGE ENCRYPTED FILE----- - lastmodified: "2023-02-14T18:27:01Z" - mac: ENC[AES256_GCM,data:2xzBab7XdYxDj4/kRIBlzRMo4AaEFAKRWz2gf8gYUN5hixS/wKra/itJLRBOVQ4VE7CVvjLWfeiMYib/aSSn0wqsjEbdHA7C2f7L1/anafVxPB4oEVdZ+Nvt9j8qQKP5FaDEkjAEw0X+EV20t3vH50Ct3LXdm5ncWH+mYGdriBc=,iv:6bB5P4svjSTLrnC6J/fn6rdpwI3+qLfxDxzRxHzbiGs=,tag:F55VCE8vRoTqeVPuhtil/g==,type:str] + lastmodified: "2023-02-15T17:08:58Z" + mac: ENC[AES256_GCM,data:FKf97bndBFxwp1d+wctwbtkkDPEJR+hsr36gXF1hiCByUyqJwjioejSKo8+ZBqJOezFwB6e77oHV1P1rf2wzC6+IvBspFIvWKZPQgCaLs0zIjbv5nZD8lpbE8nU19mEWGrgzuW0tfVaKmcq4aH1ExQS5M7HBx5Fy0gSgkUHlrmM=,iv:9poN0lEvYV5WcXP/1UdtmIMttUO2DGufQ4vK92GPNaM=,tag:VrQaFCdq3orhtrams4hj5Q==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.7.3 diff --git a/flake.nix b/flake.nix index b5d0b7f..3a1b65e 100644 --- a/flake.nix +++ b/flake.nix @@ -60,6 +60,7 @@ # this function should take simple exports of homeConfigurations.${profile}, # nixosConfigurations.${profile}, devShells.${profile}, packages.${profile} # and correctly produce + supported_systems = flake-utils.lib.defaultSystems; cross_platform = config_fn: let # nixosConfigurations.${profile} -> nixosConfigurations.${system}.${profile} # pass in: path.to.exports.nixosConfigurations @@ -93,7 +94,7 @@ (acc: confName: (strategyMap."${confName}" confName config."${confName}" system)) {} (builtins.attrNames config)); in builtins.foldl' nixlib.lib.recursiveUpdate {} ( - builtins.map (system: (mapConfig (config_fn system) system)) flake-utils.lib.defaultSystems + builtins.map (system: (mapConfig (config_fn system) system)) supported_systems ); in cross_platform (system: let @@ -175,6 +176,6 @@ debug = { inherit final_inputs hosts users modules lib inputs_w_lib unit_tests pkgs nixpkgs nixlib; }; - formatter."${system}" = pkgs.nixpkgs-fmt; + # formatter."${system}" = pkgs.nixpkgs-fmt; }); } diff --git a/native_configs/ssh/config b/native_configs/ssh/config index 34043ac..ee37eae 100644 --- a/native_configs/ssh/config +++ b/native_configs/ssh/config @@ -85,3 +85,9 @@ Host d3l-3 HostName 10.111.103.65 User htran Port 22 + +Host goat + HostName 10.133.32.100 + User "EGN NOC" + Port 22 + diff --git a/templates/py-poetry/README.md b/templates/py-poetry/README.md index 2b1e13a..8d5e3da 100644 --- a/templates/py-poetry/README.md +++ b/templates/py-poetry/README.md @@ -23,6 +23,11 @@ poetry init ### Libraries worth integrating +- [pytest](https://github.com/pytest-dev/pytest) Testing framework for Python + +```sh +poetry add --group dev pytest +``` - [tophat/syrupy](https://github.com/tophat/syrupy) Snapshot testing plugin for (builtin) pytest ```sh From 1d39c05834e73adedf7a33576d0e1e4c8f3f655a Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 22 Feb 2023 11:05:10 -0700 Subject: [PATCH 14/64] more credentials --- credentials.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/credentials.yml b/credentials.yml index ef9f47c..33b437c 100644 --- a/credentials.yml +++ b/credentials.yml @@ -1,4 +1,14 @@ credentials: + - kind: + name_unencrypted: kv + name_unencrypted: Gitea credentials + user_unencrypted: pegasust + password: ENC[AES256_GCM,data:l472gCfek08/Z1cWL0EVtqWYYhE=,iv:TDUX4piGeHSkFSApeaGIPiXPzYAHZWxoMIuQ8G6cunw=,tag:WhCDoCNIUxe5gdxUuuYhZA==,type:str] + - kind: + name_unencrypted: kv + name_unencrypted: Nix SSH password for hungtr + user_unencrypted: hungtr + password: ENC[AES256_GCM,data:cJpfi8l1mx/86R1Oxd8=,iv:AwYBs4/P4ICNo4B6MxIz3HrGB+hdohIRtVflGBSS/P0=,tag:SC6MO5Zn0xwDRH4TGBR2LQ==,type:str] - kind: name_unencrypted: ssh name_unencrypted: egi-htran @@ -52,8 +62,8 @@ sops: Q0ZxRXNvTGlJVHNiZFNyMU5XaTM0YTQKUJvYfdyGqPFmONa+8jKjVb9tbke/HsL2 X33WHFVrQf2uOMRf3yAzRm5SfpdULFQ+JTP3CEUmcZ2nUxTmUs+X6A== -----END AGE ENCRYPTED FILE----- - lastmodified: "2023-02-15T17:08:58Z" - mac: ENC[AES256_GCM,data:FKf97bndBFxwp1d+wctwbtkkDPEJR+hsr36gXF1hiCByUyqJwjioejSKo8+ZBqJOezFwB6e77oHV1P1rf2wzC6+IvBspFIvWKZPQgCaLs0zIjbv5nZD8lpbE8nU19mEWGrgzuW0tfVaKmcq4aH1ExQS5M7HBx5Fy0gSgkUHlrmM=,iv:9poN0lEvYV5WcXP/1UdtmIMttUO2DGufQ4vK92GPNaM=,tag:VrQaFCdq3orhtrams4hj5Q==,type:str] + lastmodified: "2023-02-22T18:03:37Z" + mac: ENC[AES256_GCM,data:sWw2fm1EuZQD8251fSmqses1qh4KjtCwRJuMqCMjfTMq1HoH54L9Be8Ij83ea9kN/6G12I01D/ISxj4ZFBbrtRazac4snngRcic0ZlHGSS0MrR5FXCJR0EzdLPIMmxhE2352im+iDhArQRF/GglT/n9olpZwWgEvCDFkYrd9kmk=,iv:6oA9CONYbeNF+kVT5gC4ksfOK1ypSsvTswTOoPbFeQE=,tag:GuCdmvk3bHAWjzXqtgX8tQ==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.7.3 From 79e3c20b39aaad4e7400189a4195e2f7cd4ba436 Mon Sep 17 00:00:00 2001 From: Pegasust Date: Sat, 4 Feb 2023 20:27:08 -0700 Subject: [PATCH 15/64] before nuking top-level-wip again --- modules/opengl.sys.nix | 4 +- nix-conf/system/flake.nix | 116 +++----------------------------------- 2 files changed, 10 insertions(+), 110 deletions(-) diff --git a/modules/opengl.sys.nix b/modules/opengl.sys.nix index d7aa0c8..42788f0 100644 --- a/modules/opengl.sys.nix +++ b/modules/opengl.sys.nix @@ -16,6 +16,6 @@ let package = pkgs.mesa.drivers; package32 = pkgs.pkgsi686Linux.mesa.drivers; }; + environment.systemPackages = gpu_pkgs; }; -in - ; +in gpu_conf diff --git a/nix-conf/system/flake.nix b/nix-conf/system/flake.nix index d10d464..970abbb 100644 --- a/nix-conf/system/flake.nix +++ b/nix-conf/system/flake.nix @@ -218,7 +218,7 @@ # interface = "ens32"; }; networking.interfaces.ens32.ipv4.addresses = [ - {address = "10.100.200.230"; prefixLength = 24;} + { address = "10.100.200.230"; prefixLength = 24; } ]; } ]; @@ -243,41 +243,14 @@ modules = base_modules ++ [ ./configuration.nix ./../../modules/storage.perso.sys.nix + ./../../modules/kde.sys.nix # GPU, sound, networking stuffs + ./../../modules/pulseaudio.sys.nix + ./../../modules/opengl.sys.nix + ./../../modules/nvgpu.sys.nix ({ config, pkgs, lib, ... }: - let - gpu_pkgs = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ]; - gpu_conf = { - # openCL - hardware.opengl = { - enable = true; - extraPackages = - let - inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime; - in - [ rocm-opencl-icd rocm-opencl-runtime ]; - # Vulkan - driSupport = true; - driSupport32Bit = true; - package = pkgs.mesa.drivers; - package32 = pkgs.pkgsi686Linux.mesa.drivers; - }; - }; - amd_rx470 = { - # early amd gpu usage - boot.initrd.kernelModules = [ "amdgpu" ]; - services.xserver.enable = true; - services.xserver.videoDrivers = [ "amdgpu" ]; - }; - nv_rtx3060 = { - nixpkgs.config.allowUnfree = true; - services.xserver.enable = true; - services.xserver.videoDrivers = [ "nvidia" ]; - hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; - }; - systemPackages = [ ] ++ gpu_pkgs; - in - lib.recursiveUpdate gpu_conf (lib.recursiveUpdate nv_rtx3060 { + { + mod.tailscale.enable = true; # Use UEFI boot.loader.systemd-boot.enable = true; @@ -286,27 +259,6 @@ # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - # Enable the X11 windowing system. - services.xserver.enable = true; - # KDE & Plasma 5 - services.xserver.displayManager.sddm.enable = true; - services.xserver.desktopManager.plasma5 = { - enable = true; - excludePackages = let plasma5 = pkgs.libsForQt5; in - [ - plasma5.elisa # audio viewer - plasma5.konsole # I use alacritty instaed - plasma5.plasma-browser-integration - plasma5.print-manager # will enable if I need - plasma5.khelpcenter # why not just write manpages instead :( - # plasma5.ksshaskpass # pls just put prompts on my dear terminal - ]; - }; - - # disables KDE's setting of askpassword - programs.ssh.askPassword = ""; - programs.ssh.enableAskPassword = false; - time.timeZone = "America/Phoenix"; # Configure keymap in X11 services.xserver.layout = "us"; @@ -318,42 +270,8 @@ # Enable CUPS to print documents. # services.printing.enable = true; - # Enable sound. (pulse audio) - sound.enable = true; - programs.dconf.enable = true; - hardware.pulseaudio.enable = true; - hardware.pulseaudio.support32Bit = true; - nixpkgs.config.pulseaudio = true; - hardware.pulseaudio.extraConfig = "load-module module-combine-sink"; - mod.tailscale.enable = true; - - # Sound: pipewire - # sound.enable = false; - # hardware.pulseaudio.enable = false; - # services.pipewire = { - # enable = true; - # alsa.enable = true; - # alsa.support32Bit = true; - # pulse.enable = true; - # # Might want to use JACK in the future - # jack.enable = true; - # }; - # - # security.rtkit.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - # users.users.alice = { - # isNormalUser = true; - # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. - # packages = with pkgs; [ - # firefox - # thunderbird - # ]; - # }; # Just an initial user to get this started lol users.users.user = { initialPassword = "pw123"; @@ -361,13 +279,6 @@ isNormalUser = true; }; - # List packages installed in system profile. To search, run: - # $ nix search wget - environment.systemPackages = with pkgs; [ - neovim - wget - ] ++ systemPackages; - # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; @@ -381,17 +292,6 @@ # Enable the OpenSSH daemon. services.openssh.enable = true; - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # Copy the NixOS configuration file and link it from the resulting system - # (/run/current-system/configuration.nix). This is useful in case you - # accidentally delete configuration.nix. - # system.copySystemConfiguration = true; - # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave @@ -399,7 +299,7 @@ # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "22.11"; # Did you read the comment? - })) + }) ]; }; }; From a9456019ad7b4dda553b7556fe038897be98edac Mon Sep 17 00:00:00 2001 From: Pegasust Date: Wed, 22 Feb 2023 11:17:36 -0700 Subject: [PATCH 16/64] cred: add bao machine --- .sops.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.sops.yaml b/.sops.yaml index 0941d5e..772392f 100644 --- a/.sops.yaml +++ b/.sops.yaml @@ -1,10 +1,14 @@ keys: - &htran-mbp age1jpm9mtxz6n8vncrk6pk7dppj3r7qxfj5hsgvcdulmp3lxvxez94qvxlgay - &htran age1jw958shpwu7st8sc4z0fufuswmfpxfc9wl3df9g3f3y57m45j92syr0mng + - &bao age1umzkd4k0xt6uv5de85fpc4uztrph86nsd79h5f8cpuvtpy8n6adss7q2fv + - &root_bao age1vx7e6vz9zptwqd0cakjj8erqv58cstddama8zcrppc36rqqmlvjs53x9u0 creation_rules: - path_regex: .* key_groups: - age: - *htran - *htran-mbp + - *bao + - *root_bao From ac131e138946d839ebbfa3316e485f5f67fbfed7 Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 22 Feb 2023 11:19:28 -0700 Subject: [PATCH 17/64] cred: allow private key access for bao --- credentials.yml | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/credentials.yml b/credentials.yml index 33b437c..4b8c137 100644 --- a/credentials.yml +++ b/credentials.yml @@ -47,20 +47,38 @@ sops: - recipient: age1jw958shpwu7st8sc4z0fufuswmfpxfc9wl3df9g3f3y57m45j92syr0mng enc: | -----BEGIN AGE ENCRYPTED FILE----- - YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBKNlFvNTh6WGFVaVBvcGlt - aldQWWtqeWpWWlVTTmRPazJmdjlUT2ZZS2pFCmI2eTRPUDVrTWQ5MFR4Rm9lb0Z3 - VHBCTFBQSkJmbUpPQ21aZWp6dTJXTVEKLS0tIDlpdDJsNGVCSU85ZEMya3RPL09C - b3hXdnNjdmhjRisvV00wbU1TQml6Sk0KJ1NconEwYIvYlrQTd6yLU1uGEAJBPPTp - z1wkrjS21PjEzZnOx8UmJX5X+kfPTSItgMkWexRdW0/zVDzGRs5AoQ== + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAwdGdsRlFqU3A5S3JERDFo + RjBhaHdhSVdXbThwNkR3aWNWc2pMY2owQ0JNCjZpTFBBRWlOTTRvYUJmVzU1QjN6 + ZzkwcGNjNkVmVzhuMlhLN1ZpWEJiSjgKLS0tIGNmbHF5T3dFeWd1dDFCajIvUmJX + TkpXSCtrU1V5NjRWbTBKMWhhMi9JNGsK+UCiGQtJNU0QDTG2kIqxUO9boLPj583M + ZwQXwhqBljQojqs1NwvXHCWgyrqhPqIobwYO8xhq1/3S/jMkyfzbAQ== -----END AGE ENCRYPTED FILE----- - recipient: age1jpm9mtxz6n8vncrk6pk7dppj3r7qxfj5hsgvcdulmp3lxvxez94qvxlgay enc: | -----BEGIN AGE ENCRYPTED FILE----- - YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBCTVNMVm91ZmtzUFVOZm96 - Rm5zQUxGbzlNYXpFbnVlUStUeG05bW9rclI4ClNwZ3htUXFsZlBqNHMvV1NMT3JW - WnlxNGFyclVIV3oyWFNPN3BvRFZ5TzgKLS0tIE1PLzNsYngwMFpFaXdrcll2S0F3 - Q0ZxRXNvTGlJVHNiZFNyMU5XaTM0YTQKUJvYfdyGqPFmONa+8jKjVb9tbke/HsL2 - X33WHFVrQf2uOMRf3yAzRm5SfpdULFQ+JTP3CEUmcZ2nUxTmUs+X6A== + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAxSnN3V2hXZ25mU1gxait3 + TDVDQ1RqbVZYOWI2Q1BCZnlDaFVHb2NuRXdrCm8yQ0FWRytReCt0TU11byt5THM1 + VWh1MjhFWVlRQ29rQXlJS2FHTUFaQlkKLS0tIExJMndaY2g3ZmlnbyswWW9Fc0RM + MFFVNGs2RHVTcUdYZWljckt0RnRFN28K4O6nmQfMaJYzaA2n4PzLAqoslyxScplr + y6b6wTL3171sA2w6DgP+8BQjJ9/oCoGOtwpyxWzs2zld0dglmP9PGA== + -----END AGE ENCRYPTED FILE----- + - recipient: age1umzkd4k0xt6uv5de85fpc4uztrph86nsd79h5f8cpuvtpy8n6adss7q2fv + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBmOFVCTS9HS2dITFVqV2s5 + VGV5WUZlaW9JMWdNM1NUeVNmTFV3eWVzS0hFCnNVTGRlbG1aU2dsaXhFMmZFekt5 + cU4wWkNpYktFcEtwYTByUDlpOW5WY1EKLS0tIENyMndiL0gxUGdlK1BtelNKd295 + QThYZGM0Y1FoTmVud2MxZ2lxK1RENFUKbRkax7DamL8m8qnN0FBHjJm7iDEjI4On + +xWVpKRSZviklQTybJqCS3PS3hCAW2zVlD8kZ5ZgTF9/p3towOAJGw== + -----END AGE ENCRYPTED FILE----- + - recipient: age1vx7e6vz9zptwqd0cakjj8erqv58cstddama8zcrppc36rqqmlvjs53x9u0 + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA3eFI3YUtGbUFQbnQ5YXZ4 + VE1uNHhNdUNPeEVOY3VuaFR5UEQ3ejJqaFJRClpETnFhQ09udk5XTWRBdmxnRW5q + T0xGbFYwOVlZWWFNb2c4d0ZBNzZnREEKLS0tIGlLK1RRMllKMG9vTmxOSHZXb3dT + cWxIRyszNmlpN2twMElIL3JCcHdOcHMKMT7Xq+XsSAdkJ1CAWRqdQTrr1NhPeTUc + UT0Fa8zUCBTUZEhcmVAnZ4Crr6N2GQbtNOU2S9Jt++od1dxQ+9TjHA== -----END AGE ENCRYPTED FILE----- lastmodified: "2023-02-22T18:03:37Z" mac: ENC[AES256_GCM,data:sWw2fm1EuZQD8251fSmqses1qh4KjtCwRJuMqCMjfTMq1HoH54L9Be8Ij83ea9kN/6G12I01D/ISxj4ZFBbrtRazac4snngRcic0ZlHGSS0MrR5FXCJR0EzdLPIMmxhE2352im+iDhArQRF/GglT/n9olpZwWgEvCDFkYrd9kmk=,iv:6oA9CONYbeNF+kVT5gC4ksfOK1ypSsvTswTOoPbFeQE=,tag:GuCdmvk3bHAWjzXqtgX8tQ==,type:str] From bdd7ea92d11a8aeec81f5bb64714ab575bf08a11 Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 22 Feb 2023 13:18:44 -0700 Subject: [PATCH 18/64] just bare minimum for convenience of sops and access to credentials.yml --- dev-shell.nix | 7 ++-- flake.nix | 93 +++++++++++-------------------------------------- lib/default.nix | 61 -------------------------------- lib/serde.nix | 31 ----------------- lib/test.nix | 1 - 5 files changed, 24 insertions(+), 169 deletions(-) delete mode 100644 lib/default.nix delete mode 100644 lib/serde.nix delete mode 100644 lib/test.nix diff --git a/dev-shell.nix b/dev-shell.nix index 2a08266..a28a0e2 100644 --- a/dev-shell.nix +++ b/dev-shell.nix @@ -12,13 +12,14 @@ # buildInputs, or packages buildInputs = [ # shell scripts - (lib.shellAsDrv { script = ''echo "hello world"''; pname = "hello"; }) - # TODO: decompose hm-switch.sh with a base version (where HOME_MANAGER_BIN is injected) - # (lib.shellAsDrv {script = builtins.readFile ./scripts/hm-switch.sh; pname = "hm-switch";}) pkgs.rust4cargo pkgs.sops ]; + shellHook = '' + # Since we need late dispatch of ~, we have to put this in shellHook. + export SOPS_AGE_KEY_FILE=~/.config/sops/age/keys.txt + ''; # env vars lol = "hello world"; } diff --git a/flake.nix b/flake.nix index 3a1b65e..6d6e1a9 100644 --- a/flake.nix +++ b/flake.nix @@ -61,46 +61,9 @@ # nixosConfigurations.${profile}, devShells.${profile}, packages.${profile} # and correctly produce supported_systems = flake-utils.lib.defaultSystems; - cross_platform = config_fn: let - # nixosConfigurations.${profile} -> nixosConfigurations.${system}.${profile} - # pass in: path.to.exports.nixosConfigurations - # get out: nixosConfigurations.${system} = {...} - strat_sandwich = field_name: config_field: system: { - "${field_name}"."${system}" = config_field; - }; - # homeConfigurations.${profile} -> packages.${system}.homeConfigurations.${profile} - # pass in: path.to.exports.homeConfigurations - # get: packages.${system}.homeConfigurations - strat_wrap_packages = field_name: config_field: system: { - packages."${system}"."${field_name}" = config_field; - }; - strat_noop = field_name: config_field: system: {"${field_name}" = config_field;}; - strategyMap = { - nixosConfigurations = strat_sandwich; - templates = strat_noop; - devShells = strat_sandwich; - devShell = strat_sandwich; - formatter = strat_sandwich; - homeConfigurations = strat_wrap_packages; - lib = strat_noop; - proj_root = strat_noop; - unit_tests = strat_noop; - secrets = strat_noop; - debug = strat_noop; - }; - # takes in {homeConfigurations = ...; nixosConfigurations = ...} - # -> {packages.$system.homeConfigurations} - mapConfig = config: system: (builtins.foldl' - (acc: confName: (strategyMap."${confName}" confName config."${confName}" system)) - {} (builtins.attrNames config)); - in builtins.foldl' nixlib.lib.recursiveUpdate {} ( - builtins.map (system: (mapConfig (config_fn system) system)) supported_systems - ); - in cross_platform (system: + forEachSystem = nixpkgs.lib.genAttrs supported_systems; + in let - # Context/global stuffs to be passed down - # NOTE: this will only read files that are within git tree - # all secrets should go into secrets.nix and secrets/*.age proj_root = let path = builtins.toString ./.; @@ -115,26 +78,24 @@ hosts.path = "${path}/hosts"; users.path = "${path}/users"; }; - overlays = import ./overlays.nix (_inputs // {inherit system;}); - pkgs = import nixpkgs { - inherit system overlays; + overlays = forEachSystem (system: import ./overlays.nix (_inputs // { inherit system; })); + pkgs = forEachSystem (system: (import nixpkgs { + inherit system; + overlays = overlays.${system}; config = { allowUnfree = true; }; - }; - # now, this lib is extremely powerful as it also engulfs nixpkgs.lib - # lib = nixpkgs.lib // pkgs.lib; + })); lib = (builtins.foldl' (lhs: rhs: (nixpkgs.lib.recursiveUpdate lhs rhs)) { } [ nixpkgs.lib - pkgs.lib - (import ./lib { - inherit proj_root pkgs overlays system; - inherit (pkgs) lib; - }) + nixlib.lib ]); - inputs_w_lib = (pkgs.lib.recursiveUpdate _inputs { - inherit system proj_root pkgs lib; - }); + inputs_w_lib = forEachSystem ( + system: lib.recursiveUpdate _inputs { + inherit system lib; + pkgs = pkgs.${system}; + } + ); modules = (import ./modules inputs_w_lib); hosts = (import ./hosts inputs_w_lib); @@ -143,28 +104,15 @@ # {nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat # ,pkgs, lib (extended), proj_root} final_inputs = inputs_w_lib; - - # Tests: unit + integration - unit_tests = (import ./lib/test.nix final_inputs) // - { - test_example = { - expr = "names must start with 'test'"; - expected = "or won't show up"; - }; - not_show = { - expr = "this will be ignored by lib.runTests"; - expected = "for sure"; - }; - }; - secrets = import ./secrets final_inputs; - in { inherit (hosts) nixosConfigurations; inherit (users) homeConfigurations; inherit lib proj_root; - devShells = import ./dev-shell.nix final_inputs; - templates = import ./templates final_inputs; + devShells = forEachSystem (system: + {default = (import ./dev-shell.nix final_inputs.${system});} + ); + templates = forEachSystem (system: import ./templates final_inputs.${system}); secrets = { pubKeys = { hosts = hosts.pubKeys; @@ -172,10 +120,9 @@ }; }; - # unit_tests = lib.runTests unit_tests; debug = { - inherit final_inputs hosts users modules lib inputs_w_lib unit_tests pkgs nixpkgs nixlib; + inherit final_inputs hosts users modules lib inputs_w_lib pkgs nixpkgs nixlib; }; # formatter."${system}" = pkgs.nixpkgs-fmt; - }); + }; } diff --git a/lib/default.nix b/lib/default.nix deleted file mode 100644 index 6568f0c..0000000 --- a/lib/default.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ pkgs - # ,nixpkgs -, proj_root - # ,agenix -, nixosDefaultVersion ? "22.05" -, defaultSystem ? "x86_64-linux" -, ... -}@inputs: -let - lib = pkgs.lib; - inputs_w_lib = (inputs // { inherit lib; }); - serde = import ./serde.nix inputs_w_lib; - shellAsDrv = { script, pname }: (pkgs.callPackage - ( - # just a pattern that we must remember: args to this are children of pkgs. - { writeShellScriptBin }: writeShellScriptBin pname script - ) - { }); - trimNull = lib.filterAttrs (name: value: value != null); - # ssh - flattenPubkey = lib.mapAttrs (_identity: meta_config: lib.attrByPath [ "metadata" "ssh_pubkey" ] null meta_config); - getPubkey = config: (lib.pipe config [ flattenPubkey trimNull ]); - # procedure = -in -{ - # short-hand to create a shell derivation - # NOTE: this is pure. This means, env vars from devShells might not - # be accessible unless MAYBE they are `export`ed - inherit shellAsDrv trimNull flattenPubkey getPubkey; - ssh = { - inherit flattenPubkey getPubkey; - }; - # Configures hosts as nixosConfiguration - # mkHost = {hostName - # , nixosBareConfiguration - # , finalInputs - # , users ? {} - # , nixosVersion? nixosDefaultVersion - # , system? defaultSystem - # , preset? "base"}: # base | minimal - # let - # hardwareConfig = hostname: import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix"; - # in nixpkgs.lib.nixosSystem (nixosBareConfiguration // { - # inherit system; - # modules = [ - # { - # system.stateVersion = nixosVersion; - # networking.hostName = hostName; - # users.users = users; - # } - # { - # _module.args = finalInputs; - # } - # import "${proj_root.modules.path}/secrets.nix" - # import "${proj_root.modules.path}/${preset}.sys.nix" - # ] ++ nixosBareConfiguration.modules; - # lib = finalInputs.lib; - # }); - inherit serde; - inherit (serde) fromYaml fromYamlPath; -} diff --git a/lib/serde.nix b/lib/serde.nix deleted file mode 100644 index d0d5732..0000000 --- a/lib/serde.nix +++ /dev/null @@ -1,31 +0,0 @@ -# Takes care of serializing and deserializing to some formats -# Blame: Pegasust -# TODO: Add to* formats from pkgs.formats.* -{ pkgs -, lib -, ... -} @ inputs: -let - yamlToJsonDrv = yamlContent: outputPath: pkgs.callPackage - ({ runCommand }: - # runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33 - runCommand outputPath { inherit yamlContent; nativeBuildInputs = [ pkgs.yq ]; } - # run yq which outputs '.' (no filter) on file at yamlPath - # note that $out is passed onto the bash/sh script for execution - '' - echo "$yamlContent" | yq >$out - '') - { }; -in -{ - # Takes in a yaml string and produces a derivation with translated JSON at $outputPath - # similar to builtins.fromJSON, turns a YAML string to nix attrset - fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json")); - fromYamlPath = yamlPath: builtins.fromJSON ( - builtins.readFile ( - yamlToJsonDrv - ( - builtins.readFile yamlPath) - "any-output.json")); - # TODO: fromToml? -} diff --git a/lib/test.nix b/lib/test.nix deleted file mode 100644 index da4b506..0000000 --- a/lib/test.nix +++ /dev/null @@ -1 +0,0 @@ -{ lib, ... }: { } From fd82956c33d8c8ae92bf70b0b3a0f0f75515c25b Mon Sep 17 00:00:00 2001 From: Hung Date: Fri, 24 Feb 2023 10:54:28 -0700 Subject: [PATCH 19/64] add ci user for dev1 --- credentials.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/credentials.yml b/credentials.yml index 4b8c137..0bbcc54 100644 --- a/credentials.yml +++ b/credentials.yml @@ -1,4 +1,9 @@ credentials: + - kind: + name_unencrypted: kv + name_unencrypted: ci@dev1.htran.egihosting.com + user_unencrypted: ci + password: ENC[AES256_GCM,data:4AIDKxX9dQncyhHe,iv:+YbvHz6GLD9unbTwE/KwcdpU/yMygFurxelOjkrFJRU=,tag:VHnzt66W2pWwcxjTH9LreQ==,type:str] - kind: name_unencrypted: kv name_unencrypted: Gitea credentials @@ -80,8 +85,8 @@ sops: cWxIRyszNmlpN2twMElIL3JCcHdOcHMKMT7Xq+XsSAdkJ1CAWRqdQTrr1NhPeTUc UT0Fa8zUCBTUZEhcmVAnZ4Crr6N2GQbtNOU2S9Jt++od1dxQ+9TjHA== -----END AGE ENCRYPTED FILE----- - lastmodified: "2023-02-22T18:03:37Z" - mac: ENC[AES256_GCM,data:sWw2fm1EuZQD8251fSmqses1qh4KjtCwRJuMqCMjfTMq1HoH54L9Be8Ij83ea9kN/6G12I01D/ISxj4ZFBbrtRazac4snngRcic0ZlHGSS0MrR5FXCJR0EzdLPIMmxhE2352im+iDhArQRF/GglT/n9olpZwWgEvCDFkYrd9kmk=,iv:6oA9CONYbeNF+kVT5gC4ksfOK1ypSsvTswTOoPbFeQE=,tag:GuCdmvk3bHAWjzXqtgX8tQ==,type:str] + lastmodified: "2023-02-24T17:50:22Z" + mac: ENC[AES256_GCM,data:RtMp7P9yh6bNsxBZ5IkM1heFw+23T9DR4+pMO7XticdZVhY3QGP5zi9KIjfboTXn5u3ENH0I7qRTvKWx6caHP3gl7PGU0n2Hi8ZsyR1Dy7Jk/YM7G4FvubzPf21TKlmouHY4dk1u/HZ5y+7IpyhLl7sMDXXwqres2SeZ5EmnIxI=,iv:tpJDZ+NSgXYcxRklnUcbpb+HF1DMdYPETXqJbHIZ+vE=,tag:rNzfy+2fXnAKBuYSIpY9KA==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.7.3 From 9a4e80ba6ea604fe05b35b0e9ac6ec1519a078ee Mon Sep 17 00:00:00 2001 From: Hung Date: Mon, 27 Feb 2023 10:32:48 -0700 Subject: [PATCH 20/64] +ssh --- credentials.yml | 6 +++--- native_configs/ssh/config | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/credentials.yml b/credentials.yml index 0bbcc54..c4ef1f4 100644 --- a/credentials.yml +++ b/credentials.yml @@ -32,7 +32,7 @@ credentials: agepriv: ENC[AES256_GCM,data:f66nwYr1WLTejGI2SpHNrf8BYRJJuxpufYLSYVix1uLdBj2TfVJVjN3bLsnHrB1DoeVyaF0nUxrdcL64LhbI38zZC/fNORfXx4E=,iv:J/noycrJlL2+r1ojmUYC/6GUVMGqRFM2ondBm2C7fSE=,tag:pT5z5NQQdS30bucdbPPBng==,type:str] - kind: name_unencrypted: ssh - name_unencrypted: gl-egi-htran-ed25519 + name_unencrypted: ci-gl-egi-htran-ed25519 privkey: ENC[AES256_GCM,data:vM5G2o/syq9YUwqpUONJk5ebwha+UQI0wUCkwkmZTTtx+nB/HTnc4kqxX/eeF9ybSE8vq7YIWuKB8aSjpizOYZjjWIV3qpWBiDmdrWkWfUIl7kDdy75azZjHNRXuXUUExbPYGVjmL7KdDMHY2u1WceDSdEvgB2sNOPw4dNiZ9lcbJ5iDpQzmxaF6zdvZ/rVoXYM2NgSMdM4oTdRtYivcOPuxwRGi39R5XgyPJYwltawSAPFPmNYofszUzYLnD7jPEJqyEQORpcI2oM2qAPab22kDrDLyd51X1F6XT/5chKuPSsidZAVjB6+v2s/yN0quqz3qcP2RTYtaZcFyeEquk6eWA/MWVwCJK8XopNoPVVo0PRppOtq3M9Fss3Z587nQAis8doCbvv9XdUunOFHFWon7k8fGu9cDDMmSOE3KGWCO7Vw0V6dYnBT+OVJnJAxlf7AsUZdXVBo3PK9Zw6+d2XF2N9Jhr0bqA1tpmGqwCygHy41FGbWtuhZBX8JimTPFE1MyT5YvptzwbayONcvps8hZED8zwKbR/64DSF7wn1DAaW0=,iv:JjO6O+FB+W1Gi216bjkVXiIFvxLmIZ4rKLCXcepOIQc=,tag:TxiwbrCZ4vFgw6WMmKrVOg==,type:str] pubkey_unencrypted: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINOqM08nqvcFhcF6E//dlphXctfck83N0tjKIfil8npY htran@Hung-Tran-MBP.local agepriv: ENC[AES256_GCM,data:Z4qRvam25nvkNr4DuZhhKtN83NIfNcBW5Wq7SGm0Nb31kAjCS25VfkTrXUtrxWIunMCZEYoIdDLiENjRQPAh/NwffGbZn94/ZKY=,iv:t3YtQvRQPdbDcXgEC/A13W1K9/IIlt6rPceR1lAl0BM=,tag:QmiriOk19fGSPOWj98doUQ==,type:str] @@ -85,8 +85,8 @@ sops: cWxIRyszNmlpN2twMElIL3JCcHdOcHMKMT7Xq+XsSAdkJ1CAWRqdQTrr1NhPeTUc UT0Fa8zUCBTUZEhcmVAnZ4Crr6N2GQbtNOU2S9Jt++od1dxQ+9TjHA== -----END AGE ENCRYPTED FILE----- - lastmodified: "2023-02-24T17:50:22Z" - mac: ENC[AES256_GCM,data:RtMp7P9yh6bNsxBZ5IkM1heFw+23T9DR4+pMO7XticdZVhY3QGP5zi9KIjfboTXn5u3ENH0I7qRTvKWx6caHP3gl7PGU0n2Hi8ZsyR1Dy7Jk/YM7G4FvubzPf21TKlmouHY4dk1u/HZ5y+7IpyhLl7sMDXXwqres2SeZ5EmnIxI=,iv:tpJDZ+NSgXYcxRklnUcbpb+HF1DMdYPETXqJbHIZ+vE=,tag:rNzfy+2fXnAKBuYSIpY9KA==,type:str] + lastmodified: "2023-02-24T19:32:21Z" + mac: ENC[AES256_GCM,data:GO8YtHRGO6qmDXRImR9xYxZM9Z6zeZvRRQxZ6oWuvEAw68EMB0t+x5xDYXHPkOdgC/J5nP1NbTXxRMs52C18z5gw5PTVS9ff+ADU1xd+86r2ihVJObYJHhfFU5/5gTObMiV9sGQb/1ngemDNjYhusax40h+tWcDU/czo+8IzAOk=,iv:UzLby0l6CObPHVYTnKf7yCF2wI1Oj6O32/2qBOO+bK8=,tag:pjU7U8OBgZFDPDm7s2OVXA==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.7.3 diff --git a/native_configs/ssh/config b/native_configs/ssh/config index ee37eae..f2d463d 100644 --- a/native_configs/ssh/config +++ b/native_configs/ssh/config @@ -91,3 +91,13 @@ Host goat User "EGN NOC" Port 22 +Host portal2 + HostName portal2.egihosting.com + User root + Port 22 + +Host egn-rest-api + HostName egn-rest-api.egihosting.com + User root + Port 22 + From 73da05fc738557bc46a283aefc6ad96a92fb9b78 Mon Sep 17 00:00:00 2001 From: Hung Date: Tue, 28 Feb 2023 12:04:25 -0700 Subject: [PATCH 21/64] credentials: add new user; add postman to work darwin --- credentials.yml | 11 ++++++++--- nix-conf/home-manager/base/neovim.nix | 2 +- nix-conf/home-manager/flake.nix | 5 +++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/credentials.yml b/credentials.yml index c4ef1f4..0194ef6 100644 --- a/credentials.yml +++ b/credentials.yml @@ -32,7 +32,7 @@ credentials: agepriv: ENC[AES256_GCM,data:f66nwYr1WLTejGI2SpHNrf8BYRJJuxpufYLSYVix1uLdBj2TfVJVjN3bLsnHrB1DoeVyaF0nUxrdcL64LhbI38zZC/fNORfXx4E=,iv:J/noycrJlL2+r1ojmUYC/6GUVMGqRFM2ondBm2C7fSE=,tag:pT5z5NQQdS30bucdbPPBng==,type:str] - kind: name_unencrypted: ssh - name_unencrypted: ci-gl-egi-htran-ed25519 + name_unencrypted: gl-egi-htran-ed25519 privkey: ENC[AES256_GCM,data:vM5G2o/syq9YUwqpUONJk5ebwha+UQI0wUCkwkmZTTtx+nB/HTnc4kqxX/eeF9ybSE8vq7YIWuKB8aSjpizOYZjjWIV3qpWBiDmdrWkWfUIl7kDdy75azZjHNRXuXUUExbPYGVjmL7KdDMHY2u1WceDSdEvgB2sNOPw4dNiZ9lcbJ5iDpQzmxaF6zdvZ/rVoXYM2NgSMdM4oTdRtYivcOPuxwRGi39R5XgyPJYwltawSAPFPmNYofszUzYLnD7jPEJqyEQORpcI2oM2qAPab22kDrDLyd51X1F6XT/5chKuPSsidZAVjB6+v2s/yN0quqz3qcP2RTYtaZcFyeEquk6eWA/MWVwCJK8XopNoPVVo0PRppOtq3M9Fss3Z587nQAis8doCbvv9XdUunOFHFWon7k8fGu9cDDMmSOE3KGWCO7Vw0V6dYnBT+OVJnJAxlf7AsUZdXVBo3PK9Zw6+d2XF2N9Jhr0bqA1tpmGqwCygHy41FGbWtuhZBX8JimTPFE1MyT5YvptzwbayONcvps8hZED8zwKbR/64DSF7wn1DAaW0=,iv:JjO6O+FB+W1Gi216bjkVXiIFvxLmIZ4rKLCXcepOIQc=,tag:TxiwbrCZ4vFgw6WMmKrVOg==,type:str] pubkey_unencrypted: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINOqM08nqvcFhcF6E//dlphXctfck83N0tjKIfil8npY htran@Hung-Tran-MBP.local agepriv: ENC[AES256_GCM,data:Z4qRvam25nvkNr4DuZhhKtN83NIfNcBW5Wq7SGm0Nb31kAjCS25VfkTrXUtrxWIunMCZEYoIdDLiENjRQPAh/NwffGbZn94/ZKY=,iv:t3YtQvRQPdbDcXgEC/A13W1K9/IIlt6rPceR1lAl0BM=,tag:QmiriOk19fGSPOWj98doUQ==,type:str] @@ -43,6 +43,11 @@ credentials: ip: ENC[AES256_GCM,data:9/FPJM8l4hLvzDc5pg==,iv:ny1LKtgznhzMd3Bhogwu6b6bOk3/uCNarKTmlWRZAes=,tag:PsleUu2ZE4leEMEcEuJdLQ==,type:str] user_unencrypted: EGN NOC password: ENC[AES256_GCM,data:YOL5Sw6zaA==,iv:Cs8gySfGIQUBPivkM5N6kflZsRhp2w9xmPwtl7RrEZE=,tag:LXYKdsX++IP+jQyjL6JBrg==,type:str] + - kind: + name_unencrypted: kv + name_unencrypted: gl-deploy-token + user_unencrypted: gitlab+deploy-token-2 + pass_unencrpyted: ENC[AES256_GCM,data:GcPu8JFy8JuPb3xrHKBpP196h0k=,iv:2N69xdTtnpjDLvRAbSpDWGh6+IFWpIZgHo6yVf2kE/4=,tag:L7UA7Oj/ZtekO3Cmvp2lvA==,type:str] sops: kms: [] gcp_kms: [] @@ -85,8 +90,8 @@ sops: cWxIRyszNmlpN2twMElIL3JCcHdOcHMKMT7Xq+XsSAdkJ1CAWRqdQTrr1NhPeTUc UT0Fa8zUCBTUZEhcmVAnZ4Crr6N2GQbtNOU2S9Jt++od1dxQ+9TjHA== -----END AGE ENCRYPTED FILE----- - lastmodified: "2023-02-24T19:32:21Z" - mac: ENC[AES256_GCM,data:GO8YtHRGO6qmDXRImR9xYxZM9Z6zeZvRRQxZ6oWuvEAw68EMB0t+x5xDYXHPkOdgC/J5nP1NbTXxRMs52C18z5gw5PTVS9ff+ADU1xd+86r2ihVJObYJHhfFU5/5gTObMiV9sGQb/1ngemDNjYhusax40h+tWcDU/czo+8IzAOk=,iv:UzLby0l6CObPHVYTnKf7yCF2wI1Oj6O32/2qBOO+bK8=,tag:pjU7U8OBgZFDPDm7s2OVXA==,type:str] + lastmodified: "2023-02-28T17:54:36Z" + mac: ENC[AES256_GCM,data:uI84H7eyWsauw2RMysa8w/OHP4QXN+FvO/GW+orj86cTlfL521MdPgZZamtSxOeyb4+893jn09GSFUBmOdQHUOX3kGNdWNwpu7eXM1ext/cpZwCsaIDBWDyCCE6LcF69LQEKsbRlC1nDAeMW3Wn510teS/TFxgbRucNdGTnrRE0=,iv:PbjX7VTDkAi0O/pipgV70KbJD/LLJAmD/U7d2kn58DM=,tag:dMsU71CPnO8JHyXoWPcFaQ==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.7.3 diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix index b2c9d4c..14d1ef1 100644 --- a/nix-conf/home-manager/base/neovim.nix +++ b/nix-conf/home-manager/base/neovim.nix @@ -33,7 +33,7 @@ let pkgs.nickel pkgs.lsp-nls - pkgs.go + pkgs.go # doesn't work, Mason installs from runtime path # Language-specific stuffs diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 4797189..9ae4930 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -187,6 +187,11 @@ base.git.name = "Hung"; base.git.email = "htran@egihosting.com"; } + { + home.packages = [ + pkgs.postman + ]; + } nerd_font_module ]; extraSpecialArgs = mkModuleArgs { From 33c4acf9eaedd89e9dfec0ada1c18f981167dc12 Mon Sep 17 00:00:00 2001 From: Pegasust Date: Mon, 6 Mar 2023 12:55:55 -0800 Subject: [PATCH 22/64] prefer ed25519 --- native_configs/ssh/config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native_configs/ssh/config b/native_configs/ssh/config index f2d463d..162bfec 100644 --- a/native_configs/ssh/config +++ b/native_configs/ssh/config @@ -1,6 +1,6 @@ Host * - IdentityFile ~/.ssh/id_rsa IdentityFile ~/.ssh/id_ed25519 + IdentityFile ~/.ssh/id_rsa # felia mirror on windows Host felia-win From 9f0023c4d6b49b5bfc185fa9a26bed339b2a85d5 Mon Sep 17 00:00:00 2001 From: Pegasust Date: Mon, 6 Mar 2023 13:11:12 -0800 Subject: [PATCH 23/64] add work gitlab --- native_configs/ssh/config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/native_configs/ssh/config b/native_configs/ssh/config index 162bfec..e95e98d 100644 --- a/native_configs/ssh/config +++ b/native_configs/ssh/config @@ -101,3 +101,9 @@ Host egn-rest-api User root Port 22 +Host gl-egi + HostName gitlab.egihosting.com + User git + Port 22 + IdentityFile ~/.ssh/id_ed25519 + From c9f22e24ad03d60f993d15d476e42744a16ebbfb Mon Sep 17 00:00:00 2001 From: Pegasust Date: Sat, 11 Mar 2023 15:29:21 -0800 Subject: [PATCH 24/64] nix-dev: should be stable now --- native_configs/ssh/config | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/native_configs/ssh/config b/native_configs/ssh/config index e95e98d..e88290b 100644 --- a/native_configs/ssh/config +++ b/native_configs/ssh/config @@ -2,6 +2,10 @@ Host * IdentityFile ~/.ssh/id_ed25519 IdentityFile ~/.ssh/id_rsa +Host 10.111.103.* + StrictHostKeyChecking no + UserKnownHostsFile /dev/null + # felia mirror on windows Host felia-win HostName felia.coati-celsius.ts.net @@ -60,6 +64,20 @@ Host sr1 HostKeyAlgorithms=+ssh-dss,ssh-rsa KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1 +Host bgp1 + HostName 10.111.100.113 + User htran + Port 22 + HostKeyAlgorithms=+ssh-dss,ssh-rsa + KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1 + +Host bgp2 + HostName 10.111.100.114 + User htran + Port 22 + HostKeyAlgorithms=+ssh-dss,ssh-rsa + KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1 + Host d1-30 HostName 10.111.103.60 User htran @@ -67,7 +85,7 @@ Host d1-30 Host dev0 HostName 10.100.200.230 - User root + User htran Port 22 Host dev1 @@ -107,3 +125,4 @@ Host gl-egi Port 22 IdentityFile ~/.ssh/id_ed25519 + From 0a947801ab44ee3b07f6a2b46061e6ae9764efbc Mon Sep 17 00:00:00 2001 From: Pegasust Date: Sat, 11 Mar 2023 21:27:34 -0800 Subject: [PATCH 25/64] flake update for hm --- native_configs/neovim/init.lua | 4 - nix-conf/home-manager/base/neovim.nix | 3 +- nix-conf/home-manager/flake.lock | 108 +++++++++++++------------- 3 files changed, 56 insertions(+), 59 deletions(-) diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 1617ead..35e7644 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -19,10 +19,6 @@ if empty(glob(plug_path)) endif ]]) -local function truthy(v) return v ~= nil end - -local function cfg(cfg_var, do_fn) if truthy(cfg_var) then do_fn() end end - -- vim-plug local Plug = vim.fn['plug#'] diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix index 14d1ef1..3e6b4e3 100644 --- a/nix-conf/home-manager/base/neovim.nix +++ b/nix-conf/home-manager/base/neovim.nix @@ -63,6 +63,7 @@ in }; }; config = lib.mkIf config.base.neovim.enable { + # home-manager programs.neovim = { enable = true; package = my_neovim; @@ -85,8 +86,8 @@ in # extraConfig actually writes to init-home-manager.vim (not lua) # https://github.com/nix-community/home-manager/pull/3287 # extraConfig = builtins.readFile "${proj_root}/neovim/init.lua"; + extraLuaConfig = (builtins.readFile "${proj_root.config.path}//neovim/init.lua"); }; # home.packages = nvim_pkgs; - xdg.configFile."nvim/init.lua".source = "${proj_root.config.path}//neovim/init.lua"; }; } diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index 831b926..949c824 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -11,11 +11,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1673405853, - "narHash": "sha256-6Nq9DuOo+gE2I8z5UZaKuumykz2xxZ9JGYmUthOuwSA=", + "lastModified": 1677892403, + "narHash": "sha256-/Wi0L1spSWLFj+UQxN3j0mPYMoc7ZoAujpUF/juFVII=", "owner": "ipetkov", "repo": "crane", - "rev": "b13963c8c18026aa694acd98d14f66d24666f70b", + "rev": "105e27adb70a9890986b6d543a67761cbc1964a2", "type": "github" }, "original": { @@ -40,11 +40,11 @@ "flake-compat_2": { "flake": false, "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type": "github" }, "original": { @@ -56,11 +56,11 @@ "flake-compat_3": { "flake": false, "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type": "github" }, "original": { @@ -87,11 +87,11 @@ }, "flake-utils": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -117,11 +117,11 @@ }, "flake-utils_3": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -132,11 +132,11 @@ }, "flake-utils_4": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -205,11 +205,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1673948101, - "narHash": "sha256-cD0OzFfnLFeeaz4jVszH9QiMTn+PBxmcYzrp+xujpwM=", + "lastModified": 1678571066, + "narHash": "sha256-MrlMr2A3tK1MY/JUGWMVzMwois8+mHWXm/1yYdwQSIc=", "owner": "nix-community", "repo": "home-manager", - "rev": "bd3efacb82c721edad1ce9eda583df5fb62ab00a", + "rev": "bf5712c5865e543fb3f4796511d4cf51efd841b1", "type": "github" }, "original": { @@ -244,11 +244,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1673937267, - "narHash": "sha256-zixnItZtMZRKK0bEh8UOBeh8JT4jeMzPR2TtacfXmyE=", + "lastModified": 1678516523, + "narHash": "sha256-DpcG4CT542aSmLmK7bmZFumKfMwBQowWrJns895TvyU=", "owner": "neovim", "repo": "neovim", - "rev": "2093e574c6c934a718f96d0a173aa965d3958a8b", + "rev": "236c20795eb9f11e21e0719b735ea741711acc08", "type": "github" }, "original": { @@ -265,11 +265,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1673943288, - "narHash": "sha256-TDo9wDfZH+MJ/tTeCtZ67jdHqtVvIxetLpFN9+vqZ7g=", + "lastModified": 1678522422, + "narHash": "sha256-g565cBceeJTBGYSRO4Gr5mGz46RapgLolYUMXpFDBFU=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "3c0bb335936754a2683a84ddf081594ddb567a89", + "rev": "3e253022630b30c44c0246d2a83bf2c1f1b185c7", "type": "github" }, "original": { @@ -287,11 +287,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1676039663, - "narHash": "sha256-fkIg8rJcnvT0kEdd4lqwp90rAe5RsxSOrWsmlXzD3Uo=", + "lastModified": 1678475794, + "narHash": "sha256-wBS87BjBhQb7aw4+GbCl2+hKN1JCrNeXT4BISD99eeo=", "owner": "tweag", "repo": "nickel", - "rev": "38ca87438918b84ebe7287a040729e4afd8c75b1", + "rev": "085545cd673dfb6f87238f71be34f0d3d092469c", "type": "github" }, "original": { @@ -307,11 +307,11 @@ ] }, "locked": { - "lastModified": 1673752441, - "narHash": "sha256-/g4ImZWV05CrXRWTSJsda6ztIp7LAPxs2L6RCrbQ66U=", + "lastModified": 1678591454, + "narHash": "sha256-uEjRsVJIkfyRjTIYHscit8CAUw4kygdzJGplNiV25l8=", "owner": "mic92", "repo": "nix-index-database", - "rev": "391180f77505c1c8cdd45fe1a59dc89d3e40300a", + "rev": "caf85d1716e1ce6d7a0da2b7f1ab1c46d9497662", "type": "github" }, "original": { @@ -370,11 +370,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1674211260, - "narHash": "sha256-xU6Rv9sgnwaWK7tgCPadV6HhI2Y/fl4lKxJoG2+m9qs=", + "lastModified": 1677932085, + "narHash": "sha256-+AB4dYllWig8iO6vAiGGYl0NEgmMgGHpy9gzWJ3322g=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5ed481943351e9fd354aeb557679624224de38d5", + "rev": "3c5319ad3aa51551182ac82ea17ab1c6b0f0df89", "type": "github" }, "original": { @@ -400,11 +400,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1673796341, - "narHash": "sha256-1kZi9OkukpNmOaPY7S5/+SlCDOuYnP3HkXHvNDyLQcc=", + "lastModified": 1678470307, + "narHash": "sha256-OEeMUr3ueLIXyW/OaFUX5jUdimyQwMg/7e+/Q0gC/QE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6dccdc458512abce8d19f74195bb20fdb067df50", + "rev": "0c4800d579af4ed98ecc47d464a5e7b0870c4b1f", "type": "github" }, "original": { @@ -445,11 +445,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1674122161, - "narHash": "sha256-9QM4rvgUSEwO8DWtJN9sR/afEqrH1s3b6ACsZT5wiAM=", + "lastModified": 1677832802, + "narHash": "sha256-XQf+k6mBYTiQUjWRf/0fozy5InAs03O1b30adCpWeXs=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "53e766957b73298fa68b47478c48cbcc005cc18a", + "rev": "382bee738397ca005206eefa36922cc10df8a21c", "type": "github" }, "original": { @@ -486,11 +486,11 @@ ] }, "locked": { - "lastModified": 1672712534, - "narHash": "sha256-8S0DdMPcbITnlOu0uA81mTo3hgX84wK8S9wS34HEFY4=", + "lastModified": 1677812689, + "narHash": "sha256-EakqhgRnjVeYJv5+BJx/NZ7/eFTMBxc4AhICUNquhUg=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "69fb7bf0a8c40e6c4c197fa1816773774c8ac59f", + "rev": "e53e8853aa7b0688bc270e9e6a681d22e01cf299", "type": "github" }, "original": { @@ -511,11 +511,11 @@ ] }, "locked": { - "lastModified": 1674267882, - "narHash": "sha256-53sIczqxA5BbrhgO6l54DSisDqHvQ3UUwbSqBryA/k0=", + "lastModified": 1677896940, + "narHash": "sha256-F4YW6/+35dwctY4Ogb/vvMfvA6O0UwhDbXE7urDhk4A=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "1fd6d280c132f4facad8cd023543fb10121e6487", + "rev": "c25d3e1951863ac0061d47a3fabf9aa7c91db5e5", "type": "github" }, "original": { @@ -530,11 +530,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1673922364, - "narHash": "sha256-U0XIY/Y/x4fFtlCZKMtWlqOYUnLiXj4F42GQHxWuPow=", + "lastModified": 1678588194, + "narHash": "sha256-IYEfP8On6ZFV69mXg2LOYFp8xleyZVJHolunVq+HEbI=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "4e0f9b8a5102387f8d19901bced16a256a6ccdc7", + "rev": "2ffce3e9c3da6c756a7862c7de2f6f9813c02aba", "type": "github" }, "original": { @@ -545,11 +545,11 @@ }, "utils": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { From dce680f2a84752a4b70daeea9902753e89c7e2c5 Mon Sep 17 00:00:00 2001 From: Pegasust Date: Sun, 19 Mar 2023 21:25:41 -0700 Subject: [PATCH 26/64] yamlls: remove keyOrdering enforcement --- native_configs/neovim/init.lua | 144 +++++++++++++++----------------- nix-conf/home-manager/flake.nix | 13 ++- 2 files changed, 78 insertions(+), 79 deletions(-) diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 35e7644..abfecdf 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -28,9 +28,9 @@ vim.call('plug#begin') Plug('nvim-lua/plenary.nvim') -- The base of all plugins -- plugins -Plug('tjdevries/nlua.nvim') -- adds symbols of vim stuffs in init.lua -Plug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting -Plug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects +Plug('tjdevries/nlua.nvim') -- adds symbols of vim stuffs in init.lua +Plug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting +Plug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects Plug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser -- TODO: this might need to be taken extra care in our Nix config -- What this Plug declaration means is this repo needs to be built on our running environment @@ -58,41 +58,41 @@ Plug('nathanalderson/yang.vim') -- Plug('tzachar/cmp-tabnine', { ['do'] = './install.sh' }) -- DevExp -Plug('windwp/nvim-autopairs') -- matches pairs like [] (),... -Plug('windwp/nvim-ts-autotag') -- matches tags hello -Plug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer -Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines -Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns -Plug('tpope/vim-fugitive') -- git commands in nvim -Plug('williamboman/mason.nvim') -- LSP, debuggers,... package manager +Plug('windwp/nvim-autopairs') -- matches pairs like [] (),... +Plug('windwp/nvim-ts-autotag') -- matches tags hello +Plug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer +Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines +Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns +Plug('tpope/vim-fugitive') -- git commands in nvim +Plug('williamboman/mason.nvim') -- LSP, debuggers,... package manager Plug('williamboman/mason-lspconfig.nvim') -- lsp config for mason -Plug('ThePrimeagen/harpoon') -- 1-click through marked files per project -Plug('TimUntersberger/neogit') -- Easy-to-see git status -Plug('folke/trouble.nvim') -- File-grouped workspace diagnostics -Plug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands -Plug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein" -Plug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator -Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs) -Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*) -Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis -Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration +Plug('ThePrimeagen/harpoon') -- 1-click through marked files per project +Plug('TimUntersberger/neogit') -- Easy-to-see git status +Plug('folke/trouble.nvim') -- File-grouped workspace diagnostics +Plug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands +Plug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein" +Plug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator +Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs) +Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*) +Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis +Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration -- UI & colorscheme -Plug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts -Plug('gruvbox-community/gruvbox') -- theme provider -Plug('nvim-lualine/lualine.nvim') -- fancy status line +Plug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts +Plug('gruvbox-community/gruvbox') -- theme provider +Plug('nvim-lualine/lualine.nvim') -- fancy status line Plug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines -Plug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes -Plug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog -Plug('folke/todo-comments.nvim') -- Highlights TODO +Plug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes +Plug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog +Plug('folke/todo-comments.nvim') -- Highlights TODO -- other utilities Plug('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' }) Plug('nvim-treesitter/nvim-treesitter-context') -- Top one-liner context of func/class scope -Plug('nvim-treesitter/playground') -- Sees Treesitter AST - less hair pulling, more PRs -Plug('saadparwaiz1/cmp_luasnip') -- snippet engine -Plug('L3MON4D3/LuaSnip') -- snippet engine -Plug('mickael-menu/zk-nvim') -- Zettelkasten +Plug('nvim-treesitter/playground') -- Sees Treesitter AST - less hair pulling, more PRs +Plug('saadparwaiz1/cmp_luasnip') -- snippet engine +Plug('L3MON4D3/LuaSnip') -- snippet engine +Plug('mickael-menu/zk-nvim') -- Zettelkasten -- Switch cases: -- `gsp` -> PascalCase (classes), `gsc` -> camelCase (Java), `gs_` -> snake_case (C/C++/Rust) -- `gsu` -> UPPER_CASE (CONSTs), `gsk` -> kebab-case (Clojure), `gsK` -> Title-Kebab-Case @@ -128,8 +128,8 @@ vim.api.nvim_create_autocmd({ "VimEnter" }, { }) -vim.g.gruvbox_contrast_dark="soft"; -vim.g.gruvbox_contrast_light="soft"; +vim.g.gruvbox_contrast_dark = "soft"; +vim.g.gruvbox_contrast_light = "soft"; vim.opt.ignorecase = true; vim.opt.smartcase = true; vim.opt.incsearch = true; @@ -150,22 +150,22 @@ vim.opt.colorcolumn = "80"; vim.opt.background = "light"; vim.api.nvim_create_user_command('Dark', function(opts) - -- opts: {name, args: str, fargs: Splited, range, ...} - ---@type string - local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark; - vim.g.gruvbox_contrast_dark = contrast; - vim.opt.background = "dark"; -end, - {nargs = "?";}) + -- opts: {name, args: str, fargs: Splited, range, ...} + ---@type string + local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark; + vim.g.gruvbox_contrast_dark = contrast; + vim.opt.background = "dark"; + end, + { nargs = "?", }) vim.api.nvim_create_user_command('Light', function(opts) - -- opts: {name, args: str, fargs: Splited, range, ...} - ---@type string - local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark; - vim.g.gruvbox_contrast_light = contrast; - vim.opt.background = "light"; -end, - {nargs = "?";}) + -- opts: {name, args: str, fargs: Splited, range, ...} + ---@type string + local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark; + vim.g.gruvbox_contrast_light = contrast; + vim.opt.background = "light"; + end, + { nargs = "?", }) vim.opt.lazyredraw = true vim.opt.termguicolors = true @@ -173,7 +173,7 @@ vim.opt.cursorline = true -- some plugins misbehave when we do swap files vim.opt.swapfile = false vim.opt.backup = false -vim.opt.undodir = vim.fn.stdpath('state')..'/.vim/undodir' +vim.opt.undodir = vim.fn.stdpath('state') .. '/.vim/undodir' vim.opt.undofile = true vim.opt.completeopt = 'menuone,noselect' -- vim.opt.clipboard = "unnamedplus" @@ -203,7 +203,7 @@ vim.keymap.set('n', 'q', 'TroubleToggle loclist') vim.keymap.set('n', 'wq', 'TroubleToggle workspace_diagnostics') -- color, highlighting, UI stuffs -vim.cmd([[ +vim.cmd([[ colorscheme gruvbox ]]) require('hlargs').setup() @@ -279,7 +279,7 @@ require('telescope').setup { theme = require('telescope.themes').get_ivy().theme, hiject_netrw = true, -- disables netrw and use file-browser instead mappings = { - ["i"] = {}, -- disable any shortcut in insert mode for now + ["i"] = {}, -- disable any shortcut in insert mode for now ["n"] = { ["c"] = fb_actions.create, ["r"] = fb_actions.rename, @@ -355,7 +355,9 @@ end, { desc = '[Z]ettelkasten [G]rep' }) require 'treesitter-context' require('nvim-treesitter.configs').setup { yati = { - enable = true, default_lazy = true, default_fallback = "auto", + enable = true, + default_lazy = true, + default_fallback = "auto", disable = { "nix" } }, indent = { enable = false }, @@ -410,7 +412,7 @@ parser_config.astro.filetype_to_parsername = { "javascript", "typescript.tsx", " require('guess-indent').setup { - auto_cmd = true, -- Set to false to disable automatic execution + auto_cmd = true, -- Set to false to disable automatic execution filetype_exclude = { -- A list of filetypes for which the auto command gets disabled "netrw", "tutor", @@ -502,12 +504,10 @@ local on_attach = function(client, bufnr) nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') nmap('wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, '[W]orkspace [L]ist Folders') -- enable inlay hints if available require('inlay-hints').on_attach(client, bufnr) - end -- nvim-cmp local cmp = require 'cmp' @@ -620,7 +620,7 @@ require("mason").setup({ -- Which means Mason's installed path is prioritized against our local install -- see: https://git.pegasust.com/pegasust/aoc/commit/b45dc32c74d84c9f787ebce7a174c9aa1d411fc2 -- This introduces some pitfalls, so we'll take the approach of trusting user's local installation - PATH = "append"; + PATH = "append", }) require('mason-lspconfig').setup({ ensure_installed = servers, @@ -697,6 +697,17 @@ require('mason-lspconfig').setup_handlers({ root_dir = require('lspconfig.util').root_pattern("deno.json", "deno.jsonc"), } end, + ["yamlls"] = function() + require('lspconfig').yamlls.setup { + on_attach = on_attach, + capabilities = capabilities, + settings = { + yaml = { + keyOrdering = false, + } + }, + } + end, -- ["rust_analyzer"] = function() -- require('lspconfig').rust_analyzer.setup { -- on_attach = on_attach, @@ -723,61 +734,48 @@ require('mason-lspconfig').setup_handlers({ -- end }) require("rust-tools").setup { - tools = { -- rust-tools options + tools = { + -- rust-tools options -- how to execute terminal commands -- options right now: termopen / quickfix executor = require("rust-tools/executors").termopen, - -- callback to execute once rust-analyzer is done initializing the workspace -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" on_initialized = function() require('inlay-hints').set_all() end, - -- automatically call RustReloadWorkspace when writing to a Cargo.toml file. reload_workspace_from_cargo_toml = true, - -- These apply to the default RustSetInlayHints command inlay_hints = { -- automatically set inlay hints (type hints) -- default: true auto = false, - -- Only show inlay hints for the current line only_current_line = false, - -- whether to show parameter hints with the inlay hints or not -- default: true show_parameter_hints = true, - -- prefix for parameter hints -- default: "<-" parameter_hints_prefix = "<- ", - -- prefix for all the other hints (type, chaining) -- default: "=>" other_hints_prefix = "=> ", - -- whether to align to the length of the longest line in the file max_len_align = false, - -- padding from the left if max_len_align is true max_len_align_padding = 1, - -- whether to align to the extreme right or not right_align = false, - -- padding from the right if right_align is true right_align_padding = 7, - -- The color of the hints highlight = "Comment", }, - -- options same as lsp hover / vim.lsp.util.open_floating_preview() hover_actions = { - -- the border that is used for the hover window -- see vim.api.nvim_open_win() border = { @@ -790,12 +788,10 @@ require("rust-tools").setup { { "╰", "FloatBorder" }, { "│", "FloatBorder" }, }, - -- whether the hover action window gets automatically focused -- default: false auto_focus = false, }, - -- settings for showing the crate graph based on graphviz and the dot -- command crate_graph = { @@ -811,7 +807,6 @@ require("rust-tools").setup { -- crates -- default: true full = true, - -- List of backends found on: https://graphviz.org/docs/outputs/ -- Is used for input validation and autocompletion -- Last updated: 2021-08-26 @@ -892,7 +887,6 @@ require("rust-tools").setup { on_attach(client, bufnr) require('inlay-hints').on_attach(client, bufnr) nmap('K', require 'rust-tools'.hover_actions.hover_actions, 'Hover Documentation') - end, capabilities = capabilities, settings = { @@ -900,7 +894,6 @@ require("rust-tools").setup { command = "clippy", } } - }, -- rust-analyzer options -- debugging stuff @@ -975,7 +968,8 @@ require('lualine').setup { lualine_a = { 'mode' }, lualine_b = { 'branch', 'diff', 'diagnostics' }, lualine_c = { - { 'filename', + { + 'filename', file_status = true, newfile_status = false, path = 1, diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 9ae4930..4f922b5 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -66,7 +66,7 @@ in cross_platform (system: let - overlays = import ./../../overlays.nix (flake_inputs // {inherit system;}); + overlays = import ./../../overlays.nix (flake_inputs // { inherit system; }); # pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays; pkgs = import nixpkgs { inherit system overlays; @@ -142,7 +142,7 @@ }; }; # Personal darwin, effectively serves as the Darwin edge channel - "hungtran" = home-manager.lib.homeManagerConfiguration { + "hungtran" = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = base.modules ++ [ ./home.nix @@ -159,6 +159,11 @@ { base.private_chromium.enable = false; } + { + home.packages = [ + pkgs.postman + ]; + } ]; extraSpecialArgs = mkModuleArgs { inherit pkgs; @@ -169,7 +174,7 @@ }; }; # Work darwin - "htran" = home-manager.lib.homeManagerConfiguration { + "htran" = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = base.modules ++ [ ./home.nix @@ -181,7 +186,7 @@ base.graphics.enable = false; # don't want to deal with GL stuffs on mac yet :/ base.graphics.useNixGL.defaultPackage = null; - # NOTE: this actually does not exist + # FIXME: this actually does not exist base.keepass.path = "/Users/htran/keepass.kdbx"; base.alacritty.font.size = 11.0; base.git.name = "Hung"; From dcc35d45a15cecd17c2f2744152860bc2644a9ae Mon Sep 17 00:00:00 2001 From: Pegasust Date: Wed, 22 Mar 2023 16:35:03 -0700 Subject: [PATCH 27/64] wip: tmux --- native_configs/neovim/init.lua | 33 ++++++++++++++++++++++++++- native_configs/tmux/tmux.conf | 10 +++++++- nix-conf/home-manager/base/shells.nix | 7 ++++-- scripts/hm-switch.sh | 3 +++ 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index abfecdf..8714e02 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -674,6 +674,37 @@ require('mason-lspconfig').setup_handlers({ } } end, + ["pyright"] = function() + require('lspconfig').pyright.setup { + on_attach = on_attach, + capabilities = capabilities, + settings = { + pyright = { + disableLanguageServices = false, + disableOrganizeImports = false, + }, + python = { + analysis = { + autoImportCompletions = true, + autoSearchPaths = true, + diagnosticMode = "openFilesOnly", + -- diagnosticSeverityOverrides = + extraPaths = {}, + logLevel = "Information", + stubPath = "typings", + typeCheckingMode = "basic", + typeshedPaths = {}, + useLibraryCodeForTypes = false, + pythonPath = "python", + venvPath = "", + }, + linting = { + mypyEnabled = true, + } + }, + }, + } + end, ["tsserver"] = function() require('lspconfig').tsserver.setup { on_attach = on_attach, @@ -735,7 +766,7 @@ require('mason-lspconfig').setup_handlers({ }) require("rust-tools").setup { tools = { - -- rust-tools options + -- rust-tools options -- how to execute terminal commands -- options right now: termopen / quickfix diff --git a/native_configs/tmux/tmux.conf b/native_configs/tmux/tmux.conf index f5e7187..54de12d 100644 --- a/native_configs/tmux/tmux.conf +++ b/native_configs/tmux/tmux.conf @@ -14,7 +14,15 @@ setw -g pane-base-index 1 set-option -g renumber-windows on # status bar -set -g status-style 'bg=#333333 fg=#5eacd3' +# set -g status-style 'bg=#333333 fg=#5eacd3' +# set -g status-interval 60 +# set -g status-right-style 'bg=#333333 fg=#5eacd3' +# set -g status-right-length 50 +set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M ' +# set -g status-left " " # Keybinds set-window-option -g mode-keys vi + +# # Log +# set-option -g history-file /tmp/.tmux.log diff --git a/nix-conf/home-manager/base/shells.nix b/nix-conf/home-manager/base/shells.nix index e8d4db5..08e24c9 100644 --- a/nix-conf/home-manager/base/shells.nix +++ b/nix-conf/home-manager/base/shells.nix @@ -53,6 +53,9 @@ in programs.tmux = { enable = true; extraConfig = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"; + plugins = + let inherit (pkgs.tmuxPlugins) cpu net-speed; + in [ cpu net-speed ]; }; programs.exa = { enable = true; @@ -88,8 +91,8 @@ in "command-not-found" # suggests which package to install; does not support nixos (we have solution already) "gitignore" # `gi list` -> `gi java >>.gitignore` "ripgrep" # adds completion for `rg` - "rust" # compe for rustc/cargo - "poetry" # compe for poetry - Python's cargo + "rust" # compe for rustc/cargo + "poetry" # compe for poetry - Python's cargo # "vi-mode" # edit promps with vi motions :) ]; }; diff --git a/scripts/hm-switch.sh b/scripts/hm-switch.sh index b99a7ac..6f499f2 100755 --- a/scripts/hm-switch.sh +++ b/scripts/hm-switch.sh @@ -31,3 +31,6 @@ else fi +# Attempt to reload running instances +tmux source-file ~/.config/tmux/tmux.conf + From 29d6a06346d51ed01375ba2d769ade0abe85cc12 Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 22 Mar 2023 17:08:04 -0700 Subject: [PATCH 28/64] nix flake update for first-timers --- flake.lock | 120 +++++++++++++++++++++---------------------- flake.nix | 1 + scripts/hm-switch.sh | 3 ++ 3 files changed, 64 insertions(+), 60 deletions(-) diff --git a/flake.lock b/flake.lock index dc4e296..34c2d57 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ ] }, "locked": { - "lastModified": 1676153903, - "narHash": "sha256-uetRyjgMiZCs6srmZ10M764Vn7F53M9mVuqnzHmyBqU=", + "lastModified": 1677969766, + "narHash": "sha256-AIp/ZYZMNLDZR/H7iiAlaGpu4lcXsVt9JQpBlf43HRY=", "owner": "ryantm", "repo": "agenix", - "rev": "ea17cc71b4e1bc5b2601f210a1c85db9453ad723", + "rev": "03b51fe8e459a946c4b88dcfb6446e45efb2c24e", "type": "github" }, "original": { @@ -32,11 +32,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1673405853, - "narHash": "sha256-6Nq9DuOo+gE2I8z5UZaKuumykz2xxZ9JGYmUthOuwSA=", + "lastModified": 1678152261, + "narHash": "sha256-cPRDxwygVMleiSEGELrvAiq9vYAN4c3KK/K4UEO13vU=", "owner": "ipetkov", "repo": "crane", - "rev": "b13963c8c18026aa694acd98d14f66d24666f70b", + "rev": "5291dd0aa7a52d607fc952763ef60714e4c881d4", "type": "github" }, "original": { @@ -99,11 +99,11 @@ "flake-compat_3": { "flake": false, "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type": "github" }, "original": { @@ -130,11 +130,11 @@ }, "flake-utils": { "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", "owner": "numtide", "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", "type": "github" }, "original": { @@ -160,11 +160,11 @@ }, "flake-utils_3": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -175,11 +175,11 @@ }, "flake-utils_4": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -248,11 +248,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1675935446, - "narHash": "sha256-WajulTn7QdwC7QuXRBavrANuIXE5z+08EdxdRw1qsNs=", + "lastModified": 1679480702, + "narHash": "sha256-npuRD61YmxUPitI1TqKwlxLrU6iGl5E+BPT196LgUDo=", "owner": "nix-community", "repo": "home-manager", - "rev": "2dce7f1a55e785a22d61668516df62899278c9e4", + "rev": "363c46b2480f1b73ec37cf68caac61f5daa82a2e", "type": "github" }, "original": { @@ -264,11 +264,11 @@ "kpcli-py": { "flake": false, "locked": { - "lastModified": 1619087457, - "narHash": "sha256-iRNLq5s2WJJHwB4beP5xQDKrBPWS/42s/ozLoSa5gAE=", + "lastModified": 1679142558, + "narHash": "sha256-l18PBzf/P7d3BPcFb5gSDX863MsC7S747qooyg0u2lA=", "owner": "rebkwok", "repo": "kpcli", - "rev": "e4d699e3b3d28887f74185f8fa69d0aade111d84", + "rev": "1c64e7274345d28ebc2607e22211a4ee9f6dbe7f", "type": "github" }, "original": { @@ -287,11 +287,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1676361142, - "narHash": "sha256-+nyWJcNRTOPCVqYC7tql7gLzPsNvZFa/wB20X9W9vTg=", + "lastModified": 1679453843, + "narHash": "sha256-A5K608V6vAgWyqf6Q4pUWXsDJZ8K+cxSvegbUcdmSbg=", "owner": "neovim", "repo": "neovim", - "rev": "53968082675cd3b8d1809e53a47c0311b7347ef9", + "rev": "a7b537c7a4e5b6114cd75df5178199f4449c6480", "type": "github" }, "original": { @@ -308,11 +308,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1676362549, - "narHash": "sha256-FZJb4ty3bdzfsd5dUaW3wR9FN2t1vNJ1IRJJhxErYYA=", + "lastModified": 1679472829, + "narHash": "sha256-hcSVMIpuFuAyFEs+7h2fKym0cDUivgdkjm0TjMgEvYo=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "447052579b7154c5cc61faf9ed6f3f484b9d053f", + "rev": "7a114101d1b72e734fbaba9e523026dd1598bc7e", "type": "github" }, "original": { @@ -330,11 +330,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1676039663, - "narHash": "sha256-fkIg8rJcnvT0kEdd4lqwp90rAe5RsxSOrWsmlXzD3Uo=", + "lastModified": 1679477897, + "narHash": "sha256-QI0YuJskVtEhV+7E7GAi04SYbU7KOQ7PEHLxuam7B40=", "owner": "tweag", "repo": "nickel", - "rev": "38ca87438918b84ebe7287a040729e4afd8c75b1", + "rev": "0c9fa8a960ca84bd5fa21a61f52834362a04ad4d", "type": "github" }, "original": { @@ -350,11 +350,11 @@ ] }, "locked": { - "lastModified": 1676172252, - "narHash": "sha256-Q5yJPpgbvOTgB0NQTJmlx3di1Sj5QQhSrjv38u6MzsQ=", + "lastModified": 1679224439, + "narHash": "sha256-QkvcuC4b67FUkkxlMsLTMPbwoD7yZr0UvJpu6jkFuLo=", "owner": "mic92", "repo": "nix-index-database", - "rev": "89e3b689e0ae9bac4c6cdc24d1085d81baeebde4", + "rev": "2f5e6e915d70c04d673a8930f94591595c73eb84", "type": "github" }, "original": { @@ -381,11 +381,11 @@ }, "nixlib": { "locked": { - "lastModified": 1676163193, - "narHash": "sha256-6cTwPLtRHsRrIlKnEg3gQ9L+MYdx87eHdRqlTUi4H8Y=", + "lastModified": 1679187309, + "narHash": "sha256-H8udmkg5wppL11d/05MMzOMryiYvc403axjDNZy1/TQ=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "d3e61f845dbbb77f10900603993c6f00bdfa9fd4", + "rev": "44214417fe4595438b31bdb9469be92536a61455", "type": "github" }, "original": { @@ -428,11 +428,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1674211260, - "narHash": "sha256-xU6Rv9sgnwaWK7tgCPadV6HhI2Y/fl4lKxJoG2+m9qs=", + "lastModified": 1678470307, + "narHash": "sha256-OEeMUr3ueLIXyW/OaFUX5jUdimyQwMg/7e+/Q0gC/QE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5ed481943351e9fd354aeb557679624224de38d5", + "rev": "0c4800d579af4ed98ecc47d464a5e7b0870c4b1f", "type": "github" }, "original": { @@ -458,11 +458,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1676300157, - "narHash": "sha256-1HjRzfp6LOLfcj/HJHdVKWAkX9QRAouoh6AjzJiIerU=", + "lastModified": 1679262748, + "narHash": "sha256-DQCrrAFrkxijC6haUzOC5ZoFqpcv/tg2WxnyW3np1Cc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "545c7a31e5dedea4a6d372712a18e00ce097d462", + "rev": "60c1d71f2ba4c80178ec84523c2ca0801522e0a6", "type": "github" }, "original": { @@ -502,11 +502,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1674122161, - "narHash": "sha256-9QM4rvgUSEwO8DWtJN9sR/afEqrH1s3b6ACsZT5wiAM=", + "lastModified": 1678376203, + "narHash": "sha256-3tyYGyC8h7fBwncLZy5nCUjTJPrHbmNwp47LlNLOHSM=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "53e766957b73298fa68b47478c48cbcc005cc18a", + "rev": "1a20b9708962096ec2481eeb2ddca29ed747770a", "type": "github" }, "original": { @@ -545,11 +545,11 @@ ] }, "locked": { - "lastModified": 1672712534, - "narHash": "sha256-8S0DdMPcbITnlOu0uA81mTo3hgX84wK8S9wS34HEFY4=", + "lastModified": 1677812689, + "narHash": "sha256-EakqhgRnjVeYJv5+BJx/NZ7/eFTMBxc4AhICUNquhUg=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "69fb7bf0a8c40e6c4c197fa1816773774c8ac59f", + "rev": "e53e8853aa7b0688bc270e9e6a681d22e01cf299", "type": "github" }, "original": { @@ -570,11 +570,11 @@ ] }, "locked": { - "lastModified": 1674267882, - "narHash": "sha256-53sIczqxA5BbrhgO6l54DSisDqHvQ3UUwbSqBryA/k0=", + "lastModified": 1678501303, + "narHash": "sha256-92s2NOlcvydz0Cxi1OOq/bs7SQc38TaqzuzdHsRANhA=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "1fd6d280c132f4facad8cd023543fb10121e6487", + "rev": "1c8200cdc4c830d937fbf8b19e1f3e83daf3370a", "type": "github" }, "original": { @@ -589,11 +589,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1676341851, - "narHash": "sha256-T8cmSiriXdpZfqlserNyJ1solTCR0DbD8A75epSDOVY=", + "lastModified": 1679451618, + "narHash": "sha256-gWFYRgmeT+8xDYHK4HSuCY9Pi7mSxC+2illHrmDkG7A=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "956ddb5047f98ea08b792b22004b94a9971932c4", + "rev": "a89d328ca7d106c3fdbbd072b6c7088ab5b798a3", "type": "github" }, "original": { @@ -604,11 +604,11 @@ }, "utils": { "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 6d6e1a9..67aa746 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,7 @@ experimental-features = "nix-command flakes"; # for darwin's browser allowUnsupportedSystem = true; + max-jobs = 4; }; description = "My personal configuration in Nix (and some native configurations)"; inputs = { diff --git a/scripts/hm-switch.sh b/scripts/hm-switch.sh index 6f499f2..4ee08c7 100755 --- a/scripts/hm-switch.sh +++ b/scripts/hm-switch.sh @@ -22,6 +22,9 @@ fi # that injects binary for Mason to use. rm -rf ~/.local/share/nvim/mason +# NOTE: https://discourse.nixos.org/t/relative-path-support-for-nix-flakes/18795 +# nix flake update is required for relative paths to work +nix flake update # test if we have home-manager, if not, attempt to use nix to put home-manager to # our environment if ! command -v home-manager ; then From 516612c36ea5d3b959e31f855373dd8e77b37171 Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 22 Mar 2023 18:04:29 -0700 Subject: [PATCH 29/64] darwin apps should be put to spotlights --- flake.lock | 6 ++-- .../home-manager/base/darwin-spotlight.nix | 28 +++++++++++++++++++ nix-conf/home-manager/flake.nix | 1 + 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 nix-conf/home-manager/base/darwin-spotlight.nix diff --git a/flake.lock b/flake.lock index 34c2d57..885c6b0 100644 --- a/flake.lock +++ b/flake.lock @@ -458,11 +458,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1679262748, - "narHash": "sha256-DQCrrAFrkxijC6haUzOC5ZoFqpcv/tg2WxnyW3np1Cc=", + "lastModified": 1679437018, + "narHash": "sha256-vOuiDPLHSEo/7NkiWtxpHpHgoXoNmrm+wkXZ6a072Fc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "60c1d71f2ba4c80178ec84523c2ca0801522e0a6", + "rev": "19cf008bb18e47b6e3b4e16e32a9a4bdd4b45f7e", "type": "github" }, "original": { diff --git a/nix-conf/home-manager/base/darwin-spotlight.nix b/nix-conf/home-manager/base/darwin-spotlight.nix new file mode 100644 index 0000000..4101528 --- /dev/null +++ b/nix-conf/home-manager/base/darwin-spotlight.nix @@ -0,0 +1,28 @@ +{ lib, pkgs, config, ... }: +{ + # Copy GUI apps to "~/Applications/Home Manager Apps" + # Based on this comment: https://github.com/nix-community/home-manager/issues/1341#issuecomment-778820334 + home.activation.darwinApps = + if pkgs.stdenv.isDarwin then + let + apps = pkgs.buildEnv { + name = "home-manager-applications"; + paths = config.home.packages; + pathsToLink = "/Applications"; + }; + in + lib.hm.dag.entryAfter [ "writeBoundary" ] '' + # Install MacOS applications to the user environment. + HM_APPS="$HOME/Applications/Home Manager Apps" + # Reset current state + [ -e "$HM_APPS" ] && $DRY_RUN_CMD rm -r "$HM_APPS" + $DRY_RUN_CMD mkdir -p "$HM_APPS" + # .app dirs need to be actual directories for Finder to detect them as Apps. + # In the env of Apps we build, the .apps are symlinks. We pass all of them as + # arguments to cp and make it dereference those using -H + $DRY_RUN_CMD cp --archive -H --dereference ${apps}/Applications/* "$HM_APPS" + $DRY_RUN_CMD chmod +w -R "$HM_APPS" + '' + else + ""; +} diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 4f922b5..c2f4a73 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -179,6 +179,7 @@ modules = base.modules ++ [ ./home.nix ./base/productive_desktop.nix + ./base/darwin-spotlight.nix { base.private_chromium.enable = false; } From 4de2b92b25f8f805292684157a4f3a45c4537466 Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 22 Mar 2023 18:11:00 -0700 Subject: [PATCH 30/64] more parallelism --- nix-conf/home-manager/flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index c2f4a73..9f6d73b 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -10,6 +10,7 @@ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ]; + max-jobs = 4; }; description = "simple home-manager config"; inputs = { From 56babf76005baff7c14c5549a7801dac1e59fe12 Mon Sep 17 00:00:00 2001 From: Hung Date: Thu, 23 Mar 2023 00:41:44 -0700 Subject: [PATCH 31/64] add sops --- .sops.yaml | 2 ++ dev-shell.nix | 1 + 2 files changed, 3 insertions(+) diff --git a/.sops.yaml b/.sops.yaml index 772392f..8d30b9a 100644 --- a/.sops.yaml +++ b/.sops.yaml @@ -3,6 +3,7 @@ keys: - &htran age1jw958shpwu7st8sc4z0fufuswmfpxfc9wl3df9g3f3y57m45j92syr0mng - &bao age1umzkd4k0xt6uv5de85fpc4uztrph86nsd79h5f8cpuvtpy8n6adss7q2fv - &root_bao age1vx7e6vz9zptwqd0cakjj8erqv58cstddama8zcrppc36rqqmlvjs53x9u0 + - &htran1 age1vkd39dmrft3uk5wnfqppharn38dhrh78ev6pl85u005jhcge5e9qz4lt79 creation_rules: - path_regex: .* key_groups: @@ -11,4 +12,5 @@ creation_rules: - *htran-mbp - *bao - *root_bao + - *htran1 diff --git a/dev-shell.nix b/dev-shell.nix index a28a0e2..a2631fe 100644 --- a/dev-shell.nix +++ b/dev-shell.nix @@ -14,6 +14,7 @@ # shell scripts pkgs.rust4cargo pkgs.sops + pkgs.ssh-to-age ]; shellHook = '' From 0e91219d9a4ac3f11ec23138d3a5ab89a5c6cec7 Mon Sep 17 00:00:00 2001 From: Hung Date: Thu, 23 Mar 2023 00:56:15 -0700 Subject: [PATCH 32/64] add some troubleshooting info --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 8b8dc70..bdce58f 100644 --- a/README.md +++ b/README.md @@ -57,4 +57,19 @@ text-editor agnostically. - Templates: `zk/templates/` - Command: `ln -s $PWD/zk/templates ~/.config/zk/templates` +## Troubleshoots + +### My MacOS just updated, `nix` is no-longer here + +- An easy fix is to add the following to the **bottom** of `/etc/zshrc` + +```sh +# Nix +if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then + . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' +fi +# End Nix +``` + +- Otherwise, consult [`gh-gist:meeech/a_help-osx-borked-my-nix.md`](https://gist.github.com/meeech/0b97a86f235d10bc4e2a1116eec38e7e) From fa4f6748533a229216f9239ab4bc17500c2dfaf1 Mon Sep 17 00:00:00 2001 From: Hung Date: Thu, 23 Mar 2023 13:49:13 -0700 Subject: [PATCH 33/64] add upload to cache --- flake.lock | 24 ++++++++++++------------ flake.nix | 2 -- nix-conf/home-manager/hwtr/nix.conf | 1 + scripts/hm-switch.sh | 5 +++-- scripts/upload-to-cache.sh | 11 +++++++++++ 5 files changed, 27 insertions(+), 16 deletions(-) create mode 100644 scripts/upload-to-cache.sh diff --git a/flake.lock b/flake.lock index 885c6b0..ade82ac 100644 --- a/flake.lock +++ b/flake.lock @@ -287,11 +287,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1679453843, - "narHash": "sha256-A5K608V6vAgWyqf6Q4pUWXsDJZ8K+cxSvegbUcdmSbg=", + "lastModified": 1679556473, + "narHash": "sha256-1kABkonN3VFGTUqb5vKCd5vrU182FGKww67KdnZ6QdQ=", "owner": "neovim", "repo": "neovim", - "rev": "a7b537c7a4e5b6114cd75df5178199f4449c6480", + "rev": "ea0b66d208dbcd5d5c0a17810596d769c7a0b6dd", "type": "github" }, "original": { @@ -308,11 +308,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1679472829, - "narHash": "sha256-hcSVMIpuFuAyFEs+7h2fKym0cDUivgdkjm0TjMgEvYo=", + "lastModified": 1679559242, + "narHash": "sha256-2qQlbQPLRLmMgbFsY48qnMmgBlCsN9onqpZHx6DPXG0=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "7a114101d1b72e734fbaba9e523026dd1598bc7e", + "rev": "583c7d315e87975b3a226cafd3ac099b8fdd0b6b", "type": "github" }, "original": { @@ -330,11 +330,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1679477897, - "narHash": "sha256-QI0YuJskVtEhV+7E7GAi04SYbU7KOQ7PEHLxuam7B40=", + "lastModified": 1679587834, + "narHash": "sha256-x55B7l1Sp/oMrPecwZFcDiqYh1uL+h19nkw274mgKys=", "owner": "tweag", "repo": "nickel", - "rev": "0c9fa8a960ca84bd5fa21a61f52834362a04ad4d", + "rev": "7284ce50a312c0a96b188e4c81e6e258b9521075", "type": "github" }, "original": { @@ -589,11 +589,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1679451618, - "narHash": "sha256-gWFYRgmeT+8xDYHK4HSuCY9Pi7mSxC+2illHrmDkG7A=", + "lastModified": 1679537973, + "narHash": "sha256-R6borgcKeyMIjjPeeYsfo+mT8UdS+OwwbhhStdCfEjg=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "a89d328ca7d106c3fdbbd072b6c7088ab5b798a3", + "rev": "fbc7ae3f14d32e78c0e8d7865f865cc28a46b232", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 67aa746..28f6851 100644 --- a/flake.nix +++ b/flake.nix @@ -2,8 +2,6 @@ nixConfig = { accept-flake-config = true; experimental-features = "nix-command flakes"; - # for darwin's browser - allowUnsupportedSystem = true; max-jobs = 4; }; description = "My personal configuration in Nix (and some native configurations)"; diff --git a/nix-conf/home-manager/hwtr/nix.conf b/nix-conf/home-manager/hwtr/nix.conf index 899ea7a..cd5ea59 100644 --- a/nix-conf/home-manager/hwtr/nix.conf +++ b/nix-conf/home-manager/hwtr/nix.conf @@ -1,3 +1,4 @@ accept-flake-config = true experimental-features = nix-command flakes +post-build-hook = /etc/nix/upload-to-cache.sh diff --git a/scripts/hm-switch.sh b/scripts/hm-switch.sh index 4ee08c7..afc4854 100755 --- a/scripts/hm-switch.sh +++ b/scripts/hm-switch.sh @@ -8,14 +8,15 @@ echo "SCRIPT_DIR: ${SCRIPT_DIR}" HOME_MANAGER_DIR="${SCRIPT_DIR}/../nix-conf/home-manager" # Manage nix.conf. Ideally, this should be done with snapshot-based version -# and with preview on-the-spot, with some timeout +# and with preview on-the-spot, with some timeout (like deploy-rs) if [ -f /etc/nix/nix.conf ]; then # managed nix.conf BACKUP_FILE="/etc/nix/nix.conf.backup" echo "overwriting /etc/nix/nix.conf. Please find latest backup in ${BACKUP_FILE}" sudo cp /etc/nix/nix.conf ${BACKUP_FILE} - sudo cp "${HOME_MANAGER_DIR}/hwtr/nix.conf" /etc/nix/ fi +sudo cp "${HOME_MANAGER_DIR}/hwtr/nix.conf" /etc/nix/ +sudo cp "${SCRIPT_DIR}/upload-to-cache.sh" /etc/nix/ # Mason is bad: it puts binaries onto xdg.data # let's make mason starts fresh, just in case we introduce RPATH hacks diff --git a/scripts/upload-to-cache.sh b/scripts/upload-to-cache.sh new file mode 100644 index 0000000..5c42b4f --- /dev/null +++ b/scripts/upload-to-cache.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -eu +set -f # disable globbing (/nix/store may contain glob chars) +export IFS=' ' + +# $OUT_PATHS when invoked by nix.settings.post-build-hook will be +# space-separated paths to /nix/store/ +echo "Uploading paths" $OUT_PATHS +exec nix copy --to "s3://example-nix-cache" $OUT_PATHS + From b0b8d2cc3afb070b0fc0c35ef277114cce1ff244 Mon Sep 17 00:00:00 2001 From: Hung Date: Thu, 23 Mar 2023 21:50:49 -0700 Subject: [PATCH 34/64] wip: copy to some remote cache --- .gitignore | 1 + flake.lock | 42 ++++++++++++++--------------- nix-conf/home-manager/hwtr/nix.conf | 1 + scripts/hm-switch.sh | 4 +++ scripts/upload-to-cache.sh | 8 +++--- 5 files changed, 31 insertions(+), 25 deletions(-) mode change 100644 => 100755 scripts/upload-to-cache.sh diff --git a/.gitignore b/.gitignore index e69de29..b2be92b 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/flake.lock b/flake.lock index ade82ac..8512316 100644 --- a/flake.lock +++ b/flake.lock @@ -175,11 +175,11 @@ }, "flake-utils_4": { "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", "owner": "numtide", "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", "type": "github" }, "original": { @@ -330,11 +330,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1679587834, - "narHash": "sha256-x55B7l1Sp/oMrPecwZFcDiqYh1uL+h19nkw274mgKys=", + "lastModified": 1679605987, + "narHash": "sha256-EWkCsAQiC7B3v9FqNmtxYARX3EDAA1hD8b+9s19cuCs=", "owner": "tweag", "repo": "nickel", - "rev": "7284ce50a312c0a96b188e4c81e6e258b9521075", + "rev": "985d19c12387f2175f902b449fc9503c4ee4d5be", "type": "github" }, "original": { @@ -412,11 +412,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1673800717, - "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", + "lastModified": 1678872516, + "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", + "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", "type": "github" }, "original": { @@ -428,11 +428,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1678470307, - "narHash": "sha256-OEeMUr3ueLIXyW/OaFUX5jUdimyQwMg/7e+/Q0gC/QE=", + "lastModified": 1678898370, + "narHash": "sha256-xTICr1j+uat5hk9FyuPOFGxpWHdJRibwZC+ATi0RbtE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0c4800d579af4ed98ecc47d464a5e7b0870c4b1f", + "rev": "ac718d02867a84b42522a0ece52d841188208f2c", "type": "github" }, "original": { @@ -502,11 +502,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1678376203, - "narHash": "sha256-3tyYGyC8h7fBwncLZy5nCUjTJPrHbmNwp47LlNLOHSM=", + "lastModified": 1678976941, + "narHash": "sha256-skNr08frCwN9NO+7I77MjOHHAw+L410/37JknNld+W4=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "1a20b9708962096ec2481eeb2ddca29ed747770a", + "rev": "32b1dbedfd77892a6e375737ef04d8efba634e9e", "type": "github" }, "original": { @@ -570,11 +570,11 @@ ] }, "locked": { - "lastModified": 1678501303, - "narHash": "sha256-92s2NOlcvydz0Cxi1OOq/bs7SQc38TaqzuzdHsRANhA=", + "lastModified": 1679106165, + "narHash": "sha256-03Opt2yu4E/AIFjvlgib0/nhMn6B4B/t/nvwS2bzOGw=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "1c8200cdc4c830d937fbf8b19e1f3e83daf3370a", + "rev": "7313c06ac334d6262ddfe30a38b3abc3da6bd565", "type": "github" }, "original": { @@ -589,11 +589,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1679537973, - "narHash": "sha256-R6borgcKeyMIjjPeeYsfo+mT8UdS+OwwbhhStdCfEjg=", + "lastModified": 1679624450, + "narHash": "sha256-wiDqUaklmc31E1+wz5sv52sMcWvZKsL1FBeGJCxz628=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "fbc7ae3f14d32e78c0e8d7865f865cc28a46b232", + "rev": "afbdcf305fd6f05f708fe76d52f24d37d066c251", "type": "github" }, "original": { diff --git a/nix-conf/home-manager/hwtr/nix.conf b/nix-conf/home-manager/hwtr/nix.conf index cd5ea59..65a4873 100644 --- a/nix-conf/home-manager/hwtr/nix.conf +++ b/nix-conf/home-manager/hwtr/nix.conf @@ -1,4 +1,5 @@ accept-flake-config = true experimental-features = nix-command flakes post-build-hook = /etc/nix/upload-to-cache.sh +trusted-users = root htran hungtran hwtr diff --git a/scripts/hm-switch.sh b/scripts/hm-switch.sh index afc4854..c2df20d 100755 --- a/scripts/hm-switch.sh +++ b/scripts/hm-switch.sh @@ -17,6 +17,10 @@ if [ -f /etc/nix/nix.conf ]; then fi sudo cp "${HOME_MANAGER_DIR}/hwtr/nix.conf" /etc/nix/ sudo cp "${SCRIPT_DIR}/upload-to-cache.sh" /etc/nix/ +sudo chmod +x /etc/nix/*.sh +# Reload nix daemon so that new changes are applied. +sudo launchctl stop org.nixos.nix-daemon +sudo launchctl start org.nixos.nix-daemon # Mason is bad: it puts binaries onto xdg.data # let's make mason starts fresh, just in case we introduce RPATH hacks diff --git a/scripts/upload-to-cache.sh b/scripts/upload-to-cache.sh old mode 100644 new mode 100755 index 5c42b4f..58597f4 --- a/scripts/upload-to-cache.sh +++ b/scripts/upload-to-cache.sh @@ -1,11 +1,11 @@ -#!/bin/sh - -set -eu +#!/usr/bin/env sh +set -eux set -f # disable globbing (/nix/store may contain glob chars) export IFS=' ' +PATH=/nix/var/nix/profiles/default/bin:$PATH # $OUT_PATHS when invoked by nix.settings.post-build-hook will be # space-separated paths to /nix/store/ echo "Uploading paths" $OUT_PATHS -exec nix copy --to "s3://example-nix-cache" $OUT_PATHS +nix copy --to "ssh-ng://10.100.200.230" $OUT_PATHS From bbcc5a14b71c2bb0ad416ca0fd405f9bdb52bbb1 Mon Sep 17 00:00:00 2001 From: Hung Date: Fri, 24 Mar 2023 09:39:29 -0700 Subject: [PATCH 35/64] wip: error building kpcli-py :/ error: builder for '/nix/store/sacq2mx2i7f4230sy0j2m36av73xsjc7-python3.10-pip-23.0.1.drv' failed with exit code 1; last 10 log lines: > updateAutotoolsGnuConfigScriptsPhase > configuring > no configure script, doing nothing > building > Executing setuptoolsBuildPhase > Traceback (most recent call last): > File /private/tmp/nix-build-python3.10-pip-23.0.1.drv-0/pip-23.0.1-source/nix_run_setup, line 3, in > import setuptools > ModuleNotFoundError: No module named 'setuptools' > /nix/store/mymsi43djixs7aiqfb9gpms4jllszfrg-stdenv-darwin/setup: line 1601: pop_var_context: head of shell_variables not a function context For full logs, run 'nix log /nix/store/sacq2mx2i7f4230sy0j2m36av73xsjc7-python3.10-pip-23.0.1.drv'. --- flake.lock | 311 +++++++++++++++++++-- flake.nix | 3 +- nix-conf/home-manager/base/shells.nix | 2 +- nix-conf/home-manager/flake.lock | 385 ++++++++++++++++++++++---- nix-conf/home-manager/flake.nix | 6 +- overlays.nix | 24 +- scripts/hm-switch.sh | 5 +- scripts/upload-to-cache.sh | 18 +- 8 files changed, 665 insertions(+), 89 deletions(-) diff --git a/flake.lock b/flake.lock index 8512316..c2fcd8a 100644 --- a/flake.lock +++ b/flake.lock @@ -21,6 +21,22 @@ "type": "github" } }, + "cargo-leptos": { + "flake": false, + "locked": { + "lastModified": 1678270781, + "narHash": "sha256-gfGjghO3zZQ1tfXevlCjYkEo6c0kOtfL+0U1FKbrdwM=", + "owner": "leptos-rs", + "repo": "cargo-leptos", + "rev": "87ffe4ddab33a498b8b4e53846e6b090fd675628", + "type": "github" + }, + "original": { + "owner": "leptos-rs", + "repo": "cargo-leptos", + "type": "github" + } + }, "crane": { "inputs": { "flake-compat": "flake-compat_3", @@ -128,6 +144,22 @@ "type": "github" } }, + "flake-compat_5": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1678901627, @@ -189,6 +221,21 @@ } }, "flake-utils_5": { + "locked": { + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_6": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -203,7 +250,22 @@ "type": "github" } }, - "flake-utils_6": { + "flake-utils_7": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_8": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -240,6 +302,41 @@ "type": "github" } }, + "gnmic": { + "flake": false, + "locked": { + "lastModified": 1679510878, + "narHash": "sha256-Dz3LeQa5Hlf8zsGOoNViDnCv1eyMQvBKHkx6XvnabEQ=", + "owner": "openconfig", + "repo": "gnmic", + "rev": "112538558f9745b08e0ad3ccd9a5578191b95819", + "type": "github" + }, + "original": { + "owner": "openconfig", + "repo": "gnmic", + "type": "github" + } + }, + "gomod2nix": { + "inputs": { + "nixpkgs": "nixpkgs_3", + "utils": "utils_2" + }, + "locked": { + "lastModified": 1677459247, + "narHash": "sha256-JbakfAiPYmCCV224yAMq/XO0udN5coWv/oazblMKdoY=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "3cbf3a51fe32e2f57af4c52744e7228bab22983d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -277,6 +374,24 @@ "type": "github" } }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1679567394, + "narHash": "sha256-ZvLuzPeARDLiQUt6zSZFGOs+HZmE+3g4QURc8mkBsfM=", + "owner": "nix-community", + "repo": "naersk", + "rev": "88cd22380154a2c36799fe8098888f0f59861a15", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, "neovim-flake": { "inputs": { "flake-utils": "flake-utils_2", @@ -287,11 +402,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1679556473, - "narHash": "sha256-1kABkonN3VFGTUqb5vKCd5vrU182FGKww67KdnZ6QdQ=", + "lastModified": 1679632758, + "narHash": "sha256-h97hY2VrAXlSQZQRp6jR3YYXgwBD3ris/4iyt20/aAA=", "owner": "neovim", "repo": "neovim", - "rev": "ea0b66d208dbcd5d5c0a17810596d769c7a0b6dd", + "rev": "a478fd41753a5c094e6c329a3573cbfb32b1c6bf", "type": "github" }, "original": { @@ -308,11 +423,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1679559242, - "narHash": "sha256-2qQlbQPLRLmMgbFsY48qnMmgBlCsN9onqpZHx6DPXG0=", + "lastModified": 1679645578, + "narHash": "sha256-gN0mpWiZHhQlEA4/bfMQFuyNSebrm+WoOntDJtm3Npk=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "583c7d315e87975b3a226cafd3ac099b8fdd0b6b", + "rev": "5974031f4d4cd09ea98f3febce783ba2d32f9c65", "type": "github" }, "original": { @@ -330,11 +445,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1679605987, - "narHash": "sha256-EWkCsAQiC7B3v9FqNmtxYARX3EDAA1hD8b+9s19cuCs=", + "lastModified": 1679662069, + "narHash": "sha256-FpPx3B8vMeHB8iixbZUXq+6awFje8fUE8zyhDTgJ+AM=", "owner": "tweag", "repo": "nickel", - "rev": "985d19c12387f2175f902b449fc9503c4ee4d5be", + "rev": "e70f4ba786bad673081629dd2f2ecfb87d0b3267", "type": "github" }, "original": { @@ -343,6 +458,32 @@ "type": "github" } }, + "nix-boost": { + "inputs": { + "cargo-leptos": "cargo-leptos", + "flake-compat": "flake-compat_5", + "gnmic": "gnmic", + "gomod2nix": "gomod2nix", + "naersk": "naersk", + "nixlib": "nixlib", + "nixpkgs": "nixpkgs_5", + "poetry2nix": "poetry2nix", + "rust-overlay": "rust-overlay_3" + }, + "locked": { + "lastModified": 1679675754, + "narHash": "sha256-B/jA2C77hCtnBmMbYhel5Bbon4nj1wB1dMacCHm3Hak=", + "ref": "refs/heads/master", + "rev": "c9744d6afa55f9c8eddd7847d27a8bb4b702e2e2", + "revCount": 50, + "type": "git", + "url": "https://git.pegasust.com/pegasust/nix-boost.git" + }, + "original": { + "type": "git", + "url": "https://git.pegasust.com/pegasust/nix-boost.git" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -365,8 +506,8 @@ }, "nixgl": { "inputs": { - "flake-utils": "flake-utils_5", - "nixpkgs": "nixpkgs_3" + "flake-utils": "flake-utils_7", + "nixpkgs": "nixpkgs_7" }, "locked": { "lastModified": 1, @@ -394,6 +535,21 @@ "type": "github" } }, + "nixlib_2": { + "locked": { + "lastModified": 1679187309, + "narHash": "sha256-H8udmkg5wppL11d/05MMzOMryiYvc403axjDNZy1/TQ=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "44214417fe4595438b31bdb9469be92536a61455", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1671983799, @@ -442,6 +598,68 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1658285632, + "narHash": "sha256-zRS5S/hoeDGUbO+L95wXG9vJNwsSYcl93XiD0HQBXLk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5342fc6fb59d0595d26883c3cadff16ce58e44f3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1679553901, + "narHash": "sha256-OhmJc18XNIj0wVC4ZoPnCVoY3SGfcPxaeKJOz1WHo5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "09ad6a72359f6aff0f96ce8e4d1ec2d1271ad15d", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1679437018, + "narHash": "sha256-vOuiDPLHSEo/7NkiWtxpHpHgoXoNmrm+wkXZ6a072Fc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "19cf008bb18e47b6e3b4e16e32a9a4bdd4b45f7e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1665296151, + "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_7": { "locked": { "lastModified": 1660551188, "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", @@ -456,7 +674,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_8": { "locked": { "lastModified": 1679437018, "narHash": "sha256-vOuiDPLHSEo/7NkiWtxpHpHgoXoNmrm+wkXZ6a072Fc=", @@ -471,7 +689,7 @@ "type": "indirect" } }, - "nixpkgs_5": { + "nixpkgs_9": { "locked": { "lastModified": 1665296151, "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", @@ -487,6 +705,28 @@ "type": "github" } }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils_5", + "nixpkgs": [ + "nix-boost", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1679613134, + "narHash": "sha256-C74l+I97ossJGP8/VJYs/YqxIZ6XHqohuuTnjKTNp/8=", + "owner": "pegasust", + "repo": "poetry2nix", + "rev": "654b3a8ed543361d5bef4210a0bf467678304c0d", + "type": "github" + }, + "original": { + "owner": "pegasust", + "repo": "poetry2nix", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat_4", @@ -524,11 +764,12 @@ "kpcli-py": "kpcli-py", "neovim-nightly-overlay": "neovim-nightly-overlay", "nickel": "nickel", + "nix-boost": "nix-boost", "nix-index-database": "nix-index-database", "nixgl": "nixgl", - "nixlib": "nixlib", - "nixpkgs": "nixpkgs_4", - "rust-overlay": "rust-overlay_3" + "nixlib": "nixlib_2", + "nixpkgs": "nixpkgs_8", + "rust-overlay": "rust-overlay_4" } }, "rust-overlay": { @@ -586,7 +827,26 @@ "rust-overlay_3": { "inputs": { "flake-utils": "flake-utils_6", - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_6" + }, + "locked": { + "lastModified": 1679624450, + "narHash": "sha256-wiDqUaklmc31E1+wz5sv52sMcWvZKsL1FBeGJCxz628=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "afbdcf305fd6f05f708fe76d52f24d37d066c251", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_4": { + "inputs": { + "flake-utils": "flake-utils_8", + "nixpkgs": "nixpkgs_9" }, "locked": { "lastModified": 1679624450, @@ -616,6 +876,21 @@ "repo": "flake-utils", "type": "github" } + }, + "utils_2": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 28f6851..0cdf8e7 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ nixConfig = { accept-flake-config = true; experimental-features = "nix-command flakes"; - max-jobs = 4; + max-jobs = 12; }; description = "My personal configuration in Nix (and some native configurations)"; inputs = { @@ -38,6 +38,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; nickel.url = "github:tweag/nickel"; + nix-boost.url = "git+https://git.pegasust.com/pegasust/nix-boost.git"; }; outputs = diff --git a/nix-conf/home-manager/base/shells.nix b/nix-conf/home-manager/base/shells.nix index 08e24c9..2ebb41e 100644 --- a/nix-conf/home-manager/base/shells.nix +++ b/nix-conf/home-manager/base/shells.nix @@ -52,7 +52,7 @@ in }; programs.tmux = { enable = true; - extraConfig = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"; + configBeforePlugin = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"; plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [ cpu net-speed ]; diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index 949c824..c257a32 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "cargo-leptos": { + "flake": false, + "locked": { + "lastModified": 1678270781, + "narHash": "sha256-gfGjghO3zZQ1tfXevlCjYkEo6c0kOtfL+0U1FKbrdwM=", + "owner": "leptos-rs", + "repo": "cargo-leptos", + "rev": "87ffe4ddab33a498b8b4e53846e6b090fd675628", + "type": "github" + }, + "original": { + "owner": "leptos-rs", + "repo": "cargo-leptos", + "type": "github" + } + }, "crane": { "inputs": { "flake-compat": "flake-compat_3", @@ -11,11 +27,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1677892403, - "narHash": "sha256-/Wi0L1spSWLFj+UQxN3j0mPYMoc7ZoAujpUF/juFVII=", + "lastModified": 1678152261, + "narHash": "sha256-cPRDxwygVMleiSEGELrvAiq9vYAN4c3KK/K4UEO13vU=", "owner": "ipetkov", "repo": "crane", - "rev": "105e27adb70a9890986b6d543a67761cbc1964a2", + "rev": "5291dd0aa7a52d607fc952763ef60714e4c881d4", "type": "github" }, "original": { @@ -85,13 +101,29 @@ "type": "github" } }, + "flake-compat_5": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", "owner": "numtide", "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", "type": "github" }, "original": { @@ -132,11 +164,11 @@ }, "flake-utils_4": { "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", "owner": "numtide", "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", "type": "github" }, "original": { @@ -146,6 +178,21 @@ } }, "flake-utils_5": { + "locked": { + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_6": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -160,7 +207,22 @@ "type": "github" } }, - "flake-utils_6": { + "flake-utils_7": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_8": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -197,6 +259,41 @@ "type": "github" } }, + "gnmic": { + "flake": false, + "locked": { + "lastModified": 1679510878, + "narHash": "sha256-Dz3LeQa5Hlf8zsGOoNViDnCv1eyMQvBKHkx6XvnabEQ=", + "owner": "openconfig", + "repo": "gnmic", + "rev": "112538558f9745b08e0ad3ccd9a5578191b95819", + "type": "github" + }, + "original": { + "owner": "openconfig", + "repo": "gnmic", + "type": "github" + } + }, + "gomod2nix": { + "inputs": { + "nixpkgs": "nixpkgs_3", + "utils": "utils_2" + }, + "locked": { + "lastModified": 1677459247, + "narHash": "sha256-JbakfAiPYmCCV224yAMq/XO0udN5coWv/oazblMKdoY=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "3cbf3a51fe32e2f57af4c52744e7228bab22983d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -205,15 +302,15 @@ "utils": "utils" }, "locked": { - "lastModified": 1678571066, - "narHash": "sha256-MrlMr2A3tK1MY/JUGWMVzMwois8+mHWXm/1yYdwQSIc=", - "owner": "nix-community", + "lastModified": 1679635191, + "narHash": "sha256-Q+wh/pbbugO+9529nrzcNmqDjOk8nQsfW0UhOSOY/HE=", + "owner": "Pegasust", "repo": "home-manager", - "rev": "bf5712c5865e543fb3f4796511d4cf51efd841b1", + "rev": "061335287875a847f622ffeaea8924b020b4a7ba", "type": "github" }, "original": { - "owner": "nix-community", + "owner": "Pegasust", "repo": "home-manager", "type": "github" } @@ -221,11 +318,11 @@ "kpcli-py": { "flake": false, "locked": { - "lastModified": 1619087457, - "narHash": "sha256-iRNLq5s2WJJHwB4beP5xQDKrBPWS/42s/ozLoSa5gAE=", + "lastModified": 1679142558, + "narHash": "sha256-l18PBzf/P7d3BPcFb5gSDX863MsC7S747qooyg0u2lA=", "owner": "rebkwok", "repo": "kpcli", - "rev": "e4d699e3b3d28887f74185f8fa69d0aade111d84", + "rev": "1c64e7274345d28ebc2607e22211a4ee9f6dbe7f", "type": "github" }, "original": { @@ -234,6 +331,24 @@ "type": "github" } }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1679567394, + "narHash": "sha256-ZvLuzPeARDLiQUt6zSZFGOs+HZmE+3g4QURc8mkBsfM=", + "owner": "nix-community", + "repo": "naersk", + "rev": "88cd22380154a2c36799fe8098888f0f59861a15", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, "neovim-flake": { "inputs": { "flake-utils": "flake-utils_2", @@ -244,11 +359,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1678516523, - "narHash": "sha256-DpcG4CT542aSmLmK7bmZFumKfMwBQowWrJns895TvyU=", + "lastModified": 1679632758, + "narHash": "sha256-h97hY2VrAXlSQZQRp6jR3YYXgwBD3ris/4iyt20/aAA=", "owner": "neovim", "repo": "neovim", - "rev": "236c20795eb9f11e21e0719b735ea741711acc08", + "rev": "a478fd41753a5c094e6c329a3573cbfb32b1c6bf", "type": "github" }, "original": { @@ -265,11 +380,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1678522422, - "narHash": "sha256-g565cBceeJTBGYSRO4Gr5mGz46RapgLolYUMXpFDBFU=", + "lastModified": 1679645578, + "narHash": "sha256-gN0mpWiZHhQlEA4/bfMQFuyNSebrm+WoOntDJtm3Npk=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "3e253022630b30c44c0246d2a83bf2c1f1b185c7", + "rev": "5974031f4d4cd09ea98f3febce783ba2d32f9c65", "type": "github" }, "original": { @@ -287,11 +402,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1678475794, - "narHash": "sha256-wBS87BjBhQb7aw4+GbCl2+hKN1JCrNeXT4BISD99eeo=", + "lastModified": 1679662069, + "narHash": "sha256-FpPx3B8vMeHB8iixbZUXq+6awFje8fUE8zyhDTgJ+AM=", "owner": "tweag", "repo": "nickel", - "rev": "085545cd673dfb6f87238f71be34f0d3d092469c", + "rev": "e70f4ba786bad673081629dd2f2ecfb87d0b3267", "type": "github" }, "original": { @@ -300,6 +415,32 @@ "type": "github" } }, + "nix-boost": { + "inputs": { + "cargo-leptos": "cargo-leptos", + "flake-compat": "flake-compat_5", + "gnmic": "gnmic", + "gomod2nix": "gomod2nix", + "naersk": "naersk", + "nixlib": "nixlib", + "nixpkgs": "nixpkgs_5", + "poetry2nix": "poetry2nix", + "rust-overlay": "rust-overlay_3" + }, + "locked": { + "lastModified": 1679675754, + "narHash": "sha256-B/jA2C77hCtnBmMbYhel5Bbon4nj1wB1dMacCHm3Hak=", + "ref": "refs/heads/master", + "rev": "c9744d6afa55f9c8eddd7847d27a8bb4b702e2e2", + "revCount": 50, + "type": "git", + "url": "https://git.pegasust.com/pegasust/nix-boost.git" + }, + "original": { + "type": "git", + "url": "https://git.pegasust.com/pegasust/nix-boost.git" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -307,11 +448,11 @@ ] }, "locked": { - "lastModified": 1678591454, - "narHash": "sha256-uEjRsVJIkfyRjTIYHscit8CAUw4kygdzJGplNiV25l8=", + "lastModified": 1679224439, + "narHash": "sha256-QkvcuC4b67FUkkxlMsLTMPbwoD7yZr0UvJpu6jkFuLo=", "owner": "mic92", "repo": "nix-index-database", - "rev": "caf85d1716e1ce6d7a0da2b7f1ab1c46d9497662", + "rev": "2f5e6e915d70c04d673a8930f94591595c73eb84", "type": "github" }, "original": { @@ -322,8 +463,8 @@ }, "nixgl": { "inputs": { - "flake-utils": "flake-utils_5", - "nixpkgs": "nixpkgs_3" + "flake-utils": "flake-utils_7", + "nixpkgs": "nixpkgs_7" }, "locked": { "lastModified": 1, @@ -336,6 +477,21 @@ "type": "path" } }, + "nixlib": { + "locked": { + "lastModified": 1679187309, + "narHash": "sha256-H8udmkg5wppL11d/05MMzOMryiYvc403axjDNZy1/TQ=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "44214417fe4595438b31bdb9469be92536a61455", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1671983799, @@ -354,11 +510,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1673800717, - "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", + "lastModified": 1678872516, + "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", + "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", "type": "github" }, "original": { @@ -370,11 +526,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1677932085, - "narHash": "sha256-+AB4dYllWig8iO6vAiGGYl0NEgmMgGHpy9gzWJ3322g=", + "lastModified": 1678898370, + "narHash": "sha256-xTICr1j+uat5hk9FyuPOFGxpWHdJRibwZC+ATi0RbtE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3c5319ad3aa51551182ac82ea17ab1c6b0f0df89", + "rev": "ac718d02867a84b42522a0ece52d841188208f2c", "type": "github" }, "original": { @@ -384,6 +540,68 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1658285632, + "narHash": "sha256-zRS5S/hoeDGUbO+L95wXG9vJNwsSYcl93XiD0HQBXLk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5342fc6fb59d0595d26883c3cadff16ce58e44f3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1679553901, + "narHash": "sha256-OhmJc18XNIj0wVC4ZoPnCVoY3SGfcPxaeKJOz1WHo5M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "09ad6a72359f6aff0f96ce8e4d1ec2d1271ad15d", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1679437018, + "narHash": "sha256-vOuiDPLHSEo/7NkiWtxpHpHgoXoNmrm+wkXZ6a072Fc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "19cf008bb18e47b6e3b4e16e32a9a4bdd4b45f7e", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1665296151, + "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_7": { "locked": { "lastModified": 1660551188, "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", @@ -398,13 +616,13 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_8": { "locked": { - "lastModified": 1678470307, - "narHash": "sha256-OEeMUr3ueLIXyW/OaFUX5jUdimyQwMg/7e+/Q0gC/QE=", + "lastModified": 1679437018, + "narHash": "sha256-vOuiDPLHSEo/7NkiWtxpHpHgoXoNmrm+wkXZ6a072Fc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0c4800d579af4ed98ecc47d464a5e7b0870c4b1f", + "rev": "19cf008bb18e47b6e3b4e16e32a9a4bdd4b45f7e", "type": "github" }, "original": { @@ -414,7 +632,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_9": { "locked": { "lastModified": 1665296151, "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", @@ -430,6 +648,28 @@ "type": "github" } }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils_5", + "nixpkgs": [ + "nix-boost", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1679613134, + "narHash": "sha256-C74l+I97ossJGP8/VJYs/YqxIZ6XHqohuuTnjKTNp/8=", + "owner": "pegasust", + "repo": "poetry2nix", + "rev": "654b3a8ed543361d5bef4210a0bf467678304c0d", + "type": "github" + }, + "original": { + "owner": "pegasust", + "repo": "poetry2nix", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat_4", @@ -445,11 +685,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1677832802, - "narHash": "sha256-XQf+k6mBYTiQUjWRf/0fozy5InAs03O1b30adCpWeXs=", + "lastModified": 1678976941, + "narHash": "sha256-skNr08frCwN9NO+7I77MjOHHAw+L410/37JknNld+W4=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "382bee738397ca005206eefa36922cc10df8a21c", + "rev": "32b1dbedfd77892a6e375737ef04d8efba634e9e", "type": "github" }, "original": { @@ -466,10 +706,11 @@ "kpcli-py": "kpcli-py", "neovim-nightly-overlay": "neovim-nightly-overlay", "nickel": "nickel", + "nix-boost": "nix-boost", "nix-index-database": "nix-index-database", "nixgl": "nixgl", - "nixpkgs": "nixpkgs_4", - "rust-overlay": "rust-overlay_3" + "nixpkgs": "nixpkgs_8", + "rust-overlay": "rust-overlay_4" } }, "rust-overlay": { @@ -511,11 +752,11 @@ ] }, "locked": { - "lastModified": 1677896940, - "narHash": "sha256-F4YW6/+35dwctY4Ogb/vvMfvA6O0UwhDbXE7urDhk4A=", + "lastModified": 1679106165, + "narHash": "sha256-03Opt2yu4E/AIFjvlgib0/nhMn6B4B/t/nvwS2bzOGw=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "c25d3e1951863ac0061d47a3fabf9aa7c91db5e5", + "rev": "7313c06ac334d6262ddfe30a38b3abc3da6bd565", "type": "github" }, "original": { @@ -527,14 +768,33 @@ "rust-overlay_3": { "inputs": { "flake-utils": "flake-utils_6", - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_6" }, "locked": { - "lastModified": 1678588194, - "narHash": "sha256-IYEfP8On6ZFV69mXg2LOYFp8xleyZVJHolunVq+HEbI=", + "lastModified": 1679624450, + "narHash": "sha256-wiDqUaklmc31E1+wz5sv52sMcWvZKsL1FBeGJCxz628=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "2ffce3e9c3da6c756a7862c7de2f6f9813c02aba", + "rev": "afbdcf305fd6f05f708fe76d52f24d37d066c251", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_4": { + "inputs": { + "flake-utils": "flake-utils_8", + "nixpkgs": "nixpkgs_9" + }, + "locked": { + "lastModified": 1679624450, + "narHash": "sha256-wiDqUaklmc31E1+wz5sv52sMcWvZKsL1FBeGJCxz628=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "afbdcf305fd6f05f708fe76d52f24d37d066c251", "type": "github" }, "original": { @@ -557,6 +817,21 @@ "repo": "flake-utils", "type": "github" } + }, + "utils_2": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } } }, "root": "root", diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 9f6d73b..7126dca 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -10,13 +10,13 @@ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ]; - max-jobs = 4; + max-jobs = 12; }; description = "simple home-manager config"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { - url = "github:nix-community/home-manager"; + url = "github:Pegasust/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; flake-utils.url = "github:numtide/flake-utils"; @@ -27,6 +27,7 @@ url = "path:../../out-of-tree/flake-compat"; flake = false; }; + nix-boost.url = "git+https://git.pegasust.com/pegasust/nix-boost.git"; kpcli-py = { url = "github:rebkwok/kpcli"; flake = false; @@ -52,6 +53,7 @@ , kpcli-py , neovim-nightly-overlay , nickel + , nix-boost , ... }: let diff --git a/overlays.nix b/overlays.nix index 1c308ca..5a0debb 100644 --- a/overlays.nix +++ b/overlays.nix @@ -4,6 +4,7 @@ flake_input@{ kpcli-py , neovim-nightly-overlay , system , nickel +, nix-boost , ... }: let kpcli-py = (final: prev: { @@ -15,9 +16,29 @@ flake_input@{ kpcli-py # tableformatter requires setuptools tableformatter = super.tableformatter.overridePythonAttrs ( old: { - buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools super.cython_3 ]; + buildInputs = (old.buildInputs or [ ]) ++ [ self.setuptools self.cython_3 ]; + src = old.src; } ); + kpcli = super.kpcli.overridePythonAttrs (old: { + buildInputs = (old.buildInputs or [ ]) ++ [self.setuptools]; + src = old.src; + }); + + # ubersmith = super.ubersmith.overridePythonAttrs (old: { + # buildInputs = builtins.filter (x: ! builtins.elem x [ ]) ((old.buildInputs or [ ]) ++ [ + # py-final.setuptools + # py-final.pip + # ]); + # + # src = final.fetchFromGitHub { + # owner = "jasonkeene"; + # repo = "python-ubersmith"; + # rev = "0c594e2eb41066d1fe7860e3a6f04b14c14f6e6a"; + # sha256 = "sha256-Dystt7CBtjpLkgzCsAif8WkkYYeLyh7VMehAtwoDGuM="; + # }; + # }); + }); }; }); @@ -43,6 +64,7 @@ flake_input@{ kpcli-py lsp-nls nickel nickelWasm; }); in [ + nix-boost.overlays.default nixgl.overlays.default rust-overlay.overlays.default neovim-nightly-overlay.overlay diff --git a/scripts/hm-switch.sh b/scripts/hm-switch.sh index c2df20d..fbf2782 100755 --- a/scripts/hm-switch.sh +++ b/scripts/hm-switch.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh # NOTE: Untested on case of no home-manager -set -xv +set -xveu # Where this script located SCRIPT_DIR=$(readlink -f $(dirname $0)) echo "SCRIPT_DIR: ${SCRIPT_DIR}" @@ -25,11 +25,12 @@ sudo launchctl start org.nixos.nix-daemon # Mason is bad: it puts binaries onto xdg.data # let's make mason starts fresh, just in case we introduce RPATH hacks # that injects binary for Mason to use. -rm -rf ~/.local/share/nvim/mason +sudo rm -rf ~/.local/share/nvim/mason # NOTE: https://discourse.nixos.org/t/relative-path-support-for-nix-flakes/18795 # nix flake update is required for relative paths to work nix flake update +nix flake update "${SCRIPT_DIR}/../nix-conf/home-manager" # test if we have home-manager, if not, attempt to use nix to put home-manager to # our environment if ! command -v home-manager ; then diff --git a/scripts/upload-to-cache.sh b/scripts/upload-to-cache.sh index 58597f4..1567ea1 100755 --- a/scripts/upload-to-cache.sh +++ b/scripts/upload-to-cache.sh @@ -1,11 +1,11 @@ #!/usr/bin/env sh -set -eux -set -f # disable globbing (/nix/store may contain glob chars) -export IFS=' ' -PATH=/nix/var/nix/profiles/default/bin:$PATH - -# $OUT_PATHS when invoked by nix.settings.post-build-hook will be -# space-separated paths to /nix/store/ -echo "Uploading paths" $OUT_PATHS -nix copy --to "ssh-ng://10.100.200.230" $OUT_PATHS +# set -eux +# set -f # disable globbing (/nix/store may contain glob chars) +# export IFS=' ' +# PATH=/nix/var/nix/profiles/default/bin:$PATH +# +# # $OUT_PATHS when invoked by nix.settings.post-build-hook will be +# # space-separated paths to /nix/store/ +# echo "Uploading paths" $OUT_PATHS +# nix copy --to "ssh-ng://10.100.200.230" $OUT_PATHS From b7c370721342c805be3ee18e3efa37ffeeb7c347 Mon Sep 17 00:00:00 2001 From: Hung Date: Sat, 1 Apr 2023 23:35:11 -0700 Subject: [PATCH 36/64] ^deps and allow htran home to be built --- dev-shell.nix | 2 + flake.lock | 396 ++++++++++++++++++++------ native_configs/neovim/init.lua | 4 +- nix-conf/home-manager/base/shells.nix | 7 +- nix-conf/home-manager/flake.lock | 388 +++++++++++++++++++------ nix-conf/home-manager/flake.nix | 3 +- out-of-tree/nixGL/fetch.py | 5 - overlays.nix | 18 +- 8 files changed, 619 insertions(+), 204 deletions(-) diff --git a/dev-shell.nix b/dev-shell.nix index a2631fe..b94d9fc 100644 --- a/dev-shell.nix +++ b/dev-shell.nix @@ -15,6 +15,8 @@ pkgs.rust4cargo pkgs.sops pkgs.ssh-to-age + pkgs.go + pkgs.gopls ]; shellHook = '' diff --git a/flake.lock b/flake.lock index c2fcd8a..cf9b2d8 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "advisory-db": { + "flake": false, + "locked": { + "lastModified": 1678924180, + "narHash": "sha256-5bwage/7JRiPiDY4wY3+OBiT8abY5f83hss6pQBklz8=", + "owner": "rustsec", + "repo": "advisory-db", + "rev": "0888b44843e3c86db9fd56334c7f5261ea00dc19", + "type": "github" + }, + "original": { + "owner": "rustsec", + "repo": "advisory-db", + "type": "github" + } + }, "agenix": { "inputs": { "darwin": "darwin", @@ -8,11 +24,11 @@ ] }, "locked": { - "lastModified": 1677969766, - "narHash": "sha256-AIp/ZYZMNLDZR/H7iiAlaGpu4lcXsVt9JQpBlf43HRY=", + "lastModified": 1680281360, + "narHash": "sha256-XdLTgAzjJNDhAG2V+++0bHpSzfvArvr2pW6omiFfEJk=", "owner": "ryantm", "repo": "agenix", - "rev": "03b51fe8e459a946c4b88dcfb6446e45efb2c24e", + "rev": "e64961977f60388dd0b49572bb0fc453b871f896", "type": "github" }, "original": { @@ -24,11 +40,11 @@ "cargo-leptos": { "flake": false, "locked": { - "lastModified": 1678270781, - "narHash": "sha256-gfGjghO3zZQ1tfXevlCjYkEo6c0kOtfL+0U1FKbrdwM=", + "lastModified": 1680094968, + "narHash": "sha256-LWi+KxvtIPP67vNe1Edf7AT8y4nKJ6jawTJtSEpt+4I=", "owner": "leptos-rs", "repo": "cargo-leptos", - "rev": "87ffe4ddab33a498b8b4e53846e6b090fd675628", + "rev": "6512bd2dc891fead2b7ff7f08d26b89789be7682", "type": "github" }, "original": { @@ -61,6 +77,31 @@ "type": "github" } }, + "crane_2": { + "inputs": { + "flake-compat": "flake-compat_5", + "flake-utils": "flake-utils_5", + "nixpkgs": [ + "nickel", + "topiary", + "nixpkgs" + ], + "rust-overlay": "rust-overlay_3" + }, + "locked": { + "lastModified": 1678152261, + "narHash": "sha256-cPRDxwygVMleiSEGELrvAiq9vYAN4c3KK/K4UEO13vU=", + "owner": "ipetkov", + "repo": "crane", + "rev": "5291dd0aa7a52d607fc952763ef60714e4c881d4", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, "darwin": { "inputs": { "nixpkgs": [ @@ -160,6 +201,22 @@ "type": "github" } }, + "flake-compat_6": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1678901627, @@ -175,6 +232,36 @@ "type": "github" } }, + "flake-utils_10": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_11": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "flake-utils_2": { "locked": { "lastModified": 1667395993, @@ -222,11 +309,11 @@ }, "flake-utils_5": { "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -237,11 +324,11 @@ }, "flake-utils_6": { "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", "type": "github" }, "original": { @@ -266,6 +353,21 @@ } }, "flake-utils_8": { + "locked": { + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_9": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -305,11 +407,11 @@ "gnmic": { "flake": false, "locked": { - "lastModified": 1679510878, - "narHash": "sha256-Dz3LeQa5Hlf8zsGOoNViDnCv1eyMQvBKHkx6XvnabEQ=", + "lastModified": 1679677474, + "narHash": "sha256-Flzajl4GYPnxlnLAlcR/KzAoPE76jMFBThztAijfPj4=", "owner": "openconfig", "repo": "gnmic", - "rev": "112538558f9745b08e0ad3ccd9a5578191b95819", + "rev": "c1e3239a694da71b3b290bf7805f3d18e84694e6", "type": "github" }, "original": { @@ -320,7 +422,7 @@ }, "gomod2nix": { "inputs": { - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "utils": "utils_2" }, "locked": { @@ -345,11 +447,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1679480702, - "narHash": "sha256-npuRD61YmxUPitI1TqKwlxLrU6iGl5E+BPT196LgUDo=", + "lastModified": 1680389554, + "narHash": "sha256-+8FUmS4GbDMynQErZGXKg+wU76rq6mI5fprxFXFWKSM=", "owner": "nix-community", "repo": "home-manager", - "rev": "363c46b2480f1b73ec37cf68caac61f5daa82a2e", + "rev": "ddd8866c0306c48f465e7f48432e6f1ecd1da7f8", "type": "github" }, "original": { @@ -376,7 +478,7 @@ }, "naersk": { "inputs": { - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_5" }, "locked": { "lastModified": 1679567394, @@ -402,11 +504,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1679632758, - "narHash": "sha256-h97hY2VrAXlSQZQRp6jR3YYXgwBD3ris/4iyt20/aAA=", + "lastModified": 1680310604, + "narHash": "sha256-2jop/z79HYhmV/hrdGvhjfTMouvzQvNRgFTkPhwWVcg=", "owner": "neovim", "repo": "neovim", - "rev": "a478fd41753a5c094e6c329a3573cbfb32b1c6bf", + "rev": "75e1b1d5c934aa3a12693a7df58795563fb7877e", "type": "github" }, "original": { @@ -423,11 +525,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1679645578, - "narHash": "sha256-gN0mpWiZHhQlEA4/bfMQFuyNSebrm+WoOntDJtm3Npk=", + "lastModified": 1680336751, + "narHash": "sha256-otSdFRXsNyPYOsbo+49vN4UGwZrVoLDrEp0EkyVJ/rY=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "5974031f4d4cd09ea98f3febce783ba2d32f9c65", + "rev": "d56f32281f4d6d74ce925a99946713dc6b5a0e30", "type": "github" }, "original": { @@ -442,14 +544,15 @@ "flake-utils": "flake-utils_4", "nixpkgs": "nixpkgs_2", "pre-commit-hooks": "pre-commit-hooks", - "rust-overlay": "rust-overlay_2" + "rust-overlay": "rust-overlay_2", + "topiary": "topiary" }, "locked": { - "lastModified": 1679662069, - "narHash": "sha256-FpPx3B8vMeHB8iixbZUXq+6awFje8fUE8zyhDTgJ+AM=", + "lastModified": 1680275475, + "narHash": "sha256-Aoq+njIRAsparRyTx6LmuqbkJIWVZmrtt3p2aUhv6eM=", "owner": "tweag", "repo": "nickel", - "rev": "e70f4ba786bad673081629dd2f2ecfb87d0b3267", + "rev": "f0854b9992a1af5228fa4828a65c3660966c271c", "type": "github" }, "original": { @@ -461,21 +564,21 @@ "nix-boost": { "inputs": { "cargo-leptos": "cargo-leptos", - "flake-compat": "flake-compat_5", + "flake-compat": "flake-compat_6", "gnmic": "gnmic", "gomod2nix": "gomod2nix", "naersk": "naersk", "nixlib": "nixlib", - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_6", "poetry2nix": "poetry2nix", - "rust-overlay": "rust-overlay_3" + "rust-overlay": "rust-overlay_5" }, "locked": { - "lastModified": 1679675754, - "narHash": "sha256-B/jA2C77hCtnBmMbYhel5Bbon4nj1wB1dMacCHm3Hak=", + "lastModified": 1680312007, + "narHash": "sha256-bFjiXGxNKtytv2wWnBwG1TfBpCNl5DYK2pckbXPacsM=", "ref": "refs/heads/master", - "rev": "c9744d6afa55f9c8eddd7847d27a8bb4b702e2e2", - "revCount": 50, + "rev": "2d8e3de16bc41c12a77bfc8721bb1f6a4cd484c5", + "revCount": 51, "type": "git", "url": "https://git.pegasust.com/pegasust/nix-boost.git" }, @@ -484,6 +587,21 @@ "url": "https://git.pegasust.com/pegasust/nix-boost.git" } }, + "nix-filter": { + "locked": { + "lastModified": 1678109515, + "narHash": "sha256-C2X+qC80K2C1TOYZT8nabgo05Dw2HST/pSn6s+n6BO8=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "aa9ff6ce4a7f19af6415fb3721eaa513ea6c763c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -506,12 +624,12 @@ }, "nixgl": { "inputs": { - "flake-utils": "flake-utils_7", - "nixpkgs": "nixpkgs_7" + "flake-utils": "flake-utils_10", + "nixpkgs": "nixpkgs_8" }, "locked": { "lastModified": 1, - "narHash": "sha256-RkO+8E7MahERHw1C5DNObDjq4xeI+FqaWH9+M7Fv2UE=", + "narHash": "sha256-fPPUpYHcU9od0bdrzHCgbIKDqFs35u+YTt3jKf+EiMQ=", "path": "out-of-tree/nixGL", "type": "path" }, @@ -522,11 +640,11 @@ }, "nixlib": { "locked": { - "lastModified": 1679187309, - "narHash": "sha256-H8udmkg5wppL11d/05MMzOMryiYvc403axjDNZy1/TQ=", + "lastModified": 1679791877, + "narHash": "sha256-tTV1Mf0hPWIMtqyU16Kd2JUBDWvfHlDC9pF57vcbgpQ=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "44214417fe4595438b31bdb9469be92536a61455", + "rev": "cc060ddbf652a532b54057081d5abd6144d01971", "type": "github" }, "original": { @@ -537,11 +655,11 @@ }, "nixlib_2": { "locked": { - "lastModified": 1679187309, - "narHash": "sha256-H8udmkg5wppL11d/05MMzOMryiYvc403axjDNZy1/TQ=", + "lastModified": 1680397293, + "narHash": "sha256-wBpJ73+tJ8fZSWb4tzNbAVahC4HSo2QG3nICDy4ExBQ=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "44214417fe4595438b31bdb9469be92536a61455", + "rev": "b18d328214ca3c627d3cc3f51fd9d1397fdbcd7a", "type": "github" }, "original": { @@ -582,6 +700,22 @@ "type": "github" } }, + "nixpkgs_10": { + "locked": { + "lastModified": 1665296151, + "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1678898370, @@ -598,6 +732,22 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1665296151, + "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1658285632, "narHash": "sha256-zRS5S/hoeDGUbO+L95wXG9vJNwsSYcl93XiD0HQBXLk=", @@ -613,13 +763,13 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { - "lastModified": 1679553901, - "narHash": "sha256-OhmJc18XNIj0wVC4ZoPnCVoY3SGfcPxaeKJOz1WHo5M=", + "lastModified": 1680273054, + "narHash": "sha256-Bs6/5LpvYp379qVqGt9mXxxx9GSE789k3oFc+OAL07M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "09ad6a72359f6aff0f96ce8e4d1ec2d1271ad15d", + "rev": "3364b5b117f65fe1ce65a3cdd5612a078a3b31e3", "type": "github" }, "original": { @@ -627,13 +777,13 @@ "type": "indirect" } }, - "nixpkgs_5": { + "nixpkgs_6": { "locked": { - "lastModified": 1679437018, - "narHash": "sha256-vOuiDPLHSEo/7NkiWtxpHpHgoXoNmrm+wkXZ6a072Fc=", + "lastModified": 1680213900, + "narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "19cf008bb18e47b6e3b4e16e32a9a4bdd4b45f7e", + "rev": "e3652e0735fbec227f342712f180f4f21f0594f2", "type": "github" }, "original": { @@ -643,7 +793,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_7": { "locked": { "lastModified": 1665296151, "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", @@ -659,7 +809,7 @@ "type": "github" } }, - "nixpkgs_7": { + "nixpkgs_8": { "locked": { "lastModified": 1660551188, "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", @@ -674,13 +824,13 @@ "type": "github" } }, - "nixpkgs_8": { + "nixpkgs_9": { "locked": { - "lastModified": 1679437018, - "narHash": "sha256-vOuiDPLHSEo/7NkiWtxpHpHgoXoNmrm+wkXZ6a072Fc=", + "lastModified": 1680213900, + "narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "19cf008bb18e47b6e3b4e16e32a9a4bdd4b45f7e", + "rev": "e3652e0735fbec227f342712f180f4f21f0594f2", "type": "github" }, "original": { @@ -689,40 +839,24 @@ "type": "indirect" } }, - "nixpkgs_9": { - "locked": { - "lastModified": 1665296151, - "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "poetry2nix": { "inputs": { - "flake-utils": "flake-utils_5", + "flake-utils": "flake-utils_8", "nixpkgs": [ "nix-boost", "nixpkgs" ] }, "locked": { - "lastModified": 1679613134, - "narHash": "sha256-C74l+I97ossJGP8/VJYs/YqxIZ6XHqohuuTnjKTNp/8=", - "owner": "pegasust", + "lastModified": 1680134979, + "narHash": "sha256-8LBOnyrk9r1X8LpxZWynIxr97vq8hRqnpo639c2RA40=", + "owner": "nix-community", "repo": "poetry2nix", - "rev": "654b3a8ed543361d5bef4210a0bf467678304c0d", + "rev": "dc8c13ab88db829c1b71e6c794d1b295c8031408", "type": "github" }, "original": { - "owner": "pegasust", + "owner": "nix-community", "repo": "poetry2nix", "type": "github" } @@ -768,8 +902,8 @@ "nix-index-database": "nix-index-database", "nixgl": "nixgl", "nixlib": "nixlib_2", - "nixpkgs": "nixpkgs_8", - "rust-overlay": "rust-overlay_4" + "nixpkgs": "nixpkgs_9", + "rust-overlay": "rust-overlay_6" } }, "rust-overlay": { @@ -826,15 +960,25 @@ }, "rust-overlay_3": { "inputs": { - "flake-utils": "flake-utils_6", - "nixpkgs": "nixpkgs_6" + "flake-utils": [ + "nickel", + "topiary", + "crane", + "flake-utils" + ], + "nixpkgs": [ + "nickel", + "topiary", + "crane", + "nixpkgs" + ] }, "locked": { - "lastModified": 1679624450, - "narHash": "sha256-wiDqUaklmc31E1+wz5sv52sMcWvZKsL1FBeGJCxz628=", + "lastModified": 1677812689, + "narHash": "sha256-EakqhgRnjVeYJv5+BJx/NZ7/eFTMBxc4AhICUNquhUg=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "afbdcf305fd6f05f708fe76d52f24d37d066c251", + "rev": "e53e8853aa7b0688bc270e9e6a681d22e01cf299", "type": "github" }, "original": { @@ -845,15 +989,15 @@ }, "rust-overlay_4": { "inputs": { - "flake-utils": "flake-utils_8", - "nixpkgs": "nixpkgs_9" + "flake-utils": "flake-utils_7", + "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1679624450, - "narHash": "sha256-wiDqUaklmc31E1+wz5sv52sMcWvZKsL1FBeGJCxz628=", + "lastModified": 1679106165, + "narHash": "sha256-03Opt2yu4E/AIFjvlgib0/nhMn6B4B/t/nvwS2bzOGw=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "afbdcf305fd6f05f708fe76d52f24d37d066c251", + "rev": "7313c06ac334d6262ddfe30a38b3abc3da6bd565", "type": "github" }, "original": { @@ -862,6 +1006,70 @@ "type": "github" } }, + "rust-overlay_5": { + "inputs": { + "flake-utils": "flake-utils_9", + "nixpkgs": "nixpkgs_7" + }, + "locked": { + "lastModified": 1680229280, + "narHash": "sha256-9UoyQCeKUmHcsIdpsAgcz41LAIDkWhI2PhVDjckrpg0=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "aa480d799023141e1b9e5d6108700de63d9ad002", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_6": { + "inputs": { + "flake-utils": "flake-utils_11", + "nixpkgs": "nixpkgs_10" + }, + "locked": { + "lastModified": 1680401949, + "narHash": "sha256-s8+b9Zm9osz9oGInNletIFihgXTs9hogw9C/c3MbErs=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "9b8632040df6f2218fd01bf79c0589379ac39584", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "topiary": { + "inputs": { + "advisory-db": "advisory-db", + "crane": "crane_2", + "flake-utils": "flake-utils_6", + "nix-filter": "nix-filter", + "nixpkgs": [ + "nickel", + "nixpkgs" + ], + "rust-overlay": "rust-overlay_4" + }, + "locked": { + "lastModified": 1680178226, + "narHash": "sha256-EZtmLYPQII8Ma9yH0udqlNjSXiYUg134j+0Srzb4rbM=", + "owner": "tweag", + "repo": "topiary", + "rev": "1af03d77abf6aef3ea36f878554c16619207252b", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "topiary", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1676283394, diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 8714e02..ee0439a 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -147,12 +147,12 @@ vim.opt.scrolloff = 30; vim.opt.signcolumn = "yes"; vim.opt.colorcolumn = "80"; -vim.opt.background = "light"; +vim.opt.background = "dark"; vim.api.nvim_create_user_command('Dark', function(opts) -- opts: {name, args: str, fargs: Splited, range, ...} ---@type string - local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark; + local contrast = (opts.arg; vim.g.gruvbox_contrast_dark = contrast; vim.opt.background = "dark"; end, diff --git a/nix-conf/home-manager/base/shells.nix b/nix-conf/home-manager/base/shells.nix index 2ebb41e..d338b9b 100644 --- a/nix-conf/home-manager/base/shells.nix +++ b/nix-conf/home-manager/base/shells.nix @@ -52,11 +52,10 @@ in }; programs.tmux = { enable = true; - configBeforePlugin = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"; - plugins = - let inherit (pkgs.tmuxPlugins) cpu net-speed; - in [ cpu net-speed ]; + # extraConfigBeforePlugin = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"; + plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [ cpu net-speed ]; }; + xdg.configFile."tmux/tmux.conf".text = myLib.mkOrder 600 (builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"); programs.exa = { enable = true; enableAliases = true; diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index c257a32..7551fbb 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -1,13 +1,29 @@ { "nodes": { + "advisory-db": { + "flake": false, + "locked": { + "lastModified": 1678924180, + "narHash": "sha256-5bwage/7JRiPiDY4wY3+OBiT8abY5f83hss6pQBklz8=", + "owner": "rustsec", + "repo": "advisory-db", + "rev": "0888b44843e3c86db9fd56334c7f5261ea00dc19", + "type": "github" + }, + "original": { + "owner": "rustsec", + "repo": "advisory-db", + "type": "github" + } + }, "cargo-leptos": { "flake": false, "locked": { - "lastModified": 1678270781, - "narHash": "sha256-gfGjghO3zZQ1tfXevlCjYkEo6c0kOtfL+0U1FKbrdwM=", + "lastModified": 1680094968, + "narHash": "sha256-LWi+KxvtIPP67vNe1Edf7AT8y4nKJ6jawTJtSEpt+4I=", "owner": "leptos-rs", "repo": "cargo-leptos", - "rev": "87ffe4ddab33a498b8b4e53846e6b090fd675628", + "rev": "6512bd2dc891fead2b7ff7f08d26b89789be7682", "type": "github" }, "original": { @@ -40,6 +56,31 @@ "type": "github" } }, + "crane_2": { + "inputs": { + "flake-compat": "flake-compat_5", + "flake-utils": "flake-utils_5", + "nixpkgs": [ + "nickel", + "topiary", + "nixpkgs" + ], + "rust-overlay": "rust-overlay_3" + }, + "locked": { + "lastModified": 1678152261, + "narHash": "sha256-cPRDxwygVMleiSEGELrvAiq9vYAN4c3KK/K4UEO13vU=", + "owner": "ipetkov", + "repo": "crane", + "rev": "5291dd0aa7a52d607fc952763ef60714e4c881d4", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -117,6 +158,22 @@ "type": "github" } }, + "flake-compat_6": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1678901627, @@ -132,6 +189,36 @@ "type": "github" } }, + "flake-utils_10": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_11": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "flake-utils_2": { "locked": { "lastModified": 1667395993, @@ -179,11 +266,11 @@ }, "flake-utils_5": { "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "owner": "numtide", "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "type": "github" }, "original": { @@ -194,11 +281,11 @@ }, "flake-utils_6": { "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", "type": "github" }, "original": { @@ -223,6 +310,21 @@ } }, "flake-utils_8": { + "locked": { + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_9": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -262,11 +364,11 @@ "gnmic": { "flake": false, "locked": { - "lastModified": 1679510878, - "narHash": "sha256-Dz3LeQa5Hlf8zsGOoNViDnCv1eyMQvBKHkx6XvnabEQ=", + "lastModified": 1679677474, + "narHash": "sha256-Flzajl4GYPnxlnLAlcR/KzAoPE76jMFBThztAijfPj4=", "owner": "openconfig", "repo": "gnmic", - "rev": "112538558f9745b08e0ad3ccd9a5578191b95819", + "rev": "c1e3239a694da71b3b290bf7805f3d18e84694e6", "type": "github" }, "original": { @@ -277,7 +379,7 @@ }, "gomod2nix": { "inputs": { - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "utils": "utils_2" }, "locked": { @@ -302,15 +404,15 @@ "utils": "utils" }, "locked": { - "lastModified": 1679635191, - "narHash": "sha256-Q+wh/pbbugO+9529nrzcNmqDjOk8nQsfW0UhOSOY/HE=", - "owner": "Pegasust", + "lastModified": 1680389554, + "narHash": "sha256-+8FUmS4GbDMynQErZGXKg+wU76rq6mI5fprxFXFWKSM=", + "owner": "nix-community", "repo": "home-manager", - "rev": "061335287875a847f622ffeaea8924b020b4a7ba", + "rev": "ddd8866c0306c48f465e7f48432e6f1ecd1da7f8", "type": "github" }, "original": { - "owner": "Pegasust", + "owner": "nix-community", "repo": "home-manager", "type": "github" } @@ -333,7 +435,7 @@ }, "naersk": { "inputs": { - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_5" }, "locked": { "lastModified": 1679567394, @@ -359,11 +461,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1679632758, - "narHash": "sha256-h97hY2VrAXlSQZQRp6jR3YYXgwBD3ris/4iyt20/aAA=", + "lastModified": 1680310604, + "narHash": "sha256-2jop/z79HYhmV/hrdGvhjfTMouvzQvNRgFTkPhwWVcg=", "owner": "neovim", "repo": "neovim", - "rev": "a478fd41753a5c094e6c329a3573cbfb32b1c6bf", + "rev": "75e1b1d5c934aa3a12693a7df58795563fb7877e", "type": "github" }, "original": { @@ -380,11 +482,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1679645578, - "narHash": "sha256-gN0mpWiZHhQlEA4/bfMQFuyNSebrm+WoOntDJtm3Npk=", + "lastModified": 1680336751, + "narHash": "sha256-otSdFRXsNyPYOsbo+49vN4UGwZrVoLDrEp0EkyVJ/rY=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "5974031f4d4cd09ea98f3febce783ba2d32f9c65", + "rev": "d56f32281f4d6d74ce925a99946713dc6b5a0e30", "type": "github" }, "original": { @@ -399,14 +501,15 @@ "flake-utils": "flake-utils_4", "nixpkgs": "nixpkgs_2", "pre-commit-hooks": "pre-commit-hooks", - "rust-overlay": "rust-overlay_2" + "rust-overlay": "rust-overlay_2", + "topiary": "topiary" }, "locked": { - "lastModified": 1679662069, - "narHash": "sha256-FpPx3B8vMeHB8iixbZUXq+6awFje8fUE8zyhDTgJ+AM=", + "lastModified": 1680275475, + "narHash": "sha256-Aoq+njIRAsparRyTx6LmuqbkJIWVZmrtt3p2aUhv6eM=", "owner": "tweag", "repo": "nickel", - "rev": "e70f4ba786bad673081629dd2f2ecfb87d0b3267", + "rev": "f0854b9992a1af5228fa4828a65c3660966c271c", "type": "github" }, "original": { @@ -418,21 +521,21 @@ "nix-boost": { "inputs": { "cargo-leptos": "cargo-leptos", - "flake-compat": "flake-compat_5", + "flake-compat": "flake-compat_6", "gnmic": "gnmic", "gomod2nix": "gomod2nix", "naersk": "naersk", "nixlib": "nixlib", - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_6", "poetry2nix": "poetry2nix", - "rust-overlay": "rust-overlay_3" + "rust-overlay": "rust-overlay_5" }, "locked": { - "lastModified": 1679675754, - "narHash": "sha256-B/jA2C77hCtnBmMbYhel5Bbon4nj1wB1dMacCHm3Hak=", + "lastModified": 1680312007, + "narHash": "sha256-bFjiXGxNKtytv2wWnBwG1TfBpCNl5DYK2pckbXPacsM=", "ref": "refs/heads/master", - "rev": "c9744d6afa55f9c8eddd7847d27a8bb4b702e2e2", - "revCount": 50, + "rev": "2d8e3de16bc41c12a77bfc8721bb1f6a4cd484c5", + "revCount": 51, "type": "git", "url": "https://git.pegasust.com/pegasust/nix-boost.git" }, @@ -441,6 +544,21 @@ "url": "https://git.pegasust.com/pegasust/nix-boost.git" } }, + "nix-filter": { + "locked": { + "lastModified": 1678109515, + "narHash": "sha256-C2X+qC80K2C1TOYZT8nabgo05Dw2HST/pSn6s+n6BO8=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "aa9ff6ce4a7f19af6415fb3721eaa513ea6c763c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -463,12 +581,12 @@ }, "nixgl": { "inputs": { - "flake-utils": "flake-utils_7", - "nixpkgs": "nixpkgs_7" + "flake-utils": "flake-utils_10", + "nixpkgs": "nixpkgs_8" }, "locked": { "lastModified": 1, - "narHash": "sha256-RkO+8E7MahERHw1C5DNObDjq4xeI+FqaWH9+M7Fv2UE=", + "narHash": "sha256-fPPUpYHcU9od0bdrzHCgbIKDqFs35u+YTt3jKf+EiMQ=", "path": "./../../out-of-tree/nixGL", "type": "path" }, @@ -479,11 +597,11 @@ }, "nixlib": { "locked": { - "lastModified": 1679187309, - "narHash": "sha256-H8udmkg5wppL11d/05MMzOMryiYvc403axjDNZy1/TQ=", + "lastModified": 1679791877, + "narHash": "sha256-tTV1Mf0hPWIMtqyU16Kd2JUBDWvfHlDC9pF57vcbgpQ=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "44214417fe4595438b31bdb9469be92536a61455", + "rev": "cc060ddbf652a532b54057081d5abd6144d01971", "type": "github" }, "original": { @@ -524,6 +642,22 @@ "type": "github" } }, + "nixpkgs_10": { + "locked": { + "lastModified": 1665296151, + "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1678898370, @@ -540,6 +674,22 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1665296151, + "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1658285632, "narHash": "sha256-zRS5S/hoeDGUbO+L95wXG9vJNwsSYcl93XiD0HQBXLk=", @@ -555,13 +705,13 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { - "lastModified": 1679553901, - "narHash": "sha256-OhmJc18XNIj0wVC4ZoPnCVoY3SGfcPxaeKJOz1WHo5M=", + "lastModified": 1680273054, + "narHash": "sha256-Bs6/5LpvYp379qVqGt9mXxxx9GSE789k3oFc+OAL07M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "09ad6a72359f6aff0f96ce8e4d1ec2d1271ad15d", + "rev": "3364b5b117f65fe1ce65a3cdd5612a078a3b31e3", "type": "github" }, "original": { @@ -569,13 +719,13 @@ "type": "indirect" } }, - "nixpkgs_5": { + "nixpkgs_6": { "locked": { - "lastModified": 1679437018, - "narHash": "sha256-vOuiDPLHSEo/7NkiWtxpHpHgoXoNmrm+wkXZ6a072Fc=", + "lastModified": 1680213900, + "narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "19cf008bb18e47b6e3b4e16e32a9a4bdd4b45f7e", + "rev": "e3652e0735fbec227f342712f180f4f21f0594f2", "type": "github" }, "original": { @@ -585,7 +735,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_7": { "locked": { "lastModified": 1665296151, "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", @@ -601,7 +751,7 @@ "type": "github" } }, - "nixpkgs_7": { + "nixpkgs_8": { "locked": { "lastModified": 1660551188, "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", @@ -616,13 +766,13 @@ "type": "github" } }, - "nixpkgs_8": { + "nixpkgs_9": { "locked": { - "lastModified": 1679437018, - "narHash": "sha256-vOuiDPLHSEo/7NkiWtxpHpHgoXoNmrm+wkXZ6a072Fc=", + "lastModified": 1680213900, + "narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "19cf008bb18e47b6e3b4e16e32a9a4bdd4b45f7e", + "rev": "e3652e0735fbec227f342712f180f4f21f0594f2", "type": "github" }, "original": { @@ -632,40 +782,24 @@ "type": "github" } }, - "nixpkgs_9": { - "locked": { - "lastModified": 1665296151, - "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "poetry2nix": { "inputs": { - "flake-utils": "flake-utils_5", + "flake-utils": "flake-utils_8", "nixpkgs": [ "nix-boost", "nixpkgs" ] }, "locked": { - "lastModified": 1679613134, - "narHash": "sha256-C74l+I97ossJGP8/VJYs/YqxIZ6XHqohuuTnjKTNp/8=", - "owner": "pegasust", + "lastModified": 1680134979, + "narHash": "sha256-8LBOnyrk9r1X8LpxZWynIxr97vq8hRqnpo639c2RA40=", + "owner": "nix-community", "repo": "poetry2nix", - "rev": "654b3a8ed543361d5bef4210a0bf467678304c0d", + "rev": "dc8c13ab88db829c1b71e6c794d1b295c8031408", "type": "github" }, "original": { - "owner": "pegasust", + "owner": "nix-community", "repo": "poetry2nix", "type": "github" } @@ -709,8 +843,8 @@ "nix-boost": "nix-boost", "nix-index-database": "nix-index-database", "nixgl": "nixgl", - "nixpkgs": "nixpkgs_8", - "rust-overlay": "rust-overlay_4" + "nixpkgs": "nixpkgs_9", + "rust-overlay": "rust-overlay_6" } }, "rust-overlay": { @@ -767,15 +901,25 @@ }, "rust-overlay_3": { "inputs": { - "flake-utils": "flake-utils_6", - "nixpkgs": "nixpkgs_6" + "flake-utils": [ + "nickel", + "topiary", + "crane", + "flake-utils" + ], + "nixpkgs": [ + "nickel", + "topiary", + "crane", + "nixpkgs" + ] }, "locked": { - "lastModified": 1679624450, - "narHash": "sha256-wiDqUaklmc31E1+wz5sv52sMcWvZKsL1FBeGJCxz628=", + "lastModified": 1677812689, + "narHash": "sha256-EakqhgRnjVeYJv5+BJx/NZ7/eFTMBxc4AhICUNquhUg=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "afbdcf305fd6f05f708fe76d52f24d37d066c251", + "rev": "e53e8853aa7b0688bc270e9e6a681d22e01cf299", "type": "github" }, "original": { @@ -786,15 +930,15 @@ }, "rust-overlay_4": { "inputs": { - "flake-utils": "flake-utils_8", - "nixpkgs": "nixpkgs_9" + "flake-utils": "flake-utils_7", + "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1679624450, - "narHash": "sha256-wiDqUaklmc31E1+wz5sv52sMcWvZKsL1FBeGJCxz628=", + "lastModified": 1679106165, + "narHash": "sha256-03Opt2yu4E/AIFjvlgib0/nhMn6B4B/t/nvwS2bzOGw=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "afbdcf305fd6f05f708fe76d52f24d37d066c251", + "rev": "7313c06ac334d6262ddfe30a38b3abc3da6bd565", "type": "github" }, "original": { @@ -803,6 +947,70 @@ "type": "github" } }, + "rust-overlay_5": { + "inputs": { + "flake-utils": "flake-utils_9", + "nixpkgs": "nixpkgs_7" + }, + "locked": { + "lastModified": 1680229280, + "narHash": "sha256-9UoyQCeKUmHcsIdpsAgcz41LAIDkWhI2PhVDjckrpg0=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "aa480d799023141e1b9e5d6108700de63d9ad002", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_6": { + "inputs": { + "flake-utils": "flake-utils_11", + "nixpkgs": "nixpkgs_10" + }, + "locked": { + "lastModified": 1680401949, + "narHash": "sha256-s8+b9Zm9osz9oGInNletIFihgXTs9hogw9C/c3MbErs=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "9b8632040df6f2218fd01bf79c0589379ac39584", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "topiary": { + "inputs": { + "advisory-db": "advisory-db", + "crane": "crane_2", + "flake-utils": "flake-utils_6", + "nix-filter": "nix-filter", + "nixpkgs": [ + "nickel", + "nixpkgs" + ], + "rust-overlay": "rust-overlay_4" + }, + "locked": { + "lastModified": 1680178226, + "narHash": "sha256-EZtmLYPQII8Ma9yH0udqlNjSXiYUg134j+0Srzb4rbM=", + "owner": "tweag", + "repo": "topiary", + "rev": "1af03d77abf6aef3ea36f878554c16619207252b", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "topiary", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1676283394, diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 7126dca..f12f7a5 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -16,7 +16,7 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager = { - url = "github:Pegasust/home-manager"; + url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; flake-utils.url = "github:numtide/flake-utils"; @@ -202,6 +202,7 @@ ]; } nerd_font_module + { base.keepass.enable = pkgs.lib.mkForce false; } ]; extraSpecialArgs = mkModuleArgs { inherit pkgs; diff --git a/out-of-tree/nixGL/fetch.py b/out-of-tree/nixGL/fetch.py index 11d0e3e..b095899 100755 --- a/out-of-tree/nixGL/fetch.py +++ b/out-of-tree/nixGL/fetch.py @@ -5,8 +5,6 @@ import json http = urllib3.PoolManager() dl_dir = http.request("GET", "https://download.nvidia.com/XFree86/Linux-x86_64/") -# print(f"{dl_dir.status=}\n{dl_dir.data=}") - assert (dl_dir.status < 400), "Error probably occurred" def find_versions(dir_html: bytes) -> list[str]: @@ -30,7 +28,6 @@ def find_versions(dir_html: bytes) -> list[str]: return _rec(dir_html, 0, []) versions = find_versions(dl_dir.data) -# print("\n".join(versions)) download_urls = lambda ver: [f"https://download.nvidia.com/XFree86/Linux-x86_64/{ver}/NVIDIA-Linux-x86_64-{ver}.run"] sha256_urls = lambda ver: [f"{url}{dl_ext}" for dl_ext in [".sha256sum", ".sha256"] for url in download_urls(ver)] @@ -46,14 +43,12 @@ none_id = lambda _: None def get_sha256(version: str) -> str | None: for url in sha256_urls(version): res = http.request("GET", url) - # print(f"attempting: {url}") if res.status < 400: return res.data.decode().split()[0] return None fetch_data = [(v, download_urls(v)[0], get_sha256(v)) for v in versions] fetch_data.append(("latest", *fetch_data[-1][1:])) -# print(fetch_data) # now print the JSON object print(json.dumps({ diff --git a/overlays.nix b/overlays.nix index 5a0debb..f57ca24 100644 --- a/overlays.nix +++ b/overlays.nix @@ -5,8 +5,9 @@ flake_input@{ kpcli-py , system , nickel , nix-boost -, ... -}: let +, ... +}: +let kpcli-py = (final: prev: { # use python3.9, which works because of cython somehow? kpcli-py = final.poetry2nix.mkPoetryApplication { @@ -21,8 +22,7 @@ flake_input@{ kpcli-py } ); kpcli = super.kpcli.overridePythonAttrs (old: { - buildInputs = (old.buildInputs or [ ]) ++ [self.setuptools]; - src = old.src; + buildInputs = (old.buildInputs or [ ]) ++ [ self.setuptools ]; }); # ubersmith = super.ubersmith.overridePythonAttrs (old: { @@ -43,7 +43,7 @@ flake_input@{ kpcli-py }; }); - rust = (final: prev: + rust = (final: prev: let nightlyRustWithExts = exts: final.rust-bin.selectLatestNightlyWith ( toolchain: (toolchain.minimal.override { @@ -53,17 +53,19 @@ flake_input@{ kpcli-py # https://rust-lang.github.io/rustup/concepts/profiles.html rust-default-components = [ "rust-docs" "rustfmt" "clippy" ]; rust-dev-components = rust-default-components ++ [ "rust-src" "rust-analyzer" "miri" ]; - in { + in + { rust4devs = nightlyRustWithExts rust-dev-components; rust4cargo = nightlyRustWithExts [ ]; rust4normi = nightlyRustWithExts rust-default-components; - }); + }); nickel = (final: prev: { inherit (flake_input.nickel.packages.${system}) lsp-nls nickel nickelWasm; }); -in [ +in +[ nix-boost.overlays.default nixgl.overlays.default rust-overlay.overlays.default From 335efeb2d9dbe092bfc262a0e324eaba968822f2 Mon Sep 17 00:00:00 2001 From: Hung Date: Sun, 2 Apr 2023 01:10:47 -0700 Subject: [PATCH 37/64] nixGL: simplify, update, and use builtins only --- out-of-tree/nixGL/fetch.py | 67 +++++++++++++------------- out-of-tree/nixGL/flake.nix | 2 + out-of-tree/nixGL/nvidia_versions.json | 32 +++++++++++- 3 files changed, 66 insertions(+), 35 deletions(-) diff --git a/out-of-tree/nixGL/fetch.py b/out-of-tree/nixGL/fetch.py index b095899..d834b12 100755 --- a/out-of-tree/nixGL/fetch.py +++ b/out-of-tree/nixGL/fetch.py @@ -1,59 +1,60 @@ -#!/usr/bin/env python3 -import urllib3 +import http.client import json -http = urllib3.PoolManager() -dl_dir = http.request("GET", "https://download.nvidia.com/XFree86/Linux-x86_64/") +NV_FREE_X86_URL = "download.nvidia.com" +POTENTIAL_SHA256_EXTS = [".sha256sum", ".sha256"] +conn = http.client.HTTPSConnection(NV_FREE_X86_URL) +conn.request("GET", "/XFree86/Linux-x86_64/") +response = conn.getresponse() +dir_html = response.read() -assert (dl_dir.status < 400), "Error probably occurred" +assert (response.status < 400), "Error occurred fetching for source from" -def find_versions(dir_html: bytes) -> list[str]: - # this algorithm obviously need recursion because we need to discover the items - def _rec(dir_html: bytes, start: int = 0, so_far: list[str] = []) -> list[str]: +def scrape_driver_versions(dir_html: bytes) -> list[str]: + # The idea is to recursively follows all interesting `src` from `` + def _rec(dir_html: bytes, href_url_start: int = 0, so_far: list[str] = []) -> list[str]: MATCH_START = b"= 400: - return err_fn(res.status) - return then_fn(res.data) +download_urls_of = lambda ver: [f"/XFree86/Linux-x86_64/{ver}/NVIDIA-Linux-x86_64-{ver}.run"] +sha256_urls_of = lambda ver: [ + f"{url}{dl_ext}" + for dl_ext in POTENTIAL_SHA256_EXTS + for url in download_urls_of(ver) +] -identity = lambda e: e -none_id = lambda _: None - -def get_sha256(version: str) -> str | None: - for url in sha256_urls(version): - res = http.request("GET", url) - if res.status < 400: - return res.data.decode().split()[0] +def sha256_of(version: str) -> str | None: + for url in sha256_urls_of(version): + conn = http.client.HTTPSConnection(NV_FREE_X86_URL) + conn.request("GET", url) + response = conn.getresponse() + if response.status < 400: + return response.read().decode().split()[0] return None -fetch_data = [(v, download_urls(v)[0], get_sha256(v)) for v in versions] -fetch_data.append(("latest", *fetch_data[-1][1:])) +fetch_data = [(v, download_urls_of(v)[0], sha256_of(v)) for v in versions] +fetch_data.append(("latest", *fetch_data[-1][1:])) # now print the JSON object print(json.dumps({ version: { - "url": dl_url, + "url": f"https://{NV_FREE_X86_URL}{dl_url}", "sha256": sha256 } for (version, dl_url, sha256) in fetch_data if sha256 is not None}, indent=4)) # execution: fetch.py >nvidia_versions.json diff --git a/out-of-tree/nixGL/flake.nix b/out-of-tree/nixGL/flake.nix index bbb7c43..e266cfb 100644 --- a/out-of-tree/nixGL/flake.nix +++ b/out-of-tree/nixGL/flake.nix @@ -27,6 +27,8 @@ nixGLIntel = pkgs.nixGLIntel; nixVulkanNvidia = pkgs.auto.nixVulkanNvidia; nixVulkanIntel = pkgs.nixVulkanIntel; + + nvida-fetch }; # deprecated attributes for retro compatibility diff --git a/out-of-tree/nixGL/nvidia_versions.json b/out-of-tree/nixGL/nvidia_versions.json index 0241076..9d94b03 100644 --- a/out-of-tree/nixGL/nvidia_versions.json +++ b/out-of-tree/nixGL/nvidia_versions.json @@ -539,6 +539,10 @@ "url": "https://download.nvidia.com/XFree86/Linux-x86_64/470.161.03/NVIDIA-Linux-x86_64-470.161.03.run", "sha256": "5da82a7f8c76e781e7d7f0be7b798db4d344f26bd4facf9abcf3c71c71fe7640" }, + "470.182.03": { + "url": "https://download.nvidia.com/XFree86/Linux-x86_64/470.182.03/NVIDIA-Linux-x86_64-470.182.03.run", + "sha256": "3dbc1408fc48b865d3ddacefc45f4a3fc13b90b83a628ee546b0082ab2c3fc79" + }, "510.108.03": { "url": "https://download.nvidia.com/XFree86/Linux-x86_64/510.108.03/NVIDIA-Linux-x86_64-510.108.03.run", "sha256": "410a515e78df29c2cba4ac0b497889ce0ff1b04cfc711ff889e2dfc80f0da0d8" @@ -547,6 +551,10 @@ "url": "https://download.nvidia.com/XFree86/Linux-x86_64/515.86.01/NVIDIA-Linux-x86_64-515.86.01.run", "sha256": "141777e1ca2f11e97d8d33260213f1be327eb73922ae22f4ddab404bb2ef4664" }, + "515.105.01": { + "url": "https://download.nvidia.com/XFree86/Linux-x86_64/515.105.01/NVIDIA-Linux-x86_64-515.105.01.run", + "sha256": "9dd2221f26c847c864dfe80cc8533f322c5f4dfaa2939cf54a934b8f7a2f6a0d" + }, "525.53": { "url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.53/NVIDIA-Linux-x86_64-525.53.run", "sha256": "74bb0971f04f1dddd3c4641c891706fb96e8de52e22f6079e50de76d3a51687f" @@ -563,8 +571,28 @@ "url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.78.01/NVIDIA-Linux-x86_64-525.78.01.run", "sha256": "43da42d2bf69bc37ea9c7c0fa02f52db0dcc483c272f52edacad89a5cb495a93" }, + "525.85.05": { + "url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.85.05/NVIDIA-Linux-x86_64-525.85.05.run", + "sha256": "ea63b4253403b224bb7313a8977a920dfe9d203d661dd5f6fc26585a70179140" + }, + "525.89.02": { + "url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.89.02/NVIDIA-Linux-x86_64-525.89.02.run", + "sha256": "0e412c88c5bd98f842a839a6f64614f20e4c0950ef7cffb12b158a71633593e9" + }, + "525.105.17": { + "url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.105.17/NVIDIA-Linux-x86_64-525.105.17.run", + "sha256": "c635a21a282c9b53485f19ebb64a0f4b536a968b94d4d97629e0bc547a58142a" + }, + "530.30.02": { + "url": "https://download.nvidia.com/XFree86/Linux-x86_64/530.30.02/NVIDIA-Linux-x86_64-530.30.02.run", + "sha256": "47fddbbd7a22ba661923dbce6e7f51eec54df68050c406cc0490c3bfbede7963" + }, + "530.41.03": { + "url": "https://download.nvidia.com/XFree86/Linux-x86_64/530.41.03/NVIDIA-Linux-x86_64-530.41.03.run", + "sha256": "ae27a16a968c85503f5d161dda343c1602612b025f4aee15f92e2ea0acb784b1" + }, "latest": { - "url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.78.01/NVIDIA-Linux-x86_64-525.78.01.run", - "sha256": "43da42d2bf69bc37ea9c7c0fa02f52db0dcc483c272f52edacad89a5cb495a93" + "url": "https://download.nvidia.com/XFree86/Linux-x86_64/530.41.03/NVIDIA-Linux-x86_64-530.41.03.run", + "sha256": "ae27a16a968c85503f5d161dda343c1602612b025f4aee15f92e2ea0acb784b1" } } From 17937c2146649504850bbb6570f1e05cec7d56f5 Mon Sep 17 00:00:00 2001 From: Hung Date: Sun, 2 Apr 2023 01:35:36 -0700 Subject: [PATCH 38/64] nixGL/fetch: cleanup --- out-of-tree/nixGL/fetch.py | 15 +++++++++++---- out-of-tree/nixGL/flake.nix | 1 - 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/out-of-tree/nixGL/fetch.py b/out-of-tree/nixGL/fetch.py index d834b12..2435435 100755 --- a/out-of-tree/nixGL/fetch.py +++ b/out-of-tree/nixGL/fetch.py @@ -1,5 +1,6 @@ import http.client import json +import sys NV_FREE_X86_URL = "download.nvidia.com" POTENTIAL_SHA256_EXTS = [".sha256sum", ".sha256"] @@ -10,7 +11,7 @@ dir_html = response.read() assert (response.status < 400), "Error occurred fetching for source from" -def scrape_driver_versions(dir_html: bytes) -> list[str]: +def scrape_driver_versions(dir_html: bytes): # The idea is to recursively follows all interesting `src` from `` def _rec(dir_html: bytes, href_url_start: int = 0, so_far: list[str] = []) -> list[str]: MATCH_START = b" list[str]: assert version_end != -1, "Should have end-signaling /" so_far.append(dir_html[potential_version_start:version_end].decode()) return _rec(dir_html, version_end, so_far) - return _rec(dir_html, 0, []) - + + versions = _rec(dir_html, 0, []) + num_versions = len(versions) + right_pad = " " * 50 + for i, version in enumerate(versions): + print(f"[{i+1}/{num_versions}] Processing version {version}{right_pad}", end="\r", file=sys.stderr) + yield version + print() + versions = scrape_driver_versions(dir_html) download_urls_of = lambda ver: [f"/XFree86/Linux-x86_64/{ver}/NVIDIA-Linux-x86_64-{ver}.run"] @@ -58,4 +66,3 @@ print(json.dumps({ "sha256": sha256 } for (version, dl_url, sha256) in fetch_data if sha256 is not None}, indent=4)) # execution: fetch.py >nvidia_versions.json - diff --git a/out-of-tree/nixGL/flake.nix b/out-of-tree/nixGL/flake.nix index e266cfb..92fd789 100644 --- a/out-of-tree/nixGL/flake.nix +++ b/out-of-tree/nixGL/flake.nix @@ -28,7 +28,6 @@ nixVulkanNvidia = pkgs.auto.nixVulkanNvidia; nixVulkanIntel = pkgs.nixVulkanIntel; - nvida-fetch }; # deprecated attributes for retro compatibility From 1f511b052ce0b3ace6c3ae995d26a423f573fb44 Mon Sep 17 00:00:00 2001 From: Hung Date: Sun, 2 Apr 2023 11:49:46 -0700 Subject: [PATCH 39/64] nixGL/fetch: single-thread beats future --- out-of-tree/nixGL/fetch.py | 21 +++++++++++++++++---- out-of-tree/nixGL/nvidia_versions.json | 1 + 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/out-of-tree/nixGL/fetch.py b/out-of-tree/nixGL/fetch.py index 2435435..688a64e 100755 --- a/out-of-tree/nixGL/fetch.py +++ b/out-of-tree/nixGL/fetch.py @@ -1,9 +1,14 @@ +#!/usr/bin/env python3 +# execution: fetch.py >nvidia_versions.json + import http.client import json import sys NV_FREE_X86_URL = "download.nvidia.com" POTENTIAL_SHA256_EXTS = [".sha256sum", ".sha256"] +RIGHT_PAD = " " * 20 + conn = http.client.HTTPSConnection(NV_FREE_X86_URL) conn.request("GET", "/XFree86/Linux-x86_64/") response = conn.getresponse() @@ -32,9 +37,8 @@ def scrape_driver_versions(dir_html: bytes): versions = _rec(dir_html, 0, []) num_versions = len(versions) - right_pad = " " * 50 for i, version in enumerate(versions): - print(f"[{i+1}/{num_versions}] Processing version {version}{right_pad}", end="\r", file=sys.stderr) + print(f"[{i+1}/{num_versions}] Processing version {version}{RIGHT_PAD}", end="\r", file=sys.stderr) yield version print() @@ -48,15 +52,24 @@ sha256_urls_of = lambda ver: [ ] def sha256_of(version: str) -> str | None: + if int(version.split(".")[0]) < 256: + # Has 3 different packages that we should probably not bother + return None for url in sha256_urls_of(version): conn = http.client.HTTPSConnection(NV_FREE_X86_URL) conn.request("GET", url) response = conn.getresponse() if response.status < 400: return response.read().decode().split()[0] + print(f"No sha256 for {version}{RIGHT_PAD}", file=sys.stderr) return None -fetch_data = [(v, download_urls_of(v)[0], sha256_of(v)) for v in versions] +def fetch(version: str): + dl_url = download_urls_of(version)[0] + sha256 = sha256_of(version) + return (version, dl_url, sha256) + +fetch_data = [fetch(v) for v in versions] fetch_data.append(("latest", *fetch_data[-1][1:])) # now print the JSON object @@ -65,4 +78,4 @@ print(json.dumps({ "url": f"https://{NV_FREE_X86_URL}{dl_url}", "sha256": sha256 } for (version, dl_url, sha256) in fetch_data if sha256 is not None}, indent=4)) -# execution: fetch.py >nvidia_versions.json + diff --git a/out-of-tree/nixGL/nvidia_versions.json b/out-of-tree/nixGL/nvidia_versions.json index 9d94b03..97de4f2 100644 --- a/out-of-tree/nixGL/nvidia_versions.json +++ b/out-of-tree/nixGL/nvidia_versions.json @@ -1,3 +1,4 @@ + { "256.25": { "url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.25/NVIDIA-Linux-x86_64-256.25.run", From 3c483aeb893880e599bebe5824a2b09d4827c430 Mon Sep 17 00:00:00 2001 From: Hung Date: Tue, 2 May 2023 09:28:34 -0700 Subject: [PATCH 40/64] feat(hm): cpu usage now works on tmux --- c_.nix | 111 --- flake.lock | 1238 +++++++++--------------- flake.nix | 141 +-- native_configs/neovim/init.lua | 6 +- native_configs/ssh/config | 5 + native_configs/tmux/tmux.conf | 1 - nix-conf/home-manager/base/neovim.nix | 6 +- nix-conf/home-manager/base/shells.nix | 5 +- nix-conf/home-manager/flake.lock | 1279 +++++++++++++++++++++---- nix-conf/home-manager/flake.nix | 2 +- nix-conf/home-manager/home.nix | 2 +- nix/cells/dotfiles/default.nix | 0 nix/cells/dotfiles/devshells.nix | 8 + 13 files changed, 1587 insertions(+), 1217 deletions(-) delete mode 100644 c_.nix create mode 100644 nix/cells/dotfiles/default.nix create mode 100644 nix/cells/dotfiles/devshells.nix diff --git a/c_.nix b/c_.nix deleted file mode 100644 index f3ae7e2..0000000 --- a/c_.nix +++ /dev/null @@ -1,111 +0,0 @@ -# a small helper that only builds on top of builtins functions -_: (builtins // ( - let - formatSecondsSinceEpoch = t: - let - rem = x: y: x - x / y * y; - days = t / 86400; - secondsInDay = rem t 86400; - hours = secondsInDay / 3600; - minutes = (rem secondsInDay 3600) / 60; - seconds = rem t 60; - - # Courtesy of https://stackoverflow.com/a/32158604. - z = days + 719468; - era = (if z >= 0 then z else z - 146096) / 146097; - doe = z - era * 146097; - yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; - y = yoe + era * 400; - doy = doe - (365 * yoe + yoe / 4 - yoe / 100); - mp = (5 * doy + 2) / 153; - d = doy - (153 * mp + 2) / 5 + 1; - m = mp + (if mp < 10 then 3 else -9); - y' = y + (if m <= 2 then 1 else 0); - - pad = s: if builtins.stringLength s < 2 then "0" + s else s; - in - "${toString y'}${pad (toString m)}${pad (toString d)}${pad (toString hours)}" - + "${pad (toString minutes)}${pad (toString seconds)}"; - - fetchTree = - # this is the value of flake.lock#lock.nodes.${input_name}.locked - { type - , host ? "" - , owner ? "" - , repo ? "" - , rev ? "" - , submodules ? "" - , path ? "" - , narHash ? null - , lastModified ? 0 - , src ? ./. - }@info: - if info.type == "github" then - { - outPath = - fetchTarball - ({ - url = "https://api.${info.host or "github.com"}/repos/" - + "${info.owner}/${info.repo}/tarball/${info.rev}"; - } - // (if info ? narHash then { sha256 = info.narHash; } else { }) - ); - rev = info.rev; - shortRev = builtins.substring 0 7 info.rev; - lastModified = info.lastModified; - lastModifiedDate = formatSecondsSinceEpoch info.lastModified; - narHash = info.narHash; - } - else if info.type == "git" then - { - outPath = - builtins.fetchGit - ({ url = info.url; } - // (if info ? rev then { inherit (info) rev; } else { }) - // (if info ? ref then { inherit (info) ref; } else { }) - // (if info ? submodules then { inherit (info) submodules; } else { }) - ); - lastModified = info.lastModified; - lastModifiedDate = formatSecondsSinceEpoch info.lastModified; - narHash = info.narHash; - } // (if info ? rev then { - rev = info.rev; - shortRev = builtins.substring 0 7 info.rev; - } else { }) - else if info.type == "path" then - { - outPath = builtins.path { - path = - if builtins.substring 0 1 info.path != "/" - then src + ("/" + info.path) # make this absolute path by prepending ./ - else info.path; # it's already an absolute path - }; - narHash = info.narHash; - } - else if info.type == "tarball" then - { - outPath = - fetchTarball - ({ inherit (info) url; } - // (if info ? narHash then { sha256 = info.narHash; } else { }) - ); - } - else if info.type == "gitlab" then - { - inherit (info) rev narHash lastModified; - outPath = - fetchTarball - ({ url = "https://${info.host or "gitlab.com"}/api/v4/projects/${info.owner}%2F${info.repo}/repository/archive.tar.gz?sha=${info.rev}"; } - // (if info ? narHash then { sha256 = info.narHash; } else { }) - ); - shortRev = builtins.substring 0 7 info.rev; - } - else - # FIXME: add Mercurial, tarball inputs. - throw "flake input has unsupported input type '${info.type}'"; - in - { - inherit fetchTree; - } -)) nil - diff --git a/flake.lock b/flake.lock index cf9b2d8..cdfd6b8 100644 --- a/flake.lock +++ b/flake.lock @@ -1,74 +1,52 @@ { "nodes": { - "advisory-db": { - "flake": false, + "blank": { "locked": { - "lastModified": 1678924180, - "narHash": "sha256-5bwage/7JRiPiDY4wY3+OBiT8abY5f83hss6pQBklz8=", - "owner": "rustsec", - "repo": "advisory-db", - "rev": "0888b44843e3c86db9fd56334c7f5261ea00dc19", + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", "type": "github" }, "original": { - "owner": "rustsec", - "repo": "advisory-db", + "owner": "divnix", + "repo": "blank", "type": "github" } }, - "agenix": { - "inputs": { - "darwin": "darwin", - "nixpkgs": [ - "nixpkgs" - ] - }, + "colmena": { "locked": { - "lastModified": 1680281360, - "narHash": "sha256-XdLTgAzjJNDhAG2V+++0bHpSzfvArvr2pW6omiFfEJk=", - "owner": "ryantm", - "repo": "agenix", - "rev": "e64961977f60388dd0b49572bb0fc453b871f896", + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", "type": "github" }, "original": { - "owner": "ryantm", - "repo": "agenix", - "type": "github" - } - }, - "cargo-leptos": { - "flake": false, - "locked": { - "lastModified": 1680094968, - "narHash": "sha256-LWi+KxvtIPP67vNe1Edf7AT8y4nKJ6jawTJtSEpt+4I=", - "owner": "leptos-rs", - "repo": "cargo-leptos", - "rev": "6512bd2dc891fead2b7ff7f08d26b89789be7682", - "type": "github" - }, - "original": { - "owner": "leptos-rs", - "repo": "cargo-leptos", + "owner": "divnix", + "repo": "blank", "type": "github" } }, "crane": { "inputs": { - "flake-compat": "flake-compat_3", - "flake-utils": "flake-utils_3", + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_2", "nixpkgs": [ - "nickel", + "std", + "paisano-mdbook-preprocessor", "nixpkgs" ], "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1678152261, - "narHash": "sha256-cPRDxwygVMleiSEGELrvAiq9vYAN4c3KK/K4UEO13vU=", + "lastModified": 1676162383, + "narHash": "sha256-krUCKdz7ebHlFYm/A7IbKDnj2ZmMMm3yIEQcooqm7+E=", "owner": "ipetkov", "repo": "crane", - "rev": "5291dd0aa7a52d607fc952763ef60714e4c881d4", + "rev": "6fb400ec631b22ccdbc7090b38207f7fb5cfb5f2", "type": "github" }, "original": { @@ -77,64 +55,124 @@ "type": "github" } }, - "crane_2": { + "deploy-rs": { "inputs": { - "flake-compat": "flake-compat_5", - "flake-utils": "flake-utils_5", - "nixpkgs": [ - "nickel", - "topiary", - "nixpkgs" - ], - "rust-overlay": "rust-overlay_3" + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs", + "utils": "utils" }, "locked": { - "lastModified": 1678152261, - "narHash": "sha256-cPRDxwygVMleiSEGELrvAiq9vYAN4c3KK/K4UEO13vU=", - "owner": "ipetkov", - "repo": "crane", - "rev": "5291dd0aa7a52d607fc952763ef60714e4c881d4", + "lastModified": 1682063650, + "narHash": "sha256-VaDHh2z6xlnTHaONlNVHP7qEMcK5rZ8Js3sT6mKb2XY=", + "owner": "serokell", + "repo": "deploy-rs", + "rev": "c2ea4e642dc50fd44b537e9860ec95867af30d39", "type": "github" }, "original": { - "owner": "ipetkov", - "repo": "crane", + "owner": "serokell", + "repo": "deploy-rs", "type": "github" } }, - "darwin": { + "devshell": { "inputs": { + "flake-utils": [ + "std", + "flake-utils" + ], "nixpkgs": [ - "agenix", + "std", "nixpkgs" ] }, "locked": { - "lastModified": 1673295039, - "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", - "owner": "lnl7", - "repo": "nix-darwin", - "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", + "lastModified": 1678957337, + "narHash": "sha256-Gw4nVbuKRdTwPngeOZQOzH/IFowmz4LryMPDiJN/ah4=", + "owner": "numtide", + "repo": "devshell", + "rev": "3e0e60ab37cd0bf7ab59888f5c32499d851edb47", "type": "github" }, "original": { - "owner": "lnl7", - "ref": "master", - "repo": "nix-darwin", + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "disko": { + "locked": { + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "blank", + "type": "github" + } + }, + "dmerge": { + "inputs": { + "nixlib": [ + "std", + "nixpkgs" + ], + "yants": [ + "std", + "yants" + ] + }, + "locked": { + "lastModified": 1659548052, + "narHash": "sha256-fzI2gp1skGA8mQo/FBFrUAtY0GQkAIAaV/V127TJPyY=", + "owner": "divnix", + "repo": "data-merge", + "rev": "d160d18ce7b1a45b88344aa3f13ed1163954b497", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "data-merge", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": "nixpkgs_5", + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1677306201, + "narHash": "sha256-VZ9x7qdTosFvVsrpgFHrtYfT6PU3yMIs7NRYn9ELapI=", + "owner": "nix-community", + "repo": "fenix", + "rev": "0923f0c162f65ae40261ec940406049726cfeab4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", "type": "github" } }, "flake-compat": { "flake": false, "locked": { - "lastModified": 1, - "narHash": "sha256-d6CilJXP+UPv3nF00zBBRhMgRklTCjSCMrjbYtYDuOI=", - "path": "out-of-tree/flake-compat", - "type": "path" + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" }, "original": { - "path": "out-of-tree/flake-compat", - "type": "path" + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" } }, "flake-compat_2": { @@ -153,101 +191,7 @@ "type": "github" } }, - "flake-compat_3": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_4": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_5": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_6": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-utils": { - "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_10": { - "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_11": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -277,436 +221,164 @@ "type": "github" } }, - "flake-utils_3": { - "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_4": { - "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_5": { - "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_6": { - "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_7": { - "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_8": { - "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_9": { - "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "gitignore": { + "haumea": { "inputs": { "nixpkgs": [ - "nickel", - "pre-commit-hooks", + "hive", "nixpkgs" ] }, "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "lastModified": 1681873442, + "narHash": "sha256-wsOEGbDKf+M/THE7JZi43s4szXTuIaiQNBxlb5Lnxs0=", + "owner": "nix-community", + "repo": "haumea", + "rev": "85038436851caf5bbf652a2fedf38b2b28e38caf", "type": "github" }, "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", + "owner": "nix-community", + "ref": "v0.2.1", + "repo": "haumea", "type": "github" } }, - "gnmic": { - "flake": false, - "locked": { - "lastModified": 1679677474, - "narHash": "sha256-Flzajl4GYPnxlnLAlcR/KzAoPE76jMFBThztAijfPj4=", - "owner": "openconfig", - "repo": "gnmic", - "rev": "c1e3239a694da71b3b290bf7805f3d18e84694e6", - "type": "github" - }, - "original": { - "owner": "openconfig", - "repo": "gnmic", - "type": "github" - } - }, - "gomod2nix": { + "hive": { "inputs": { - "nixpkgs": "nixpkgs_4", - "utils": "utils_2" + "colmena": "colmena", + "disko": "disko", + "haumea": "haumea", + "home-manager": "home-manager", + "nixos-generators": "nixos-generators", + "nixpkgs": "nixpkgs_2", + "paisano": "paisano" }, "locked": { - "lastModified": 1677459247, - "narHash": "sha256-JbakfAiPYmCCV224yAMq/XO0udN5coWv/oazblMKdoY=", - "owner": "nix-community", - "repo": "gomod2nix", - "rev": "3cbf3a51fe32e2f57af4c52744e7228bab22983d", + "lastModified": 1682269418, + "narHash": "sha256-0fdUrQMkXMuK1/6D1Y+gbGXIWChiIRnlbYvo4dmNfVE=", + "owner": "divnix", + "repo": "hive", + "rev": "669cdfcf61823d33f11a4fe5ee1f3c34903f4eaa", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "gomod2nix", + "owner": "divnix", + "repo": "hive", "type": "github" } }, "home-manager": { + "locked": { + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "blank", + "type": "github" + } + }, + "incl": { "inputs": { - "nixpkgs": [ + "nixlib": [ + "std", "nixpkgs" + ] + }, + "locked": { + "lastModified": 1669263024, + "narHash": "sha256-E/+23NKtxAqYG/0ydYgxlgarKnxmDbg6rCMWnOBqn9Q=", + "owner": "divnix", + "repo": "incl", + "rev": "ce7bebaee048e4cd7ebdb4cee7885e00c4e2abca", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "incl", + "type": "github" + } + }, + "n2c": { + "inputs": { + "flake-utils": [ + "std", + "flake-utils" ], - "utils": "utils" - }, - "locked": { - "lastModified": 1680389554, - "narHash": "sha256-+8FUmS4GbDMynQErZGXKg+wU76rq6mI5fprxFXFWKSM=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "ddd8866c0306c48f465e7f48432e6f1ecd1da7f8", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, - "kpcli-py": { - "flake": false, - "locked": { - "lastModified": 1679142558, - "narHash": "sha256-l18PBzf/P7d3BPcFb5gSDX863MsC7S747qooyg0u2lA=", - "owner": "rebkwok", - "repo": "kpcli", - "rev": "1c64e7274345d28ebc2607e22211a4ee9f6dbe7f", - "type": "github" - }, - "original": { - "owner": "rebkwok", - "repo": "kpcli", - "type": "github" - } - }, - "naersk": { - "inputs": { - "nixpkgs": "nixpkgs_5" - }, - "locked": { - "lastModified": 1679567394, - "narHash": "sha256-ZvLuzPeARDLiQUt6zSZFGOs+HZmE+3g4QURc8mkBsfM=", - "owner": "nix-community", - "repo": "naersk", - "rev": "88cd22380154a2c36799fe8098888f0f59861a15", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "naersk", - "type": "github" - } - }, - "neovim-flake": { - "inputs": { - "flake-utils": "flake-utils_2", "nixpkgs": [ - "neovim-nightly-overlay", + "std", "nixpkgs" ] }, "locked": { - "dir": "contrib", - "lastModified": 1680310604, - "narHash": "sha256-2jop/z79HYhmV/hrdGvhjfTMouvzQvNRgFTkPhwWVcg=", - "owner": "neovim", - "repo": "neovim", - "rev": "75e1b1d5c934aa3a12693a7df58795563fb7877e", + "lastModified": 1677330646, + "narHash": "sha256-hUYCwJneMjnxTvj30Fjow6UMJUITqHlpUGpXMPXUJsU=", + "owner": "nlewo", + "repo": "nix2container", + "rev": "ebca8f58d450cae1a19c07701a5a8ae40afc9efc", "type": "github" }, "original": { - "dir": "contrib", - "owner": "neovim", - "repo": "neovim", + "owner": "nlewo", + "repo": "nix2container", "type": "github" } }, - "neovim-nightly-overlay": { - "inputs": { - "flake-compat": "flake-compat_2", - "neovim-flake": "neovim-flake", - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1680336751, - "narHash": "sha256-otSdFRXsNyPYOsbo+49vN4UGwZrVoLDrEp0EkyVJ/rY=", - "owner": "nix-community", - "repo": "neovim-nightly-overlay", - "rev": "d56f32281f4d6d74ce925a99946713dc6b5a0e30", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "neovim-nightly-overlay", - "type": "github" - } - }, - "nickel": { - "inputs": { - "crane": "crane", - "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs_2", - "pre-commit-hooks": "pre-commit-hooks", - "rust-overlay": "rust-overlay_2", - "topiary": "topiary" - }, - "locked": { - "lastModified": 1680275475, - "narHash": "sha256-Aoq+njIRAsparRyTx6LmuqbkJIWVZmrtt3p2aUhv6eM=", - "owner": "tweag", - "repo": "nickel", - "rev": "f0854b9992a1af5228fa4828a65c3660966c271c", - "type": "github" - }, - "original": { - "owner": "tweag", - "repo": "nickel", - "type": "github" - } - }, - "nix-boost": { - "inputs": { - "cargo-leptos": "cargo-leptos", - "flake-compat": "flake-compat_6", - "gnmic": "gnmic", - "gomod2nix": "gomod2nix", - "naersk": "naersk", - "nixlib": "nixlib", - "nixpkgs": "nixpkgs_6", - "poetry2nix": "poetry2nix", - "rust-overlay": "rust-overlay_5" - }, - "locked": { - "lastModified": 1680312007, - "narHash": "sha256-bFjiXGxNKtytv2wWnBwG1TfBpCNl5DYK2pckbXPacsM=", - "ref": "refs/heads/master", - "rev": "2d8e3de16bc41c12a77bfc8721bb1f6a4cd484c5", - "revCount": 51, - "type": "git", - "url": "https://git.pegasust.com/pegasust/nix-boost.git" - }, - "original": { - "type": "git", - "url": "https://git.pegasust.com/pegasust/nix-boost.git" - } - }, - "nix-filter": { - "locked": { - "lastModified": 1678109515, - "narHash": "sha256-C2X+qC80K2C1TOYZT8nabgo05Dw2HST/pSn6s+n6BO8=", - "owner": "numtide", - "repo": "nix-filter", - "rev": "aa9ff6ce4a7f19af6415fb3721eaa513ea6c763c", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "nix-filter", - "type": "github" - } - }, - "nix-index-database": { + "nixago": { "inputs": { + "flake-utils": [ + "std", + "flake-utils" + ], + "nixago-exts": [ + "std", + "blank" + ], "nixpkgs": [ + "std", "nixpkgs" ] }, "locked": { - "lastModified": 1679224439, - "narHash": "sha256-QkvcuC4b67FUkkxlMsLTMPbwoD7yZr0UvJpu6jkFuLo=", - "owner": "mic92", - "repo": "nix-index-database", - "rev": "2f5e6e915d70c04d673a8930f94591595c73eb84", + "lastModified": 1682297764, + "narHash": "sha256-KcE95ua4IA+nwpaP53Se0x1TZxR538fGGEm8edaLuzU=", + "owner": "nix-community", + "repo": "nixago", + "rev": "d68634526733c79a2ca4fcc87c25a1ceabf132f4", "type": "github" }, "original": { - "owner": "mic92", - "repo": "nix-index-database", + "owner": "nix-community", + "repo": "nixago", "type": "github" } }, - "nixgl": { - "inputs": { - "flake-utils": "flake-utils_10", - "nixpkgs": "nixpkgs_8" - }, + "nixos-generators": { "locked": { - "lastModified": 1, - "narHash": "sha256-fPPUpYHcU9od0bdrzHCgbIKDqFs35u+YTt3jKf+EiMQ=", - "path": "out-of-tree/nixGL", - "type": "path" - }, - "original": { - "path": "out-of-tree/nixGL", - "type": "path" - } - }, - "nixlib": { - "locked": { - "lastModified": 1679791877, - "narHash": "sha256-tTV1Mf0hPWIMtqyU16Kd2JUBDWvfHlDC9pF57vcbgpQ=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "cc060ddbf652a532b54057081d5abd6144d01971", + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, - "nixlib_2": { - "locked": { - "lastModified": 1680397293, - "narHash": "sha256-wBpJ73+tJ8fZSWb4tzNbAVahC4HSo2QG3nICDy4ExBQ=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "b18d328214ca3c627d3cc3f51fd9d1397fdbcd7a", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", + "owner": "divnix", + "repo": "blank", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1671983799, - "narHash": "sha256-Z2Ro6hFPZHkBqkVXY5/aBUzxi5xizQGvuHQ9+T5B/ks=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "fad51abd42ca17a60fc1d4cb9382e2d79ae31836", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1678872516, - "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", + "lastModified": 1671417167, + "narHash": "sha256-JkHam6WQOwZN1t2C2sbp1TqMv3TVRjzrdoejqfefwrM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-22.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_10": { - "locked": { - "lastModified": 1665296151, - "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "rev": "bb31220cca6d044baa6dc2715b07497a2a7c4bc7", "type": "github" }, "original": { @@ -718,72 +390,59 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1678898370, - "narHash": "sha256-xTICr1j+uat5hk9FyuPOFGxpWHdJRibwZC+ATi0RbtE=", - "owner": "NixOS", + "lastModified": 1675940568, + "narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "ac718d02867a84b42522a0ece52d841188208f2c", + "rev": "6ccc4a59c3f1b56d039d93da52696633e641bc71", "type": "github" }, "original": { - "id": "nixpkgs", - "ref": "nixos-unstable", - "type": "indirect" + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" } }, "nixpkgs_3": { "locked": { - "lastModified": 1665296151, - "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", - "owner": "NixOS", + "lastModified": 1683014792, + "narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", + "owner": "nixos", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_4": { "locked": { - "lastModified": 1658285632, - "narHash": "sha256-zRS5S/hoeDGUbO+L95wXG9vJNwsSYcl93XiD0HQBXLk=", - "owner": "NixOS", + "lastModified": 1675940568, + "narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=", + "owner": "nixos", "repo": "nixpkgs", - "rev": "5342fc6fb59d0595d26883c3cadff16ce58e44f3", + "rev": "6ccc4a59c3f1b56d039d93da52696633e641bc71", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "master", + "owner": "nixos", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_5": { "locked": { - "lastModified": 1680273054, - "narHash": "sha256-Bs6/5LpvYp379qVqGt9mXxxx9GSE789k3oFc+OAL07M=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "3364b5b117f65fe1ce65a3cdd5612a078a3b31e3", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_6": { - "locked": { - "lastModified": 1680213900, - "narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=", + "lastModified": 1677063315, + "narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e3652e0735fbec227f342712f180f4f21f0594f2", + "rev": "988cc958c57ce4350ec248d2d53087777f9e1949", "type": "github" }, "original": { @@ -793,138 +452,205 @@ "type": "github" } }, - "nixpkgs_7": { + "nosys": { "locked": { - "lastModified": 1665296151, - "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "lastModified": 1668010795, + "narHash": "sha256-JBDVBnos8g0toU7EhIIqQ1If5m/nyBqtHhL3sicdPwI=", + "owner": "divnix", + "repo": "nosys", + "rev": "feade0141487801c71ff55623b421ed535dbdefa", "type": "github" }, "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", + "owner": "divnix", + "repo": "nosys", "type": "github" } }, - "nixpkgs_8": { + "nosys_2": { "locked": { - "lastModified": 1660551188, - "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "441dc5d512153039f19ef198e662e4f3dbb9fd65", + "lastModified": 1668010795, + "narHash": "sha256-JBDVBnos8g0toU7EhIIqQ1If5m/nyBqtHhL3sicdPwI=", + "owner": "divnix", + "repo": "nosys", + "rev": "feade0141487801c71ff55623b421ed535dbdefa", "type": "github" }, "original": { - "owner": "nixos", - "repo": "nixpkgs", + "owner": "divnix", + "repo": "nosys", "type": "github" } }, - "nixpkgs_9": { - "locked": { - "lastModified": 1680213900, - "narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "e3652e0735fbec227f342712f180f4f21f0594f2", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-unstable", - "type": "indirect" - } - }, - "poetry2nix": { + "paisano": { "inputs": { - "flake-utils": "flake-utils_8", "nixpkgs": [ - "nix-boost", + "hive", + "nixpkgs" + ], + "nosys": "nosys", + "yants": "yants" + }, + "locked": { + "lastModified": 1678562978, + "narHash": "sha256-GaPyKdB0RvSBIgPxKkdJHTG/FyKsT0Ku5zifLEjr3QQ=", + "owner": "divnix", + "repo": "paisano", + "rev": "f71a2db9414d66663c03a65ade97a9f353fb6d55", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "paisano", + "type": "github" + } + }, + "paisano-actions": { + "inputs": { + "nixpkgs": [ + "std", + "paisano-mdbook-preprocessor", "nixpkgs" ] }, "locked": { - "lastModified": 1680134979, - "narHash": "sha256-8LBOnyrk9r1X8LpxZWynIxr97vq8hRqnpo639c2RA40=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "dc8c13ab88db829c1b71e6c794d1b295c8031408", + "lastModified": 1677306424, + "narHash": "sha256-H9/dI2rGEbKo4KEisqbRPHFG2ajF8Tm111NPdKGIf28=", + "owner": "paisano-nix", + "repo": "actions", + "rev": "65ec4e080b3480167fc1a748c89a05901eea9a9b", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "poetry2nix", + "owner": "paisano-nix", + "repo": "actions", "type": "github" } }, - "pre-commit-hooks": { + "paisano-mdbook-preprocessor": { "inputs": { - "flake-compat": "flake-compat_4", - "flake-utils": [ - "nickel", - "flake-utils" - ], - "gitignore": "gitignore", + "crane": "crane", + "fenix": "fenix", "nixpkgs": [ - "nickel", + "std", "nixpkgs" ], - "nixpkgs-stable": "nixpkgs-stable" + "paisano-actions": "paisano-actions", + "std": [ + "std" + ] }, "locked": { - "lastModified": 1678976941, - "narHash": "sha256-skNr08frCwN9NO+7I77MjOHHAw+L410/37JknNld+W4=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "32b1dbedfd77892a6e375737ef04d8efba634e9e", + "lastModified": 1680654400, + "narHash": "sha256-Qdpio+ldhUK3zfl22Mhf8HUULdUOJXDWDdO7MIK69OU=", + "owner": "paisano-nix", + "repo": "mdbook-paisano-preprocessor", + "rev": "11a8fc47f574f194a7ae7b8b98001f6143ba4cf1", "type": "github" }, "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", + "owner": "paisano-nix", + "repo": "mdbook-paisano-preprocessor", + "type": "github" + } + }, + "paisano-tui": { + "inputs": { + "nixpkgs": [ + "std", + "blank" + ], + "std": [ + "std" + ] + }, + "locked": { + "lastModified": 1681847764, + "narHash": "sha256-mdd7PJW1BZvxy0cIKsPfAO+ohVl/V7heE5ZTAHzTdv8=", + "owner": "paisano-nix", + "repo": "tui", + "rev": "3096bad91cae73ab8ab3367d31f8a143d248a244", + "type": "github" + }, + "original": { + "owner": "paisano-nix", + "ref": "0.1.1", + "repo": "tui", + "type": "github" + } + }, + "paisano_2": { + "inputs": { + "nixpkgs": [ + "std", + "nixpkgs" + ], + "nosys": "nosys_2", + "yants": [ + "std", + "yants" + ] + }, + "locked": { + "lastModified": 1678949904, + "narHash": "sha256-oAoF66hYYz1RPh3lEwb9/4e4iyBAfTbQKZRRQ8gP0Ds=", + "owner": "paisano-nix", + "repo": "core", + "rev": "88f2aff10a5064551d1d4cb86800d17084489ce3", + "type": "github" + }, + "original": { + "owner": "paisano-nix", + "repo": "core", "type": "github" } }, "root": { "inputs": { - "agenix": "agenix", - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", - "home-manager": "home-manager", - "kpcli-py": "kpcli-py", - "neovim-nightly-overlay": "neovim-nightly-overlay", - "nickel": "nickel", - "nix-boost": "nix-boost", - "nix-index-database": "nix-index-database", - "nixgl": "nixgl", - "nixlib": "nixlib_2", - "nixpkgs": "nixpkgs_9", - "rust-overlay": "rust-overlay_6" + "deploy-rs": "deploy-rs", + "hive": "hive", + "nixpkgs": "nixpkgs_3", + "std": "std" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1677221702, + "narHash": "sha256-1M+58rC4eTCWNmmX0hQVZP20t3tfYNunl9D/PrGUyGE=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "f5401f620699b26ed9d47a1d2e838143a18dbe3b", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" } }, "rust-overlay": { "inputs": { "flake-utils": [ - "nickel", + "std", + "paisano-mdbook-preprocessor", "crane", "flake-utils" ], "nixpkgs": [ - "nickel", + "std", + "paisano-mdbook-preprocessor", "crane", "nixpkgs" ] }, "locked": { - "lastModified": 1677812689, - "narHash": "sha256-EakqhgRnjVeYJv5+BJx/NZ7/eFTMBxc4AhICUNquhUg=", + "lastModified": 1675391458, + "narHash": "sha256-ukDKZw922BnK5ohL9LhwtaDAdCsJL7L6ScNEyF1lO9w=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "e53e8853aa7b0688bc270e9e6a681d22e01cf299", + "rev": "383a4acfd11d778d5c2efcf28376cbd845eeaedf", "type": "github" }, "original": { @@ -933,150 +659,54 @@ "type": "github" } }, - "rust-overlay_2": { + "std": { "inputs": { - "flake-utils": [ - "nickel", - "flake-utils" + "arion": [ + "std", + "blank" ], - "nixpkgs": [ - "nickel", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1679106165, - "narHash": "sha256-03Opt2yu4E/AIFjvlgib0/nhMn6B4B/t/nvwS2bzOGw=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "7313c06ac334d6262ddfe30a38b3abc3da6bd565", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_3": { - "inputs": { - "flake-utils": [ - "nickel", - "topiary", - "crane", - "flake-utils" + "blank": "blank", + "devshell": "devshell", + "dmerge": "dmerge", + "flake-utils": "flake-utils", + "incl": "incl", + "makes": [ + "std", + "blank" ], - "nixpkgs": [ - "nickel", - "topiary", - "crane", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1677812689, - "narHash": "sha256-EakqhgRnjVeYJv5+BJx/NZ7/eFTMBxc4AhICUNquhUg=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "e53e8853aa7b0688bc270e9e6a681d22e01cf299", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_4": { - "inputs": { - "flake-utils": "flake-utils_7", - "nixpkgs": "nixpkgs_3" - }, - "locked": { - "lastModified": 1679106165, - "narHash": "sha256-03Opt2yu4E/AIFjvlgib0/nhMn6B4B/t/nvwS2bzOGw=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "7313c06ac334d6262ddfe30a38b3abc3da6bd565", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_5": { - "inputs": { - "flake-utils": "flake-utils_9", - "nixpkgs": "nixpkgs_7" - }, - "locked": { - "lastModified": 1680229280, - "narHash": "sha256-9UoyQCeKUmHcsIdpsAgcz41LAIDkWhI2PhVDjckrpg0=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "aa480d799023141e1b9e5d6108700de63d9ad002", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_6": { - "inputs": { - "flake-utils": "flake-utils_11", - "nixpkgs": "nixpkgs_10" - }, - "locked": { - "lastModified": 1680401949, - "narHash": "sha256-s8+b9Zm9osz9oGInNletIFihgXTs9hogw9C/c3MbErs=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "9b8632040df6f2218fd01bf79c0589379ac39584", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "topiary": { - "inputs": { - "advisory-db": "advisory-db", - "crane": "crane_2", - "flake-utils": "flake-utils_6", - "nix-filter": "nix-filter", - "nixpkgs": [ - "nickel", - "nixpkgs" + "microvm": [ + "std", + "blank" ], - "rust-overlay": "rust-overlay_4" + "n2c": "n2c", + "nixago": "nixago", + "nixpkgs": "nixpkgs_4", + "paisano": "paisano_2", + "paisano-mdbook-preprocessor": "paisano-mdbook-preprocessor", + "paisano-tui": "paisano-tui", + "yants": "yants_2" }, "locked": { - "lastModified": 1680178226, - "narHash": "sha256-EZtmLYPQII8Ma9yH0udqlNjSXiYUg134j+0Srzb4rbM=", - "owner": "tweag", - "repo": "topiary", - "rev": "1af03d77abf6aef3ea36f878554c16619207252b", + "lastModified": 1682297963, + "narHash": "sha256-lB89W0c4/gqArk2g7bOhsDHMgYz29E+yaYyCK35D9A4=", + "owner": "divnix", + "repo": "std", + "rev": "a0f9dd33cff37e2c532e2c236d011e2ecd77286d", "type": "github" }, "original": { - "owner": "tweag", - "repo": "topiary", + "owner": "divnix", + "repo": "std", "type": "github" } }, "utils": { "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { @@ -1085,18 +715,46 @@ "type": "github" } }, - "utils_2": { + "yants": { + "inputs": { + "nixpkgs": [ + "hive", + "paisano", + "nixpkgs" + ] + }, "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "lastModified": 1677285314, + "narHash": "sha256-hlAcg2514zKrPu8jn24BUsIjjvXvCLdw1jvKgBTpqko=", + "owner": "divnix", + "repo": "yants", + "rev": "9eab24b273ce021406c852166c216b86e2bb4ec4", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "divnix", + "repo": "yants", + "type": "github" + } + }, + "yants_2": { + "inputs": { + "nixpkgs": [ + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1667096281, + "narHash": "sha256-wRRec6ze0gJHmGn6m57/zhz/Kdvp9HS4Nl5fkQ+uIuA=", + "owner": "divnix", + "repo": "yants", + "rev": "d18f356ec25cb94dc9c275870c3a7927a10f8c3c", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "yants", "type": "github" } } diff --git a/flake.nix b/flake.nix index 0cdf8e7..f074dd4 100644 --- a/flake.nix +++ b/flake.nix @@ -6,123 +6,36 @@ }; description = "My personal configuration in Nix (and some native configurations)"; inputs = { - nixpkgs.url = "nixpkgs/nixos-unstable"; - # continously merged & rebased lightweight .lib. Basically a huge extension to c_. - nixlib.url = "github:nix-community/nixpkgs.lib"; - agenix = { - url = "github:ryantm/agenix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - flake-utils.url = "github:numtide/flake-utils"; - nixgl.url = "path:out-of-tree/nixGL"; - rust-overlay.url = "github:oxalica/rust-overlay"; - # Allows default.nix to call onto flake.nix. Useful for nix eval and automations - flake-compat = { - url = "path:out-of-tree/flake-compat"; - flake = false; - }; - kpcli-py = { - url = "github:rebkwok/kpcli"; - flake = false; - }; - neovim-nightly-overlay = { - url = "github:nix-community/neovim-nightly-overlay"; - inputs.nixpkgs.url = "github:nixos/nixpkgs?rev=fad51abd42ca17a60fc1d4cb9382e2d79ae31836"; - }; - nix-index-database = { - url = "github:mic92/nix-index-database"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - nickel.url = "github:tweag/nickel"; - nix-boost.url = "git+https://git.pegasust.com/pegasust/nix-boost.git"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + deploy-rs.url = "github:serokell/deploy-rs"; + std.url = "github:divnix/std"; + hive.url = "github:divnix/hive"; }; - outputs = - { nixpkgs - , agenix - , home-manager - , flake-utils - , nixgl - , rust-overlay - , flake-compat - , neovim-nightly-overlay - , nix-index-database - , nixlib - , nickel - , ... - }@_inputs: - let - # config_fn:: system -> config - # this function should take simple exports of homeConfigurations.${profile}, - # nixosConfigurations.${profile}, devShells.${profile}, packages.${profile} - # and correctly produce - supported_systems = flake-utils.lib.defaultSystems; - forEachSystem = nixpkgs.lib.genAttrs supported_systems; - in - let - proj_root = - let - path = builtins.toString ./.; - in - { - inherit path; - configs.path = "${path}/native_configs"; - scripts.path = "${path}/scripts"; - secrets.path = "${path}/secrets"; - testdata.path = "${path}/tests"; - modules.path = "${path}/modules"; - hosts.path = "${path}/hosts"; - users.path = "${path}/users"; - }; - overlays = forEachSystem (system: import ./overlays.nix (_inputs // { inherit system; })); - pkgs = forEachSystem (system: (import nixpkgs { - inherit system; - overlays = overlays.${system}; - config = { - allowUnfree = true; - }; - })); - lib = (builtins.foldl' (lhs: rhs: (nixpkgs.lib.recursiveUpdate lhs rhs)) { } [ - nixpkgs.lib - nixlib.lib - ]); - inputs_w_lib = forEachSystem ( - system: lib.recursiveUpdate _inputs { - inherit system lib; - pkgs = pkgs.${system}; - } - ); - - modules = (import ./modules inputs_w_lib); - hosts = (import ./hosts inputs_w_lib); - users = (import ./users inputs_w_lib); - - # {nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat - # ,pkgs, lib (extended), proj_root} - final_inputs = inputs_w_lib; - in + outputs = { std, hive, ... }@inputs: std.growOn { - inherit (hosts) nixosConfigurations; - inherit (users) homeConfigurations; - inherit lib proj_root; - devShells = forEachSystem (system: - {default = (import ./dev-shell.nix final_inputs.${system});} - ); - templates = forEachSystem (system: import ./templates final_inputs.${system}); - secrets = { - pubKeys = { - hosts = hosts.pubKeys; - users = users.pubKeys; - }; - }; + # boilerplate + inherit inputs; + # All cell blocks are under ./nix/cells// as `.nix` + # or `, range, ...} ---@type string - local contrast = (opts.arg; - vim.g.gruvbox_contrast_dark = contrast; + local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_light; + = contrast; vim.opt.background = "dark"; end, { nargs = "?", }) @@ -616,7 +616,7 @@ require("mason").setup({ }, check_outdated_packages_on_open = true, }, - -- The default settings is "prepend" https://github.com/williamboman/mason.nvim#default-configuration + -- NOTE: The default settings is "prepend" https://github.com/williamboman/mason.nvim#default-configuration -- Which means Mason's installed path is prioritized against our local install -- see: https://git.pegasust.com/pegasust/aoc/commit/b45dc32c74d84c9f787ebce7a174c9aa1d411fc2 -- This introduces some pitfalls, so we'll take the approach of trusting user's local installation diff --git a/native_configs/ssh/config b/native_configs/ssh/config index e88290b..c5a9b14 100644 --- a/native_configs/ssh/config +++ b/native_configs/ssh/config @@ -88,6 +88,11 @@ Host dev0 User htran Port 22 +Host dev2 + HostName 10.100.200.210 + User htran + Port 22 + Host dev1 HostName 10.100.200.220 User htran diff --git a/native_configs/tmux/tmux.conf b/native_configs/tmux/tmux.conf index 54de12d..d494893 100644 --- a/native_configs/tmux/tmux.conf +++ b/native_configs/tmux/tmux.conf @@ -18,7 +18,6 @@ set-option -g renumber-windows on # set -g status-interval 60 # set -g status-right-style 'bg=#333333 fg=#5eacd3' # set -g status-right-length 50 -set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M ' # set -g status-left " " # Keybinds diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix index 3e6b4e3..6f28f50 100644 --- a/nix-conf/home-manager/base/neovim.nix +++ b/nix-conf/home-manager/base/neovim.nix @@ -42,6 +42,7 @@ let pkgs.nodePackages.pyright pkgs.python3Packages.pylint pkgs.python3Packages.flake8 + # FIXME: installing ansible from here just doesn't work :/ # pkgs.ansible-lint # pkgs.python38Packages.ansible # pkgs.ansible-language-server @@ -51,7 +52,10 @@ let # pkgs.rust-analyzer # rust_pkgs # pkgs.evcxr # Rust REPL for Conjure! - ]; + ] ++ lib.optionals (pkgs.stdenv.isDarwin) (let + inherit (pkgs.darwin.apple_sdk.frameworks) System CoreFoundation; in [ + System CoreFoundation pkgs.cc + ]); in { options.base.neovim = { diff --git a/nix-conf/home-manager/base/shells.nix b/nix-conf/home-manager/base/shells.nix index d338b9b..16faf76 100644 --- a/nix-conf/home-manager/base/shells.nix +++ b/nix-conf/home-manager/base/shells.nix @@ -54,8 +54,11 @@ in enable = true; # extraConfigBeforePlugin = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"; plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [ cpu net-speed ]; + extraConfig = (builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"); }; - xdg.configFile."tmux/tmux.conf".text = myLib.mkOrder 600 (builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"); + xdg.configFile."tmux/tmux.conf".text = myLib.mkOrder 600 '' + set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M ' + ''; programs.exa = { enable = true; enableAliases = true; diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index 7551fbb..c885170 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -16,14 +16,29 @@ "type": "github" } }, + "blank": { + "locked": { + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "blank", + "type": "github" + } + }, "cargo-leptos": { "flake": false, "locked": { - "lastModified": 1680094968, - "narHash": "sha256-LWi+KxvtIPP67vNe1Edf7AT8y4nKJ6jawTJtSEpt+4I=", + "lastModified": 1682155645, + "narHash": "sha256-Hya0qk1f0AYhGXwj6C20HVlh/iQnHBjx89ER6fuWdYw=", "owner": "leptos-rs", "repo": "cargo-leptos", - "rev": "6512bd2dc891fead2b7ff7f08d26b89789be7682", + "rev": "d49b5883a97a23eff4ab84d76916a8f67da81a76", "type": "github" }, "original": { @@ -34,8 +49,8 @@ }, "crane": { "inputs": { - "flake-compat": "flake-compat_3", - "flake-utils": "flake-utils_3", + "flake-compat": "flake-compat_4", + "flake-utils": "flake-utils_4", "nixpkgs": [ "nickel", "nixpkgs" @@ -58,8 +73,8 @@ }, "crane_2": { "inputs": { - "flake-compat": "flake-compat_5", - "flake-utils": "flake-utils_5", + "flake-compat": "flake-compat_6", + "flake-utils": "flake-utils_6", "nixpkgs": [ "nickel", "topiary", @@ -81,6 +96,126 @@ "type": "github" } }, + "crane_3": { + "inputs": { + "flake-compat": "flake-compat_7", + "flake-utils": "flake-utils_9", + "nixpkgs": "nixpkgs_5", + "rust-overlay": "rust-overlay_5" + }, + "locked": { + "lastModified": 1681680516, + "narHash": "sha256-EB8Adaeg4zgcYDJn9sR6UMjN/OHdIiMMK19+3LmmXQY=", + "owner": "ipetkov", + "repo": "crane", + "rev": "54b63c8eae4c50172cb50b612946ff1d2bc1c75c", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "crane_4": { + "inputs": { + "flake-compat": "flake-compat_9", + "flake-utils": "flake-utils_13", + "nixpkgs": [ + "nix-boost", + "std", + "paisano-mdbook-preprocessor", + "nixpkgs" + ], + "rust-overlay": "rust-overlay_7" + }, + "locked": { + "lastModified": 1676162383, + "narHash": "sha256-krUCKdz7ebHlFYm/A7IbKDnj2ZmMMm3yIEQcooqm7+E=", + "owner": "ipetkov", + "repo": "crane", + "rev": "6fb400ec631b22ccdbc7090b38207f7fb5cfb5f2", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "devshell": { + "inputs": { + "flake-utils": [ + "nix-boost", + "std", + "flake-utils" + ], + "nixpkgs": [ + "nix-boost", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1678957337, + "narHash": "sha256-Gw4nVbuKRdTwPngeOZQOzH/IFowmz4LryMPDiJN/ah4=", + "owner": "numtide", + "repo": "devshell", + "rev": "3e0e60ab37cd0bf7ab59888f5c32499d851edb47", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "dmerge": { + "inputs": { + "nixlib": [ + "nix-boost", + "std", + "nixpkgs" + ], + "yants": [ + "nix-boost", + "std", + "yants" + ] + }, + "locked": { + "lastModified": 1659548052, + "narHash": "sha256-fzI2gp1skGA8mQo/FBFrUAtY0GQkAIAaV/V127TJPyY=", + "owner": "divnix", + "repo": "data-merge", + "rev": "d160d18ce7b1a45b88344aa3f13ed1163954b497", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "data-merge", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": "nixpkgs_10", + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1677306201, + "narHash": "sha256-VZ9x7qdTosFvVsrpgFHrtYfT6PU3yMIs7NRYn9ELapI=", + "owner": "nix-community", + "repo": "fenix", + "rev": "0923f0c162f65ae40261ec940406049726cfeab4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -174,13 +309,125 @@ "type": "github" } }, - "flake-utils": { + "flake-compat_7": { + "flake": false, "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_8": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_9": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1680392223, + "narHash": "sha256-n3g7QFr85lDODKt250rkZj2IFS3i4/8HBU2yKHO3tqw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "dcc36e45d054d7bb554c9cdab69093debd91a0b5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1678379998, + "narHash": "sha256-TZdfNqftHhDuIFwBcN9MUThx5sQXCTeZk9je5byPKRw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c13d60b89adea3dc20704c045ec4d50dd964d447", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly-overlay", + "hercules-ci-effects", + "hercules-ci-agent", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1678379998, + "narHash": "sha256-TZdfNqftHhDuIFwBcN9MUThx5sQXCTeZk9je5byPKRw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c13d60b89adea3dc20704c045ec4d50dd964d447", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -190,6 +437,42 @@ } }, "flake-utils_10": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_11": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_12": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -204,7 +487,22 @@ "type": "github" } }, - "flake-utils_11": { + "flake-utils_13": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_14": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -219,6 +517,24 @@ "type": "github" } }, + "flake-utils_15": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "flake-utils_2": { "locked": { "lastModified": 1667395993, @@ -236,11 +552,11 @@ }, "flake-utils_3": { "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { @@ -250,6 +566,21 @@ } }, "flake-utils_4": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { "locked": { "lastModified": 1678901627, "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", @@ -264,7 +595,7 @@ "type": "github" } }, - "flake-utils_5": { + "flake-utils_6": { "locked": { "lastModified": 1676283394, "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", @@ -279,7 +610,7 @@ "type": "github" } }, - "flake-utils_6": { + "flake-utils_7": { "locked": { "lastModified": 1678901627, "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", @@ -294,37 +625,7 @@ "type": "github" } }, - "flake-utils_7": { - "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "flake-utils_8": { - "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_9": { "locked": { "lastModified": 1659877975, "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", @@ -339,7 +640,46 @@ "type": "github" } }, + "flake-utils_9": { + "locked": { + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "gitignore": { + "inputs": { + "nixpkgs": [ + "neovim-nightly-overlay", + "hercules-ci-effects", + "hercules-ci-agent", + "pre-commit-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_2": { "inputs": { "nixpkgs": [ "nickel", @@ -364,11 +704,11 @@ "gnmic": { "flake": false, "locked": { - "lastModified": 1679677474, - "narHash": "sha256-Flzajl4GYPnxlnLAlcR/KzAoPE76jMFBThztAijfPj4=", + "lastModified": 1681861366, + "narHash": "sha256-lM5Tz2JafXh2zi643mOM53DO756ixc2khiTt/csw9og=", "owner": "openconfig", "repo": "gnmic", - "rev": "c1e3239a694da71b3b290bf7805f3d18e84694e6", + "rev": "7c51956133dd4d855818660649640396949f0341", "type": "github" }, "original": { @@ -379,8 +719,8 @@ }, "gomod2nix": { "inputs": { - "nixpkgs": "nixpkgs_4", - "utils": "utils_2" + "nixpkgs": "nixpkgs_6", + "utils": "utils" }, "locked": { "lastModified": 1677459247, @@ -396,19 +736,78 @@ "type": "github" } }, + "haskell-flake": { + "locked": { + "lastModified": 1678138103, + "narHash": "sha256-D0lao82bV3t2gEFjHiU6RN233t+1MnkQV+bq8MEu2ic=", + "owner": "hercules-ci", + "repo": "haskell-flake", + "rev": "1e1660e6dd00838ba73bc7952e6e73be67da18d1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "ref": "0.1-extraLibraries", + "repo": "haskell-flake", + "type": "github" + } + }, + "hercules-ci-agent": { + "inputs": { + "flake-parts": "flake-parts_3", + "haskell-flake": "haskell-flake", + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs", + "pre-commit-hooks-nix": "pre-commit-hooks-nix" + }, + "locked": { + "lastModified": 1678446614, + "narHash": "sha256-Z6Gsba5ahn/N0QlF0vJfIEfnZgCs4qr1IZtXAqjbE7s=", + "owner": "hercules-ci", + "repo": "hercules-ci-agent", + "rev": "0b90d1a87c117a5861785cb85833dd1c9df0b6ef", + "type": "github" + }, + "original": { + "id": "hercules-ci-agent", + "type": "indirect" + } + }, + "hercules-ci-effects": { + "inputs": { + "flake-parts": "flake-parts_2", + "hercules-ci-agent": "hercules-ci-agent", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1681898675, + "narHash": "sha256-nIJ7CAdiHv4i1no/VgDoeTJLzbLYwu5+/Ycoyzn0S78=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "15ff4f63e5f28070391a5b09a82f6d5c6cc5c9d0", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ "nixpkgs" - ], - "utils": "utils" + ] }, "locked": { - "lastModified": 1680389554, - "narHash": "sha256-+8FUmS4GbDMynQErZGXKg+wU76rq6mI5fprxFXFWKSM=", + "lastModified": 1682977601, + "narHash": "sha256-F1Va/Uiw2tVNn27FLqWyBkiqDyIm/eCamw9wA/GK8Fw=", "owner": "nix-community", "repo": "home-manager", - "rev": "ddd8866c0306c48f465e7f48432e6f1ecd1da7f8", + "rev": "0e4c33d76006c9080d2f228ba1c2308e3e4d7be6", "type": "github" }, "original": { @@ -417,6 +816,28 @@ "type": "github" } }, + "incl": { + "inputs": { + "nixlib": [ + "nix-boost", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1669263024, + "narHash": "sha256-E/+23NKtxAqYG/0ydYgxlgarKnxmDbg6rCMWnOBqn9Q=", + "owner": "divnix", + "repo": "incl", + "rev": "ce7bebaee048e4cd7ebdb4cee7885e00c4e2abca", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "incl", + "type": "github" + } + }, "kpcli-py": { "flake": false, "locked": { @@ -433,27 +854,36 @@ "type": "github" } }, - "naersk": { + "n2c": { "inputs": { - "nixpkgs": "nixpkgs_5" + "flake-utils": [ + "nix-boost", + "std", + "flake-utils" + ], + "nixpkgs": [ + "nix-boost", + "std", + "nixpkgs" + ] }, "locked": { - "lastModified": 1679567394, - "narHash": "sha256-ZvLuzPeARDLiQUt6zSZFGOs+HZmE+3g4QURc8mkBsfM=", - "owner": "nix-community", - "repo": "naersk", - "rev": "88cd22380154a2c36799fe8098888f0f59861a15", + "lastModified": 1677330646, + "narHash": "sha256-hUYCwJneMjnxTvj30Fjow6UMJUITqHlpUGpXMPXUJsU=", + "owner": "nlewo", + "repo": "nix2container", + "rev": "ebca8f58d450cae1a19c07701a5a8ae40afc9efc", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "naersk", + "owner": "nlewo", + "repo": "nix2container", "type": "github" } }, "neovim-flake": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "nixpkgs": [ "neovim-nightly-overlay", "nixpkgs" @@ -461,11 +891,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1680310604, - "narHash": "sha256-2jop/z79HYhmV/hrdGvhjfTMouvzQvNRgFTkPhwWVcg=", + "lastModified": 1682581904, + "narHash": "sha256-9P4T2erXXrPxXTTLgD29U/IdKCOYqP4xbwdYswtVBA8=", "owner": "neovim", "repo": "neovim", - "rev": "75e1b1d5c934aa3a12693a7df58795563fb7877e", + "rev": "d321deb4a9b05e9d81b79ac166274f4a6e7981bf", "type": "github" }, "original": { @@ -478,15 +908,17 @@ "neovim-nightly-overlay": { "inputs": { "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts", + "hercules-ci-effects": "hercules-ci-effects", "neovim-flake": "neovim-flake", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1680336751, - "narHash": "sha256-otSdFRXsNyPYOsbo+49vN4UGwZrVoLDrEp0EkyVJ/rY=", + "lastModified": 1682955971, + "narHash": "sha256-6Orm5CIh/Zz3X/RHbMbLnii5jSyEjLxV9KF7lrrI5pA=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "d56f32281f4d6d74ce925a99946713dc6b5a0e30", + "rev": "a9719c5050b1abbb0adada7dd9f98e0cdbd3ed53", "type": "github" }, "original": { @@ -498,18 +930,18 @@ "nickel": { "inputs": { "crane": "crane", - "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs_2", + "flake-utils": "flake-utils_5", + "nixpkgs": "nixpkgs_3", "pre-commit-hooks": "pre-commit-hooks", "rust-overlay": "rust-overlay_2", "topiary": "topiary" }, "locked": { - "lastModified": 1680275475, - "narHash": "sha256-Aoq+njIRAsparRyTx6LmuqbkJIWVZmrtt3p2aUhv6eM=", + "lastModified": 1682671784, + "narHash": "sha256-TEH6J7OZKqVvHbzGIIO6jIlEIEUfFX/nq/fVd/DmU2c=", "owner": "tweag", "repo": "nickel", - "rev": "f0854b9992a1af5228fa4828a65c3660966c271c", + "rev": "9ba6a37e59b0f3c606ae99869a9ef663cdf8a336", "type": "github" }, "original": { @@ -521,21 +953,21 @@ "nix-boost": { "inputs": { "cargo-leptos": "cargo-leptos", - "flake-compat": "flake-compat_6", + "crane": "crane_3", + "flake-compat": "flake-compat_8", "gnmic": "gnmic", "gomod2nix": "gomod2nix", - "naersk": "naersk", - "nixlib": "nixlib", - "nixpkgs": "nixpkgs_6", + "nixpkgs": "nixpkgs_7", "poetry2nix": "poetry2nix", - "rust-overlay": "rust-overlay_5" + "rust-overlay": "rust-overlay_6", + "std": "std" }, "locked": { - "lastModified": 1680312007, - "narHash": "sha256-bFjiXGxNKtytv2wWnBwG1TfBpCNl5DYK2pckbXPacsM=", + "lastModified": 1682634888, + "narHash": "sha256-gyQr0FPWMh/I7fvGqsC3xtWQV5rfms2O97le4HzrgdU=", "ref": "refs/heads/master", - "rev": "2d8e3de16bc41c12a77bfc8721bb1f6a4cd484c5", - "revCount": 51, + "rev": "f4c97b6948a9292bf36ffe3514285fbe464e6613", + "revCount": 65, "type": "git", "url": "https://git.pegasust.com/pegasust/nix-boost.git" }, @@ -544,6 +976,29 @@ "url": "https://git.pegasust.com/pegasust/nix-boost.git" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "neovim-nightly-overlay", + "hercules-ci-effects", + "hercules-ci-agent", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1673295039, + "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, "nix-filter": { "locked": { "lastModified": 1678109515, @@ -566,11 +1021,11 @@ ] }, "locked": { - "lastModified": 1679224439, - "narHash": "sha256-QkvcuC4b67FUkkxlMsLTMPbwoD7yZr0UvJpu6jkFuLo=", + "lastModified": 1682417654, + "narHash": "sha256-XtUhq1GTRzV7QebHkxjd7Z58E6lVEk6Iv1/pF/GnBB4=", "owner": "mic92", "repo": "nix-index-database", - "rev": "2f5e6e915d70c04d673a8930f94591595c73eb84", + "rev": "e3e320b19c192f40a5b98e8776e3870df62dee8a", "type": "github" }, "original": { @@ -579,14 +1034,46 @@ "type": "github" } }, + "nixago": { + "inputs": { + "flake-utils": [ + "nix-boost", + "std", + "flake-utils" + ], + "nixago-exts": [ + "nix-boost", + "std", + "blank" + ], + "nixpkgs": [ + "nix-boost", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1682297764, + "narHash": "sha256-KcE95ua4IA+nwpaP53Se0x1TZxR538fGGEm8edaLuzU=", + "owner": "nix-community", + "repo": "nixago", + "rev": "d68634526733c79a2ca4fcc87c25a1ceabf132f4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixago", + "type": "github" + } + }, "nixgl": { "inputs": { - "flake-utils": "flake-utils_10", - "nixpkgs": "nixpkgs_8" + "flake-utils": "flake-utils_14", + "nixpkgs": "nixpkgs_11" }, "locked": { "lastModified": 1, - "narHash": "sha256-fPPUpYHcU9od0bdrzHCgbIKDqFs35u+YTt3jKf+EiMQ=", + "narHash": "sha256-1Vtx9qxakFbFcKO96LJKbNotI3hN8DpePSfwPfDN9x0=", "path": "./../../out-of-tree/nixGL", "type": "path" }, @@ -595,38 +1082,57 @@ "type": "path" } }, - "nixlib": { - "locked": { - "lastModified": 1679791877, - "narHash": "sha256-tTV1Mf0hPWIMtqyU16Kd2JUBDWvfHlDC9pF57vcbgpQ=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "cc060ddbf652a532b54057081d5abd6144d01971", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1671983799, - "narHash": "sha256-Z2Ro6hFPZHkBqkVXY5/aBUzxi5xizQGvuHQ9+T5B/ks=", - "owner": "nixos", + "lastModified": 1678293141, + "narHash": "sha256-lLlQHaR0y+q6nd6kfpydPTGHhl1rS9nU9OQmztzKOYs=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "fad51abd42ca17a60fc1d4cb9382e2d79ae31836", + "rev": "c90c4025bb6e0c4eaf438128a3b2640314b1c58d", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1678375444, + "narHash": "sha256-XIgHfGvjFvZQ8hrkfocanCDxMefc/77rXeHvYdzBMc8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "130fa0baaa2b93ec45523fdcde942f6844ee9f6e", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-stable": { + "locked": { + "lastModified": 1673800717, + "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_2": { "locked": { "lastModified": 1678872516, "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", @@ -644,11 +1150,58 @@ }, "nixpkgs_10": { "locked": { - "lastModified": 1665296151, - "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", + "lastModified": 1677063315, + "narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "988cc958c57ce4350ec248d2d53087777f9e1949", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_11": { + "locked": { + "lastModified": 1660551188, + "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "441dc5d512153039f19ef198e662e4f3dbb9fd65", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_12": { + "locked": { + "lastModified": 1683014792, + "narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_13": { + "locked": { + "lastModified": 1681358109, + "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", "type": "github" }, "original": { @@ -659,6 +1212,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1682929865, + "narHash": "sha256-jxVrgnf5QNjO+XoxDxUWtN2G5xyJSGZ5SWDQFxMuHxc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f2e9a130461950270f87630b11132323706b4d91", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1678898370, "narHash": "sha256-xTICr1j+uat5hk9FyuPOFGxpWHdJRibwZC+ATi0RbtE=", @@ -673,7 +1242,7 @@ "type": "indirect" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1665296151, "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", @@ -689,7 +1258,23 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { + "locked": { + "lastModified": 1680487167, + "narHash": "sha256-9FNIqrxDZgSliGGN2XJJSvcDYmQbgOANaZA4UWnTdg4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "53dad94e874c9586e71decf82d972dfb640ef044", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { "locked": { "lastModified": 1658285632, "narHash": "sha256-zRS5S/hoeDGUbO+L95wXG9vJNwsSYcl93XiD0HQBXLk=", @@ -705,27 +1290,13 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_7": { "locked": { - "lastModified": 1680273054, - "narHash": "sha256-Bs6/5LpvYp379qVqGt9mXxxx9GSE789k3oFc+OAL07M=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "3364b5b117f65fe1ce65a3cdd5612a078a3b31e3", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "type": "indirect" - } - }, - "nixpkgs_6": { - "locked": { - "lastModified": 1680213900, - "narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=", + "lastModified": 1682526928, + "narHash": "sha256-2cKh4O6t1rQ8Ok+v16URynmb0rV7oZPEbXkU0owNLQs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e3652e0735fbec227f342712f180f4f21f0594f2", + "rev": "d6b863fd9b7bb962e6f9fdf292419a775e772891", "type": "github" }, "original": { @@ -735,13 +1306,13 @@ "type": "github" } }, - "nixpkgs_7": { + "nixpkgs_8": { "locked": { - "lastModified": 1665296151, - "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", + "lastModified": 1681358109, + "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", "type": "github" }, "original": { @@ -751,51 +1322,158 @@ "type": "github" } }, - "nixpkgs_8": { + "nixpkgs_9": { "locked": { - "lastModified": 1660551188, - "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", + "lastModified": 1675940568, + "narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=", "owner": "nixos", "repo": "nixpkgs", - "rev": "441dc5d512153039f19ef198e662e4f3dbb9fd65", + "rev": "6ccc4a59c3f1b56d039d93da52696633e641bc71", "type": "github" }, "original": { "owner": "nixos", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs_9": { + "nosys": { "locked": { - "lastModified": 1680213900, - "narHash": "sha256-cIDr5WZIj3EkKyCgj/6j3HBH4Jj1W296z7HTcWj1aMA=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "e3652e0735fbec227f342712f180f4f21f0594f2", + "lastModified": 1668010795, + "narHash": "sha256-JBDVBnos8g0toU7EhIIqQ1If5m/nyBqtHhL3sicdPwI=", + "owner": "divnix", + "repo": "nosys", + "rev": "feade0141487801c71ff55623b421ed535dbdefa", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", + "owner": "divnix", + "repo": "nosys", + "type": "github" + } + }, + "paisano": { + "inputs": { + "nixpkgs": [ + "nix-boost", + "std", + "nixpkgs" + ], + "nosys": "nosys", + "yants": [ + "nix-boost", + "std", + "yants" + ] + }, + "locked": { + "lastModified": 1678949904, + "narHash": "sha256-oAoF66hYYz1RPh3lEwb9/4e4iyBAfTbQKZRRQ8gP0Ds=", + "owner": "paisano-nix", + "repo": "core", + "rev": "88f2aff10a5064551d1d4cb86800d17084489ce3", + "type": "github" + }, + "original": { + "owner": "paisano-nix", + "repo": "core", + "type": "github" + } + }, + "paisano-actions": { + "inputs": { + "nixpkgs": [ + "nix-boost", + "std", + "paisano-mdbook-preprocessor", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1677306424, + "narHash": "sha256-H9/dI2rGEbKo4KEisqbRPHFG2ajF8Tm111NPdKGIf28=", + "owner": "paisano-nix", + "repo": "actions", + "rev": "65ec4e080b3480167fc1a748c89a05901eea9a9b", + "type": "github" + }, + "original": { + "owner": "paisano-nix", + "repo": "actions", + "type": "github" + } + }, + "paisano-mdbook-preprocessor": { + "inputs": { + "crane": "crane_4", + "fenix": "fenix", + "nixpkgs": [ + "nix-boost", + "std", + "nixpkgs" + ], + "paisano-actions": "paisano-actions", + "std": [ + "nix-boost", + "std" + ] + }, + "locked": { + "lastModified": 1680654400, + "narHash": "sha256-Qdpio+ldhUK3zfl22Mhf8HUULdUOJXDWDdO7MIK69OU=", + "owner": "paisano-nix", + "repo": "mdbook-paisano-preprocessor", + "rev": "11a8fc47f574f194a7ae7b8b98001f6143ba4cf1", + "type": "github" + }, + "original": { + "owner": "paisano-nix", + "repo": "mdbook-paisano-preprocessor", + "type": "github" + } + }, + "paisano-tui": { + "inputs": { + "nixpkgs": [ + "nix-boost", + "std", + "blank" + ], + "std": [ + "nix-boost", + "std" + ] + }, + "locked": { + "lastModified": 1681847764, + "narHash": "sha256-mdd7PJW1BZvxy0cIKsPfAO+ohVl/V7heE5ZTAHzTdv8=", + "owner": "paisano-nix", + "repo": "tui", + "rev": "3096bad91cae73ab8ab3367d31f8a143d248a244", + "type": "github" + }, + "original": { + "owner": "paisano-nix", + "ref": "0.1.1", + "repo": "tui", "type": "github" } }, "poetry2nix": { "inputs": { - "flake-utils": "flake-utils_8", + "flake-utils": "flake-utils_10", "nixpkgs": [ "nix-boost", "nixpkgs" ] }, "locked": { - "lastModified": 1680134979, - "narHash": "sha256-8LBOnyrk9r1X8LpxZWynIxr97vq8hRqnpo639c2RA40=", + "lastModified": 1682555464, + "narHash": "sha256-FdkKWqzKbXmX/tInaNod2S6+yGyLMM1xUdYflmx/jgs=", "owner": "nix-community", "repo": "poetry2nix", - "rev": "dc8c13ab88db829c1b71e6c794d1b295c8031408", + "rev": "863f574729fd26c98ae521ffddd30339041fc51f", "type": "github" }, "original": { @@ -806,17 +1484,17 @@ }, "pre-commit-hooks": { "inputs": { - "flake-compat": "flake-compat_4", + "flake-compat": "flake-compat_5", "flake-utils": [ "nickel", "flake-utils" ], - "gitignore": "gitignore", + "gitignore": "gitignore_2", "nixpkgs": [ "nickel", "nixpkgs" ], - "nixpkgs-stable": "nixpkgs-stable" + "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { "lastModified": 1678976941, @@ -832,6 +1510,33 @@ "type": "github" } }, + "pre-commit-hooks-nix": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_2", + "gitignore": "gitignore", + "nixpkgs": [ + "neovim-nightly-overlay", + "hercules-ci-effects", + "hercules-ci-agent", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1678376203, + "narHash": "sha256-3tyYGyC8h7fBwncLZy5nCUjTJPrHbmNwp47LlNLOHSM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "1a20b9708962096ec2481eeb2ddca29ed747770a", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "flake-compat": "flake-compat", @@ -843,8 +1548,25 @@ "nix-boost": "nix-boost", "nix-index-database": "nix-index-database", "nixgl": "nixgl", - "nixpkgs": "nixpkgs_9", - "rust-overlay": "rust-overlay_6" + "nixpkgs": "nixpkgs_12", + "rust-overlay": "rust-overlay_8" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1677221702, + "narHash": "sha256-1M+58rC4eTCWNmmX0hQVZP20t3tfYNunl9D/PrGUyGE=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "f5401f620699b26ed9d47a1d2e838143a18dbe3b", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" } }, "rust-overlay": { @@ -930,8 +1652,8 @@ }, "rust-overlay_4": { "inputs": { - "flake-utils": "flake-utils_7", - "nixpkgs": "nixpkgs_3" + "flake-utils": "flake-utils_8", + "nixpkgs": "nixpkgs_4" }, "locked": { "lastModified": 1679106165, @@ -949,15 +1671,23 @@ }, "rust-overlay_5": { "inputs": { - "flake-utils": "flake-utils_9", - "nixpkgs": "nixpkgs_7" + "flake-utils": [ + "nix-boost", + "crane", + "flake-utils" + ], + "nixpkgs": [ + "nix-boost", + "crane", + "nixpkgs" + ] }, "locked": { - "lastModified": 1680229280, - "narHash": "sha256-9UoyQCeKUmHcsIdpsAgcz41LAIDkWhI2PhVDjckrpg0=", + "lastModified": 1680488274, + "narHash": "sha256-0vYMrZDdokVmPQQXtFpnqA2wEgCCUXf5a3dDuDVshn0=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "aa480d799023141e1b9e5d6108700de63d9ad002", + "rev": "7ec2ff598a172c6e8584457167575b3a1a5d80d8", "type": "github" }, "original": { @@ -969,14 +1699,14 @@ "rust-overlay_6": { "inputs": { "flake-utils": "flake-utils_11", - "nixpkgs": "nixpkgs_10" + "nixpkgs": "nixpkgs_8" }, "locked": { - "lastModified": 1680401949, - "narHash": "sha256-s8+b9Zm9osz9oGInNletIFihgXTs9hogw9C/c3MbErs=", + "lastModified": 1682561982, + "narHash": "sha256-x0LtoiGT9gQ7Sn8SvjV3CIUqGu/GLDBDAoa5lXyef/8=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "9b8632040df6f2218fd01bf79c0589379ac39584", + "rev": "cc85c38ed6f7ecb9d7eb3d71be3c6f01b87e92f9", "type": "github" }, "original": { @@ -985,11 +1715,165 @@ "type": "github" } }, + "rust-overlay_7": { + "inputs": { + "flake-utils": [ + "nix-boost", + "std", + "paisano-mdbook-preprocessor", + "crane", + "flake-utils" + ], + "nixpkgs": [ + "nix-boost", + "std", + "paisano-mdbook-preprocessor", + "crane", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1675391458, + "narHash": "sha256-ukDKZw922BnK5ohL9LhwtaDAdCsJL7L6ScNEyF1lO9w=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "383a4acfd11d778d5c2efcf28376cbd845eeaedf", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_8": { + "inputs": { + "flake-utils": "flake-utils_15", + "nixpkgs": "nixpkgs_13" + }, + "locked": { + "lastModified": 1682993975, + "narHash": "sha256-LlI5vwUw97NLAwcOYHRLRfhICVdp7MK2KFcUSj0Zwdg=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "07f421299826591e2b28e03bbbe19a5292395afe", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "std": { + "inputs": { + "arion": [ + "nix-boost", + "std", + "blank" + ], + "blank": "blank", + "devshell": "devshell", + "dmerge": "dmerge", + "flake-utils": "flake-utils_12", + "incl": "incl", + "makes": [ + "nix-boost", + "std", + "blank" + ], + "microvm": [ + "nix-boost", + "std", + "blank" + ], + "n2c": "n2c", + "nixago": "nixago", + "nixpkgs": "nixpkgs_9", + "paisano": "paisano", + "paisano-mdbook-preprocessor": "paisano-mdbook-preprocessor", + "paisano-tui": "paisano-tui", + "yants": "yants" + }, + "locked": { + "lastModified": 1682297963, + "narHash": "sha256-lB89W0c4/gqArk2g7bOhsDHMgYz29E+yaYyCK35D9A4=", + "owner": "divnix", + "repo": "std", + "rev": "a0f9dd33cff37e2c532e2c236d011e2ecd77286d", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "std", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "topiary": { "inputs": { "advisory-db": "advisory-db", "crane": "crane_2", - "flake-utils": "flake-utils_6", + "flake-utils": "flake-utils_7", "nix-filter": "nix-filter", "nixpkgs": [ "nickel", @@ -998,11 +1882,11 @@ "rust-overlay": "rust-overlay_4" }, "locked": { - "lastModified": 1680178226, - "narHash": "sha256-EZtmLYPQII8Ma9yH0udqlNjSXiYUg134j+0Srzb4rbM=", + "lastModified": 1682503900, + "narHash": "sha256-3Kb9D8S0lkGcPAcpJJGInVyFN79K6gn6TN0ZHWFA19s=", "owner": "tweag", "repo": "topiary", - "rev": "1af03d77abf6aef3ea36f878554c16619207252b", + "rev": "773159aa4c819b46c6d51ca9275e7366087eb3a0", "type": "github" }, "original": { @@ -1012,21 +1896,6 @@ } }, "utils": { - "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "utils_2": { "locked": { "lastModified": 1653893745, "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", @@ -1040,6 +1909,28 @@ "repo": "flake-utils", "type": "github" } + }, + "yants": { + "inputs": { + "nixpkgs": [ + "nix-boost", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1667096281, + "narHash": "sha256-wRRec6ze0gJHmGn6m57/zhz/Kdvp9HS4Nl5fkQ+uIuA=", + "owner": "divnix", + "repo": "yants", + "rev": "d18f356ec25cb94dc9c275870c3a7927a10f8c3c", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "yants", + "type": "github" + } } }, "root": "root", diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index f12f7a5..367002b 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -35,7 +35,7 @@ neovim-nightly-overlay = { url = "github:nix-community/neovim-nightly-overlay"; # Pin to a nixpkgs revision that doesn't have NixOS/nixpkgs#208103 yet - inputs.nixpkgs.url = "github:nixos/nixpkgs?rev=fad51abd42ca17a60fc1d4cb9382e2d79ae31836"; + # inputs.nixpkgs.url = "github:nixos/nixpkgs?rev=fad51abd42ca17a60fc1d4cb9382e2d79ae31836"; }; nix-index-database = { url = "github:mic92/nix-index-database"; diff --git a/nix-conf/home-manager/home.nix b/nix-conf/home-manager/home.nix index f1ac5f9..c6b4a75 100644 --- a/nix-conf/home-manager/home.nix +++ b/nix-conf/home-manager/home.nix @@ -37,7 +37,7 @@ in # pkgs.xorg.xclock # TODO: only include if have gui # For testing GL installation # pkgs.logseq # TODO: only include if have GL # Obsidian alt pkgs.mosh # Parsec for SSH - pkgs.nixops_unstable # nixops v2 # insecure for now + # pkgs.nixops_unstable # nixops v2 # insecure for now pkgs.lynx # Web browser at your local terminal pkgs.zk diff --git a/nix/cells/dotfiles/default.nix b/nix/cells/dotfiles/default.nix new file mode 100644 index 0000000..e69de29 diff --git a/nix/cells/dotfiles/devshells.nix b/nix/cells/dotfiles/devshells.nix new file mode 100644 index 0000000..9d23473 --- /dev/null +++ b/nix/cells/dotfiles/devshells.nix @@ -0,0 +1,8 @@ +{inputs, cells}: let + inherit (inputs) std nixpkgs; + +in { + default = std.lib.dev.mkShell { + name = nixpkgs.lib. + }; +} From b50bd9964cdff991e3e82231ed0c19c3e930786e Mon Sep 17 00:00:00 2001 From: Hung Date: Tue, 2 May 2023 10:26:53 -0700 Subject: [PATCH 41/64] feat(nvim): optimize for rust --- native_configs/neovim/init.lua | 50 ++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index f496a3f..42e11a6 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -72,7 +72,7 @@ Plug('folke/trouble.nvim') -- File-grouped workspace diagnostics Plug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands Plug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein" Plug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator -Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs) +-- Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs) Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*) Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration @@ -127,7 +127,6 @@ vim.api.nvim_create_autocmd({ "VimEnter" }, { end }) - vim.g.gruvbox_contrast_dark = "soft"; vim.g.gruvbox_contrast_light = "soft"; vim.opt.ignorecase = true; @@ -152,8 +151,8 @@ vim.opt.background = "dark"; vim.api.nvim_create_user_command('Dark', function(opts) -- opts: {name, args: str, fargs: Splited, range, ...} ---@type string - local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_light; - = contrast; + local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark; + vim.g.gruvbox_contrast_dark = contrast; vim.opt.background = "dark"; end, { nargs = "?", }) @@ -161,7 +160,7 @@ vim.api.nvim_create_user_command('Dark', function(opts) vim.api.nvim_create_user_command('Light', function(opts) -- opts: {name, args: str, fargs: Splited, range, ...} ---@type string - local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark; + local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_light; vim.g.gruvbox_contrast_light = contrast; vim.opt.background = "light"; end, @@ -201,6 +200,7 @@ vim.keymap.set('n', 'e', vim.diagnostic.open_float) -- opens diag in box -- vim.keymap.set('n', 'wq', vim.diagnostic.setqflist) -- workspace diags vim.keymap.set('n', 'q', 'TroubleToggle loclist') vim.keymap.set('n', 'wq', 'TroubleToggle workspace_diagnostics') +vim.keymap.set('n', 'g', 'GuessIndent') -- color, highlighting, UI stuffs vim.cmd([[ @@ -412,18 +412,18 @@ parser_config.astro.filetype_to_parsername = { "javascript", "typescript.tsx", " require('guess-indent').setup { - auto_cmd = true, -- Set to false to disable automatic execution + auto_cmd = true, filetype_exclude = { -- A list of filetypes for which the auto command gets disabled "netrw", "tutor", }, - buftype_exclude = { -- A list of buffer types for which the auto command gets disabled - "help", - "nofile", - "terminal", - -- "prompt", - }, + -- buftype_exclude = { -- A list of buffer types for which the auto command gets disabled + -- "help", + -- "nofile", + -- "terminal", + -- -- "prompt", + -- }, } -- harpoon: O(1) buffer/terminal switching @@ -585,7 +585,7 @@ cmp.setup { { name = 'luasnip' }, { name = 'buffer' }, { name = 'path' }, - { name = "conjure" }, + -- { name = "conjure" }, -- { name = 'cmp_tabnine' }, }, } @@ -775,6 +775,7 @@ require("rust-tools").setup { -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" on_initialized = function() require('inlay-hints').set_all() + end, -- automatically call RustReloadWorkspace when writing to a Cargo.toml file. reload_workspace_from_cargo_toml = true, @@ -916,15 +917,28 @@ require("rust-tools").setup { vim.keymap.set('n', keys, func, { noremap = true, buffer = bufnr, desc = desc }) end on_attach(client, bufnr) - require('inlay-hints').on_attach(client, bufnr) nmap('K', require 'rust-tools'.hover_actions.hover_actions, 'Hover Documentation') end, capabilities = capabilities, + cmd = {"rust-analyzer"}, settings = { - checkOnSave = { - command = "clippy", - } - } + ["rust-analyzer"] = { + -- enable clippy on save + checkOnSave = { + command = "clippy", + extraArgs = { "--all", "--", "-W", "clippy::all" }, + }, + rustfmt = { + extraArgs = { "+nightly" }, + }, + cargo = { + loadOutDirsFromCheck = true, + }, + procMacro = { + enable = true, + }, + }, + }, }, -- rust-analyzer options -- debugging stuff From 8b4cb660c8e6b14427221b8f3af35feddd84d2d7 Mon Sep 17 00:00:00 2001 From: Hung Date: Tue, 16 May 2023 09:26:57 -0700 Subject: [PATCH 42/64] fix(neovim): Just pin neovim correctly to its latest working nightly --- .envrc | 20 +++- flake.lock | 93 +++++++++++---- flake.nix | 13 +- native_configs/neovim/init.lua | 6 +- nix-conf/home-manager/base/neovim.nix | 17 +-- nix-conf/home-manager/flake.lock | 43 +++---- nix-conf/home-manager/flake.nix | 6 +- .../home-manager/fromYamlSandbox/flake.lock | 44 ------- .../home-manager/fromYamlSandbox/flake.nix | 111 ------------------ nix-conf/home-manager/overlays.nix | 76 ++++++++++++ nix/cells/dotfiles/default.nix | 0 nix/cells/dotfiles/devshells.nix | 3 +- overlays.nix | 76 ------------ 13 files changed, 209 insertions(+), 299 deletions(-) delete mode 100644 nix-conf/home-manager/fromYamlSandbox/flake.lock delete mode 100644 nix-conf/home-manager/fromYamlSandbox/flake.nix create mode 100644 nix-conf/home-manager/overlays.nix delete mode 100644 nix/cells/dotfiles/default.nix diff --git a/.envrc b/.envrc index 9834d0e..2b67239 100644 --- a/.envrc +++ b/.envrc @@ -1,6 +1,16 @@ -# If nix-shell available, then nix is installed. We're going to use nix-direnv. -if command -v nix-shell &> /dev/null -then - use flake -fi +#! /bin/sh + +source "$( + nix eval \ + --no-update-lock-file \ + --no-write-lock-file \ + --no-warn-dirty \ + --accept-flake-config \ + .#__std.direnv_lib 2>/dev/null \ + || nix eval .#__std.direnv_lib # show the errors +)" +# FIXME: This should check if $USER is in userShells, if not, +# fall back to `use nix` +use std nix "//repo/userShells:${USER}" + diff --git a/flake.lock b/flake.lock index cdfd6b8..5ef23d9 100644 --- a/flake.lock +++ b/flake.lock @@ -62,11 +62,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1682063650, - "narHash": "sha256-VaDHh2z6xlnTHaONlNVHP7qEMcK5rZ8Js3sT6mKb2XY=", + "lastModified": 1683779844, + "narHash": "sha256-sIeOU0GsCeQEn5TpqE/jFRN4EGsPsjqVRsPdrzIDABM=", "owner": "serokell", "repo": "deploy-rs", - "rev": "c2ea4e642dc50fd44b537e9860ec95867af30d39", + "rev": "c80189917086e43d49eece2bd86f56813500a0eb", "type": "github" }, "original": { @@ -87,11 +87,11 @@ ] }, "locked": { - "lastModified": 1678957337, - "narHash": "sha256-Gw4nVbuKRdTwPngeOZQOzH/IFowmz4LryMPDiJN/ah4=", + "lastModified": 1682700442, + "narHash": "sha256-qjaAAcCYgp1pBBG7mY9z95ODUBZMtUpf0Qp3Gt/Wha0=", "owner": "numtide", "repo": "devshell", - "rev": "3e0e60ab37cd0bf7ab59888f5c32499d851edb47", + "rev": "fb6673fe9fe4409e3f43ca86968261e970918a83", "type": "github" }, "original": { @@ -117,6 +117,8 @@ }, "dmerge": { "inputs": { + "haumea": "haumea_2", + "namaka": "namaka", "nixlib": [ "std", "nixpkgs" @@ -127,16 +129,17 @@ ] }, "locked": { - "lastModified": 1659548052, - "narHash": "sha256-fzI2gp1skGA8mQo/FBFrUAtY0GQkAIAaV/V127TJPyY=", + "lastModified": 1684178600, + "narHash": "sha256-EtSQcCHRQUBBEj4vbYU0vgPUYiKP261ero5k1QfQ3Bc=", "owner": "divnix", - "repo": "data-merge", - "rev": "d160d18ce7b1a45b88344aa3f13ed1163954b497", + "repo": "dmerge", + "rev": "ac9932f26325afac5baa59cf6478432d17762a4e", "type": "github" }, "original": { "owner": "divnix", - "repo": "data-merge", + "ref": "0.2.0", + "repo": "dmerge", "type": "github" } }, @@ -243,6 +246,28 @@ "type": "github" } }, + "haumea_2": { + "inputs": { + "nixpkgs": [ + "std", + "dmerge", + "nixlib" + ] + }, + "locked": { + "lastModified": 1681176209, + "narHash": "sha256-bJLDun6esIyWtwRVXcsgzGbh4UKu8wJDrPgykqPyzmg=", + "owner": "nix-community", + "repo": "haumea", + "rev": "b915b66b27da3a595d77b139e945bb0a2fcac926", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "haumea", + "type": "github" + } + }, "hive": { "inputs": { "colmena": "colmena", @@ -328,6 +353,34 @@ "type": "github" } }, + "namaka": { + "inputs": { + "haumea": [ + "std", + "dmerge", + "haumea" + ], + "nixpkgs": [ + "std", + "dmerge", + "nixlib" + ] + }, + "locked": { + "lastModified": 1683059428, + "narHash": "sha256-ZTMqleCWmuNWhZE375gtF1j1JRkaKEUFN1AM43e7h4Y=", + "owner": "nix-community", + "repo": "namaka", + "rev": "2deba2f416454aec770bc1cc7365e39c73e6b1d7", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "v0.1.1", + "repo": "namaka", + "type": "github" + } + }, "nixago": { "inputs": { "flake-utils": [ @@ -344,11 +397,11 @@ ] }, "locked": { - "lastModified": 1682297764, - "narHash": "sha256-KcE95ua4IA+nwpaP53Se0x1TZxR538fGGEm8edaLuzU=", + "lastModified": 1683210100, + "narHash": "sha256-bhGDOlkWtlhVECpoOog4fWiFJmLCpVEg09a40aTjCbw=", "owner": "nix-community", "repo": "nixago", - "rev": "d68634526733c79a2ca4fcc87c25a1ceabf132f4", + "rev": "1da60ad9412135f9ed7a004669fdcf3d378ec630", "type": "github" }, "original": { @@ -406,11 +459,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1683014792, - "narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=", + "lastModified": 1684215771, + "narHash": "sha256-fsum28z+g18yreNa1Y7MPo9dtps5h1VkHfZbYQ+YPbk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42", + "rev": "963006aab35e3e8ebbf6052b6bf4ea712fdd3c28", "type": "github" }, "original": { @@ -687,11 +740,11 @@ "yants": "yants_2" }, "locked": { - "lastModified": 1682297963, - "narHash": "sha256-lB89W0c4/gqArk2g7bOhsDHMgYz29E+yaYyCK35D9A4=", + "lastModified": 1684180498, + "narHash": "sha256-kA58ms4yunOVPhe3r7V0IIKeWUV+vl4r2GTcfFfYW5o=", "owner": "divnix", "repo": "std", - "rev": "a0f9dd33cff37e2c532e2c236d011e2ecd77286d", + "rev": "45b431ae09df98e046bcc8271aa209bdfc87444d", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index f074dd4..34b36b1 100644 --- a/flake.nix +++ b/flake.nix @@ -19,23 +19,22 @@ # All cell blocks are under ./nix/cells// as `.nix` # or `e', vim.diagnostic.open_float) -- opens diag in box -- vim.keymap.set('n', 'wq', vim.diagnostic.setqflist) -- workspace diags vim.keymap.set('n', 'q', 'TroubleToggle loclist') vim.keymap.set('n', 'wq', 'TroubleToggle workspace_diagnostics') -vim.keymap.set('n', 'g', 'GuessIndent') +vim.keymap.set('n', 'gg', 'GuessIndent') -- color, highlighting, UI stuffs vim.cmd([[ @@ -605,7 +605,7 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities() local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'cmake', 'tailwindcss', 'prismals', 'rnix', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels", - "jsonls", "denols", "gopls", "nickel_ls" + "jsonls", "denols", "gopls", "nickel_ls", 'pylsp', } require("mason").setup({ ui = { diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix index 6f28f50..bdb4356 100644 --- a/nix-conf/home-manager/base/neovim.nix +++ b/nix-conf/home-manager/base/neovim.nix @@ -16,19 +16,18 @@ let ( toolchain: toolchain.default.override { - extensions = [ "rust-src" ]; + extensions = [ "rust-src" "rust-analyzer" "rust-docs" "rustfmt" "clippy" "miri" ]; } )); nvim_pkgs = [ # pkgs.gccStdenv - pkgs.gcc pkgs.tree-sitter pkgs.fzf # file name fuzzy search pkgs.ripgrep # content fuzzy search pkgs.zk # Zettelkasten (limited support) pkgs.fd # Required by a Telescope plugin (?) pkgs.stdenv.cc.cc.lib - pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo + pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo pkgs.rust4cargo pkgs.nickel pkgs.lsp-nls @@ -52,10 +51,14 @@ let # pkgs.rust-analyzer # rust_pkgs # pkgs.evcxr # Rust REPL for Conjure! - ] ++ lib.optionals (pkgs.stdenv.isDarwin) (let - inherit (pkgs.darwin.apple_sdk.frameworks) System CoreFoundation; in [ - System CoreFoundation pkgs.cc - ]); + ] ++ lib.optionals (pkgs.stdenv.isDarwin) ( + let + inherit (pkgs.darwin.apple_sdk.frameworks) System CoreFoundation; in + [ + System + CoreFoundation + ] + ); in { options.base.neovim = { diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index c885170..6e58fe8 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -803,11 +803,11 @@ ] }, "locked": { - "lastModified": 1682977601, - "narHash": "sha256-F1Va/Uiw2tVNn27FLqWyBkiqDyIm/eCamw9wA/GK8Fw=", + "lastModified": 1684189380, + "narHash": "sha256-GUp9OkZynocyppLur1VX8oAjtXGue0oKRHbsksOMUm0=", "owner": "nix-community", "repo": "home-manager", - "rev": "0e4c33d76006c9080d2f228ba1c2308e3e4d7be6", + "rev": "b7d814c5744dca7e70b3dc2638f06568dce96ca6", "type": "github" }, "original": { @@ -914,16 +914,17 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1682955971, - "narHash": "sha256-6Orm5CIh/Zz3X/RHbMbLnii5jSyEjLxV9KF7lrrI5pA=", + "lastModified": 1684067841, + "narHash": "sha256-UzOHzcx5KrysKdLZuyU2k5RipVa6wP8EbVeqF/C7OLM=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "a9719c5050b1abbb0adada7dd9f98e0cdbd3ed53", + "rev": "88a6c749a7d126c49f3374f9f28ca452ea9419b8", "type": "github" }, "original": { "owner": "nix-community", "repo": "neovim-nightly-overlay", + "rev": "88a6c749a7d126c49f3374f9f28ca452ea9419b8", "type": "github" } }, @@ -937,11 +938,11 @@ "topiary": "topiary" }, "locked": { - "lastModified": 1682671784, - "narHash": "sha256-TEH6J7OZKqVvHbzGIIO6jIlEIEUfFX/nq/fVd/DmU2c=", + "lastModified": 1684220170, + "narHash": "sha256-Vl6KHfZCmG016cN3xkaHgVtB9p2eODwjHQuMXF3KUsg=", "owner": "tweag", "repo": "nickel", - "rev": "9ba6a37e59b0f3c606ae99869a9ef663cdf8a336", + "rev": "f11b7b09e2fbbcaa6384e511ef95cde1f4aae93a", "type": "github" }, "original": { @@ -1021,11 +1022,11 @@ ] }, "locked": { - "lastModified": 1682417654, - "narHash": "sha256-XtUhq1GTRzV7QebHkxjd7Z58E6lVEk6Iv1/pF/GnBB4=", + "lastModified": 1683638468, + "narHash": "sha256-tQEaGZfZ2Hpw+XIVEHaJ8FaF1yNQyMDDhUyIQ7LTIEg=", "owner": "mic92", "repo": "nix-index-database", - "rev": "e3e320b19c192f40a5b98e8776e3870df62dee8a", + "rev": "219067a5e3cf4b9581c8b4fcfc59ecd5af953d07", "type": "github" }, "original": { @@ -1181,11 +1182,11 @@ }, "nixpkgs_12": { "locked": { - "lastModified": 1683014792, - "narHash": "sha256-6Va9iVtmmsw4raBc3QKvQT2KT/NGRWlvUlJj46zN8B8=", + "lastModified": 1684215771, + "narHash": "sha256-fsum28z+g18yreNa1Y7MPo9dtps5h1VkHfZbYQ+YPbk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1a411f23ba299db155a5b45d5e145b85a7aafc42", + "rev": "963006aab35e3e8ebbf6052b6bf4ea712fdd3c28", "type": "github" }, "original": { @@ -1213,11 +1214,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1682929865, - "narHash": "sha256-jxVrgnf5QNjO+XoxDxUWtN2G5xyJSGZ5SWDQFxMuHxc=", + "lastModified": 1683968890, + "narHash": "sha256-FuNtjMvT07cJydY5NRyRhIni/dEwkSkijmFEdsmqdkA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f2e9a130461950270f87630b11132323706b4d91", + "rev": "ea11a3977f4cba013d8680667616be827c967ac0", "type": "github" }, "original": { @@ -1752,11 +1753,11 @@ "nixpkgs": "nixpkgs_13" }, "locked": { - "lastModified": 1682993975, - "narHash": "sha256-LlI5vwUw97NLAwcOYHRLRfhICVdp7MK2KFcUSj0Zwdg=", + "lastModified": 1684203630, + "narHash": "sha256-ZOWNixdHU4qFZUgYNEULFB3ifctMQO9H4Oo+Zrz+4L8=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "07f421299826591e2b28e03bbbe19a5292395afe", + "rev": "65c3f2655f52a81e1b3e629d4c07df4873d0f2bb", "type": "github" }, "original": { diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 367002b..121501b 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -33,9 +33,7 @@ flake = false; }; neovim-nightly-overlay = { - url = "github:nix-community/neovim-nightly-overlay"; - # Pin to a nixpkgs revision that doesn't have NixOS/nixpkgs#208103 yet - # inputs.nixpkgs.url = "github:nixos/nixpkgs?rev=fad51abd42ca17a60fc1d4cb9382e2d79ae31836"; + url = "github:nix-community/neovim-nightly-overlay?rev=88a6c749a7d126c49f3374f9f28ca452ea9419b8"; }; nix-index-database = { url = "github:mic92/nix-index-database"; @@ -69,7 +67,7 @@ in cross_platform (system: let - overlays = import ./../../overlays.nix (flake_inputs // { inherit system; }); + overlays = import ./overlays.nix (flake_inputs // { inherit system; }); # pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays; pkgs = import nixpkgs { inherit system overlays; diff --git a/nix-conf/home-manager/fromYamlSandbox/flake.lock b/nix-conf/home-manager/fromYamlSandbox/flake.lock deleted file mode 100644 index 65e798e..0000000 --- a/nix-conf/home-manager/fromYamlSandbox/flake.lock +++ /dev/null @@ -1,44 +0,0 @@ -{ - "nodes": { - "from-yaml": { - "flake": false, - "locked": { - "lastModified": 1667993008, - "narHash": "sha256-X5RWyebq+j56mUGGCmZTVcJBy6Y/QgFEMHklaz+GOt0=", - "owner": "pegasust", - "repo": "fromYaml", - "rev": "23d2616051f5a781dcfe2915a526925fd9cdd08c", - "type": "github" - }, - "original": { - "owner": "pegasust", - "repo": "fromYaml", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1667811565, - "narHash": "sha256-HYml7RdQPQ7X13VNe2CoDMqmifsXbt4ACTKxHRKQE3Q=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "667e5581d16745bcda791300ae7e2d73f49fff25", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "from-yaml": "from-yaml", - "nixpkgs": "nixpkgs" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/nix-conf/home-manager/fromYamlSandbox/flake.nix b/nix-conf/home-manager/fromYamlSandbox/flake.nix deleted file mode 100644 index 1bfc84a..0000000 --- a/nix-conf/home-manager/fromYamlSandbox/flake.nix +++ /dev/null @@ -1,111 +0,0 @@ -{ - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - from-yaml = { - url = "github:pegasust/fromYaml"; - flake = false; - }; - }; - outputs = { nixpkgs, from-yaml, ... }: - let - system = "x86_64-linux"; - pkgs = import nixpkgs { inherit system; }; - lib = { - fromYaml = import "${from-yaml}/fromYaml.nix" { lib = pkgs.lib; }; - }; - in - { - inherit nixpkgs; - inherit from-yaml; - inherit lib; - inherit pkgs; - fromYamlFn = lib.fromYaml; - yamlCmd = str: (builtins.fromJSON (pkgs.runCommand "echo ${str} | yq")); - test_0 = '' - key_bindings: - - hello: - "N" - ''; - key_bind = '' - key_bindings: - - { key: N, mods: Control, action: CreateNewWindow } - # - { key: Paste, action: Paste } - # - { key: Copy, action: Copy } - #- { key: L, mods: Control, action: ClearLogNotice } - #- { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" } - #- { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp } - #- { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown } - #- { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop } - #- { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom } - - # Vi Mode - #- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode } - - { key: Escape, mods: Shift, mode: ~Search, action: ToggleViMode } - #- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom } - #- { key: Escape, mode: Vi|~Search, action: ClearSelection } - #- { key: I, mode: Vi|~Search, action: ToggleViMode } - #- { key: I, mode: Vi|~Search, action: ScrollToBottom } - #- { key: C, mods: Control, mode: Vi|~Search, action: ToggleViMode } - #- { key: Y, mods: Control, mode: Vi|~Search, action: ScrollLineUp } - #- { key: E, mods: Control, mode: Vi|~Search, action: ScrollLineDown } - #- { key: G, mode: Vi|~Search, action: ScrollToTop } - #- { key: G, mods: Shift, mode: Vi|~Search, action: ScrollToBottom } - #- { key: B, mods: Control, mode: Vi|~Search, action: ScrollPageUp } - #- { key: F, mods: Control, mode: Vi|~Search, action: ScrollPageDown } - #- { key: U, mods: Control, mode: Vi|~Search, action: ScrollHalfPageUp } - #- { key: D, mods: Control, mode: Vi|~Search, action: ScrollHalfPageDown } - #- { key: Y, mode: Vi|~Search, action: Copy } - #- { key: Y, mode: Vi|~Search, action: ClearSelection } - #- { key: Copy, mode: Vi|~Search, action: ClearSelection } - #- { key: V, mode: Vi|~Search, action: ToggleNormalSelection } - #- { key: V, mods: Shift, mode: Vi|~Search, action: ToggleLineSelection } - #- { key: V, mods: Control, mode: Vi|~Search, action: ToggleBlockSelection } - #- { key: V, mods: Alt, mode: Vi|~Search, action: ToggleSemanticSelection } - #- { key: Return, mode: Vi|~Search, action: Open } - #- { key: Z, mode: Vi|~Search, action: CenterAroundViCursor } - #- { key: K, mode: Vi|~Search, action: Up } - #- { key: J, mode: Vi|~Search, action: Down } - #- { key: H, mode: Vi|~Search, action: Left } - #- { key: L, mode: Vi|~Search, action: Right } - #- { key: Up, mode: Vi|~Search, action: Up } - #- { key: Down, mode: Vi|~Search, action: Down } - #- { key: Left, mode: Vi|~Search, action: Left } - #- { key: Right, mode: Vi|~Search, action: Right } - #- { key: Key0, mode: Vi|~Search, action: First } - #- { key: Key4, mods: Shift, mode: Vi|~Search, action: Last } - #- { key: Key6, mods: Shift, mode: Vi|~Search, action: FirstOccupied } - #- { key: H, mods: Shift, mode: Vi|~Search, action: High } - #- { key: M, mods: Shift, mode: Vi|~Search, action: Middle } - #- { key: L, mods: Shift, mode: Vi|~Search, action: Low } - #- { key: B, mode: Vi|~Search, action: SemanticLeft } - #- { key: W, mode: Vi|~Search, action: SemanticRight } - #- { key: E, mode: Vi|~Search, action: SemanticRightEnd } - #- { key: B, mods: Shift, mode: Vi|~Search, action: WordLeft } - #- { key: W, mods: Shift, mode: Vi|~Search, action: WordRight } - #- { key: E, mods: Shift, mode: Vi|~Search, action: WordRightEnd } - #- { key: Key5, mods: Shift, mode: Vi|~Search, action: Bracket } - #- { key: Slash, mode: Vi|~Search, action: SearchForward } - #- { key: Slash, mods: Shift, mode: Vi|~Search, action: SearchBackward } - #- { key: N, mode: Vi|~Search, action: SearchNext } - #- { key: N, mods: Shift, mode: Vi|~Search, action: SearchPrevious } - - # Search Mode - #- { key: Return, mode: Search|Vi, action: SearchConfirm } - #- { key: Escape, mode: Search, action: SearchCancel } - #- { key: C, mods: Control, mode: Search, action: SearchCancel } - #- { key: U, mods: Control, mode: Search, action: SearchClear } - #- { key: W, mods: Control, mode: Search, action: SearchDeleteWord } - #- { key: P, mods: Control, mode: Search, action: SearchHistoryPrevious } - #- { key: N, mods: Control, mode: Search, action: SearchHistoryNext } - #- { key: Up, mode: Search, action: SearchHistoryPrevious } - #- { key: Down, mode: Search, action: SearchHistoryNext } - #- { key: Return, mode: Search|~Vi, action: SearchFocusNext } - #- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious } - - # (Windows, Linux, and BSD only) - - { key: V, mods: Control|Shift, mode: ~Vi, action: Paste } - - { key: C, mods: Control|Shift, action: Copy } - ''; - }; -} - diff --git a/nix-conf/home-manager/overlays.nix b/nix-conf/home-manager/overlays.nix new file mode 100644 index 0000000..4f08827 --- /dev/null +++ b/nix-conf/home-manager/overlays.nix @@ -0,0 +1,76 @@ +flake_input@{ kpcli-py +, nixgl +, rust-overlay +, neovim-nightly-overlay +, system +, nickel +, nix-boost +, ... +}: +let + kpcli-py = (final: prev: { + # use python3.9, which works because of cython somehow? + kpcli-py = final.poetry2nix.mkPoetryApplication { + projectDir = flake_input.kpcli-py; + python = final.python39; + overrides = final.poetry2nix.defaultPoetryOverrides.extend (self: super: { + # tableformatter requires setuptools + tableformatter = super.tableformatter.overridePythonAttrs ( + old: { + buildInputs = (old.buildInputs or [ ]) ++ [ self.setuptools self.cython_3 ]; + src = old.src; + } + ); + kpcli = super.kpcli.overridePythonAttrs (old: { + buildInputs = (old.buildInputs or [ ]) ++ [ self.setuptools ]; + }); + + # ubersmith = super.ubersmith.overridePythonAttrs (old: { + # buildInputs = builtins.filter (x: ! builtins.elem x [ ]) ((old.buildInputs or [ ]) ++ [ + # py-final.setuptools + # py-final.pip + # ]); + # + # src = final.fetchFromGitHub { + # owner = "jasonkeene"; + # repo = "python-ubersmith"; + # rev = "0c594e2eb41066d1fe7860e3a6f04b14c14f6e6a"; + # sha256 = "sha256-Dystt7CBtjpLkgzCsAif8WkkYYeLyh7VMehAtwoDGuM="; + # }; + # }); + + }); + }; + }); + + rust = (final: prev: + let + nightlyRustWithExts = exts: final.rust-bin.selectLatestNightlyWith ( + toolchain: (toolchain.minimal.override { + extensions = exts; + }) + ); + # https://rust-lang.github.io/rustup/concepts/profiles.html + rust-default-components = [ "rust-docs" "rustfmt" "clippy" ]; + rust-dev-components = rust-default-components ++ [ "rust-src" "rust-analyzer" "miri" ]; + in + { + rust4devs = nightlyRustWithExts rust-dev-components; + rust4cargo = nightlyRustWithExts [ ]; + rust4normi = nightlyRustWithExts rust-default-components; + }); + + nickel = (final: prev: { + inherit (flake_input.nickel.packages.${system}) + lsp-nls nickel nickelWasm; + }); +in +[ + nix-boost.overlays.default + nixgl.overlays.default + rust-overlay.overlays.default + neovim-nightly-overlay.overlay + rust + kpcli-py + nickel +] diff --git a/nix/cells/dotfiles/default.nix b/nix/cells/dotfiles/default.nix deleted file mode 100644 index e69de29..0000000 diff --git a/nix/cells/dotfiles/devshells.nix b/nix/cells/dotfiles/devshells.nix index 9d23473..44bc82b 100644 --- a/nix/cells/dotfiles/devshells.nix +++ b/nix/cells/dotfiles/devshells.nix @@ -3,6 +3,7 @@ in { default = std.lib.dev.mkShell { - name = nixpkgs.lib. + name = "default"; + imports = [inputs.std.std.devshellProfiles.default]; }; } diff --git a/overlays.nix b/overlays.nix index f57ca24..8b13789 100644 --- a/overlays.nix +++ b/overlays.nix @@ -1,77 +1 @@ -flake_input@{ kpcli-py -, nixgl -, rust-overlay -, neovim-nightly-overlay -, system -, nickel -, nix-boost -, ... -}: -let - kpcli-py = (final: prev: { - # use python3.9, which works because of cython somehow? - kpcli-py = final.poetry2nix.mkPoetryApplication { - projectDir = flake_input.kpcli-py; - python = final.python39; - overrides = final.poetry2nix.defaultPoetryOverrides.extend (self: super: { - # tableformatter requires setuptools - tableformatter = super.tableformatter.overridePythonAttrs ( - old: { - buildInputs = (old.buildInputs or [ ]) ++ [ self.setuptools self.cython_3 ]; - src = old.src; - } - ); - kpcli = super.kpcli.overridePythonAttrs (old: { - buildInputs = (old.buildInputs or [ ]) ++ [ self.setuptools ]; - }); - - # ubersmith = super.ubersmith.overridePythonAttrs (old: { - # buildInputs = builtins.filter (x: ! builtins.elem x [ ]) ((old.buildInputs or [ ]) ++ [ - # py-final.setuptools - # py-final.pip - # ]); - # - # src = final.fetchFromGitHub { - # owner = "jasonkeene"; - # repo = "python-ubersmith"; - # rev = "0c594e2eb41066d1fe7860e3a6f04b14c14f6e6a"; - # sha256 = "sha256-Dystt7CBtjpLkgzCsAif8WkkYYeLyh7VMehAtwoDGuM="; - # }; - # }); - - }); - }; - }); - - rust = (final: prev: - let - nightlyRustWithExts = exts: final.rust-bin.selectLatestNightlyWith ( - toolchain: (toolchain.minimal.override { - extensions = exts; - }) - ); - # https://rust-lang.github.io/rustup/concepts/profiles.html - rust-default-components = [ "rust-docs" "rustfmt" "clippy" ]; - rust-dev-components = rust-default-components ++ [ "rust-src" "rust-analyzer" "miri" ]; - in - { - rust4devs = nightlyRustWithExts rust-dev-components; - rust4cargo = nightlyRustWithExts [ ]; - rust4normi = nightlyRustWithExts rust-default-components; - }); - - nickel = (final: prev: { - inherit (flake_input.nickel.packages.${system}) - lsp-nls nickel nickelWasm; - }); -in -[ - nix-boost.overlays.default - nixgl.overlays.default - rust-overlay.overlays.default - neovim-nightly-overlay.overlay - rust - kpcli-py - nickel -] From 632104be6905b5cf363b67c80415063d739d4a35 Mon Sep 17 00:00:00 2001 From: Hung Date: Tue, 16 May 2023 09:31:51 -0700 Subject: [PATCH 43/64] fix(flakes): minimum to work correctly, along with user shell integration --- flake.nix | 13 +++++++------ nix/cells/dotfiles/devshells.nix | 2 +- nix/cells/repo/userShells.nix | 4 ++++ 3 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 nix/cells/repo/userShells.nix diff --git a/flake.nix b/flake.nix index 34b36b1..10f81b4 100644 --- a/flake.nix +++ b/flake.nix @@ -23,18 +23,19 @@ cellBlocks = let - inherit (std.blockTypes) devShells functions; + inherit (std.blockTypes) devshells functions; in [ - (devShells "devshells") - (functions "host_profile") - (functions "home_profile") + (devshells "devshells") + (devshells "userShells") + # (functions "host_profile") + # (functions "home_profile") ]; } { devShells = std.harvest [ [ "dotfiles" "devshells" ] ]; - nixosConfigurations = std.pick [ [ "dotfiles" "nixos" ] ]; - homeConfigurations = std.pick [ [ "dotfiles" "home" ] ]; + # nixosConfigurations = std.pick [ [ "dotfiles" "nixos" ] ]; + # homeConfigurations = std.pick [ [ "dotfiles" "home" ] ]; }; } diff --git a/nix/cells/dotfiles/devshells.nix b/nix/cells/dotfiles/devshells.nix index 44bc82b..fe24e92 100644 --- a/nix/cells/dotfiles/devshells.nix +++ b/nix/cells/dotfiles/devshells.nix @@ -1,4 +1,4 @@ -{inputs, cells}: let +{inputs, cell}: let inherit (inputs) std nixpkgs; in { diff --git a/nix/cells/repo/userShells.nix b/nix/cells/repo/userShells.nix new file mode 100644 index 0000000..3d5b345 --- /dev/null +++ b/nix/cells/repo/userShells.nix @@ -0,0 +1,4 @@ +{inputs, cell}: { + htran = inputs.cells.dotfiles.devshells.default; + hungtran = inputs.cells.dotfiles.devshells.default; +} From 9a8ddc42d50be2f963f8238ad5323b4f51fe97ad Mon Sep 17 00:00:00 2001 From: Hung Date: Thu, 1 Jun 2023 08:26:10 -0700 Subject: [PATCH 44/64] tsql --- flake.lock | 12 ++++++------ native_configs/neovim/init.lua | 7 +++---- nix-conf/home-manager/flake.lock | 24 ++++++++++++------------ nix-conf/home-manager/flake.nix | 2 +- nix-conf/home-manager/htran/nix.conf | 6 ++++++ nix-conf/home-manager/nix.conf | 4 ++++ scripts/hm-switch.sh | 3 ++- 7 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 nix-conf/home-manager/htran/nix.conf create mode 100644 nix-conf/home-manager/nix.conf diff --git a/flake.lock b/flake.lock index 5ef23d9..f99bd80 100644 --- a/flake.lock +++ b/flake.lock @@ -459,11 +459,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1684215771, - "narHash": "sha256-fsum28z+g18yreNa1Y7MPo9dtps5h1VkHfZbYQ+YPbk=", + "lastModified": 1685168767, + "narHash": "sha256-wQgnxz0PdqbyKKpsWl/RU8T8QhJQcHfeC6lh1xRUTfk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "963006aab35e3e8ebbf6052b6bf4ea712fdd3c28", + "rev": "e10802309bf9ae351eb27002c85cfdeb1be3b262", "type": "github" }, "original": { @@ -740,11 +740,11 @@ "yants": "yants_2" }, "locked": { - "lastModified": 1684180498, - "narHash": "sha256-kA58ms4yunOVPhe3r7V0IIKeWUV+vl4r2GTcfFfYW5o=", + "lastModified": 1684882168, + "narHash": "sha256-Yu1yw1sPWZsXe7BX7HaHg+O8fWKHCpy/AwgGfBdhivw=", "owner": "divnix", "repo": "std", - "rev": "45b431ae09df98e046bcc8271aa209bdfc87444d", + "rev": "959f54d6698ff7fea01e4e6d8e5d7d95fcf66844", "type": "github" }, "original": { diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 9173409..7db0368 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -72,7 +72,7 @@ Plug('folke/trouble.nvim') -- File-grouped workspace diagnostics Plug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands Plug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein" Plug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator -Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs) +-- Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs) Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*) Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration @@ -87,7 +87,6 @@ Plug('m-demare/hlargs.nvim') -- highlights arguments; great for f Plug('folke/todo-comments.nvim') -- Highlights TODO -- other utilities -Plug('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' }) Plug('nvim-treesitter/nvim-treesitter-context') -- Top one-liner context of func/class scope Plug('nvim-treesitter/playground') -- Sees Treesitter AST - less hair pulling, more PRs Plug('saadparwaiz1/cmp_luasnip') -- snippet engine @@ -98,6 +97,7 @@ Plug('mickael-menu/zk-nvim') -- Zettelkasten -- `gsu` -> UPPER_CASE (CONSTs), `gsk` -> kebab-case (Clojure), `gsK` -> Title-Kebab-Case -- `gs.` -> dot.case (R) Plug('arthurxavierx/vim-caser') -- switch cases +Plug('pegasust/tsql.nvim') -- workspace code intelligence --------- vim.call('plug#end') @@ -775,7 +775,6 @@ require("rust-tools").setup { -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" on_initialized = function() require('inlay-hints').set_all() - end, -- automatically call RustReloadWorkspace when writing to a Cargo.toml file. reload_workspace_from_cargo_toml = true, @@ -920,7 +919,7 @@ require("rust-tools").setup { nmap('K', require 'rust-tools'.hover_actions.hover_actions, 'Hover Documentation') end, capabilities = capabilities, - cmd = {"rust-analyzer"}, + cmd = { "rust-analyzer" }, settings = { ["rust-analyzer"] = { -- enable clippy on save diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index 6e58fe8..26e6774 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -803,11 +803,11 @@ ] }, "locked": { - "lastModified": 1684189380, - "narHash": "sha256-GUp9OkZynocyppLur1VX8oAjtXGue0oKRHbsksOMUm0=", + "lastModified": 1685189510, + "narHash": "sha256-Hq5WF7zIixojPgvhgcd6MBvywwycVZ9wpK/8ogOyoaA=", "owner": "nix-community", "repo": "home-manager", - "rev": "b7d814c5744dca7e70b3dc2638f06568dce96ca6", + "rev": "2d963854ae2499193c0c72fd67435fee34d3e4fd", "type": "github" }, "original": { @@ -938,11 +938,11 @@ "topiary": "topiary" }, "locked": { - "lastModified": 1684220170, - "narHash": "sha256-Vl6KHfZCmG016cN3xkaHgVtB9p2eODwjHQuMXF3KUsg=", + "lastModified": 1685111201, + "narHash": "sha256-WiaWxL1mBvHjOWGfC082zj/Nd1aaJt+Ga+KuzPQZ5dk=", "owner": "tweag", "repo": "nickel", - "rev": "f11b7b09e2fbbcaa6384e511ef95cde1f4aae93a", + "rev": "afdaff57cec860b27e9cdab79fafc2ee724b0cff", "type": "github" }, "original": { @@ -1182,11 +1182,11 @@ }, "nixpkgs_12": { "locked": { - "lastModified": 1684215771, - "narHash": "sha256-fsum28z+g18yreNa1Y7MPo9dtps5h1VkHfZbYQ+YPbk=", + "lastModified": 1685168767, + "narHash": "sha256-wQgnxz0PdqbyKKpsWl/RU8T8QhJQcHfeC6lh1xRUTfk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "963006aab35e3e8ebbf6052b6bf4ea712fdd3c28", + "rev": "e10802309bf9ae351eb27002c85cfdeb1be3b262", "type": "github" }, "original": { @@ -1753,11 +1753,11 @@ "nixpkgs": "nixpkgs_13" }, "locked": { - "lastModified": 1684203630, - "narHash": "sha256-ZOWNixdHU4qFZUgYNEULFB3ifctMQO9H4Oo+Zrz+4L8=", + "lastModified": 1685240871, + "narHash": "sha256-bOCbP0lWTjhmrPcdyuFD/yx/38CKkzC2TNXmBzZSLJA=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "65c3f2655f52a81e1b3e629d4c07df4873d0f2bb", + "rev": "aa1b08de9ca770534ad750dccc70cebd95c15e26", "type": "github" }, "original": { diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 121501b..47cc1aa 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -191,6 +191,7 @@ # FIXME: this actually does not exist base.keepass.path = "/Users/htran/keepass.kdbx"; base.alacritty.font.size = 11.0; + base.alacritty.font.family = "DroidSansM Nerd Font"; base.git.name = "Hung"; base.git.email = "htran@egihosting.com"; } @@ -199,7 +200,6 @@ pkgs.postman ]; } - nerd_font_module { base.keepass.enable = pkgs.lib.mkForce false; } ]; extraSpecialArgs = mkModuleArgs { diff --git a/nix-conf/home-manager/htran/nix.conf b/nix-conf/home-manager/htran/nix.conf new file mode 100644 index 0000000..93b8bba --- /dev/null +++ b/nix-conf/home-manager/htran/nix.conf @@ -0,0 +1,6 @@ +accept-flake-config = true +experimental-features = nix-command flakes +post-build-hook = /etc/nix/upload-to-cache.sh +trusted-users = root htran hungtran hwtr +max-jobs = 8 +cores = 12 diff --git a/nix-conf/home-manager/nix.conf b/nix-conf/home-manager/nix.conf new file mode 100644 index 0000000..a9ba586 --- /dev/null +++ b/nix-conf/home-manager/nix.conf @@ -0,0 +1,4 @@ +accept-flake-config = true +experimental-features = nix-command flakes +post-build-hook = /etc/nix/upload-to-cache.sh +trusted-users = root htran hungtran hwtr diff --git a/scripts/hm-switch.sh b/scripts/hm-switch.sh index fbf2782..04013b1 100755 --- a/scripts/hm-switch.sh +++ b/scripts/hm-switch.sh @@ -15,7 +15,8 @@ if [ -f /etc/nix/nix.conf ]; then echo "overwriting /etc/nix/nix.conf. Please find latest backup in ${BACKUP_FILE}" sudo cp /etc/nix/nix.conf ${BACKUP_FILE} fi -sudo cp "${HOME_MANAGER_DIR}/hwtr/nix.conf" /etc/nix/ +sudo cp "${HOME_MANAGER_DIR}/nix.conf" /etc/nix/ +sudo cp "${HOME_MANAGER_DIR}/${USER}/nix.conf" /etc/nix/ | echo "no nix.conf for ${USER}. Totally OK." sudo cp "${SCRIPT_DIR}/upload-to-cache.sh" /etc/nix/ sudo chmod +x /etc/nix/*.sh # Reload nix daemon so that new changes are applied. From 84a69f863817ce49fc7811285c2cd90bc7f6529e Mon Sep 17 00:00:00 2001 From: Hung Date: Sat, 3 Jun 2023 20:23:42 -0700 Subject: [PATCH 45/64] feat: vi-copy mode now consistent with vim: use 'v' for select mode and 'y' to copy --- native_configs/tmux/tmux.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/native_configs/tmux/tmux.conf b/native_configs/tmux/tmux.conf index d494893..0af00fb 100644 --- a/native_configs/tmux/tmux.conf +++ b/native_configs/tmux/tmux.conf @@ -21,6 +21,11 @@ set-option -g renumber-windows on # set -g status-left " " # Keybinds +# Enter copy mode with 'v' in vi mode +bind-key -Tcopy-mode-vi v send-keys -X begin-selection + +# Copy selection with 'y' in vi mode +bind-key -Tcopy-mode-vi y send-keys -X copy-selection-and-cancel set-window-option -g mode-keys vi # # Log From 9cd012f2e2c427eb36dba68b6a36df24a8e95d18 Mon Sep 17 00:00:00 2001 From: Hung Date: Sun, 4 Jun 2023 20:17:13 -0700 Subject: [PATCH 46/64] feat: less init.lua, more neovim.nix along with docs on shell setup --- flake.lock | 84 +++++++++++++++++++++++---- native_configs/neovim/init.lua | 62 +++++++++----------- nix-conf/home-manager/base/neovim.nix | 54 +++++++++++++++++ nix-conf/home-manager/base/shells.nix | 7 ++- nix-conf/home-manager/flake.lock | 36 ++++++------ nix-conf/home-manager/overlays.nix | 1 - 6 files changed, 180 insertions(+), 64 deletions(-) diff --git a/flake.lock b/flake.lock index f99bd80..ecaa208 100644 --- a/flake.lock +++ b/flake.lock @@ -145,7 +145,7 @@ }, "fenix": { "inputs": { - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_6", "rust-analyzer-src": "rust-analyzer-src" }, "locked": { @@ -268,6 +268,28 @@ "type": "github" } }, + "haumea_3": { + "inputs": { + "nixpkgs": [ + "std", + "paisano", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1681176209, + "narHash": "sha256-bJLDun6esIyWtwRVXcsgzGbh4UKu8wJDrPgykqPyzmg=", + "owner": "nix-community", + "repo": "haumea", + "rev": "b915b66b27da3a595d77b139e945bb0a2fcac926", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "haumea", + "type": "github" + } + }, "hive": { "inputs": { "colmena": "colmena", @@ -381,6 +403,29 @@ "type": "github" } }, + "namaka_2": { + "inputs": { + "haumea": [ + "std", + "paisano", + "haumea" + ], + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1681604203, + "narHash": "sha256-oA/fW/85GmSNprghgAnZi0XeVMvW9xVuCYprzPw2hz0=", + "owner": "nix-community", + "repo": "namaka", + "rev": "1550ddc025334cff2e8ec9021256473b2ffb27e5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "namaka", + "type": "github" + } + }, "nixago": { "inputs": { "flake-utils": [ @@ -459,11 +504,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1685168767, - "narHash": "sha256-wQgnxz0PdqbyKKpsWl/RU8T8QhJQcHfeC6lh1xRUTfk=", + "lastModified": 1685655444, + "narHash": "sha256-6EujQNAeaUkWvpEZZcVF8qSfQrNVWFNNGbUJxv/A5a8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e10802309bf9ae351eb27002c85cfdeb1be3b262", + "rev": "e635192892f5abbc2289eaac3a73cdb249abaefd", "type": "github" }, "original": { @@ -490,6 +535,22 @@ } }, "nixpkgs_5": { + "locked": { + "lastModified": 1680758185, + "narHash": "sha256-sCVWwfnk7zEX8Z+OItiH+pcSklrlsLZ4TJTtnxAYREw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0e19daa510e47a40e06257e205965f3b96ce0ac9", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { "locked": { "lastModified": 1677063315, "narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=", @@ -634,6 +695,8 @@ }, "paisano_2": { "inputs": { + "haumea": "haumea_3", + "namaka": "namaka_2", "nixpkgs": [ "std", "nixpkgs" @@ -645,15 +708,16 @@ ] }, "locked": { - "lastModified": 1678949904, - "narHash": "sha256-oAoF66hYYz1RPh3lEwb9/4e4iyBAfTbQKZRRQ8gP0Ds=", + "lastModified": 1685757649, + "narHash": "sha256-gu21uo35i5OguZ5laGpqIFgVRcowbjvLn2mxSyNKZfQ=", "owner": "paisano-nix", "repo": "core", - "rev": "88f2aff10a5064551d1d4cb86800d17084489ce3", + "rev": "db53b8a8e2e3e557bf5ec5842b7a52ee5de04e87", "type": "github" }, "original": { "owner": "paisano-nix", + "ref": "0.1.0", "repo": "core", "type": "github" } @@ -740,11 +804,11 @@ "yants": "yants_2" }, "locked": { - "lastModified": 1684882168, - "narHash": "sha256-Yu1yw1sPWZsXe7BX7HaHg+O8fWKHCpy/AwgGfBdhivw=", + "lastModified": 1685759602, + "narHash": "sha256-aEIGXP3RecgVQ0qEsRM+OuYrY4GYzq7mmlVjpO+SOuo=", "owner": "divnix", "repo": "std", - "rev": "959f54d6698ff7fea01e4e6d8e5d7d95fcf66844", + "rev": "1607dab0469ac89ca6727a1cadde8bce3a958438", "type": "github" }, "original": { diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 7db0368..45132dc 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -1,5 +1,4 @@ --- What: Mono-file nvim configuration file --- Why: Easy to see through everything without needing to navigate thru files +-- What: Mono-file nvim configuration file Why: Easy to see through everything without needing to navigate thru files -- Features: -- - LSP -- - Auto-complete (in insert mode: ctrl-space, navigate w/ Tab+S-Tab, confirm: Enter) @@ -25,13 +24,13 @@ local Plug = vim.fn['plug#'] vim.call('plug#begin') -- libs and dependencies -Plug('nvim-lua/plenary.nvim') -- The base of all plugins +-- Plug('nvim-lua/plenary.nvim') -- The base of all plugins -- plugins -Plug('tjdevries/nlua.nvim') -- adds symbols of vim stuffs in init.lua -Plug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting -Plug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects -Plug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser +-- Plug('tjdevries/nlua.nvim') -- adds symbols of vim stuffs in init.lua +-- Plug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting +-- Plug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects +-- Plug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser -- TODO: this might need to be taken extra care in our Nix config -- What this Plug declaration means is this repo needs to be built on our running environment -- ----- @@ -41,32 +40,32 @@ Plug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser -- - Make sure that if we run `make` at first Plug run, that `make` is idempotent -- OR -- Make sure that Plug does not run `make` and use the output it needs -Plug('nvim-telescope/telescope-fzf-native.nvim', - { ['do'] = 'make >> /tmp/log 2>&1' }) -Plug('nvim-telescope/telescope-file-browser.nvim') +-- Plug('nvim-telescope/telescope-fzf-native.nvim', +-- { ['do'] = 'make >> /tmp/log 2>&1' }) +-- Plug('nvim-telescope/telescope-file-browser.nvim') -- cmp: auto-complete/suggestions -Plug('neovim/nvim-lspconfig') -- built-in LSP configurations -Plug('hrsh7th/cmp-nvim-lsp') -Plug('hrsh7th/cmp-path') -Plug('hrsh7th/cmp-buffer') -Plug('hrsh7th/cmp-cmdline') -Plug('hrsh7th/nvim-cmp') -Plug('onsails/lspkind-nvim') +-- Plug('neovim/nvim-lspconfig') -- built-in LSP configurations +-- Plug('hrsh7th/cmp-nvim-lsp') +-- Plug('hrsh7th/cmp-path') +-- Plug('hrsh7th/cmp-buffer') +-- Plug('hrsh7th/cmp-cmdline') +-- Plug('hrsh7th/nvim-cmp') +-- Plug('onsails/lspkind-nvim') Plug('yioneko/nvim-yati', { tag = '*' }) -- copium: fix Python indent auto-correct from smart-indent Plug('nathanalderson/yang.vim') -- Plug('tzachar/cmp-tabnine', { ['do'] = './install.sh' }) -- DevExp -Plug('windwp/nvim-autopairs') -- matches pairs like [] (),... -Plug('windwp/nvim-ts-autotag') -- matches tags hello -Plug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer +-- Plug('windwp/nvim-autopairs') -- matches pairs like [] (),... +-- Plug('windwp/nvim-ts-autotag') -- matches tags hello +-- Plug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns Plug('tpope/vim-fugitive') -- git commands in nvim Plug('williamboman/mason.nvim') -- LSP, debuggers,... package manager Plug('williamboman/mason-lspconfig.nvim') -- lsp config for mason -Plug('ThePrimeagen/harpoon') -- 1-click through marked files per project +-- Plug('ThePrimeagen/harpoon') -- 1-click through marked files per project Plug('TimUntersberger/neogit') -- Easy-to-see git status Plug('folke/trouble.nvim') -- File-grouped workspace diagnostics Plug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands @@ -79,7 +78,7 @@ Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integ -- UI & colorscheme Plug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts -Plug('gruvbox-community/gruvbox') -- theme provider +-- Plug('gruvbox-community/gruvbox') -- theme provider Plug('nvim-lualine/lualine.nvim') -- fancy status line Plug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines Plug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes @@ -90,14 +89,14 @@ Plug('folke/todo-comments.nvim') -- Highlights TODO Plug('nvim-treesitter/nvim-treesitter-context') -- Top one-liner context of func/class scope Plug('nvim-treesitter/playground') -- Sees Treesitter AST - less hair pulling, more PRs Plug('saadparwaiz1/cmp_luasnip') -- snippet engine -Plug('L3MON4D3/LuaSnip') -- snippet engine -Plug('mickael-menu/zk-nvim') -- Zettelkasten +-- Plug('L3MON4D3/LuaSnip') -- snippet engine +-- Plug('mickael-menu/zk-nvim') -- Zettelkasten -- Switch cases: -- `gsp` -> PascalCase (classes), `gsc` -> camelCase (Java), `gs_` -> snake_case (C/C++/Rust) -- `gsu` -> UPPER_CASE (CONSTs), `gsk` -> kebab-case (Clojure), `gsK` -> Title-Kebab-Case -- `gs.` -> dot.case (R) Plug('arthurxavierx/vim-caser') -- switch cases -Plug('pegasust/tsql.nvim') -- workspace code intelligence +Plug('~/local_repos/ts-ql') -- workspace code intelligence --------- vim.call('plug#end') @@ -361,12 +360,6 @@ require('nvim-treesitter.configs').setup { disable = { "nix" } }, indent = { enable = false }, - ensure_installed = { - 'tsx', 'toml', 'lua', 'typescript', 'rust', 'go', 'yaml', 'json', 'php', 'css', - 'python', 'prisma', 'html', "dockerfile", "c", "cpp", "hcl", "svelte", "astro", - "clojure", "fennel", "bash", "nix", "query", "nickel" - }, - sync_install = false, highlight = { enable = true, enable_vim_regex_highlighting = true, @@ -603,7 +596,7 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities() -- }) -- default language servers local servers = { - 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'sumneko_lua', 'cmake', 'tailwindcss', 'prismals', + 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'lua_ls', 'cmake', 'tailwindcss', 'prismals', 'rnix', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels", "jsonls", "denols", "gopls", "nickel_ls", 'pylsp', } @@ -645,8 +638,8 @@ require('mason-lspconfig').setup_handlers({ capabilities = capabilities, } end, - ["sumneko_lua"] = function() - require('lspconfig').sumneko_lua.setup { + ["lua_ls"] = function() + require('lspconfig').lua_ls.setup { on_attach = on_attach, capabilities = capabilities, settings = { @@ -1040,3 +1033,4 @@ require('lualine').setup { } require('nvim-surround').setup {} +require('tsql').setup() diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix index bdb4356..dbfae99 100644 --- a/nix-conf/home-manager/base/neovim.nix +++ b/nix-conf/home-manager/base/neovim.nix @@ -94,6 +94,60 @@ in # https://github.com/nix-community/home-manager/pull/3287 # extraConfig = builtins.readFile "${proj_root}/neovim/init.lua"; extraLuaConfig = (builtins.readFile "${proj_root.config.path}//neovim/init.lua"); + plugins = (let inherit (pkgs.vimPlugins) + plenary-nvim + + nvim-treesitter + nvim-treesitter-textobjects + nvim-treesitter-context + + telescope-fzf-native-nvim + telescope-file-browser-nvim + telescope-nvim + + nvim-lspconfig + + gruvbox-community + + neodev-nvim + + cmp-nvim-lsp + cmp-path + cmp-buffer + cmp-cmdline + nvim-cmp + + lspkind-nvim + nvim-autopairs + nvim-ts-autotag + guess-indent-nvim + harpoon + zk-nvim + luasnip + ; in [ + plenary-nvim + nvim-treesitter.withAllGrammars + nvim-treesitter-textobjects + telescope-fzf-native-nvim + telescope-file-browser-nvim + telescope-nvim + nvim-lspconfig + gruvbox-community + neodev-nvim + cmp-nvim-lsp + cmp-path + cmp-buffer + cmp-cmdline + nvim-cmp + lspkind-nvim + nvim-autopairs + nvim-ts-autotag + guess-indent-nvim + harpoon + zk-nvim + luasnip + nvim-treesitter-context + ]); }; # home.packages = nvim_pkgs; }; diff --git a/nix-conf/home-manager/base/shells.nix b/nix-conf/home-manager/base/shells.nix index 16faf76..36b293e 100644 --- a/nix-conf/home-manager/base/shells.nix +++ b/nix-conf/home-manager/base/shells.nix @@ -1,5 +1,5 @@ # Configurations for shell stuffs. -# Should probably be decoupled even more +# Should probably be decoupled even more for each feature { config , proj_root , myLib @@ -59,14 +59,17 @@ in xdg.configFile."tmux/tmux.conf".text = myLib.mkOrder 600 '' set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M ' ''; + # Colored ls programs.exa = { enable = true; enableAliases = true; }; + # Make the shell look beautiful programs.starship = { enable = true; enableZshIntegration = true; }; + # Fuzzy finder. `fzf` for TUI, `fzf -f ''` for UNIX piping programs.fzf.enable = true; programs.bash = { enable = true; @@ -99,6 +102,8 @@ in ]; }; sessionVariables = { + # Vim mode on the terminal + # VI_MODE_RESET_PROMPT_ON_MODE_CHANGE = true; # VI_MODE_SET_CURSOR = true; # ZVM_VI_ESCAPE_BINDKEY = ""; diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index 26e6774..9cf8b49 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -423,11 +423,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", "type": "github" }, "original": { @@ -803,11 +803,11 @@ ] }, "locked": { - "lastModified": 1685189510, - "narHash": "sha256-Hq5WF7zIixojPgvhgcd6MBvywwycVZ9wpK/8ogOyoaA=", + "lastModified": 1685833925, + "narHash": "sha256-KCo8QT/DtM4pSTQDWFOhVP7MDzwi0wb2ZlxhgjEwXtM=", "owner": "nix-community", "repo": "home-manager", - "rev": "2d963854ae2499193c0c72fd67435fee34d3e4fd", + "rev": "bffc49ffb255f213d2f902043da37b3016450f4a", "type": "github" }, "original": { @@ -938,11 +938,11 @@ "topiary": "topiary" }, "locked": { - "lastModified": 1685111201, - "narHash": "sha256-WiaWxL1mBvHjOWGfC082zj/Nd1aaJt+Ga+KuzPQZ5dk=", + "lastModified": 1685719780, + "narHash": "sha256-igcKtuS1p63O3JDo3qIH4T53hK66K+QQNe+bo+D9qZI=", "owner": "tweag", "repo": "nickel", - "rev": "afdaff57cec860b27e9cdab79fafc2ee724b0cff", + "rev": "651ffdbc76e0314d693f4818812be3e2b100f626", "type": "github" }, "original": { @@ -1022,11 +1022,11 @@ ] }, "locked": { - "lastModified": 1683638468, - "narHash": "sha256-tQEaGZfZ2Hpw+XIVEHaJ8FaF1yNQyMDDhUyIQ7LTIEg=", + "lastModified": 1685764721, + "narHash": "sha256-CIy1iwQTEKfZRrid4gBLA+r/LPGA9IUFo0lKJVyECGI=", "owner": "mic92", "repo": "nix-index-database", - "rev": "219067a5e3cf4b9581c8b4fcfc59ecd5af953d07", + "rev": "669ca1f2e2bc401abab6b837ae9c51503edc9b49", "type": "github" }, "original": { @@ -1182,11 +1182,11 @@ }, "nixpkgs_12": { "locked": { - "lastModified": 1685168767, - "narHash": "sha256-wQgnxz0PdqbyKKpsWl/RU8T8QhJQcHfeC6lh1xRUTfk=", + "lastModified": 1685655444, + "narHash": "sha256-6EujQNAeaUkWvpEZZcVF8qSfQrNVWFNNGbUJxv/A5a8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e10802309bf9ae351eb27002c85cfdeb1be3b262", + "rev": "e635192892f5abbc2289eaac3a73cdb249abaefd", "type": "github" }, "original": { @@ -1753,11 +1753,11 @@ "nixpkgs": "nixpkgs_13" }, "locked": { - "lastModified": 1685240871, - "narHash": "sha256-bOCbP0lWTjhmrPcdyuFD/yx/38CKkzC2TNXmBzZSLJA=", + "lastModified": 1685846256, + "narHash": "sha256-G4aYK4VqlMHImvZ0lUnLHw1A+Cx28T0sBMvAKZBcGpk=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "aa1b08de9ca770534ad750dccc70cebd95c15e26", + "rev": "1ef3c6de6127a1cba94cc5492cdde52e33d06ea4", "type": "github" }, "original": { diff --git a/nix-conf/home-manager/overlays.nix b/nix-conf/home-manager/overlays.nix index 4f08827..c711e6a 100644 --- a/nix-conf/home-manager/overlays.nix +++ b/nix-conf/home-manager/overlays.nix @@ -12,7 +12,6 @@ let # use python3.9, which works because of cython somehow? kpcli-py = final.poetry2nix.mkPoetryApplication { projectDir = flake_input.kpcli-py; - python = final.python39; overrides = final.poetry2nix.defaultPoetryOverrides.extend (self: super: { # tableformatter requires setuptools tableformatter = super.tableformatter.overridePythonAttrs ( From d58acd7bc2321e61b1db5d6b955942846568530a Mon Sep 17 00:00:00 2001 From: Hung Date: Sun, 4 Jun 2023 21:40:47 -0700 Subject: [PATCH 47/64] feat(nvim): add 'fug' for unrestricted live grep (no .gitignore) --- flake.lock | 6 +++--- native_configs/neovim/init.lua | 8 +++++++- nix-conf/home-manager/flake.lock | 18 +++++++++--------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/flake.lock b/flake.lock index ecaa208..787668d 100644 --- a/flake.lock +++ b/flake.lock @@ -504,11 +504,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1685655444, - "narHash": "sha256-6EujQNAeaUkWvpEZZcVF8qSfQrNVWFNNGbUJxv/A5a8=", + "lastModified": 1685836261, + "narHash": "sha256-rpxEPGeW4JZJcH58SQApJUtJ7w78VPtkF6Cut/Pq6Kg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e635192892f5abbc2289eaac3a73cdb249abaefd", + "rev": "dd4982554e18b936790da07c4ea2db7c7600f283", "type": "github" }, "original": { diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 45132dc..532e978 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -328,6 +328,12 @@ remap('n', 'fg', function() require('telescope.builtin').live_grep() end, { desc = '[F]ind by [G]rep' }) +remap('n', 'fug', function() + -- This relies on many factors: We use `rg` and that `-g '**/*'` effectively + -- drops ignore rules like the default `.gitignore` rule. + require('telescope.builtin').live_grep({ glob_pattern = '**/*' }) +end, { desc = '[F]ind by [u]nrestricted [G]rep' }) + remap('n', 'fb', function() require('telescope.builtin').buffers() end, { desc = '[F]ind existing [B]uffers' }) @@ -347,7 +353,7 @@ remap('n', 'zf', function() end, { desc = '[Z]ettelkasten [F]iles' }) remap('n', 'zg', function() - vim.cmd([[:ZkGrep]]) + vim.cmd(":ZkGrep") end, { desc = '[Z]ettelkasten [G]rep' }) -- treesitter diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index 9cf8b49..bcc7d08 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -803,11 +803,11 @@ ] }, "locked": { - "lastModified": 1685833925, - "narHash": "sha256-KCo8QT/DtM4pSTQDWFOhVP7MDzwi0wb2ZlxhgjEwXtM=", + "lastModified": 1685885003, + "narHash": "sha256-+OB0EvZBfGvnlTGg6mtyUCqkMnUp9DkmRUU4d7BZBVE=", "owner": "nix-community", "repo": "home-manager", - "rev": "bffc49ffb255f213d2f902043da37b3016450f4a", + "rev": "607d8fad96436b134424b9935166a7cd0884003e", "type": "github" }, "original": { @@ -1182,11 +1182,11 @@ }, "nixpkgs_12": { "locked": { - "lastModified": 1685655444, - "narHash": "sha256-6EujQNAeaUkWvpEZZcVF8qSfQrNVWFNNGbUJxv/A5a8=", + "lastModified": 1685836261, + "narHash": "sha256-rpxEPGeW4JZJcH58SQApJUtJ7w78VPtkF6Cut/Pq6Kg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e635192892f5abbc2289eaac3a73cdb249abaefd", + "rev": "dd4982554e18b936790da07c4ea2db7c7600f283", "type": "github" }, "original": { @@ -1753,11 +1753,11 @@ "nixpkgs": "nixpkgs_13" }, "locked": { - "lastModified": 1685846256, - "narHash": "sha256-G4aYK4VqlMHImvZ0lUnLHw1A+Cx28T0sBMvAKZBcGpk=", + "lastModified": 1685932304, + "narHash": "sha256-HUrE7Al6Rp9GeOjUycXz25TYhXXf1vtZLf/FFPVFRNw=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "1ef3c6de6127a1cba94cc5492cdde52e33d06ea4", + "rev": "08b06ab2046bce2c3b5f53ec599a6550ab9a9485", "type": "github" }, "original": { From ba993d16f5ac065e8405edb113493f4ebdb76e72 Mon Sep 17 00:00:00 2001 From: Hung Date: Mon, 5 Jun 2023 09:04:08 -0700 Subject: [PATCH 48/64] feat(nvim): tablines and potential for job management --- flake.lock | 6 ++-- native_configs/neovim/init.lua | 60 +++++++++++++++++++++++++++++----- 2 files changed, 55 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index 787668d..52ffd66 100644 --- a/flake.lock +++ b/flake.lock @@ -62,11 +62,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1683779844, - "narHash": "sha256-sIeOU0GsCeQEn5TpqE/jFRN4EGsPsjqVRsPdrzIDABM=", + "lastModified": 1685948350, + "narHash": "sha256-1FldJ059so0X/rScdbIiOlQbjjSNCCTdj2cUr5pHU4A=", "owner": "serokell", "repo": "deploy-rs", - "rev": "c80189917086e43d49eece2bd86f56813500a0eb", + "rev": "65211db63ba1199f09b4c9f27e5eba5ec50d76ac", "type": "github" }, "original": { diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 532e978..ffe9041 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -1,5 +1,4 @@ --- What: Mono-file nvim configuration file Why: Easy to see through everything without needing to navigate thru files --- Features: +-- What: Mono-file nvim configuration file Why: Easy to see through everything without needing to navigate thru files Features: -- - LSP -- - Auto-complete (in insert mode: ctrl-space, navigate w/ Tab+S-Tab, confirm: Enter) -- - df to format document @@ -174,6 +173,8 @@ vim.opt.backup = false vim.opt.undodir = vim.fn.stdpath('state') .. '/.vim/undodir' vim.opt.undofile = true vim.opt.completeopt = 'menuone,noselect' + + -- vim.opt.clipboard = "unnamedplus" -- more aggressive swap file writing. ThePrimeagen believes higher number -- leads to low DX @@ -356,6 +357,46 @@ remap('n', 'zg', function() vim.cmd(":ZkGrep") end, { desc = '[Z]ettelkasten [G]rep' }) +-- tab management {{{ + +-- Jump to specific tab with [number] +for i = 1, 9 do + vim.api.nvim_set_keymap('n', '' .. i, ':tabn ' .. i .. '', { noremap = true, silent = true }) +end + +-- Show tab number in tab display +vim.o.showtabline = 1 +vim.o.tabline = '%!v:lua.my_tabline()' + +function _G.my_tabline() + local s = '' + for i = 1, vim.fn.tabpagenr('$') do + if i == vim.fn.tabpagenr() then + s = s .. '%' .. i .. 'T%#TabLineSel#' + else + s = s .. '%' .. i .. 'T%#TabLine#' + end + local tab = vim.fn.gettabinfo(i)[1] + local tabbuf = tab.variables.buffers + local bufname = "" + if tabbuf then + bufname = tabbuf[tab.curwin].name + end + -- Canonicalize tab/buf name + s = s .. ' ' .. i .. ' ' .. vim.fn.fnamemodify(bufname, ':t') + if i ~= vim.fn.tabpagenr('$') then + s = s .. '%#TabLine#|%#TabLine#' + end + end + return s .. '%T%#TabLineFill#%=' +end + +-- Close all tabs except the first one +vim.api.nvim_set_keymap('n', 'x', ':tabdo if tabpagenr() > 1 | tabclose | endif', + { noremap = true, silent = true }) + +-- }}} + -- treesitter require 'treesitter-context' require('nvim-treesitter.configs').setup { @@ -496,6 +537,7 @@ local on_attach = function(client, bufnr) nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') -- Lesser used LSP functionality + nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') nmap('gtd', vim.lsp.buf.type_definition, '[G]oto [T]ype [D]efinition') nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') @@ -622,8 +664,8 @@ require("mason").setup({ PATH = "append", }) require('mason-lspconfig').setup({ - ensure_installed = servers, - automatic_installation = true + -- ensure_installed = servers, + automatic_installation = false }) local inlay_hint_tsjs = { @@ -661,7 +703,9 @@ require('mason-lspconfig').setup_handlers({ library = vim.api.nvim_get_runtime_file('', true) }, telemetry = { enable = false }, - hint = { enable = true, }, + hint = { + enable = true, + }, format = { enable = true, defaultConfig = { @@ -783,7 +827,7 @@ require("rust-tools").setup { -- default: true auto = false, -- Only show inlay hints for the current line - only_current_line = false, + only_current_line = true, -- whether to show parameter hints with the inlay hints or not -- default: true show_parameter_hints = true, @@ -801,8 +845,8 @@ require("rust-tools").setup { right_align = false, -- padding from the right if right_align is true right_align_padding = 7, - -- The color of the hints - highlight = "Comment", + -- The color of the hints use `:highlight` for a pick-and-choose menu + highlight = "NonText", }, -- options same as lsp hover / vim.lsp.util.open_floating_preview() hover_actions = { From aef09a32c5bc16945ac6052dbb7fd0a030a15f76 Mon Sep 17 00:00:00 2001 From: Hung Date: Tue, 6 Jun 2023 21:19:13 -0700 Subject: [PATCH 49/64] feat(nvim): fidget.nvim --- native_configs/neovim/init.lua | 51 +++++++++++++++++++++++++++ nix-conf/home-manager/base/neovim.nix | 2 ++ 2 files changed, 53 insertions(+) diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index ffe9041..5302860 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -59,6 +59,7 @@ Plug('nathanalderson/yang.vim') -- Plug('windwp/nvim-autopairs') -- matches pairs like [] (),... -- Plug('windwp/nvim-ts-autotag') -- matches tags hello -- Plug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer +-- Plug('j-hui/fidget.nvim') -- Progress bar for LSP Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns Plug('tpope/vim-fugitive') -- git commands in nvim @@ -1084,3 +1085,53 @@ require('lualine').setup { require('nvim-surround').setup {} require('tsql').setup() +require('fidget').setup({ + text = { + spinner = "pipe", -- animation shown when tasks are ongoing + done = "✔", -- character shown when all tasks are complete + commenced = "Started", -- message shown when task starts + completed = "Completed", -- message shown when task completes + }, + align = { + bottom = true, -- align fidgets along bottom edge of buffer + right = true, -- align fidgets along right edge of buffer + }, + timer = { + spinner_rate = 125, -- frame rate of spinner animation, in ms + fidget_decay = 2000, -- how long to keep around empty fidget, in ms + task_decay = 1000, -- how long to keep around completed task, in ms + }, + window = { + relative = "win", -- where to anchor, either "win" or "editor" + blend = 100, -- &winblend for the window + zindex = nil, -- the zindex value for the window + border = "none", -- style of border for the fidget window + }, + fmt = { + leftpad = true, -- right-justify text in fidget box + stack_upwards = true, -- list of tasks grows upwards + max_width = 0, -- maximum width of the fidget box + fidget = -- function to format fidget title + function(fidget_name, spinner) + return string.format("%s %s", spinner, fidget_name) + end, + task = -- function to format each task line + function(task_name, message, percentage) + return string.format( + "%s%s [%s]", + message, + percentage and string.format(" (%s%%)", percentage) or "", + task_name + ) + end, + }, + sources = { -- Sources to configure + * = { -- Name of source + ignore = false, -- Ignore notifications from this source + }, + }, + debug = { + logging = false, -- whether to enable logging, for debugging + strict = false, -- whether to interpret LSP strictly + }, +}) diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix index dbfae99..b8ce466 100644 --- a/nix-conf/home-manager/base/neovim.nix +++ b/nix-conf/home-manager/base/neovim.nix @@ -124,6 +124,7 @@ in harpoon zk-nvim luasnip + fidget-nvim ; in [ plenary-nvim nvim-treesitter.withAllGrammars @@ -147,6 +148,7 @@ in zk-nvim luasnip nvim-treesitter-context + fidget-nvim ]); }; # home.packages = nvim_pkgs; From f546cb6b322b1d8528d97cebd19189f6c4e2c011 Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 7 Jun 2023 08:30:46 -0700 Subject: [PATCH 50/64] fix: fidget and home-manager should remove existing darwin spotlight if already existed --- flake.lock | 12 +- native_configs/neovim/init.lua | 114 +++++++++--------- .../home-manager/base/darwin-spotlight.nix | 4 +- nix-conf/home-manager/flake.lock | 24 ++-- 4 files changed, 78 insertions(+), 76 deletions(-) diff --git a/flake.lock b/flake.lock index 52ffd66..a1e9aa9 100644 --- a/flake.lock +++ b/flake.lock @@ -504,11 +504,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1685836261, - "narHash": "sha256-rpxEPGeW4JZJcH58SQApJUtJ7w78VPtkF6Cut/Pq6Kg=", + "lastModified": 1685931219, + "narHash": "sha256-8EWeOZ6LKQfgAjB/USffUSELPRjw88A+xTcXnOUvO5M=", "owner": "nixos", "repo": "nixpkgs", - "rev": "dd4982554e18b936790da07c4ea2db7c7600f283", + "rev": "7409480d5c8584a1a83c422530419efe4afb0d19", "type": "github" }, "original": { @@ -804,11 +804,11 @@ "yants": "yants_2" }, "locked": { - "lastModified": 1685759602, - "narHash": "sha256-aEIGXP3RecgVQ0qEsRM+OuYrY4GYzq7mmlVjpO+SOuo=", + "lastModified": 1686006649, + "narHash": "sha256-6sdvFtQyx7SZoki1MlO2+3Xns4jmR34FEjlXawQdwhk=", "owner": "divnix", "repo": "std", - "rev": "1607dab0469ac89ca6727a1cadde8bce3a958438", + "rev": "d6bcee9c35fb4a905b51c39e4d5ca842e9a421eb", "type": "github" }, "original": { diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 5302860..df1e4c8 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -59,7 +59,7 @@ Plug('nathanalderson/yang.vim') -- Plug('windwp/nvim-autopairs') -- matches pairs like [] (),... -- Plug('windwp/nvim-ts-autotag') -- matches tags hello -- Plug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer --- Plug('j-hui/fidget.nvim') -- Progress bar for LSP +-- Plug('j-hui/fidget.nvim') -- Progress bar for LSP Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns Plug('tpope/vim-fugitive') -- git commands in nvim @@ -507,12 +507,6 @@ require("inlay-hints").setup { } } local on_attach = function(client, bufnr) - -- NOTE: Remember that lua is a real programming language, and as such it is possible - -- to define small helper and utility functions so you don't have to repeat yourself - -- many times. - -- - -- In this case, we create a function that lets us more easily define mappings specific - -- for LSP related items. It sets the mode, buffer and description for us each time. local nmap = function(keys, func, desc) if desc then desc = 'LSP: ' .. desc @@ -523,6 +517,7 @@ local on_attach = function(client, bufnr) nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + -- NOTE: I have no clue what this does again vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') nmap('df', function() vim.lsp.buf.format({ async = true }) end, '[D]ocument [F]ormat') @@ -533,15 +528,19 @@ local on_attach = function(client, bufnr) nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - -- documentations. See `:help K` for why this keymap + -- documentations & helps + -- NOTE: When you press K, it shows in-line Documentation + -- This is to stay faithful with vim's default keybind for help. + -- See `:help K` for even more info on Vim's original keybindings for help nmap('K', vim.lsp.buf.hover, 'Hover Documentation') nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') - -- Lesser used LSP functionality - + -- Less likely LSP functionality to be used nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') nmap('gtd', vim.lsp.buf.type_definition, '[G]oto [T]ype [D]efinition') nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') + -- + -- Very rarely used nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') nmap('wl', function() @@ -1086,52 +1085,53 @@ require('lualine').setup { require('nvim-surround').setup {} require('tsql').setup() require('fidget').setup({ - text = { - spinner = "pipe", -- animation shown when tasks are ongoing - done = "✔", -- character shown when all tasks are complete - commenced = "Started", -- message shown when task starts - completed = "Completed", -- message shown when task completes - }, - align = { - bottom = true, -- align fidgets along bottom edge of buffer - right = true, -- align fidgets along right edge of buffer - }, - timer = { - spinner_rate = 125, -- frame rate of spinner animation, in ms - fidget_decay = 2000, -- how long to keep around empty fidget, in ms - task_decay = 1000, -- how long to keep around completed task, in ms - }, - window = { - relative = "win", -- where to anchor, either "win" or "editor" - blend = 100, -- &winblend for the window - zindex = nil, -- the zindex value for the window - border = "none", -- style of border for the fidget window - }, - fmt = { - leftpad = true, -- right-justify text in fidget box - stack_upwards = true, -- list of tasks grows upwards - max_width = 0, -- maximum width of the fidget box - fidget = -- function to format fidget title - function(fidget_name, spinner) - return string.format("%s %s", spinner, fidget_name) - end, - task = -- function to format each task line - function(task_name, message, percentage) - return string.format( - "%s%s [%s]", - message, - percentage and string.format(" (%s%%)", percentage) or "", - task_name - ) - end, - }, - sources = { -- Sources to configure - * = { -- Name of source - ignore = false, -- Ignore notifications from this source + text = { + spinner = "moon", -- animation shown when tasks are ongoing + done = "✔", -- character shown when all tasks are complete + commenced = "Started", -- message shown when task starts + completed = "Completed", -- message shown when task completes + }, + align = { + bottom = true, -- align fidgets along bottom edge of buffer + right = true, -- align fidgets along right edge of buffer + }, + timer = { + spinner_rate = 125, -- frame rate of spinner animation, in ms + fidget_decay = 2000, -- how long to keep around empty fidget, in ms + task_decay = 1000, -- how long to keep around completed task, in ms + }, + window = { + relative = "editor", -- where to anchor, either "win" or "editor" + blend = 100, -- &winblend for the window + zindex = nil, -- the zindex value for the window + border = "none", -- style of border for the fidget window + }, + fmt = { + leftpad = true, -- right-justify text in fidget box + stack_upwards = true, -- list of tasks grows upwards + max_width = 0, -- maximum width of the fidget box + fidget = -- function to format fidget title + function(fidget_name, spinner) + return string.format("%s %s", spinner, fidget_name) + end, + task = -- function to format each task line + function(task_name, message, percentage) + return string.format( + "%s%s [%s]", + message, + percentage and string.format(" (%s%%)", percentage) or "", + task_name + ) + end, + }, + sources = { + -- Sources to configure + ['*'] = { -- Name of source + ignore = false, -- Ignore notifications from this source + }, + }, + debug = { + logging = false, -- whether to enable logging, for debugging + strict = false, -- whether to interpret LSP strictly }, - }, - debug = { - logging = false, -- whether to enable logging, for debugging - strict = false, -- whether to interpret LSP strictly - }, }) diff --git a/nix-conf/home-manager/base/darwin-spotlight.nix b/nix-conf/home-manager/base/darwin-spotlight.nix index 4101528..c538e66 100644 --- a/nix-conf/home-manager/base/darwin-spotlight.nix +++ b/nix-conf/home-manager/base/darwin-spotlight.nix @@ -15,7 +15,9 @@ # Install MacOS applications to the user environment. HM_APPS="$HOME/Applications/Home Manager Apps" # Reset current state - [ -e "$HM_APPS" ] && $DRY_RUN_CMD rm -r "$HM_APPS" + if [ -e "$HM_APPS" ]; then + $DRY_RUN_CMD rm -r "$HM_APPS" + fi $DRY_RUN_CMD mkdir -p "$HM_APPS" # .app dirs need to be actual directories for Finder to detect them as Apps. # In the env of Apps we build, the .apps are symlinks. We pass all of them as diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index bcc7d08..e4d9579 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -803,11 +803,11 @@ ] }, "locked": { - "lastModified": 1685885003, - "narHash": "sha256-+OB0EvZBfGvnlTGg6mtyUCqkMnUp9DkmRUU4d7BZBVE=", + "lastModified": 1685999310, + "narHash": "sha256-gaRMZhc7z4KeU/xS3IWv3kC+WhVcAXOLXXGKLe5zn1Y=", "owner": "nix-community", "repo": "home-manager", - "rev": "607d8fad96436b134424b9935166a7cd0884003e", + "rev": "28614ed7a1e3ace824c122237bdc0e5e0b62c5c3", "type": "github" }, "original": { @@ -938,11 +938,11 @@ "topiary": "topiary" }, "locked": { - "lastModified": 1685719780, - "narHash": "sha256-igcKtuS1p63O3JDo3qIH4T53hK66K+QQNe+bo+D9qZI=", + "lastModified": 1685962675, + "narHash": "sha256-S4UEX+H/j3tmz+202ODtPuK7WWoPbSIbk0y5GXaHJPY=", "owner": "tweag", "repo": "nickel", - "rev": "651ffdbc76e0314d693f4818812be3e2b100f626", + "rev": "43bc8fee6a5f69455cd49be75b10d2d4219553e0", "type": "github" }, "original": { @@ -1182,11 +1182,11 @@ }, "nixpkgs_12": { "locked": { - "lastModified": 1685836261, - "narHash": "sha256-rpxEPGeW4JZJcH58SQApJUtJ7w78VPtkF6Cut/Pq6Kg=", + "lastModified": 1685931219, + "narHash": "sha256-8EWeOZ6LKQfgAjB/USffUSELPRjw88A+xTcXnOUvO5M=", "owner": "nixos", "repo": "nixpkgs", - "rev": "dd4982554e18b936790da07c4ea2db7c7600f283", + "rev": "7409480d5c8584a1a83c422530419efe4afb0d19", "type": "github" }, "original": { @@ -1753,11 +1753,11 @@ "nixpkgs": "nixpkgs_13" }, "locked": { - "lastModified": 1685932304, - "narHash": "sha256-HUrE7Al6Rp9GeOjUycXz25TYhXXf1vtZLf/FFPVFRNw=", + "lastModified": 1686105195, + "narHash": "sha256-tBTKW+oqfT86Mvq/nm8Tkk3pzhJFXJWXJrj71cTF7lE=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "08b06ab2046bce2c3b5f53ec599a6550ab9a9485", + "rev": "1279a72003f5e4b08c8eca1101d8f57452a539f9", "type": "github" }, "original": { From fbb8477c19728c1086cc6a821823f3f6d387f421 Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 7 Jun 2023 21:53:56 -0700 Subject: [PATCH 51/64] feat: more ssh targets; darwin spotlight home-manager is broken :( --- flake.lock | 6 +- native_configs/ssh/config | 37 +-- .../home-manager/base/darwin-spotlight.nix | 2 +- nix-conf/home-manager/flake.lock | 216 +++++++++++++----- nix-conf/home-manager/flake.nix | 2 +- scripts/hm-switch.sh | 2 +- 6 files changed, 182 insertions(+), 83 deletions(-) diff --git a/flake.lock b/flake.lock index a1e9aa9..f175de8 100644 --- a/flake.lock +++ b/flake.lock @@ -504,11 +504,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1685931219, - "narHash": "sha256-8EWeOZ6LKQfgAjB/USffUSELPRjw88A+xTcXnOUvO5M=", + "lastModified": 1686020360, + "narHash": "sha256-Wee7lIlZ6DIZHHLiNxU5KdYZQl0iprENXa/czzI6Cj4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7409480d5c8584a1a83c422530419efe4afb0d19", + "rev": "4729ffac6fd12e26e5a8de002781ffc49b0e94b7", "type": "github" }, "original": { diff --git a/native_configs/ssh/config b/native_configs/ssh/config index c5a9b14..61c7ae2 100644 --- a/native_configs/ssh/config +++ b/native_configs/ssh/config @@ -1,11 +1,3 @@ -Host * - IdentityFile ~/.ssh/id_ed25519 - IdentityFile ~/.ssh/id_rsa - -Host 10.111.103.* - StrictHostKeyChecking no - UserKnownHostsFile /dev/null - # felia mirror on windows Host felia-win HostName felia.coati-celsius.ts.net @@ -61,6 +53,7 @@ Host sr1 HostName 10.30.76.46 User htran Port 22 + StrictHostKeyChecking no HostKeyAlgorithms=+ssh-dss,ssh-rsa KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1 @@ -68,6 +61,7 @@ Host bgp1 HostName 10.111.100.113 User htran Port 22 + StrictHostKeyChecking no HostKeyAlgorithms=+ssh-dss,ssh-rsa KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1 @@ -75,13 +69,26 @@ Host bgp2 HostName 10.111.100.114 User htran Port 22 + StrictHostKeyChecking no HostKeyAlgorithms=+ssh-dss,ssh-rsa KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1 - Host d1-30 HostName 10.111.103.60 User htran Port 22 + StrictHostKeyChecking no + UserKnownHostsFile /dev/null + IdentityFile ~/.ssh/id_ed25519 + IdentityFile ~/.ssh/id_rsa + +Host d3l-3 + HostName 10.111.103.65 + User htran + Port 22 + StrictHostKeyChecking no + UserKnownHostsFile /dev/null + IdentityFile ~/.ssh/id_ed25519 + IdentityFile ~/.ssh/id_rsa Host dev0 HostName 10.100.200.230 @@ -104,11 +111,6 @@ Host ztp-egi User root Port 22 -Host d3l-3 - HostName 10.111.103.65 - User htran - Port 22 - Host goat HostName 10.133.32.100 User "EGN NOC" @@ -130,4 +132,11 @@ Host gl-egi Port 22 IdentityFile ~/.ssh/id_ed25519 +Host 10.111.103.* + StrictHostKeyChecking no + UserKnownHostsFile /dev/null + +Host * + IdentityFile ~/.ssh/id_ed25519 + IdentityFile ~/.ssh/id_rsa diff --git a/nix-conf/home-manager/base/darwin-spotlight.nix b/nix-conf/home-manager/base/darwin-spotlight.nix index c538e66..554e212 100644 --- a/nix-conf/home-manager/base/darwin-spotlight.nix +++ b/nix-conf/home-manager/base/darwin-spotlight.nix @@ -16,7 +16,7 @@ HM_APPS="$HOME/Applications/Home Manager Apps" # Reset current state if [ -e "$HM_APPS" ]; then - $DRY_RUN_CMD rm -r "$HM_APPS" + $DRY_RUN_CMD mv "$HM_APPS" "$HM_APPS.$(date +%Y%m%d%H%M%S)" fi $DRY_RUN_CMD mkdir -p "$HM_APPS" # .app dirs need to be actual directories for Finder to detect them as Apps. diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index e4d9579..f66ecce 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -3,11 +3,11 @@ "advisory-db": { "flake": false, "locked": { - "lastModified": 1678924180, - "narHash": "sha256-5bwage/7JRiPiDY4wY3+OBiT8abY5f83hss6pQBklz8=", + "lastModified": 1684292571, + "narHash": "sha256-OpCnswRyIATPNoiQR4O7jE7iAyI9dekG7HfYhgZI3aI=", "owner": "rustsec", "repo": "advisory-db", - "rev": "0888b44843e3c86db9fd56334c7f5261ea00dc19", + "rev": "0e97e6e71f0dd52b4b4e0ab3fa6e5e5dd72f852a", "type": "github" }, "original": { @@ -58,11 +58,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1678152261, - "narHash": "sha256-cPRDxwygVMleiSEGELrvAiq9vYAN4c3KK/K4UEO13vU=", + "lastModified": 1684981077, + "narHash": "sha256-68X9cFm0RTZm8u0rXPbeBzOVUH5OoUGAfeHHVoxGd9o=", "owner": "ipetkov", "repo": "crane", - "rev": "5291dd0aa7a52d607fc952763ef60714e4c881d4", + "rev": "35110cccf28823320f4fd697fcafcb5038683982", "type": "github" }, "original": { @@ -83,11 +83,11 @@ "rust-overlay": "rust-overlay_3" }, "locked": { - "lastModified": 1678152261, - "narHash": "sha256-cPRDxwygVMleiSEGELrvAiq9vYAN4c3KK/K4UEO13vU=", + "lastModified": 1684468982, + "narHash": "sha256-EoC1N5sFdmjuAP3UOkyQujSOT6EdcXTnRw8hPjJkEgc=", "owner": "ipetkov", "repo": "crane", - "rev": "5291dd0aa7a52d607fc952763ef60714e4c881d4", + "rev": "99de890b6ef4b4aab031582125b6056b792a4a30", "type": "github" }, "original": { @@ -438,7 +438,7 @@ }, "flake-utils_10": { "inputs": { - "systems": "systems_2" + "systems": "systems_7" }, "locked": { "lastModified": 1681202837, @@ -456,7 +456,7 @@ }, "flake-utils_11": { "inputs": { - "systems": "systems_3" + "systems": "systems_8" }, "locked": { "lastModified": 1681202837, @@ -519,7 +519,7 @@ }, "flake-utils_15": { "inputs": { - "systems": "systems_4" + "systems": "systems_9" }, "locked": { "lastModified": 1681202837, @@ -566,12 +566,15 @@ } }, "flake-utils_4": { + "inputs": { + "systems": "systems_2" + }, "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -581,12 +584,15 @@ } }, "flake-utils_5": { + "inputs": { + "systems": "systems_3" + }, "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", "owner": "numtide", "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", "type": "github" }, "original": { @@ -596,12 +602,15 @@ } }, "flake-utils_6": { + "inputs": { + "systems": "systems_4" + }, "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -611,12 +620,15 @@ } }, "flake-utils_7": { + "inputs": { + "systems": "systems_5" + }, "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -626,12 +638,15 @@ } }, "flake-utils_8": { + "inputs": { + "systems": "systems_6" + }, "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -803,11 +818,11 @@ ] }, "locked": { - "lastModified": 1685999310, - "narHash": "sha256-gaRMZhc7z4KeU/xS3IWv3kC+WhVcAXOLXXGKLe5zn1Y=", + "lastModified": 1686142265, + "narHash": "sha256-IP0xPa0VYqxCzpqZsg3iYGXarUF+4r2zpkhwdHy9WsM=", "owner": "nix-community", "repo": "home-manager", - "rev": "28614ed7a1e3ace824c122237bdc0e5e0b62c5c3", + "rev": "39c7d0a97a77d3f31953941767a0822c94dc01f5", "type": "github" }, "original": { @@ -938,11 +953,11 @@ "topiary": "topiary" }, "locked": { - "lastModified": 1685962675, - "narHash": "sha256-S4UEX+H/j3tmz+202ODtPuK7WWoPbSIbk0y5GXaHJPY=", + "lastModified": 1686147433, + "narHash": "sha256-KqDqUGNfXcOwh6fkHMbH4a2W6k/W7S7wC/mxstlORwo=", "owner": "tweag", "repo": "nickel", - "rev": "43bc8fee6a5f69455cd49be75b10d2d4219553e0", + "rev": "dc6804acd123257460eef60d615da2eb0a8aca78", "type": "github" }, "original": { @@ -1002,11 +1017,11 @@ }, "nix-filter": { "locked": { - "lastModified": 1678109515, - "narHash": "sha256-C2X+qC80K2C1TOYZT8nabgo05Dw2HST/pSn6s+n6BO8=", + "lastModified": 1681154353, + "narHash": "sha256-MCJ5FHOlbfQRFwN0brqPbCunLEVw05D/3sRVoNVt2tI=", "owner": "numtide", "repo": "nix-filter", - "rev": "aa9ff6ce4a7f19af6415fb3721eaa513ea6c763c", + "rev": "f529f42792ade8e32c4be274af6b6d60857fbee7", "type": "github" }, "original": { @@ -1182,11 +1197,11 @@ }, "nixpkgs_12": { "locked": { - "lastModified": 1685931219, - "narHash": "sha256-8EWeOZ6LKQfgAjB/USffUSELPRjw88A+xTcXnOUvO5M=", + "lastModified": 1686020360, + "narHash": "sha256-Wee7lIlZ6DIZHHLiNxU5KdYZQl0iprENXa/czzI6Cj4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7409480d5c8584a1a83c422530419efe4afb0d19", + "rev": "4729ffac6fd12e26e5a8de002781ffc49b0e94b7", "type": "github" }, "original": { @@ -1230,11 +1245,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1678898370, - "narHash": "sha256-xTICr1j+uat5hk9FyuPOFGxpWHdJRibwZC+ATi0RbtE=", + "lastModified": 1685655444, + "narHash": "sha256-6EujQNAeaUkWvpEZZcVF8qSfQrNVWFNNGbUJxv/A5a8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ac718d02867a84b42522a0ece52d841188208f2c", + "rev": "e635192892f5abbc2289eaac3a73cdb249abaefd", "type": "github" }, "original": { @@ -1245,11 +1260,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1665296151, - "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", + "lastModified": 1681358109, + "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", "type": "github" }, "original": { @@ -1498,11 +1513,11 @@ "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { - "lastModified": 1678976941, - "narHash": "sha256-skNr08frCwN9NO+7I77MjOHHAw+L410/37JknNld+W4=", + "lastModified": 1685361114, + "narHash": "sha256-4RjrlSb+OO+e1nzTExKW58o3WRwVGpXwj97iCta8aj4=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "32b1dbedfd77892a6e375737ef04d8efba634e9e", + "rev": "ca2fdbf3edda2a38140184da6381d49f8206eaf4", "type": "github" }, "original": { @@ -1584,11 +1599,11 @@ ] }, "locked": { - "lastModified": 1677812689, - "narHash": "sha256-EakqhgRnjVeYJv5+BJx/NZ7/eFTMBxc4AhICUNquhUg=", + "lastModified": 1683080331, + "narHash": "sha256-nGDvJ1DAxZIwdn6ww8IFwzoHb2rqBP4wv/65Wt5vflk=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "e53e8853aa7b0688bc270e9e6a681d22e01cf299", + "rev": "d59c3fa0cba8336e115b376c2d9e91053aa59e56", "type": "github" }, "original": { @@ -1609,11 +1624,11 @@ ] }, "locked": { - "lastModified": 1679106165, - "narHash": "sha256-03Opt2yu4E/AIFjvlgib0/nhMn6B4B/t/nvwS2bzOGw=", + "lastModified": 1685759304, + "narHash": "sha256-I3YBH6MS3G5kGzNuc1G0f9uYfTcNY9NYoRc3QsykLk4=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "7313c06ac334d6262ddfe30a38b3abc3da6bd565", + "rev": "c535b4f3327910c96dcf21851bbdd074d0760290", "type": "github" }, "original": { @@ -1638,11 +1653,11 @@ ] }, "locked": { - "lastModified": 1677812689, - "narHash": "sha256-EakqhgRnjVeYJv5+BJx/NZ7/eFTMBxc4AhICUNquhUg=", + "lastModified": 1683080331, + "narHash": "sha256-nGDvJ1DAxZIwdn6ww8IFwzoHb2rqBP4wv/65Wt5vflk=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "e53e8853aa7b0688bc270e9e6a681d22e01cf299", + "rev": "d59c3fa0cba8336e115b376c2d9e91053aa59e56", "type": "github" }, "original": { @@ -1657,11 +1672,11 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1679106165, - "narHash": "sha256-03Opt2yu4E/AIFjvlgib0/nhMn6B4B/t/nvwS2bzOGw=", + "lastModified": 1684808436, + "narHash": "sha256-WG5LgB1+Oguj4H4Bpqr5GoLSc382LyGlaToiOw5xhwA=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "7313c06ac334d6262ddfe30a38b3abc3da6bd565", + "rev": "a227d4571dd1f948138a40ea8b0d0c413eefb44b", "type": "github" }, "original": { @@ -1870,6 +1885,81 @@ "type": "github" } }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_6": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_7": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_8": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_9": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "topiary": { "inputs": { "advisory-db": "advisory-db", @@ -1883,11 +1973,11 @@ "rust-overlay": "rust-overlay_4" }, "locked": { - "lastModified": 1682503900, - "narHash": "sha256-3Kb9D8S0lkGcPAcpJJGInVyFN79K6gn6TN0ZHWFA19s=", + "lastModified": 1685522994, + "narHash": "sha256-OJQ16KpYT3jGyP0WSI+jZQMU55/cnbzdYZKVBfx9wNk=", "owner": "tweag", "repo": "topiary", - "rev": "773159aa4c819b46c6d51ca9275e7366087eb3a0", + "rev": "b2399161f60c1eb3404e487b4471ff76455d7a94", "type": "github" }, "original": { diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 47cc1aa..84c87ed 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -180,7 +180,7 @@ modules = base.modules ++ [ ./home.nix ./base/productive_desktop.nix - ./base/darwin-spotlight.nix + # ./base/darwin-spotlight.nix { base.private_chromium.enable = false; } diff --git a/scripts/hm-switch.sh b/scripts/hm-switch.sh index 04013b1..baf0f55 100755 --- a/scripts/hm-switch.sh +++ b/scripts/hm-switch.sh @@ -37,7 +37,7 @@ nix flake update "${SCRIPT_DIR}/../nix-conf/home-manager" if ! command -v home-manager ; then nix-shell -p home-manager --run "home-manager switch --flake $HOME_MANAGER_DIR $@" else - home-manager switch -b backup --flake "$HOME_MANAGER_DIR" $@ + home-manager switch --flake "$HOME_MANAGER_DIR" $@ fi From 63900e1117060369ca9d29961c7325c10f750faa Mon Sep 17 00:00:00 2001 From: Hung Date: Wed, 7 Jun 2023 22:04:50 -0700 Subject: [PATCH 52/64] docs --- README.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bdce58f..0590ee0 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,10 @@ Contains my configurations for the software I use. I'm looking to move forward to configuration with NixOS, but until I get a bit more experiment on NixOS, I'll keep this repository as simple as possible. +- As of 2023-06-07, I have little interest in keeping configurations +([`init.lua`](./native_configs/neovim/init.lua), [`sshconfig`](./native_configs/ssh/config),...) +to be idempotent for Nix and non-Nix targets. + ## Nix Monorepo that contains my commonly used personal environments. @@ -13,8 +17,7 @@ onto this repo for quick env setup (especially devel) on new machines. ## How do I apply these config -- I will always first clone this repository, preferably from local source before -going from the github. `git clone https://github.com/pegasust/dotfiles` +- Clone and nixify ### neovim @@ -26,7 +29,6 @@ My main text editor. It's based on `vim`, but stays loyal to `lua` ecosystem #### Notes - Ensure that neovim is installed and invocable by `nvim`. -- My config based on rather experimental version of`nvim` (>=0.7.2) - For information on installing neovim, visit their [github page](https://github.com/neovim/neovim/wiki/Installing-Neovim) ### tmux @@ -40,7 +42,7 @@ from one terminal. #### Notes -- Unsure if the minimum version of tmux. I have had an ancient HPC server +- Unsure of the minimum version of tmux. I have had an ancient HPC server that does not respond well to one of the config lines. ### zk @@ -57,6 +59,9 @@ text-editor agnostically. - Templates: `zk/templates/` - Command: `ln -s $PWD/zk/templates ~/.config/zk/templates` +Note (2023-06-07): I'm now using a mix of nvim-zk with Notion. I'm still figuring out +a centralize place to put my notes and use it to do some knowledge graph magic + ## Troubleshoots ### My MacOS just updated, `nix` is no-longer here @@ -64,11 +69,11 @@ text-editor agnostically. - An easy fix is to add the following to the **bottom** of `/etc/zshrc` ```sh -# Nix +# Nix {{{ if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' fi -# End Nix +# }}} ``` - Otherwise, consult [`gh-gist:meeech/a_help-osx-borked-my-nix.md`](https://gist.github.com/meeech/0b97a86f235d10bc4e2a1116eec38e7e) From a5186b204c3bb42c82da289bed05155c24213574 Mon Sep 17 00:00:00 2001 From: Hung Date: Sun, 11 Jun 2023 21:21:01 -0700 Subject: [PATCH 53/64] feat: idempotent installation with WPlug --- flake.lock | 18 ++--- flake.nix | 1 + native_configs/neovim/init.lua | 126 +++++++++++++++++------------ nix-conf/home-manager/base/ssh.nix | 2 +- nix-conf/home-manager/flake.lock | 24 +++--- nix-conf/home-manager/flake.nix | 28 ++----- nix/cells/repo/home-modules.nix | 9 +++ 7 files changed, 110 insertions(+), 98 deletions(-) create mode 100644 nix/cells/repo/home-modules.nix diff --git a/flake.lock b/flake.lock index f175de8..d3ddfd1 100644 --- a/flake.lock +++ b/flake.lock @@ -301,11 +301,11 @@ "paisano": "paisano" }, "locked": { - "lastModified": 1682269418, - "narHash": "sha256-0fdUrQMkXMuK1/6D1Y+gbGXIWChiIRnlbYvo4dmNfVE=", + "lastModified": 1686502488, + "narHash": "sha256-sLSiDkU9oNpcl1QEge0xVviD7N87iVdrwl7l9i+6mxQ=", "owner": "divnix", "repo": "hive", - "rev": "669cdfcf61823d33f11a4fe5ee1f3c34903f4eaa", + "rev": "e8b46fa4d2917dfd456f3f040e9761262b4648d2", "type": "github" }, "original": { @@ -504,11 +504,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1686020360, - "narHash": "sha256-Wee7lIlZ6DIZHHLiNxU5KdYZQl0iprENXa/czzI6Cj4=", + "lastModified": 1686412476, + "narHash": "sha256-inl9SVk6o5h75XKC79qrDCAobTD1Jxh6kVYTZKHzewA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4729ffac6fd12e26e5a8de002781ffc49b0e94b7", + "rev": "21951114383770f96ae528d0ae68824557768e81", "type": "github" }, "original": { @@ -804,11 +804,11 @@ "yants": "yants_2" }, "locked": { - "lastModified": 1686006649, - "narHash": "sha256-6sdvFtQyx7SZoki1MlO2+3Xns4jmR34FEjlXawQdwhk=", + "lastModified": 1686337240, + "narHash": "sha256-JedAsyUIbSIhVrRWSl0R3lSWemVWsHg0w3MuzW7h4tg=", "owner": "divnix", "repo": "std", - "rev": "d6bcee9c35fb4a905b51c39e4d5ca842e9a421eb", + "rev": "1bd99cec90a5cee8575f45dbc193d6dd860a5f35", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 10f81b4..a20d8cf 100644 --- a/flake.nix +++ b/flake.nix @@ -37,5 +37,6 @@ devShells = std.harvest [ [ "dotfiles" "devshells" ] ]; # nixosConfigurations = std.pick [ [ "dotfiles" "nixos" ] ]; # homeConfigurations = std.pick [ [ "dotfiles" "home" ] ]; + homeModules = std.pick [["repo" "home-modules"]]; }; } diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index df1e4c8..ffab27e 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -8,6 +8,7 @@ -- - zk @ https://github.com/mickael-menu/zk -- - prettierd @ npm install -g @fsouza/prettierd +-- Auto-installs vim-plug vim.cmd([[ let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' let plug_path = data_dir . '/autoload/plug.vim' @@ -20,83 +21,102 @@ endif -- vim-plug local Plug = vim.fn['plug#'] +-- prepare a list of installed plugins from rtp +local installed_plugins = {} +-- NOTE: nvim_list_runtime_paths will expand wildcard paths for us. +for _, path in ipairs(vim.api.nvim_list_runtime_paths()) do + local last_folder_start = path:find("/[^/]*$") + if last_folder_start then + local plugin_name = path:sub(last_folder_start + 1) + installed_plugins[plugin_name] = true + end +end + +-- Do Plug if plugin not yet linked in `rtp`. This takes care of Nix-compatibility +local function WPlug(plugin_path, ...) + local plugin_name = plugin_path:match("/([^/]+)$") + if not installed_plugins[plugin_name] then + Plug(plugin_path, ...) + end +end + vim.call('plug#begin') -- libs and dependencies -- Plug('nvim-lua/plenary.nvim') -- The base of all plugins -- plugins --- Plug('tjdevries/nlua.nvim') -- adds symbols of vim stuffs in init.lua --- Plug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting --- Plug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects --- Plug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser +WPlug('tjdevries/nlua.nvim') -- adds symbols of vim stuffs in init.lua +WPlug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting +WPlug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects +WPlug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser -- TODO: this might need to be taken extra care in our Nix config --- What this Plug declaration means is this repo needs to be built on our running environment +-- What this WPlug declaration means is this repo needs to be built on our running environment -- ----- -- What to do: -- - Run `make` at anytime before Nix is done on this repository -- - Might mean that we fetch this repository, run make, and copy to destination folder --- - Make sure that if we run `make` at first Plug run, that `make` is idempotent +-- - Make sure that if we run `make` at first WPlug run, that `make` is idempotent -- OR --- Make sure that Plug does not run `make` and use the output it needs --- Plug('nvim-telescope/telescope-fzf-native.nvim', --- { ['do'] = 'make >> /tmp/log 2>&1' }) --- Plug('nvim-telescope/telescope-file-browser.nvim') +-- Make sure that WPlug does not run `make` and use the output it needs +WPlug('nvim-telescope/telescope-fzf-native.nvim', + { ['do'] = 'make >> /tmp/log 2>&1' }) +WPlug('nvim-telescope/telescope-file-browser.nvim') -- cmp: auto-complete/suggestions --- Plug('neovim/nvim-lspconfig') -- built-in LSP configurations --- Plug('hrsh7th/cmp-nvim-lsp') --- Plug('hrsh7th/cmp-path') --- Plug('hrsh7th/cmp-buffer') --- Plug('hrsh7th/cmp-cmdline') --- Plug('hrsh7th/nvim-cmp') --- Plug('onsails/lspkind-nvim') -Plug('yioneko/nvim-yati', { tag = '*' }) -- copium: fix Python indent auto-correct from smart-indent -Plug('nathanalderson/yang.vim') --- Plug('tzachar/cmp-tabnine', { ['do'] = './install.sh' }) +WPlug('neovim/nvim-lspconfig') -- built-in LSP configurations +WPlug('hrsh7th/cmp-nvim-lsp') +WPlug('hrsh7th/cmp-path') +WPlug('hrsh7th/cmp-buffer') +WPlug('hrsh7th/cmp-cmdline') +WPlug('hrsh7th/nvim-cmp') +WPlug('onsails/lspkind-nvim') +WPlug('yioneko/nvim-yati', { tag = '*' }) -- copium: fix Python indent auto-correct from smart-indent +WPlug('nathanalderson/yang.vim') +-- WPlug('tzachar/cmp-tabnine', { ['do'] = './install.sh' }) -- DevExp --- Plug('windwp/nvim-autopairs') -- matches pairs like [] (),... --- Plug('windwp/nvim-ts-autotag') -- matches tags hello --- Plug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer --- Plug('j-hui/fidget.nvim') -- Progress bar for LSP -Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines -Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns -Plug('tpope/vim-fugitive') -- git commands in nvim -Plug('williamboman/mason.nvim') -- LSP, debuggers,... package manager -Plug('williamboman/mason-lspconfig.nvim') -- lsp config for mason --- Plug('ThePrimeagen/harpoon') -- 1-click through marked files per project -Plug('TimUntersberger/neogit') -- Easy-to-see git status -Plug('folke/trouble.nvim') -- File-grouped workspace diagnostics -Plug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands -Plug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein" -Plug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator --- Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs) -Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*) -Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis -Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration +WPlug('windwp/nvim-autopairs') -- matches pairs like [] (),... +WPlug('windwp/nvim-ts-autotag') -- matches tags hello +WPlug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer +WPlug('j-hui/fidget.nvim') -- Progress bar for LSP +WPlug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines +WPlug('lewis6991/gitsigns.nvim') -- add git info to sign columns +WPlug('tpope/vim-fugitive') -- git commands in nvim +WPlug('williamboman/mason.nvim') -- LSP, debuggers,... package manager +WPlug('williamboman/mason-lspconfig.nvim') -- lsp config for mason +WPlug('ThePrimeagen/harpoon') -- 1-click through marked files per project +WPlug('TimUntersberger/neogit') -- Easy-to-see git status +WPlug('folke/trouble.nvim') -- File-grouped workspace diagnostics +WPlug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands +WPlug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein" +WPlug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator +-- WPlug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs) +WPlug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*) +WPlug('kylechui/nvim-surround') -- surrounds with tags/parenthesis +WPlug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration -- UI & colorscheme -Plug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts --- Plug('gruvbox-community/gruvbox') -- theme provider -Plug('nvim-lualine/lualine.nvim') -- fancy status line -Plug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines -Plug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes -Plug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog -Plug('folke/todo-comments.nvim') -- Highlights TODO +WPlug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts +WPlug('gruvbox-community/gruvbox') -- theme provider +WPlug('nvim-lualine/lualine.nvim') -- fancy status line +WPlug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines +WPlug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes +WPlug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog +WPlug('folke/todo-comments.nvim') -- Highlights TODO -- other utilities -Plug('nvim-treesitter/nvim-treesitter-context') -- Top one-liner context of func/class scope -Plug('nvim-treesitter/playground') -- Sees Treesitter AST - less hair pulling, more PRs -Plug('saadparwaiz1/cmp_luasnip') -- snippet engine --- Plug('L3MON4D3/LuaSnip') -- snippet engine --- Plug('mickael-menu/zk-nvim') -- Zettelkasten +WPlug('nvim-treesitter/nvim-treesitter-context') -- Top one-liner context of func/class scope +WPlug('nvim-treesitter/playground') -- Sees Treesitter AST - less hair pulling, more PRs +WPlug('saadparwaiz1/cmp_luasnip') -- snippet engine +WPlug('L3MON4D3/LuaSnip') -- snippet engine +WPlug('mickael-menu/zk-nvim') -- Zettelkasten -- Switch cases: -- `gsp` -> PascalCase (classes), `gsc` -> camelCase (Java), `gs_` -> snake_case (C/C++/Rust) -- `gsu` -> UPPER_CASE (CONSTs), `gsk` -> kebab-case (Clojure), `gsK` -> Title-Kebab-Case -- `gs.` -> dot.case (R) -Plug('arthurxavierx/vim-caser') -- switch cases -Plug('~/local_repos/ts-ql') -- workspace code intelligence +WPlug('arthurxavierx/vim-caser') -- switch cases +WPlug('~/local_repos/ts-ql') -- workspace code intelligence --------- vim.call('plug#end') diff --git a/nix-conf/home-manager/base/ssh.nix b/nix-conf/home-manager/base/ssh.nix index dd02bdf..c95b3c0 100644 --- a/nix-conf/home-manager/base/ssh.nix +++ b/nix-conf/home-manager/base/ssh.nix @@ -17,7 +17,7 @@ in config.programs.ssh = { inherit (cfg) enable; forwardAgent = true; - extraConfig = builtins.readFile "${proj_root.config.path}/ssh/config"; + includes = ["${proj_root.config.path}/ssh/config"]; }; } diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index f66ecce..f5c7820 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -818,11 +818,11 @@ ] }, "locked": { - "lastModified": 1686142265, - "narHash": "sha256-IP0xPa0VYqxCzpqZsg3iYGXarUF+4r2zpkhwdHy9WsM=", + "lastModified": 1686391840, + "narHash": "sha256-5S0APl6Mfm6a37taHwvuf11UHnAX0+PnoWQbsYbMUnc=", "owner": "nix-community", "repo": "home-manager", - "rev": "39c7d0a97a77d3f31953941767a0822c94dc01f5", + "rev": "0144ac418ef633bfc9dbd89b8c199ad3a617c59f", "type": "github" }, "original": { @@ -953,11 +953,11 @@ "topiary": "topiary" }, "locked": { - "lastModified": 1686147433, - "narHash": "sha256-KqDqUGNfXcOwh6fkHMbH4a2W6k/W7S7wC/mxstlORwo=", + "lastModified": 1686315162, + "narHash": "sha256-KZZRTXSpxJDDGVbEdyTR/4Mu2COSMtrim+5iL7qwDTw=", "owner": "tweag", "repo": "nickel", - "rev": "dc6804acd123257460eef60d615da2eb0a8aca78", + "rev": "9fed1326c9306d7c339884584702ce570764beaf", "type": "github" }, "original": { @@ -1197,11 +1197,11 @@ }, "nixpkgs_12": { "locked": { - "lastModified": 1686020360, - "narHash": "sha256-Wee7lIlZ6DIZHHLiNxU5KdYZQl0iprENXa/czzI6Cj4=", + "lastModified": 1686412476, + "narHash": "sha256-inl9SVk6o5h75XKC79qrDCAobTD1Jxh6kVYTZKHzewA=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4729ffac6fd12e26e5a8de002781ffc49b0e94b7", + "rev": "21951114383770f96ae528d0ae68824557768e81", "type": "github" }, "original": { @@ -1768,11 +1768,11 @@ "nixpkgs": "nixpkgs_13" }, "locked": { - "lastModified": 1686105195, - "narHash": "sha256-tBTKW+oqfT86Mvq/nm8Tkk3pzhJFXJWXJrj71cTF7lE=", + "lastModified": 1686537156, + "narHash": "sha256-mJD80brS6h6P4jzwdKID0S9RvfyiruxgJbXvPPIDqF0=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "1279a72003f5e4b08c8eca1101d8f57452a539f9", + "rev": "e75da5cfc7da874401decaa88f4ccb3b4d64d20d", "type": "github" }, "original": { diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 84c87ed..b4da2d7 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -80,11 +80,10 @@ nerd_font_module = { config, pkgs, ... }: { fonts.fontconfig.enable = true; home.packages = [ - (pkgs.nerdfonts.override { fonts = [ "DroidSansMono" ]; }) + # list of fonts are available at https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/data/fonts/nerdfonts/shas.nix + (pkgs.nerdfonts.override { fonts = [ "Hack" ]; }) ]; - # For some reasons, Windows es in the font name as DroidSansMono NF - # so we need to override this - base.alacritty.font.family = "DroidSansMono Nerd Font"; + base.alacritty.font.family = "Hack Nerd Font Mono"; }; in { @@ -184,14 +183,14 @@ { base.private_chromium.enable = false; } + nerd_font_module { base.graphics.enable = false; # don't want to deal with GL stuffs on mac yet :/ base.graphics.useNixGL.defaultPackage = null; # FIXME: this actually does not exist - base.keepass.path = "/Users/htran/keepass.kdbx"; + # base.keepass.path = "/Users/htran/keepass.kdbx"; base.alacritty.font.size = 11.0; - base.alacritty.font.family = "DroidSansM Nerd Font"; base.git.name = "Hung"; base.git.email = "htran@egihosting.com"; } @@ -232,23 +231,6 @@ }; }; }; - # NOTE: This is never actually tested. This is for Ubuntu@Felia - # "ubuntu_admin" = home-manager.lib.homeManagerConfiguration { - # inherit pkgs; - # modules = [ - # ./home.nix - # ]; - # extraSpecialArgs = { - # myLib = lib; - # myHome = { - # username = "ubuntu_admin"; - # homeDirectory = "/home/ubuntu_admin"; - # shellInitExtra = '' - # '' + x11_wsl; - # }; - # }; - # }; - # Personal laptop hwtr = home-manager.lib.homeManagerConfiguration { inherit pkgs; diff --git a/nix/cells/repo/home-modules.nix b/nix/cells/repo/home-modules.nix new file mode 100644 index 0000000..73e8273 --- /dev/null +++ b/nix/cells/repo/home-modules.nix @@ -0,0 +1,9 @@ +{inputs, cell}: { + nerd_font_module = {config, pkgs, ...}: { + fonts.fontconfig.enable = true; + home.packages = [ + (pkgs.nerdfonts.override { fonts = [ "Hack" ]; }) + ]; + base.alacritty.font.family = "Hack Nerd Font Mono"; + }; +} From a6c979c6590f9e53c69dd6281fe97bdf73345f98 Mon Sep 17 00:00:00 2001 From: Hung Date: Sun, 11 Jun 2023 23:51:47 -0700 Subject: [PATCH 54/64] feat: add couple more vim plugins via nixpkgs --- README.md | 1 + native_configs/neovim/init.lua | 26 +------ nix-conf/home-manager/base/neovim.nix | 61 ++++++++++----- scripts/vim_dsl.py | 104 ++++++++++++++++++++++++++ 4 files changed, 149 insertions(+), 43 deletions(-) create mode 100755 scripts/vim_dsl.py diff --git a/README.md b/README.md index 0590ee0..f11cddb 100644 --- a/README.md +++ b/README.md @@ -78,3 +78,4 @@ fi - Otherwise, consult [`gh-gist:meeech/a_help-osx-borked-my-nix.md`](https://gist.github.com/meeech/0b97a86f235d10bc4e2a1116eec38e7e) + diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index ffab27e..081fed7 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -34,7 +34,7 @@ end -- Do Plug if plugin not yet linked in `rtp`. This takes care of Nix-compatibility local function WPlug(plugin_path, ...) - local plugin_name = plugin_path:match("/([^/]+)$") + local plugin_name = string.lower(plugin_path:match("/([^/]+)$")) if not installed_plugins[plugin_name] then Plug(plugin_path, ...) end @@ -802,30 +802,6 @@ require('mason-lspconfig').setup_handlers({ }, } end, - -- ["rust_analyzer"] = function() - -- require('lspconfig').rust_analyzer.setup { - -- on_attach = on_attach, - -- capabilities = capabilities, - -- settings = { - -- checkOnSave = { - -- command = "clippy", - -- } - -- } - -- } - -- end, - -- ["astro"] = function() - -- print('configuring astro') - -- require('lspconfig').astro.setup { - -- on_attach = on_attach, - -- capabilities = capabilities, - -- init_options = { - -- configuration = {}, - -- typescript = { - -- serverPath = data_dir - -- } - -- } - -- } - -- end }) require("rust-tools").setup { tools = { diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix index b8ce466..ecc36ab 100644 --- a/nix-conf/home-manager/base/neovim.nix +++ b/nix-conf/home-manager/base/neovim.nix @@ -1,9 +1,8 @@ -# TODO: vim-plug and Mason supports laziness. Probably worth it to explore -# incremental dependencies based on the project +# TODO: vim-plug and Mason supports laziness. Probably worth it to explore incremental dependencies based on the project # TODO: just install these things, then symlink to mason's bin directory # # One thing to consider, though, /nix/store of `nix-shell` or `nix-develop` -# might be different from `home-manager`'s +# might be different from `home-manager`'s (~/.nix_profile/bin/jq) { pkgs, lib, config, proj_root, ... }: let # NOTE: Add packages to nvim_pkgs instead, so that it's available at userspace @@ -34,7 +33,6 @@ let pkgs.go # doesn't work, Mason installs from runtime path - # Language-specific stuffs pkgs.sumneko-lua-language-server # pkgs.python3Packages.python-lsp-server @@ -78,21 +76,7 @@ in vimAlias = true; withPython3 = true; withNodeJs = true; - # Attempt 4: Correct way to make neovim aware of packages - # homeConfigurations.config.programs.neovim takes UNWRAPPED neovim - # and wraps it. - # Ideally, we build our own neovim and add that to config.home.packages - # to share it with nixOS. But we don't really need to share extraPackages = nvim_pkgs; - # only for here for archive-documentation - # extraPython3Packages = (pypkgs: [ - # # pypkgs.python-lsp-server - # pypkgs.ujson - # ]); - # I use vim-plug, so I probably don't require packaging - # extraConfig actually writes to init-home-manager.vim (not lua) - # https://github.com/nix-community/home-manager/pull/3287 - # extraConfig = builtins.readFile "${proj_root}/neovim/init.lua"; extraLuaConfig = (builtins.readFile "${proj_root.config.path}//neovim/init.lua"); plugins = (let inherit (pkgs.vimPlugins) plenary-nvim @@ -125,6 +109,27 @@ in zk-nvim luasnip fidget-nvim + rust-tools-nvim + + cmp_luasnip + gitsigns-nvim + indent-blankline-nvim + lualine-nvim + mason-lspconfig-nvim + mason-nvim + neogit + nlua-nvim + nvim-jqx + nvim-surround + nvim-web-devicons + playground + todo-comments-nvim + trouble-nvim + vim-dispatch + vim-dispatch-neovim + vim-fugitive + vim-jack-in + ; in [ plenary-nvim nvim-treesitter.withAllGrammars @@ -149,6 +154,26 @@ in luasnip nvim-treesitter-context fidget-nvim + rust-tools-nvim + + cmp_luasnip + gitsigns-nvim + indent-blankline-nvim + lualine-nvim + mason-lspconfig-nvim + mason-nvim + neogit + nlua-nvim + nvim-jqx + nvim-surround + nvim-web-devicons + playground + todo-comments-nvim + trouble-nvim + vim-dispatch + vim-dispatch-neovim + vim-fugitive + vim-jack-in ]); }; # home.packages = nvim_pkgs; diff --git a/scripts/vim_dsl.py b/scripts/vim_dsl.py new file mode 100755 index 0000000..45b1121 --- /dev/null +++ b/scripts/vim_dsl.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 # A simple playground to explore vim plugins that are available in nixpkgs + +import csv +import urllib.request +from io import StringIO +import sqlite3 + +UPSTREAM_CSV = "https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/applications/editors/vim/plugins/vim-plugin-names" + + +def load_csv(url): + with urllib.request.urlopen(url) as response: + data = response.read().decode() + return csv.DictReader(StringIO(data)) + + +class VimPlugins: + def __init__(self, url: str, sqlite: str = ":memory:"): + self.conn = sqlite3.connect(sqlite) + csv_data = load_csv(url) + fieldnames = csv_data.fieldnames or ["repo", "branch", "alias"] + + cur = self.create_table() + for row in csv_data: + fields = ", ".join(f'"{row[field]}"' for field in fieldnames) + cur.execute(f"INSERT INTO {self.table_name()} VALUES ({fields})") + + self.conn.commit() + + def create_table(self, cursor=None): + cur = self.conn.cursor() if not cursor else cursor + cur.execute(f''' + CREATE TABLE {self.table_name()} ( + "repo" TEXT, + "branch" TEXT, + "alias" TEXT + ); + ''') + return cur + + def table_name(self): + return "vim_plugins" + + def query(self, query: str): + return self.conn.cursor().execute(query).fetchall() + + +def vim_plugin_slug(name: str): + return name.replace(".", "-").lower() + + +def name_from_repo(repo: str): + spl = repo.split("/") + return vim_plugin_slug(spl[-1] or spl[-2]) + + +if __name__ == "__main__": + # REPL zone + vp = VimPlugins(UPSTREAM_CSV) + need_install_plugins = """ +tjdevries/nlua.nvim +yioneko/nvim-yati +nathanalderson/yang.vim +numToStr/Comment.nvim +lewis6991/gitsigns.nvim +tpope/vim-fugitive +williamboman/mason.nvim +williamboman/mason-lspconfig.nvim +TimUntersberger/neogit +folke/trouble.nvim +tpope/vim-dispatch +clojure-vim/vim-jack-in +radenling/vim-dispatch-neovim +gennaro-tedesco/nvim-jqx +kylechui/nvim-surround +simrat39/inlay-hints.nvim +gruvbox-community/gruvbox +nvim-lualine/lualine.nvim +lukas-reineke/indent-blankline.nvim +kyazdani42/nvim-web-devicons +m-demare/hlargs.nvim +folke/todo-comments.nvim +nvim-treesitter/playground +saadparwaiz1/cmp_luasnip +L3MON4D3/LuaSnip +arthurxavierx/vim-caser +~/local_repos/ts-ql + """.split() + need_install_plugins = [plugin.strip() for plugin in plugins] + need_install_plugins = [plugin for plugin in plugins if len(plugin) > 0] + need_install_plugins_gh = [ + f"https://github.com/{plugin}/".lower() for plugin in need_install_plugins if plugin[0] not in "~./"] + values = vp.query(f"SELECT LOWER(repo), alias from {vp.table_name()}") + need_install = [] + for repo, alias in values: + if repo in need_install_plugins_gh: + need_install.append(vim_plugin_slug(alias) if len(alias) > 0 else name_from_repo(repo)) + print("need_install", "\n".join(need_install)) + + repos = [repo for repo, _ in values] + not_in_repo = [name_from_repo(gh) for gh in need_install_plugins_gh if gh not in repos] + print("not in repo", not_in_repo) # nvim-yati, yang-vim, Comment-nvim, inlay-hints-nvim, hlargs-nvim, vim-caser, gruvbox-community + + From 7f0611d186286d51bb5743bc84222f66b0bf3ea0 Mon Sep 17 00:00:00 2001 From: Hung Date: Mon, 12 Jun 2023 12:14:59 -0700 Subject: [PATCH 55/64] docs --- docs/DEV.md | 2 +- docs/vim-plugins.md | 169 ++++++++ flake.lock | 6 +- native_configs/neovim/init.fnl | 721 +++++++++++++++++++++++++++++++ native_configs/neovim/init.lua | 27 +- nix-conf/home-manager/flake.lock | 12 +- scripts/vim_dsl.py | 28 +- 7 files changed, 942 insertions(+), 23 deletions(-) create mode 100644 docs/vim-plugins.md create mode 100644 native_configs/neovim/init.fnl diff --git a/docs/DEV.md b/docs/DEV.md index f5f7c68..2d78e62 100644 --- a/docs/DEV.md +++ b/docs/DEV.md @@ -28,7 +28,7 @@ documentations and defaults - `nativeBuildInputs` is supposed to be built by a deployment machine (not target) -- `buildInputs` gives you access during runtime +- `buildInputs` gives you access during runtime (if the package goes path build filter) - `nativeBulidInputs` gives you access to packages during build time diff --git a/docs/vim-plugins.md b/docs/vim-plugins.md new file mode 100644 index 0000000..2c10cc3 --- /dev/null +++ b/docs/vim-plugins.md @@ -0,0 +1,169 @@ +# Vim Plugins + +The current [`scripts/vim.dsl`](../scripts/vim.dsl) grabs the upstream supported vim plugins +onto a sqlite database to be stored in memory. We could perform some data exploration via this database + +## Explore which plugins should be added to `neovim.nix` + +Gather list of plugins need to be added. This can be done simply by adding +a print statement on `WPlug` in `../native_configs/neovim/init.lua` then run neovim +to collect it. + +```lua +-- as of git://./dotfiles.git#a6c979c6 +local function WPlug(plugin_path, ...) + local plugin_name = string.lower(plugin_path:match("/([^/]+)$")) + if not installed_plugins[plugin_name] then + -- NOTE: Add print statement to get which plugin is still being + -- plugged at runtime + print("Plugging "..plugin_path) + Plug(plugin_path, ...) + end +end +``` + +We can then use `vim_dsl.py` + +```py + vp = VimPlugins(UPSTREAM_CSV) + need_install_plugins = """ +tjdevries/nlua.nvim +yioneko/nvim-yati +nathanalderson/yang.vim +numToStr/Comment.nvim +lewis6991/gitsigns.nvim +tpope/vim-fugitive +williamboman/mason.nvim +williamboman/mason-lspconfig.nvim +TimUntersberger/neogit +folke/trouble.nvim +tpope/vim-dispatch +clojure-vim/vim-jack-in +radenling/vim-dispatch-neovim +gennaro-tedesco/nvim-jqx +kylechui/nvim-surround +simrat39/inlay-hints.nvim +gruvbox-community/gruvbox +nvim-lualine/lualine.nvim +lukas-reineke/indent-blankline.nvim +kyazdani42/nvim-web-devicons +m-demare/hlargs.nvim +folke/todo-comments.nvim +nvim-treesitter/playground +saadparwaiz1/cmp_luasnip +L3MON4D3/LuaSnip +arthurxavierx/vim-caser +~/local_repos/ts-ql + """.split() + need_install_plugins = [plugin.strip() for plugin in plugins_raw if plugin.strip()] + + # Create the GitHub URL list + need_install_plugins_gh = [ + f"https://github.com/{plugin}/".lower() for plugin in need_install_plugins if not plugin.startswith(("~", "."))] + + # Get the values from the database + values = vp.query(f"SELECT LOWER(repo), alias from {vp.table_name()}") + + # Check if the repo is in the list of plugins + need_install = [ + vim_plugin_slug(alias) if alias else name_from_repo(repo) for repo, alias in values if repo in need_install_plugins_gh] + + print("need_install", "\n".join(need_install)) + + # Check if the repo is not in the list + repos = [repo for repo, _ in values] + not_in_repo = [name_from_repo(gh) for gh in need_install_plugins_gh if gh not in repos] + print("not in repo", not_in_repo) # nvim-yati, yang-vim, Comment-nvim, inlay-hints-nvim, hlargs-nvim, vim-caser, gruvbox-community +``` + +This should print out +``` +need_install +cmp_luasnip +comment-nvim +gitsigns-nvim +gruvbox-community +indent-blankline-nvim +lualine-nvim +luasnip +mason-lspconfig-nvim +mason-nvim +neogit +nlua-nvim +nvim-jqx +nvim-surround +nvim-web-devicons +playground +todo-comments-nvim +trouble-nvim +vim-dispatch +vim-dispatch-neovim +vim-fugitive +vim-jack-in +not in repo ['nvim-yati', 'yang-vim', 'inlay-hints-nvim', 'hlargs-nvim', 'vim-caser'] +``` + +Given this list, we could safely add to `neovim.nix` + +```nix +programs.neovim.plugins = + let inherit (pkgs.vimPlugins) + need_install + cmp_luasnip + comment-nvim + gitsigns-nvim + gruvbox-community + indent-blankline-nvim + lualine-nvim + luasnip + mason-lspconfig-nvim + mason-nvim + neogit + nlua-nvim + nvim-jqx + nvim-surround + nvim-web-devicons + playground + todo-comments-nvim + trouble-nvim + vim-dispatch + vim-dispatch-neovim + vim-fugitive + vim-jack-in + ;in [ + need_install + cmp_luasnip + comment-nvim + gitsigns-nvim + gruvbox-community + indent-blankline-nvim + lualine-nvim + luasnip + mason-lspconfig-nvim + mason-nvim + neogit + nlua-nvim + nvim-jqx + nvim-surround + nvim-web-devicons + playground + todo-comments-nvim + trouble-nvim + vim-dispatch + vim-dispatch-neovim + vim-fugitive + vim-jack-in + + ]; +``` + + +TODO: +- [ ] Source the plugins directly +- [ ] Add 'frozen' to each of these plugin +- [ ] Pin plugins separately from `neovim.nix` +- [ ] Find a better way to `inherit` with list comprehension +- [ ] Create alert & notification channel for this, ideally via Discord channel +- [ ] Even better, just put it in email with some labels +- [ ] Better end-to-end design that take even deeper account to gruvbox-community and such + diff --git a/flake.lock b/flake.lock index d3ddfd1..e7e8ab9 100644 --- a/flake.lock +++ b/flake.lock @@ -504,11 +504,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1686412476, - "narHash": "sha256-inl9SVk6o5h75XKC79qrDCAobTD1Jxh6kVYTZKHzewA=", + "lastModified": 1686501370, + "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "21951114383770f96ae528d0ae68824557768e81", + "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", "type": "github" }, "original": { diff --git a/native_configs/neovim/init.fnl b/native_configs/neovim/init.fnl new file mode 100644 index 0000000..20465e7 --- /dev/null +++ b/native_configs/neovim/init.fnl @@ -0,0 +1,721 @@ +(vim.cmd "let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' +let plug_path = data_dir . '/autoload/plug.vim' +if empty(glob(plug_path)) + execute '!curl -fLo '.plug_path.' --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' + execute 'so '.plug_path +endif +") +(local Plug (. vim.fn "plug#")) +(local installed-plugins {}) +(each [_ path (ipairs (vim.api.nvim_list_runtime_paths))] + (local last-folder-start (path:find "/[^/]*$")) + (when last-folder-start + (local plugin-name (path:sub (+ last-folder-start 1))) + (tset installed-plugins plugin-name true))) +(fn WPlug [plugin-path ...] + (let [plugin-name (string.lower (plugin-path:match "/([^/]+)$"))] + (when (not (. installed-plugins plugin-name)) (Plug plugin-path ...)))) +(vim.call "plug#begin") +(WPlug :tjdevries/nlua.nvim) +(WPlug :nvim-treesitter/nvim-treesitter) +(WPlug :nvim-treesitter/nvim-treesitter-textobjects) +(WPlug :nvim-telescope/telescope.nvim {:branch :0.1.x}) +(WPlug :nvim-telescope/telescope-fzf-native.nvim {:do "make >> /tmp/log 2>&1"}) +(WPlug :nvim-telescope/telescope-file-browser.nvim) +(WPlug :neovim/nvim-lspconfig) +(WPlug :hrsh7th/cmp-nvim-lsp) +(WPlug :hrsh7th/cmp-path) +(WPlug :hrsh7th/cmp-buffer) +(WPlug :hrsh7th/cmp-cmdline) +(WPlug :hrsh7th/nvim-cmp) +(WPlug :onsails/lspkind-nvim) +(WPlug :yioneko/nvim-yati {:tag "*"}) +(WPlug :nathanalderson/yang.vim) +(WPlug :windwp/nvim-autopairs) +(WPlug :windwp/nvim-ts-autotag) +(WPlug :NMAC427/guess-indent.nvim) +(WPlug :j-hui/fidget.nvim) +(WPlug :numToStr/Comment.nvim) +(WPlug :lewis6991/gitsigns.nvim) +(WPlug :tpope/vim-fugitive) +(WPlug :williamboman/mason.nvim) +(WPlug :williamboman/mason-lspconfig.nvim) +(WPlug :ThePrimeagen/harpoon) +(WPlug :TimUntersberger/neogit) +(WPlug :folke/trouble.nvim) +(WPlug :tpope/vim-dispatch) +(WPlug :clojure-vim/vim-jack-in) +(WPlug :radenling/vim-dispatch-neovim) +(WPlug :gennaro-tedesco/nvim-jqx) +(WPlug :kylechui/nvim-surround) +(WPlug :simrat39/rust-tools.nvim) +(WPlug :simrat39/inlay-hints.nvim) +(WPlug :gruvbox-community/gruvbox) +(WPlug :nvim-lualine/lualine.nvim) +(WPlug :lukas-reineke/indent-blankline.nvim) +(WPlug :kyazdani42/nvim-web-devicons) +(WPlug :m-demare/hlargs.nvim) +(WPlug :folke/todo-comments.nvim) +(WPlug :nvim-treesitter/nvim-treesitter-context) +(WPlug :nvim-treesitter/playground) +(WPlug :saadparwaiz1/cmp_luasnip) +(WPlug :L3MON4D3/LuaSnip) +(WPlug :mickael-menu/zk-nvim) +(WPlug :arthurxavierx/vim-caser) +(WPlug "~/local_repos/ts-ql") +(vim.call "plug#end") +(vim.cmd "if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) + PlugInstall --sync | autocmd VimEnter * so $MYVIMRC +endif +") +(vim.api.nvim_create_autocmd [:VimEnter] + {:callback (fn [] + (fn named-term [term-idx term-name] + ((. (require :harpoon.term) + :gotoTerminal) term-idx) + (vim.cmd (.. ":exe \":file " + term-name + "\" | :bfirst"))) + + (named-term 4 "term:ctl") + (named-term 5 "term:dev") + (named-term 7 "term:repl") + (named-term 6 "term:repl2"))}) +(set vim.g.gruvbox_contrast_dark :soft) +(set vim.g.gruvbox_contrast_light :soft) +(set vim.opt.ignorecase true) +(set vim.opt.smartcase true) +(set vim.opt.incsearch true) +(set vim.opt.number true) +(set vim.opt.relativenumber true) +(set vim.opt.autoindent true) +(set vim.opt.smartindent true) +(set vim.opt.expandtab true) +(set vim.opt.exrc true) +(set vim.opt.tabstop 4) +(set vim.opt.softtabstop 4) +(set vim.opt.shiftwidth 4) +(set vim.opt.scrolloff 30) +(set vim.opt.signcolumn :yes) +(set vim.opt.colorcolumn :80) +(set vim.opt.background :dark) +(vim.api.nvim_create_user_command :Dark + (fn [opts] + (let [contrast (or (and (and opts.args + (> (string.len opts.args) + 0)) + opts.args) + vim.g.gruvbox_contrast_dark)] + (set vim.g.gruvbox_contrast_dark contrast) + (set vim.opt.background :dark))) + {:nargs "?"}) +(vim.api.nvim_create_user_command :Light + (fn [opts] + (let [contrast (or (and (and opts.args + (> (string.len opts.args) + 0)) + opts.args) + vim.g.gruvbox_contrast_light)] + (set vim.g.gruvbox_contrast_light + contrast) + (set vim.opt.background :light))) + {:nargs "?"}) +(set vim.opt.lazyredraw true) +(set vim.opt.termguicolors true) +(set vim.opt.cursorline true) +(set vim.opt.swapfile false) +(set vim.opt.backup false) +(set vim.opt.undodir (.. (vim.fn.stdpath :state) :/.vim/undodir)) +(set vim.opt.undofile true) +(set vim.opt.completeopt "menuone,noselect") +(set vim.opt.updatetime 50) +(set vim.g.mapleader " ") +(set vim.g.maplocalleader ",") +(vim.keymap.set [:n :v] : : {:silent true}) +(vim.keymap.set :t : ")") +(vim.keymap.set [:n :i :v] : :mode {:desc ""}) +(vim.keymap.set :n "[d" vim.diagnostic.goto_prev) +(vim.keymap.set :n "]d" vim.diagnostic.goto_next) +(vim.keymap.set :n :e vim.diagnostic.open_float) +(vim.keymap.set :n :q "TroubleToggle loclist") +(vim.keymap.set :n :wq "TroubleToggle workspace_diagnostics") +(vim.keymap.set :n :gg :GuessIndent) +(vim.cmd "colorscheme gruvbox\n") +((. (require :hlargs) :setup)) +((. (require :nvim-web-devicons) :setup)) +((. (require :trouble) :setup)) +((. (require :todo-comments) :setup)) +(fn remap [mode key-cmd binded-fn opts] + (set-forcibly! opts (or opts {:remap true})) + (vim.keymap.set mode key-cmd binded-fn opts)) +((. (require :Comment) :setup)) +(set vim.opt.list true) +(vim.opt.listchars:append "space:⋅") +(vim.opt.listchars:append "eol:↴") +((. (require :indent_blankline) :setup) {:show_end_of_line true + :space_char_blankline " "}) +(vim.api.nvim_create_user_command :HalfSpaces + (fn [opts] + (vim.api.nvim_command "set ts=2 sts=2 noet") + (vim.api.nvim_command :retab!) + (vim.api.nvim_command "set ts=1 sts=1 et") + (vim.api.nvim_command :retab) + (vim.api.nvim_command :GuessIndent)) + {:nargs 0}) +(vim.api.nvim_create_user_command :DoubleSpaces + (fn [opts] + (vim.api.nvim_command "set ts=2 sts=2 noet") + (vim.api.nvim_command :retab!) + (vim.api.nvim_command "set ts=4 sts=4 et") + (vim.api.nvim_command :retab) + (vim.api.nvim_command :GuessIndent)) + {:nargs 0}) +(local fb-actions (. (. (. (require :telescope) :extensions) :file_browser) + :actions)) +((. (require :telescope) :setup) {:defaults {:mappings {:i {: false + : false}}} + :extensions {:file_browser {:hiject_netrw true + :mappings {:i {} + :n {:c fb-actions.create + :d fb-actions.remove + :e fb-actions.goto_home_dir + :f fb-actions.toggle_browser + :g fb-actions.goto_parent_dir + :h fb-actions.toggle_hidden + :m fb-actions.move + :o fb-actions.open + :r fb-actions.rename + :s fb-actions.toggle_all + :t fb-actions.change_cwd + :w fb-actions.goto_cwd + :y fb-actions.copy}} + :theme (. ((. (require :telescope.themes) + :get_ivy)) + :theme)} + :fzf {:case_mode :smart_case + :fuzzy true + :override_file_sorter true + :override_generic_sorter true}}}) +(pcall (. (require :telescope) :load_extension) :fzf) +(pcall (. (require :telescope) :load_extension) :file_browser) +(remap :n : :Telescope {:desc "Open Telescope general search"}) +(remap :n :fm (fn [] + ((. (. (. (require :telescope) :extensions) + :file_browser) + :file_browser) {})) + {:desc "[F]ile [M]utation"}) +(remap :n :ff + (fn [] + ((. (require :telescope.builtin) :find_files) {:follow false + :hidden false + :no_ignore false})) + {:desc "[F]ind [F]ile"}) +(remap :n :fa + (fn [] + ((. (require :telescope.builtin) :find_files) {:follow true + :hidden true + :no_ignore true})) + {:desc "[F]ind [A]ll files"}) +(remap :n :fg + (fn [] + ((. (require :telescope.builtin) :live_grep))) + {:desc "[F]ind by [G]rep"}) +(remap :n :fug + (fn [] + ((. (require :telescope.builtin) :live_grep) {:glob_pattern "**/*"})) + {:desc "[F]ind by [u]nrestricted [G]rep"}) +(remap :n :fb + (fn [] + ((. (require :telescope.builtin) :buffers))) + {:desc "[F]ind existing [B]uffers"}) +(remap :n :fh + (fn [] + ((. (require :telescope.builtin) :help_tags))) + {:desc "[F]ind [H]elp"}) +(remap :n :fd + (fn [] + ((. (require :telescope.builtin) :diagnostics))) + {:desc "[F]ind [D]iagnostics"}) +(remap :n :zf + (fn [] + ((. (require :zk) :edit) {} {:multi_select false})) + {:desc "[Z]ettelkasten [F]iles"}) +(remap :n :zg (fn [] (vim.cmd ":ZkGrep")) + {:desc "[Z]ettelkasten [G]rep"}) +(for [i 1 9] + (vim.api.nvim_set_keymap :n (.. : i) (.. ":tabn " i :) + {:noremap true :silent true})) +(set vim.o.showtabline 1) +(set vim.o.tabline "%!v:lua.my_tabline()") +(fn _G.my_tabline [] + (var s "") + (for [i 1 (vim.fn.tabpagenr "$")] + (if (= i (vim.fn.tabpagenr)) (set s (.. s "%" i "T%#TabLineSel#")) + (set s (.. s "%" i "T%#TabLine#"))) + (local tab (. (vim.fn.gettabinfo i) 1)) + (local tabbuf tab.variables.buffers) + (var bufname :) + (when tabbuf + (set bufname (. (. tabbuf tab.curwin) :name))) + (set s (.. s " " i " " (vim.fn.fnamemodify bufname ":t"))) + (when (not= i (vim.fn.tabpagenr "$")) + (set s (.. s "%#TabLine#|%#TabLine#")))) + (.. s "%T%#TabLineFill#%=")) +(vim.api.nvim_set_keymap :n :x + ":tabdo if tabpagenr() > 1 | tabclose | endif" + {:noremap true :silent true}) +(require :treesitter-context) +((. (require :nvim-treesitter.configs) :setup) {:autotag {:enable true} + :highlight {:enable true + :enable_vim_regex_highlighting true} + :incremental_selection {:enable true + :keymaps {:init_selection : + :node_decremental : + :node_incremental : + :pscope_incremental :}} + :indent {:enable false} + :playground {:disable {} + :enable true} + :textobjects {:select {:enable true + :keymaps {:ac "@class.outer" + :af "@function.outer" + :ic "@class.inner" + :if "@function.inner"} + :lookahead true}} + :yati {:default_fallback :auto + :default_lazy true + :disable [:nix] + :enable true}}) +((. (require :nvim-autopairs) :setup) {:check_ts true}) +(local parser-config + ((. (require :nvim-treesitter.parsers) :get_parser_configs))) +(set parser-config.tsx.filetype_to_parsername [:javascript :typescript.tsx]) +(set parser-config.astro.filetype_to_parsername + [:javascript :typescript.tsx :astro]) +((. (require :guess-indent) :setup) {:auto_cmd true + :filetype_exclude [:netrw :tutor]}) +(remap :n :m + (fn [] + ((. (require :harpoon.mark) :add_file))) + {:desc "[H]arpoon [M]ark"}) +(fn harpoon-nav [key nav-file-index lead-keybind] + (set-forcibly! lead-keybind (or lead-keybind :h)) + (assert (= (type key) :string) "expect key to be string(keybind)") + (assert (and (= (type nav-file-index) :number) (>= nav-file-index 1)) + "expect 1-indexed number for file index") + (remap :n (.. lead-keybind key) + (fn [] + ((. (require :harpoon.ui) :nav_file) nav-file-index)) + {:desc (.. "[H]arpoon navigate " (tostring nav-file-index))})) +(harpoon-nav :f 1) +(harpoon-nav :j 2) +(harpoon-nav :d 3) +(harpoon-nav :k 4) +(remap :n :hh + (fn [] + ((. (require :harpoon.ui) :toggle_quick_menu)))) +(for [i 1 10] + (harpoon-nav (tostring (% i 10)) i) + (remap :n (.. :t (tostring (% i 10))) + (fn [] + ((. (require :harpoon.term) :gotoTerminal) i)))) +((. (require :neogit) :setup) {}) +(remap :n :gs (fn [] + ((. (require :neogit) :open) {})) + {:desc "[G]it [S]tatus"}) +((. (require :inlay-hints) :setup) {:eol {:right_align false} + :only_current_line false}) +(fn on-attach [client bufnr] + (fn nmap [keys func desc] + (when desc (set-forcibly! desc (.. "LSP: " desc))) + (vim.keymap.set :n keys func {:buffer bufnr : desc :noremap true})) + + (nmap :rn vim.lsp.buf.rename "[R]e[n]ame") + (nmap :ca vim.lsp.buf.code_action "[C]ode [A]ction") + (vim.api.nvim_buf_set_option bufnr :omnifunc "v:lua.vim.lsp.omnifunc") + (nmap :df (fn [] (vim.lsp.buf.format {:async true})) + "[D]ocument [F]ormat") + (nmap :gd vim.lsp.buf.definition "[G]oto [D]efinition") + (nmap :gi vim.lsp.buf.implementation "[G]oto [I]mplementation") + (nmap :gr (. (require :telescope.builtin) :lsp_references)) + (nmap :ds (. (require :telescope.builtin) :lsp_document_symbols) + "[D]ocument [S]ymbols") + (nmap :ws (. (require :telescope.builtin) + :lsp_dynamic_workspace_symbols) + "[W]orkspace [S]ymbols") + (nmap :K vim.lsp.buf.hover "Hover Documentation") + (nmap : vim.lsp.buf.signature_help "Signature Documentation") + (nmap :gD vim.lsp.buf.declaration "[G]oto [D]eclaration") + (nmap :gtd vim.lsp.buf.type_definition "[G]oto [T]ype [D]efinition") + (nmap :D vim.lsp.buf.type_definition "Type [D]efinition") + (nmap :wa vim.lsp.buf.add_workspace_folder "[W]orkspace [A]dd Folder") + (nmap :wr vim.lsp.buf.remove_workspace_folder + "[W]orkspace [R]emove Folder") + (nmap :wl + (fn [] + (print (vim.inspect (vim.lsp.buf.list_workspace_folders)))) + "[W]orkspace [L]ist Folders") + ((. (require :inlay-hints) :on_attach) client bufnr)) +(local cmp (require :cmp)) +(local luasnip (require :luasnip)) +(local lspkind (require :lspkind)) +(local source-mapping {:buffer "[Buffer]" + :nvim_lsp "[LSP]" + :nvim_lua "[Lua]" + :path "[Path]"}) +(cmp.event:on :confirm_done ((. (require :nvim-autopairs.completion.cmp) + :on_confirm_done))) +(cmp.setup {:formatting {:format (fn [entry vim-item] + (set vim-item.kind + (lspkind.symbolic vim-item.kind + {:mode :symbol})) + (set vim-item.menu + (. source-mapping entry.source_name)) + (local maxwidth 80) + (set vim-item.abbr + (string.sub vim-item.abbr 1 maxwidth)) + vim-item)} + :mapping (cmp.mapping.preset.insert {: (cmp.mapping.scroll_docs 4) + : (cmp.mapping.complete) + : (cmp.mapping.scroll_docs (- 4)) + : (cmp.mapping.confirm {:behavior cmp.ConfirmBehavior.Replace + :select true}) + : (cmp.mapping (fn [fallback] + (if (cmp.visible) + (cmp.select_prev_item) + (luasnip.jumpable (- 1)) + (luasnip.jump (- 1)) + (fallback))) + [:i :s]) + : (cmp.mapping (fn [fallback] + (if (cmp.visible) + (cmp.select_next_item) + (luasnip.expand_or_jumpable) + (luasnip.expand_or_jump) + (fallback))) + [:i :s])}) + :snippet {:expand (fn [args] (luasnip.lsp_expand args.body))} + :sources (cmp.config.sources [{:name :nvim_lsp} + {:name :luasnip} + {:name :buffer} + {:name :path}])}) +(local capabilities ((. (require :cmp_nvim_lsp) :default_capabilities))) +(local servers [:clangd + :rust_analyzer + :pyright + :tsserver + :lua_ls + :cmake + :tailwindcss + :prismals + :rnix + :eslint + :terraformls + :tflint + :svelte + :astro + :clojure_lsp + :bashls + :yamlls + :ansiblels + :jsonls + :denols + :gopls + :nickel_ls + :pylsp]) +((. (require :mason) :setup) {:PATH :append + :ui {:check_outdated_packages_on_open true + :icons {:package_installed "✓" + :package_pending "➜" + :package_uninstalled "✗"}}}) +((. (require :mason-lspconfig) :setup) {:automatic_installation false}) +(local inlay-hint-tsjs + {:includeInlayEnumMemberValueHints true + :includeInlayFunctionLikeReturnTypeHints true + :includeInlayFunctionParameterTypeHints true + :includeInlayParameterNameHints :all + :includeInlayPropertyDeclarationTypeHints true + :includeInlayVariableTypeHints true + :inlcudeInlayParameterNameHintsWhenArgumentMatchesName false}) +((. (require :mason-lspconfig) :setup_handlers) {1 (fn [server-name] + ((. (. (require :lspconfig) + server-name) + :setup) {: capabilities + :on_attach on-attach})) + :denols (fn [] + ((. (. (require :lspconfig) + :denols) + :setup) {: capabilities + :on_attach on-attach + :root_dir ((. (require :lspconfig.util) + :root_pattern) :deno.json + :deno.jsonc)})) + :lua_ls (fn [] + ((. (. (require :lspconfig) + :lua_ls) + :setup) {: capabilities + :on_attach on-attach + :settings {:Lua {:diagnostics {:globals [:vim]} + :format {:defaultConfig {:indent_size 4 + :indent_style :space} + :enable true} + :hint {:enable true} + :runtime {:path (vim.split package.path + ";") + :version :LuaJIT} + :telemetry {:enable false} + :workspace {:library (vim.api.nvim_get_runtime_file "" + true)}}}})) + :pyright (fn [] + ((. (. (require :lspconfig) + :pyright) + :setup) {: capabilities + :on_attach on-attach + :settings {:pyright {:disableLanguageServices false + :disableOrganizeImports false} + :python {:analysis {:autoImportCompletions true + :autoSearchPaths true + :diagnosticMode :openFilesOnly + :extraPaths {} + :logLevel :Information + :pythonPath :python + :stubPath :typings + :typeCheckingMode :basic + :typeshedPaths {} + :useLibraryCodeForTypes false + :venvPath ""} + :linting {:mypyEnabled true}}}})) + :tsserver (fn [] + ((. (. (require :lspconfig) + :tsserver) + :setup) {: capabilities + :on_attach on-attach + :root_dir ((. (require :lspconfig.util) + :root_pattern) :package.json) + :settings {:javascript inlay-hint-tsjs + :typescript inlay-hint-tsjs}})) + :yamlls (fn [] + ((. (. (require :lspconfig) + :yamlls) + :setup) {: capabilities + :on_attach on-attach + :settings {:yaml {:keyOrdering false}}}))}) +((. (require :rust-tools) :setup) {:dap {:adapter {:command :lldb-vscode + :name :rt_lldb + :type :executable}} + :server {: capabilities + :cmd [:rust-analyzer] + :on_attach (fn [client bufnr] + (fn nmap [keys + func + desc] + (when desc + (set-forcibly! desc + (.. "LSP: " + desc))) + (vim.keymap.set :n + keys + func + {:buffer bufnr + : desc + :noremap true})) + + (on-attach client + bufnr) + (nmap :K + (. (. (require :rust-tools) + :hover_actions) + :hover_actions) + "Hover Documentation")) + :settings {:rust-analyzer {:cargo {:loadOutDirsFromCheck true} + :checkOnSave {:command :clippy + :extraArgs [:--all + "--" + :-W + "clippy::all"]} + :procMacro {:enable true} + :rustfmt {:extraArgs [:+nightly]}}} + :standalone true} + :tools {:crate_graph {:backend :x11 + :enabled_graphviz_backends [:bmp + :cgimage + :canon + :dot + :gv + :xdot + :xdot1.2 + :xdot1.4 + :eps + :exr + :fig + :gd + :gd2 + :gif + :gtk + :ico + :cmap + :ismap + :imap + :cmapx + :imap_np + :cmapx_np + :jpg + :jpeg + :jpe + :jp2 + :json + :json0 + :dot_json + :xdot_json + :pdf + :pic + :pct + :pict + :plain + :plain-ext + :png + :pov + :ps + :ps2 + :psd + :sgi + :svg + :svgz + :tga + :tiff + :tif + :tk + :vml + :vmlz + :wbmp + :webp + :xlib + :x11] + :full true + :output nil} + :executor (. (require :rust-tools/executors) + :termopen) + :hover_actions {:auto_focus false + :border [["╭" + :FloatBorder] + ["─" + :FloatBorder] + ["╮" + :FloatBorder] + ["│" + :FloatBorder] + ["╯" + :FloatBorder] + ["─" + :FloatBorder] + ["╰" + :FloatBorder] + ["│" + :FloatBorder]]} + :inlay_hints {:auto false + :highlight :NonText + :max_len_align false + :max_len_align_padding 1 + :only_current_line true + :other_hints_prefix "=> " + :parameter_hints_prefix "<- " + :right_align false + :right_align_padding 7 + :show_parameter_hints true} + :on_initialized (fn [] + ((. (require :inlay-hints) + :set_all))) + :reload_workspace_from_cargo_toml true}}) +((. (require :zk) :setup) {:lsp {:auto_attach {:enable true + :filetypes [:markdown]} + :config {:cmd [:zk :lsp] + :name :zk + :on_attach on-attach}} + :picker :telescope}) +((. (require :zk.commands) :add) :ZkOrphans + (fn [options] + (set-forcibly! options + (vim.tbl_extend :force + {:orphan true} + (or options + {}))) + ((. (require :zk) :edit) options + {:title "Zk Orphans (unlinked notes)"}))) +((. (require :zk.commands) :add) :ZkGrep + (fn [match-ctor] + (var grep-str match-ctor) + (var ___match___ nil) + (if (or (= match-ctor nil) (= match-ctor "")) + (do + (vim.fn.inputsave) + (set grep-str + (vim.fn.input "Grep string: >")) + (vim.fn.inputrestore) + (set ___match___ {:match grep-str})) + (= (type match-ctor) :string) + (set ___match___ {:match grep-str})) + ((. (require :zk) :edit) ___match___ + {:mutli_select false + :title (.. "Grep: '" + grep-str + "'")}))) +((. (require :gitsigns) :setup) {:signs {:add {:text "+"} + :change {:text "~"} + :changedelete {:text "~"} + :delete {:text "_"} + :topdelete {:text "‾"}}}) +((. (require :lualine) :setup) {:inactive_sections {:lualine_a {} + :lualine_b {} + :lualine_c [{1 :filename + :file_status true + :path 1}] + :lualine_x [:location] + :lualine_y {} + :lualine_z {}} + :options {:icons_enabled true} + :sections {:lualine_a [:mode] + :lualine_b [:branch + :diff + :diagnostics] + :lualine_c [{1 :filename + :file_status true + :newfile_status false + :path 1 + :symbols {:modified "[+]" + :newfile "[New]" + :readonly "[-]" + :unnamed "[Unnamed]"}}] + :lualine_x [:encoding + :fileformat + :filetype] + :lualine_y [:progress] + :lualine_z [:location]}}) +((. (require :nvim-surround) :setup) {}) +((. (require :tsql) :setup)) +((. (require :fidget) :setup) {:align {:bottom true :right true} + :debug {:logging false :strict false} + :fmt {:fidget (fn [fidget-name spinner] + (string.format "%s %s" spinner + fidget-name)) + :leftpad true + :max_width 0 + :stack_upwards true + :task (fn [task-name message percentage] + (string.format "%s%s [%s]" message + (or (and percentage + (string.format " (%s%%)" + percentage)) + "") + task-name))} + :sources {:* {:ignore false}} + :text {:commenced :Started + :completed :Completed + :done "✔" + :spinner :moon} + :timer {:fidget_decay 2000 + :spinner_rate 125 + :task_decay 1000} + :window {:blend 100 + :border :none + :relative :editor + :zindex nil}}) diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 081fed7..27616b9 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -67,7 +67,7 @@ WPlug('nvim-telescope/telescope-file-browser.nvim') WPlug('neovim/nvim-lspconfig') -- built-in LSP configurations WPlug('hrsh7th/cmp-nvim-lsp') WPlug('hrsh7th/cmp-path') -WPlug('hrsh7th/cmp-buffer') +WPlug('hrsh7th/cmp-buffer') -- Recommends words within the buffer WPlug('hrsh7th/cmp-cmdline') WPlug('hrsh7th/nvim-cmp') WPlug('onsails/lspkind-nvim') @@ -644,11 +644,34 @@ cmp.setup { sources = cmp.config.sources { { name = 'nvim_lsp' }, { name = 'luasnip' }, - { name = 'buffer' }, + { + name = 'buffer', + option = { + -- default is only in the current buffer. This grabs recommendations + -- from all visible buffers + get_bufnrs = function() + local bufs = {} + for _, win in ipairs(vim.api.nvim_list_wins()) do + local buf = vim.api.nvim_win_get_buf(win) + local byte_size = vim.api.nvim_buf_get_offset(buf, vim.api.nvim_buf_line_count(buf)) + if byte_size <= 1024 * 1024 then -- 1 MiB max + bufs[buf] = true + end + end + return vim.tbl_keys(bufs) + end, + } + }, { name = 'path' }, -- { name = "conjure" }, -- { name = 'cmp_tabnine' }, }, + sorting = { + comparators = { + -- Optimize searches by recommending things that are closer to the current cursor + function(...) require('cmp-buffer'):compare_locality(...) end, + } + }, } -- nvim-cmp supports additional completion capabilities local capabilities = require('cmp_nvim_lsp').default_capabilities() diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index f5c7820..13cf0fe 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -818,11 +818,11 @@ ] }, "locked": { - "lastModified": 1686391840, - "narHash": "sha256-5S0APl6Mfm6a37taHwvuf11UHnAX0+PnoWQbsYbMUnc=", + "lastModified": 1686562199, + "narHash": "sha256-FG6kCtVjCh0dHnV4AsVfhfSyPhjnSVXucwqCdTpMASE=", "owner": "nix-community", "repo": "home-manager", - "rev": "0144ac418ef633bfc9dbd89b8c199ad3a617c59f", + "rev": "b0cdae4e9baa188d69ba84aa1b7406b7bebe37f6", "type": "github" }, "original": { @@ -1197,11 +1197,11 @@ }, "nixpkgs_12": { "locked": { - "lastModified": 1686412476, - "narHash": "sha256-inl9SVk6o5h75XKC79qrDCAobTD1Jxh6kVYTZKHzewA=", + "lastModified": 1686501370, + "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "21951114383770f96ae528d0ae68824557768e81", + "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", "type": "github" }, "original": { diff --git a/scripts/vim_dsl.py b/scripts/vim_dsl.py index 45b1121..3484181 100755 --- a/scripts/vim_dsl.py +++ b/scripts/vim_dsl.py @@ -86,19 +86,25 @@ L3MON4D3/LuaSnip arthurxavierx/vim-caser ~/local_repos/ts-ql """.split() - need_install_plugins = [plugin.strip() for plugin in plugins] - need_install_plugins = [plugin for plugin in plugins if len(plugin) > 0] - need_install_plugins_gh = [ - f"https://github.com/{plugin}/".lower() for plugin in need_install_plugins if plugin[0] not in "~./"] - values = vp.query(f"SELECT LOWER(repo), alias from {vp.table_name()}") - need_install = [] - for repo, alias in values: - if repo in need_install_plugins_gh: - need_install.append(vim_plugin_slug(alias) if len(alias) > 0 else name_from_repo(repo)) - print("need_install", "\n".join(need_install)) + need_install_plugins = [plugin.strip() for plugin in need_install_plugins if plugin.strip()] + # Create the GitHub URL list + need_install_plugins_gh = [ + f"https://github.com/{plugin}/".lower() for plugin in need_install_plugins if not plugin.startswith(("~", "."))] + + # Get the values from the database + values = vp.query(f"SELECT LOWER(repo), alias from {vp.table_name()}") + + # Check if the repo is in the list of plugins + need_install = [ + vim_plugin_slug(alias) if alias else name_from_repo(repo) for repo, alias in values if repo in need_install_plugins_gh] + + print("need_install") + print("\n".join(need_install)) + + # Check if the repo is not in the list repos = [repo for repo, _ in values] not_in_repo = [name_from_repo(gh) for gh in need_install_plugins_gh if gh not in repos] print("not in repo", not_in_repo) # nvim-yati, yang-vim, Comment-nvim, inlay-hints-nvim, hlargs-nvim, vim-caser, gruvbox-community - + From f04388f562ba3d06b532664b3d527da89d955147 Mon Sep 17 00:00:00 2001 From: Hung Date: Mon, 12 Jun 2023 23:58:03 -0700 Subject: [PATCH 56/64] many neovim changes and vimplugins nightly overlay --- native_configs/neovim/init.lua | 1714 ++++++++++++++----------- nix-conf/home-manager/base/neovim.nix | 3 +- nix-conf/home-manager/flake.lock | 74 +- nix-conf/home-manager/flake.nix | 2 + nix-conf/home-manager/overlays.nix | 5 + 5 files changed, 989 insertions(+), 809 deletions(-) diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 27616b9..5fcd059 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -4,17 +4,14 @@ -- - df to format document -- - Harpoon marks: Navigate through main files within each project -- --- REQUIREMENTS: --- - zk @ https://github.com/mickael-menu/zk --- - prettierd @ npm install -g @fsouza/prettierd -- Auto-installs vim-plug vim.cmd([[ let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' let plug_path = data_dir . '/autoload/plug.vim' if empty(glob(plug_path)) - execute '!curl -fLo '.plug_path.' --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' - execute 'so '.plug_path + execute '!curl -fLo '.plug_path.' --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' + execute 'so '.plug_path endif ]]) @@ -25,19 +22,19 @@ local Plug = vim.fn['plug#'] local installed_plugins = {} -- NOTE: nvim_list_runtime_paths will expand wildcard paths for us. for _, path in ipairs(vim.api.nvim_list_runtime_paths()) do - local last_folder_start = path:find("/[^/]*$") - if last_folder_start then - local plugin_name = path:sub(last_folder_start + 1) - installed_plugins[plugin_name] = true - end + local last_folder_start = path:find("/[^/]*$") + if last_folder_start then + local plugin_name = path:sub(last_folder_start + 1) + installed_plugins[plugin_name] = true + end end -- Do Plug if plugin not yet linked in `rtp`. This takes care of Nix-compatibility local function WPlug(plugin_path, ...) - local plugin_name = string.lower(plugin_path:match("/([^/]+)$")) - if not installed_plugins[plugin_name] then - Plug(plugin_path, ...) - end + local plugin_name = string.lower(plugin_path:match("/([^/]+)$")) + if not installed_plugins[plugin_name] then + Plug(plugin_path, ...) + end end vim.call('plug#begin') @@ -55,12 +52,12 @@ WPlug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser -- ----- -- What to do: -- - Run `make` at anytime before Nix is done on this repository --- - Might mean that we fetch this repository, run make, and copy to destination folder +-- - Might mean that we fetch this repository, run make, and copy to destination folder -- - Make sure that if we run `make` at first WPlug run, that `make` is idempotent -- OR --- Make sure that WPlug does not run `make` and use the output it needs +-- Make sure that WPlug does not run `make` and use the output it needs WPlug('nvim-telescope/telescope-fzf-native.nvim', - { ['do'] = 'make >> /tmp/log 2>&1' }) + { ['do'] = 'make >> /tmp/log 2>&1' }) WPlug('nvim-telescope/telescope-file-browser.nvim') -- cmp: auto-complete/suggestions @@ -70,6 +67,7 @@ WPlug('hrsh7th/cmp-path') WPlug('hrsh7th/cmp-buffer') -- Recommends words within the buffer WPlug('hrsh7th/cmp-cmdline') WPlug('hrsh7th/nvim-cmp') +WPlug('hrsh7th/cmp-nvim-lsp-signature-help') WPlug('onsails/lspkind-nvim') WPlug('yioneko/nvim-yati', { tag = '*' }) -- copium: fix Python indent auto-correct from smart-indent WPlug('nathanalderson/yang.vim') @@ -91,19 +89,21 @@ WPlug('folke/trouble.nvim') -- File-grouped workspace diagnostics WPlug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands WPlug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein" WPlug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator --- WPlug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs) +-- WPlug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs) WPlug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*) WPlug('kylechui/nvim-surround') -- surrounds with tags/parenthesis WPlug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration -- UI & colorscheme -WPlug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts -WPlug('gruvbox-community/gruvbox') -- theme provider -WPlug('nvim-lualine/lualine.nvim') -- fancy status line -WPlug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines -WPlug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes -WPlug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog -WPlug('folke/todo-comments.nvim') -- Highlights TODO +WPlug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts +WPlug('gruvbox-community/gruvbox') -- theme provider +WPlug('nvim-lualine/lualine.nvim') -- fancy status line +WPlug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines +WPlug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes +WPlug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog +WPlug('folke/todo-comments.nvim') -- Highlights TODO +WPlug('NvChad/nvim-colorizer.lua') -- color highlighter with tailwind support +WPlug('roobert/tailwindcss-colorizer-cmp.nvim') -- color highlighter with tailwind support -- other utilities WPlug('nvim-treesitter/nvim-treesitter-context') -- Top one-liner context of func/class scope @@ -121,29 +121,37 @@ WPlug('~/local_repos/ts-ql') -- workspace code intelligence --------- vim.call('plug#end') +local PLUGIN_URI = 'gh:pegasust:dotfiles' +local PLUGIN_LEVEL = 'debug' +local log = require('plenary.log').new({ plugin = PLUGIN_URI, level = PLUGIN_LEVEL, use_console = false }) + vim.cmd([[ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) - PlugInstall --sync | autocmd VimEnter * so $MYVIMRC + PlugInstall --sync | autocmd VimEnter * so $MYVIMRC endif ]]) -- special terminals, place them at 4..=7 for ergonomics +-- NOTE: this requires a flawless startup, otherwise, it's going to throw errors +-- since we're basically simulating keystrokes +-- TODO: The correct behavior is to register terminal keystroke with an assigned +-- buffer vim.api.nvim_create_autocmd({ "VimEnter" }, { - callback = function() - local function named_term(term_idx, term_name) - require('harpoon.term').gotoTerminal(term_idx) - vim.cmd([[:exe ":file ]] .. term_name .. [[" | :bfirst]]) - end - - -- term:ctl at 4 - named_term(4, "term:ctl") - -- term:dev at 5 - named_term(5, "term:dev") - -- term:repl at 7 - named_term(7, "term:repl") - -- term:repl at 6 - named_term(6, "term:repl2") + callback = function() + local function named_term(term_idx, term_name) + require('harpoon.term').gotoTerminal(term_idx) + vim.cmd([[:exe ":file ]] .. term_name .. [[" | :bfirst]]) end + + -- term:ctl at 4 + named_term(4, "term:ctl") + -- term:dev at 5 + named_term(5, "term:dev") + -- term:repl at 7 + named_term(7, "term:repl") + -- term:repl at 6 + named_term(6, "term:repl2") + end }) vim.g.gruvbox_contrast_dark = "soft"; @@ -168,22 +176,22 @@ vim.opt.colorcolumn = "80"; vim.opt.background = "dark"; vim.api.nvim_create_user_command('Dark', function(opts) - -- opts: {name, args: str, fargs: Splited, range, ...} - ---@type string - local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark; - vim.g.gruvbox_contrast_dark = contrast; - vim.opt.background = "dark"; - end, - { nargs = "?", }) + -- opts: {name, args: str, fargs: Splited, range, ...} + ---@type string + local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark; + vim.g.gruvbox_contrast_dark = contrast; + vim.opt.background = "dark"; + end, + { nargs = "?", }) vim.api.nvim_create_user_command('Light', function(opts) - -- opts: {name, args: str, fargs: Splited, range, ...} - ---@type string - local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_light; - vim.g.gruvbox_contrast_light = contrast; - vim.opt.background = "light"; - end, - { nargs = "?", }) + -- opts: {name, args: str, fargs: Splited, range, ...} + ---@type string + local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_light; + vim.g.gruvbox_contrast_light = contrast; + vim.opt.background = "light"; + end, + { nargs = "?", }) vim.opt.lazyredraw = true vim.opt.termguicolors = true @@ -193,7 +201,10 @@ vim.opt.swapfile = false vim.opt.backup = false vim.opt.undodir = vim.fn.stdpath('state') .. '/.vim/undodir' vim.opt.undofile = true -vim.opt.completeopt = 'menuone,noselect' +-- show menu even if there's 1 selection, and default to no selection +-- Note that we're not setitng `noinsert`, which allows us to "foresee" what the +-- completion would give us. This is faithful to VSCode +vim.opt.completeopt = { "menu", "menuone", "noselect", "noinsert" } -- vim.opt.clipboard = "unnamedplus" @@ -237,8 +248,8 @@ require('todo-comments').setup() -- plugin keymaps local function remap(mode, key_cmd, binded_fn, opts) - opts = opts or { remap = true } - return vim.keymap.set(mode, key_cmd, binded_fn, opts) + opts = opts or { remap = true } + return vim.keymap.set(mode, key_cmd, binded_fn, opts) end -- Comment.nvim @@ -249,76 +260,76 @@ vim.opt.listchars:append "space:⋅" vim.opt.listchars:append "eol:↴" require("indent_blankline").setup { - show_end_of_line = true, - space_char_blankline = " ", + show_end_of_line = true, + space_char_blankline = " ", } -- User command that transform into 2-spaces by translating to tabstop vim.api.nvim_create_user_command( - 'HalfSpaces', - function(opts) - vim.api.nvim_command("set ts=2 sts=2 noet") - vim.api.nvim_command("retab!") - vim.api.nvim_command("set ts=1 sts=1 et") - vim.api.nvim_command("retab") - vim.api.nvim_command("GuessIndent") - end, - { nargs = 0 } + 'HalfSpaces', + function(opts) + vim.api.nvim_command("set ts=2 sts=2 noet") + vim.api.nvim_command("retab!") + vim.api.nvim_command("set ts=1 sts=1 et") + vim.api.nvim_command("retab") + vim.api.nvim_command("GuessIndent") + end, + { nargs = 0 } ) vim.api.nvim_create_user_command( - 'DoubleSpaces', - function(opts) - -- cannot really do 1-space tab. The minimum is 2-space to begin - -- doubling - vim.api.nvim_command("set ts=2 sts=2 noet") - vim.api.nvim_command("retab!") - vim.api.nvim_command("set ts=4 sts=4 et") - vim.api.nvim_command("retab") - vim.api.nvim_command("GuessIndent") - end, - { nargs = 0 } + 'DoubleSpaces', + function(opts) + -- cannot really do 1-space tab. The minimum is 2-space to begin + -- doubling + vim.api.nvim_command("set ts=2 sts=2 noet") + vim.api.nvim_command("retab!") + vim.api.nvim_command("set ts=4 sts=4 et") + vim.api.nvim_command("retab") + vim.api.nvim_command("GuessIndent") + end, + { nargs = 0 } ) -- telescope local fb_actions = require "telescope".extensions.file_browser.actions require('telescope').setup { - defaults = { - mappings = { - i = { - [''] = false, - [''] = false, - }, - }, + defaults = { + mappings = { + i = { + [''] = false, + [''] = false, + }, }, - extensions = { - fzf = { - fuzzy = true, -- allow fuzzy matches - override_generic_sorter = true, - override_file_sorter = true, - case_mode = 'smart_case' - }, - file_browser = { - theme = require('telescope.themes').get_ivy().theme, - hiject_netrw = true, -- disables netrw and use file-browser instead - mappings = { - ["i"] = {}, -- disable any shortcut in insert mode for now - ["n"] = { - ["c"] = fb_actions.create, - ["r"] = fb_actions.rename, - ["m"] = fb_actions.move, - ["y"] = fb_actions.copy, - ["d"] = fb_actions.remove, - ["o"] = fb_actions.open, - ["g"] = fb_actions.goto_parent_dir, - ["e"] = fb_actions.goto_home_dir, - ["w"] = fb_actions.goto_cwd, - ["t"] = fb_actions.change_cwd, - ["f"] = fb_actions.toggle_browser, - ["h"] = fb_actions.toggle_hidden, - ["s"] = fb_actions.toggle_all, - } - } + }, + extensions = { + fzf = { + fuzzy = true, -- allow fuzzy matches + override_generic_sorter = true, + override_file_sorter = true, + case_mode = 'smart_case' + }, + file_browser = { + theme = require('telescope.themes').get_ivy().theme, + hiject_netrw = true, -- disables netrw and use file-browser instead + mappings = { + ["i"] = {}, -- disable any shortcut in insert mode for now + ["n"] = { + ["c"] = fb_actions.create, + ["r"] = fb_actions.rename, + ["m"] = fb_actions.move, + ["y"] = fb_actions.copy, + ["d"] = fb_actions.remove, + ["o"] = fb_actions.open, + ["g"] = fb_actions.goto_parent_dir, + ["e"] = fb_actions.goto_home_dir, + ["w"] = fb_actions.goto_cwd, + ["t"] = fb_actions.change_cwd, + ["f"] = fb_actions.toggle_browser, + ["h"] = fb_actions.toggle_hidden, + ["s"] = fb_actions.toggle_all, } + } } + } } -- Telescope key remap stuffs @@ -327,62 +338,62 @@ pcall(require('telescope').load_extension, 'file_browser') remap('n', '', 'Telescope', { desc = 'Open Telescope general search' }) remap('n', 'fm', function() - require("telescope").extensions.file_browser.file_browser({}) + require("telescope").extensions.file_browser.file_browser({}) end, { desc = '[F]ile [M]utation' }) remap('n', 'ff', function() - require('telescope.builtin').find_files({ - hidden = false, - no_ignore = false, - follow = false, - }) + require('telescope.builtin').find_files({ + hidden = false, + no_ignore = false, + follow = false, + }) end, { desc = '[F]ind [F]ile' }) remap('n', 'fa', function() - require('telescope.builtin').find_files({ - hidden = true, - no_ignore = true, - follow = true, - }) + require('telescope.builtin').find_files({ + hidden = true, + no_ignore = true, + follow = true, + }) end, { desc = '[F]ind [A]ll files' }) remap('n', 'fg', function() - require('telescope.builtin').live_grep() + require('telescope.builtin').live_grep() end, { desc = '[F]ind by [G]rep' }) remap('n', 'fug', function() - -- This relies on many factors: We use `rg` and that `-g '**/*'` effectively - -- drops ignore rules like the default `.gitignore` rule. - require('telescope.builtin').live_grep({ glob_pattern = '**/*' }) + -- This relies on many factors: We use `rg` and that `-g '**/*'` effectively + -- drops ignore rules like the default `.gitignore` rule. + require('telescope.builtin').live_grep({ glob_pattern = '**/*' }) end, { desc = '[F]ind by [u]nrestricted [G]rep' }) remap('n', 'fb', function() - require('telescope.builtin').buffers() + require('telescope.builtin').buffers() end, { desc = '[F]ind existing [B]uffers' }) remap('n', 'fh', function() - require('telescope.builtin').help_tags() + require('telescope.builtin').help_tags() end, { desc = '[F]ind [H]elp' }) remap('n', 'fd', function() - require('telescope.builtin').diagnostics() + require('telescope.builtin').diagnostics() end, { desc = '[F]ind [D]iagnostics' }) -- ZK remap stuffs remap('n', 'zf', function() - -- vim.cmd([[:ZkNotes]]) - require('zk').edit({}, { multi_select = false }) + -- vim.cmd([[:ZkNotes]]) + require('zk').edit({}, { multi_select = false }) end, { desc = '[Z]ettelkasten [F]iles' }) remap('n', 'zg', function() - vim.cmd(":ZkGrep") + vim.cmd(":ZkGrep") end, { desc = '[Z]ettelkasten [G]rep' }) -- tab management {{{ -- Jump to specific tab with [number] for i = 1, 9 do - vim.api.nvim_set_keymap('n', '' .. i, ':tabn ' .. i .. '', { noremap = true, silent = true }) + vim.api.nvim_set_keymap('n', '' .. i, ':tabn ' .. i .. '', { noremap = true, silent = true }) end -- Show tab number in tab display @@ -390,81 +401,81 @@ vim.o.showtabline = 1 vim.o.tabline = '%!v:lua.my_tabline()' function _G.my_tabline() - local s = '' - for i = 1, vim.fn.tabpagenr('$') do - if i == vim.fn.tabpagenr() then - s = s .. '%' .. i .. 'T%#TabLineSel#' - else - s = s .. '%' .. i .. 'T%#TabLine#' - end - local tab = vim.fn.gettabinfo(i)[1] - local tabbuf = tab.variables.buffers - local bufname = "" - if tabbuf then - bufname = tabbuf[tab.curwin].name - end - -- Canonicalize tab/buf name - s = s .. ' ' .. i .. ' ' .. vim.fn.fnamemodify(bufname, ':t') - if i ~= vim.fn.tabpagenr('$') then - s = s .. '%#TabLine#|%#TabLine#' - end + local s = '' + for i = 1, vim.fn.tabpagenr('$') do + if i == vim.fn.tabpagenr() then + s = s .. '%' .. i .. 'T%#TabLineSel#' + else + s = s .. '%' .. i .. 'T%#TabLine#' end - return s .. '%T%#TabLineFill#%=' + local tab = vim.fn.gettabinfo(i)[1] + local tabbuf = tab.variables.buffers + local bufname = "" + if tabbuf then + bufname = tabbuf[tab.curwin].name + end + -- Canonicalize tab/buf name + s = s .. ' ' .. i .. ' ' .. vim.fn.fnamemodify(bufname, ':t') + if i ~= vim.fn.tabpagenr('$') then + s = s .. '%#TabLine#|%#TabLine#' + end + end + return s .. '%T%#TabLineFill#%=' end -- Close all tabs except the first one vim.api.nvim_set_keymap('n', 'x', ':tabdo if tabpagenr() > 1 | tabclose | endif', - { noremap = true, silent = true }) + { noremap = true, silent = true }) -- }}} -- treesitter require 'treesitter-context' require('nvim-treesitter.configs').setup { - yati = { - enable = true, - default_lazy = true, - default_fallback = "auto", - disable = { "nix" } + yati = { + enable = true, + default_lazy = true, + default_fallback = "auto", + disable = { "nix" } + }, + indent = { enable = false }, + highlight = { + enable = true, + enable_vim_regex_highlighting = true, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + node_decremental = '', + scope_incremental = '' }, - indent = { enable = false }, - highlight = { - enable = true, - enable_vim_regex_highlighting = true, - }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = '', - node_incremental = '', - node_decremental = '', - pscope_incremental = '' - }, - }, - textobjects = { - select = { - enable = true, - lookahead = true, - keymaps = { - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', - }, - }, - }, - playground = { - enable = true, - disable = {} - }, - -- automatically close and modify HTML and TSX tags - autotag = { - enable = true, + }, + textobjects = { + select = { + enable = true, + lookahead = true, + keymaps = { + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, }, + }, + playground = { + enable = true, + disable = {} + }, + -- automatically close and modify HTML and TSX tags + autotag = { + enable = true, + }, } require('nvim-autopairs').setup { - check_ts = true, + check_ts = true, } local parser_config = require('nvim-treesitter.parsers').get_parser_configs() @@ -473,29 +484,29 @@ parser_config.astro.filetype_to_parsername = { "javascript", "typescript.tsx", " require('guess-indent').setup { - auto_cmd = true, - filetype_exclude = { -- A list of filetypes for which the auto command gets disabled - "netrw", - "tutor", - }, + auto_cmd = true, + filetype_exclude = { -- A list of filetypes for which the auto command gets disabled + "netrw", + "tutor", + }, - -- buftype_exclude = { -- A list of buffer types for which the auto command gets disabled - -- "help", - -- "nofile", - -- "terminal", - -- -- "prompt", - -- }, + -- buftype_exclude = { -- A list of buffer types for which the auto command gets disabled + -- "help", + -- "nofile", + -- "terminal", + -- -- "prompt", + -- }, } -- harpoon: O(1) buffer/terminal switching remap('n', 'm', function() require('harpoon.mark').add_file() end, { desc = "[H]arpoon [M]ark" }) local function harpoon_nav(key, nav_file_index, lead_keybind) - lead_keybind = lead_keybind or 'h' - assert(type(key) == "string", "expect key to be string(keybind)") - assert(type(nav_file_index) == "number" and nav_file_index >= 1, "expect 1-indexed number for file index") - return remap('n', lead_keybind .. key, - function() require('harpoon.ui').nav_file(nav_file_index) end, - { desc = "[H]arpoon navigate " .. tostring(nav_file_index) }) + lead_keybind = lead_keybind or 'h' + assert(type(key) == "string", "expect key to be string(keybind)") + assert(type(nav_file_index) == "number" and nav_file_index >= 1, "expect 1-indexed number for file index") + return remap('n', lead_keybind .. key, + function() require('harpoon.ui').nav_file(nav_file_index) end, + { desc = "[H]arpoon navigate " .. tostring(nav_file_index) }) end -- remap letters to index. Inspired by alternating number of Dvorak programmer @@ -506,12 +517,12 @@ harpoon_nav('d', 3) harpoon_nav('k', 4) remap('n', 'hh', function() require('harpoon.ui').toggle_quick_menu() end) for i = 1, 10 do - -- harpoon: navigate files by numbers - harpoon_nav(tostring(i % 10), i) - -- harpoon: navigate terms by numbers - remap('n', 't' .. tostring(i % 10), function() - require('harpoon.term').gotoTerminal(i) - end) + -- harpoon: navigate files by numbers + harpoon_nav(tostring(i % 10), i) + -- harpoon: navigate terms by numbers + remap('n', 't' .. tostring(i % 10), function() + require('harpoon.term').gotoTerminal(i) + end) end -- neogit: easy-to-see git status. Provides only productivity on staging/unstage @@ -521,518 +532,620 @@ remap('n', 'gs', function() require('neogit').open({}) end, { desc = "[G -- LSP settings -- This function gets run when an LSP connects to a particular buffer. require("inlay-hints").setup { - only_current_line = false, - eol = { - right_align = false, - } -} -local on_attach = function(client, bufnr) - local nmap = function(keys, func, desc) - if desc then - desc = 'LSP: ' .. desc - end + -- renderer to use + -- possible options are dynamic, eol, virtline and custom + -- renderer = "inlay-hints/render/dynamic", + renderer = "inlay-hints/render/dynamic", - vim.keymap.set('n', keys, func, { noremap = true, buffer = bufnr, desc = desc }) + hints = { + parameter = { + show = true, + highlight = "whitespace", + }, + type = { + show = true, + highlight = "Whitespace", + }, + }, + + -- Only show inlay hints for the current line + only_current_line = false, + + eol = { + -- whether to align to the extreme right or not + right_align = false, + + -- padding from the right if right_align is true + right_align_padding = 7, + + parameter = { + separator = ", ", + format = function(hints) + return string.format(" <- (%s)", hints) + end, + }, + + type = { + separator = ", ", + format = function(hints) + return string.format(" => %s", hints) + end, + }, + }, +} + + +local on_attach = function(client, bufnr) + local nmap = function(keys, func, desc) + if desc then + desc = 'LSP: ' .. desc end - nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') - nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') - -- NOTE: I have no clue what this does again - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - nmap('df', function() vim.lsp.buf.format({ async = true }) end, '[D]ocument [F]ormat') + vim.keymap.set('n', keys, func, { noremap = true, buffer = bufnr, desc = desc }) + end - -- symbols and gotos - nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') - nmap('gi', vim.lsp.buf.implementation, '[G]oto [I]mplementation') - nmap('gr', require('telescope.builtin').lsp_references) - nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') - nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') + nmap('rn', vim.lsp.buf.rename, '[R]e[n]ame') + nmap('ca', vim.lsp.buf.code_action, '[C]ode [A]ction') + -- NOTE: I have no clue what this does again + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + nmap('df', function() vim.lsp.buf.format({ async = true }) end, '[D]ocument [F]ormat') - -- documentations & helps - -- NOTE: When you press K, it shows in-line Documentation - -- This is to stay faithful with vim's default keybind for help. - -- See `:help K` for even more info on Vim's original keybindings for help - nmap('K', vim.lsp.buf.hover, 'Hover Documentation') - nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') + -- symbols and gotos + nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') + nmap('gi', vim.lsp.buf.implementation, '[G]oto [I]mplementation') + nmap('gr', require('telescope.builtin').lsp_references) + nmap('ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') + nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') - -- Less likely LSP functionality to be used - nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - nmap('gtd', vim.lsp.buf.type_definition, '[G]oto [T]ype [D]efinition') - nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') - -- - -- Very rarely used - nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') - nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') - nmap('wl', function() - print(vim.inspect(vim.lsp.buf.list_workspace_folders())) - end, '[W]orkspace [L]ist Folders') + -- documentations & helps + -- NOTE: When you press K, it shows in-line Documentation + -- This is to stay faithful with vim's default keybind for help. + -- See `:help K` for even more info on Vim's original keybindings for help + nmap('K', vim.lsp.buf.hover, 'Hover Documentation') + -- nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') - -- enable inlay hints if available - require('inlay-hints').on_attach(client, bufnr) + -- Less likely LSP functionality to be used + nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') + nmap('gtd', vim.lsp.buf.type_definition, '[G]oto [T]ype [D]efinition') + nmap('D', vim.lsp.buf.type_definition, 'Type [D]efinition') + -- + -- Very rarely used + nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') + nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') + nmap('wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, '[W]orkspace [L]ist Folders') + + -- enable inlay hints if available + require('inlay-hints').on_attach(client, bufnr) end -- nvim-cmp + local cmp = require 'cmp' local luasnip = require 'luasnip' local lspkind = require('lspkind') -local source_mapping = { - buffer = '[Buffer]', - nvim_lsp = '[LSP]', - nvim_lua = '[Lua]', - -- cmp_tabnine = '[T9]', - path = '[Path]', -} + +lspkind.init { + symbol_map = { + Copilot = "", + }, +} cmp.event:on( - "confirm_done", - require('nvim-autopairs.completion.cmp').on_confirm_done() + "confirm_done", + require('nvim-autopairs.completion.cmp').on_confirm_done() ) -cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, +---@type cmp.ConfigSchema +local cmp_config = { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert { + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, }, - mapping = cmp.mapping.preset.insert { - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() + -- NOTE: rebind tab and shift-tab since it may break whenever we + -- need to peform manual indentation + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + + }, + performance = { + debounce = 60, + throttle = 30, + }, + formatting = { + fields = { 'abbr', 'kind', 'menu' }, + -- vim_items: complete-items (`:h complete-items`) + -- word, abbr, menu, info, kind, icase, equal, dup, empty, user_data + format = function(entry, vim_item) + local kind_fn = lspkind.cmp_format { + with_text = true, + menu = { + buffer = "[buf]", + nvim_lsp = "[LSP]", + nvim_lua = "[api]", + path = "[path]", + luasnip = "[snip]", + gh_issues = "[issues]", + tn = "[TabNine]", + eruby = "[erb]", + nvim_lsp_signature_help = "[sig]", + } + } + vim_item = kind_fn(entry, vim_item) + return require('tailwindcss-colorizer-cmp').formatter(entry, vim_item) + end, + }, + sources = cmp.config.sources( --[[@as cmp.SourceConfig[]] { + { name = 'nvim_lsp', }, + { name = 'nvim_lsp_signature_help' }, + -- NOTE: Path is triggered by `.` and `/`, so when it comes up, it's + -- usually desirable. + { name = 'path' }, + { name = 'luasnip' }, + { + name = 'buffer', + option = { + -- default is only in the current buffer. This grabs recommendations + -- from all visible buffers + get_bufnrs = function() + -- Must always have current buffer + local bufs = { [0] = true } + for _, buf in ipairs(vim.api.nvim_list_bufs()) do + local byte_size = vim.api.nvim_buf_get_offset(buf, vim.api.nvim_buf_line_count(buf)) + if byte_size <= 1024 * 1024 then -- 1 MiB max + bufs[buf] = true end - end, { 'i', 's' }), - [''] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { 'i', 's' }), - }, - formatting = { - format = function(entry, vim_item) - vim_item.kind = lspkind.symbolic(vim_item.kind, { mode = 'symbol' }) - vim_item.menu = source_mapping[entry.source_name] - -- if entry.source.name == "cmp_tabnine" then - -- local detail = (entry.completion_item.data or {}).detail - -- vim_item.kind = "" - -- if detail and detail:find('.*%%.*') then - -- vim_item.kind = vim_item.kind .. ' ' .. detail - -- end - -- - -- if (entry.completion_item.data or {}).multiline then - -- vim_item.kind = vim_item.kind .. ' ' .. '[ML]' - -- end - -- end - local maxwidth = 80 - vim_item.abbr = string.sub(vim_item.abbr, 1, maxwidth) - return vim_item + end + return vim.tbl_keys(bufs) end, + }, }, - sources = cmp.config.sources { - { name = 'nvim_lsp' }, - { name = 'luasnip' }, - { - name = 'buffer', - option = { - -- default is only in the current buffer. This grabs recommendations - -- from all visible buffers - get_bufnrs = function() - local bufs = {} - for _, win in ipairs(vim.api.nvim_list_wins()) do - local buf = vim.api.nvim_win_get_buf(win) - local byte_size = vim.api.nvim_buf_get_offset(buf, vim.api.nvim_buf_line_count(buf)) - if byte_size <= 1024 * 1024 then -- 1 MiB max - bufs[buf] = true - end - end - return vim.tbl_keys(bufs) - end, - } - }, - { name = 'path' }, - -- { name = "conjure" }, - -- { name = 'cmp_tabnine' }, - }, - sorting = { - comparators = { - -- Optimize searches by recommending things that are closer to the current cursor - function(...) require('cmp-buffer'):compare_locality(...) end, - } + -- NOTE: I don't like cmdline that much. Most of the time, it recommends more harm than good + -- { name = 'cmp_tabnine' }, + -- { name = "conjure" }, + }), + experimental = { ghost_text = { hl_group = "Comment" }, }, + sorting = { + comparators = { + ---@param lhs_entry cmp.Entry + ---@param rhs_entry cmp.Entry + function(lhs_entry, rhs_entry) + return nil + end, + cmp.config.compare.exact, + cmp.config.compare.recently_used, + cmp.config.compare.offset, + cmp.config.compare.score, + cmp.config.compare.kind, + cmp.config.compare.locality, + cmp.config.compare.sort_text, + cmp.config.compare.scope, }, + }, } + + +cmp.setup(vim.tbl_deep_extend("force", require('cmp.config.default')(), cmp_config)) + +-- `/` cmdline search. +cmp.setup.cmdline('/', { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } +}) +-- `:` cmdline vim command. +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { + name = 'cmdline', + option = { + ignore_cmds = { 'Man', '!' } + } + } + }) +}) + -- nvim-cmp supports additional completion capabilities local capabilities = require('cmp_nvim_lsp').default_capabilities() -- local tabnine = require('cmp_tabnine.config') -- tabnine.setup({ --- max_lines = 1000, --- max_num_results = 20, --- sort = true, --- run_on_every_keystroke = true, --- snippet_placeholder = '..', --- ignored_file_types = {}, --- show_prediction_strength = true, +-- max_lines = 1000, +-- max_num_results = 20, +-- sort = true, +-- run_on_every_keystroke = true, +-- snippet_placeholder = '..', +-- ignored_file_types = {}, +-- show_prediction_strength = true, -- }) -- default language servers local servers = { - 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'lua_ls', 'cmake', 'tailwindcss', 'prismals', - 'rnix', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels", - "jsonls", "denols", "gopls", "nickel_ls", 'pylsp', + 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'lua_ls', 'cmake', 'tailwindcss', 'prismals', + 'rnix', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels", + "jsonls", "denols", "gopls", "nickel_ls", 'pylsp', } require("mason").setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗" - }, - check_outdated_packages_on_open = true, + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗" }, - -- NOTE: The default settings is "prepend" https://github.com/williamboman/mason.nvim#default-configuration - -- Which means Mason's installed path is prioritized against our local install - -- see: https://git.pegasust.com/pegasust/aoc/commit/b45dc32c74d84c9f787ebce7a174c9aa1d411fc2 - -- This introduces some pitfalls, so we'll take the approach of trusting user's local installation - PATH = "append", + check_outdated_packages_on_open = true, + }, + -- NOTE: The default settings is "prepend" https://github.com/williamboman/mason.nvim#default-configuration + -- Which means Mason's installed path is prioritized against our local install + -- see: https://git.pegasust.com/pegasust/aoc/commit/b45dc32c74d84c9f787ebce7a174c9aa1d411fc2 + -- This introduces some pitfalls, so we'll take the approach of trusting user's local installation + PATH = "append", }) require('mason-lspconfig').setup({ - -- ensure_installed = servers, - automatic_installation = false + -- ensure_installed = servers, + ensure_installed = { "pylsp", "pyright", "tailwindcss", "svelte", "astro", "lua_ls" }, + automatic_installation = false, }) local inlay_hint_tsjs = { - includeInlayEnumMemberValueHints = true, - includeInlayFunctionLikeReturnTypeHints = true, - includeInlayFunctionParameterTypeHints = true, - includeInlayParameterNameHints = 'all', -- "none" | "literals" | "all" - inlcudeInlayParameterNameHintsWhenArgumentMatchesName = false, - includeInlayPropertyDeclarationTypeHints = true, - includeInlayVariableTypeHints = true, + includeInlayEnumMemberValueHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayFunctionParameterTypeHints = true, + includeInlayParameterNameHints = 'all', -- "none" | "literals" | "all" + inlcudeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayVariableTypeHints = true, }; require('mason-lspconfig').setup_handlers({ - -- default handler - function(server_name) - require('lspconfig')[server_name].setup { - on_attach = on_attach, - capabilities = capabilities, - } - end, - ["lua_ls"] = function() - require('lspconfig').lua_ls.setup { - on_attach = on_attach, - capabilities = capabilities, - settings = { - Lua = { - runtime = { - version = "LuaJIT", - path = vim.split(package.path, ";"), - }, - diagnostics = { - globals = { "vim" } - }, - workspace = { - library = vim.api.nvim_get_runtime_file('', true) - }, - telemetry = { enable = false }, - hint = { - enable = true, - }, - format = { - enable = true, - defaultConfig = { - indent_style = "space", - indent_size = 4, - } - } - } + -- default handler + function(server_name) + require('lspconfig')[server_name].setup { + on_attach = on_attach, + capabilities = capabilities, + } + end, + ["lua_ls"] = function() + require('lspconfig').lua_ls.setup { + on_attach = on_attach, + capabilities = capabilities, + settings = { + Lua = { + runtime = { + version = "LuaJIT", + path = vim.split(package.path, ";"), + }, + diagnostics = { + globals = { "vim" } + }, + workspace = { + library = vim.api.nvim_get_runtime_file('', true), + -- Don't prompt me to select + checkThirdParty = false, + }, + telemetry = { enable = false }, + hint = { + enable = true, + }, + format = { + enable = true, + defaultConfig = { + indent_style = "space", + indent_size = 4, } + } } - end, - ["pyright"] = function() - require('lspconfig').pyright.setup { - on_attach = on_attach, - capabilities = capabilities, - settings = { - pyright = { - disableLanguageServices = false, - disableOrganizeImports = false, - }, - python = { - analysis = { - autoImportCompletions = true, - autoSearchPaths = true, - diagnosticMode = "openFilesOnly", - -- diagnosticSeverityOverrides = - extraPaths = {}, - logLevel = "Information", - stubPath = "typings", - typeCheckingMode = "basic", - typeshedPaths = {}, - useLibraryCodeForTypes = false, - pythonPath = "python", - venvPath = "", - }, - linting = { - mypyEnabled = true, - } - }, - }, + } + } + end, + ["pyright"] = function() + require('lspconfig').pyright.setup { + on_attach = on_attach, + capabilities = capabilities, + settings = { + pyright = { + disableLanguageServices = false, + disableOrganizeImports = false, + }, + python = { + analysis = { + autoImportCompletions = true, + autoSearchPaths = true, + diagnosticMode = "openFilesOnly", + -- diagnosticSeverityOverrides = + extraPaths = {}, + logLevel = "Information", + stubPath = "typings", + typeCheckingMode = "basic", + typeshedPaths = {}, + useLibraryCodeForTypes = false, + pythonPath = "python", + venvPath = "", + }, + linting = { + mypyEnabled = true, + } + }, + }, + } + end, + ["tsserver"] = function() + require('lspconfig').tsserver.setup { + on_attach = on_attach, + capabilities = capabilities, + -- TODO: Have to figure out an alternative config for monorepo to prevent + -- Deno from injecting TS projects. + -- Monorepo support: spawn one instance of lsp within the git + -- repos. + -- root_dir = require('lspconfig.util').root_pattern('.git'), + root_dir = require('lspconfig.util').root_pattern('package.json'), + settings = { + javascript = inlay_hint_tsjs, + typescript = inlay_hint_tsjs, + } + } + end, + ["denols"] = function() + require('lspconfig').denols.setup { + on_attach = on_attach, + capabilities = capabilities, + root_dir = require('lspconfig.util').root_pattern("deno.json", "deno.jsonc"), + } + end, + ["yamlls"] = function() + require('lspconfig').yamlls.setup { + on_attach = on_attach, + capabilities = capabilities, + settings = { + yaml = { + keyOrdering = false, } - end, - ["tsserver"] = function() - require('lspconfig').tsserver.setup { - on_attach = on_attach, - capabilities = capabilities, - -- TODO: Have to figure out an alternative config for monorepo to prevent - -- Deno from injecting TS projects. - -- Monorepo support: spawn one instance of lsp within the git - -- repos. - -- root_dir = require('lspconfig.util').root_pattern('.git'), - root_dir = require('lspconfig.util').root_pattern('package.json'), - settings = { - javascript = inlay_hint_tsjs, - typescript = inlay_hint_tsjs, - } - } - end, - ["denols"] = function() - require('lspconfig').denols.setup { - on_attach = on_attach, - capabilities = capabilities, - root_dir = require('lspconfig.util').root_pattern("deno.json", "deno.jsonc"), - } - end, - ["yamlls"] = function() - require('lspconfig').yamlls.setup { - on_attach = on_attach, - capabilities = capabilities, - settings = { - yaml = { - keyOrdering = false, - } - }, - } - end, + }, + } + end, }) require("rust-tools").setup { - tools = { - -- rust-tools options + tools = { + -- rust-tools options - -- how to execute terminal commands - -- options right now: termopen / quickfix - executor = require("rust-tools/executors").termopen, - -- callback to execute once rust-analyzer is done initializing the workspace - -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" - on_initialized = function() - require('inlay-hints').set_all() - end, - -- automatically call RustReloadWorkspace when writing to a Cargo.toml file. - reload_workspace_from_cargo_toml = true, - -- These apply to the default RustSetInlayHints command - inlay_hints = { - -- automatically set inlay hints (type hints) - -- default: true - auto = false, - -- Only show inlay hints for the current line - only_current_line = true, - -- whether to show parameter hints with the inlay hints or not - -- default: true - show_parameter_hints = true, - -- prefix for parameter hints - -- default: "<-" - parameter_hints_prefix = "<- ", - -- prefix for all the other hints (type, chaining) - -- default: "=>" - other_hints_prefix = "=> ", - -- whether to align to the length of the longest line in the file - max_len_align = false, - -- padding from the left if max_len_align is true - max_len_align_padding = 1, - -- whether to align to the extreme right or not - right_align = false, - -- padding from the right if right_align is true - right_align_padding = 7, - -- The color of the hints use `:highlight` for a pick-and-choose menu - highlight = "NonText", - }, - -- options same as lsp hover / vim.lsp.util.open_floating_preview() - hover_actions = { - -- the border that is used for the hover window - -- see vim.api.nvim_open_win() - border = { - { "╭", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╮", "FloatBorder" }, - { "│", "FloatBorder" }, - { "╯", "FloatBorder" }, - { "─", "FloatBorder" }, - { "╰", "FloatBorder" }, - { "│", "FloatBorder" }, - }, - -- whether the hover action window gets automatically focused - -- default: false - auto_focus = false, - }, - -- settings for showing the crate graph based on graphviz and the dot - -- command - crate_graph = { - -- Backend used for displaying the graph - -- see: https://graphviz.org/docs/outputs/ - -- default: x11 - backend = "x11", - -- where to store the output, nil for no output stored (relative - -- path from pwd) - -- default: nil - output = nil, - -- true for all crates.io and external crates, false only the local - -- crates - -- default: true - full = true, - -- List of backends found on: https://graphviz.org/docs/outputs/ - -- Is used for input validation and autocompletion - -- Last updated: 2021-08-26 - enabled_graphviz_backends = { - "bmp", - "cgimage", - "canon", - "dot", - "gv", - "xdot", - "xdot1.2", - "xdot1.4", - "eps", - "exr", - "fig", - "gd", - "gd2", - "gif", - "gtk", - "ico", - "cmap", - "ismap", - "imap", - "cmapx", - "imap_np", - "cmapx_np", - "jpg", - "jpeg", - "jpe", - "jp2", - "json", - "json0", - "dot_json", - "xdot_json", - "pdf", - "pic", - "pct", - "pict", - "plain", - "plain-ext", - "png", - "pov", - "ps", - "ps2", - "psd", - "sgi", - "svg", - "svgz", - "tga", - "tiff", - "tif", - "tk", - "vml", - "vmlz", - "wbmp", - "webp", - "xlib", - "x11", - }, - }, + -- how to execute terminal commands + -- options right now: termopen / quickfix + executor = require("rust-tools/executors").termopen, + -- callback to execute once rust-analyzer is done initializing the workspace + -- The callback receives one parameter indicating the `health` of the server: "ok" | "warning" | "error" + on_initialized = function() + require('inlay-hints').set_all() + end, + -- automatically call RustReloadWorkspace when writing to a Cargo.toml file. + reload_workspace_from_cargo_toml = true, + -- These apply to the default RustSetInlayHints command + inlay_hints = { + -- automatically set inlay hints (type hints) + -- default: true + auto = false, + -- Only show inlay hints for the current line + only_current_line = true, + -- whether to show parameter hints with the inlay hints or not + -- default: true + show_parameter_hints = true, + -- prefix for parameter hints + -- default: "<-" + parameter_hints_prefix = "<- ", + -- prefix for all the other hints (type, chaining) + -- default: "=>" + other_hints_prefix = "=> ", + -- whether to align to the length of the longest line in the file + max_len_align = false, + -- padding from the left if max_len_align is true + max_len_align_padding = 1, + -- whether to align to the extreme right or not + right_align = false, + -- padding from the right if right_align is true + right_align_padding = 7, + -- The color of the hints use `:highlight` for a pick-and-choose menu + highlight = "NonText", }, - - -- all the opts to send to nvim-lspconfig - -- these override the defaults set by rust-tools.nvim - -- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer - server = { - -- standalone file support - -- setting it to false may improve startup time - standalone = true, - on_attach = function(client, bufnr) - local nmap = function(keys, func, desc) - if desc then - desc = 'LSP: ' .. desc - end - - vim.keymap.set('n', keys, func, { noremap = true, buffer = bufnr, desc = desc }) - end - on_attach(client, bufnr) - nmap('K', require 'rust-tools'.hover_actions.hover_actions, 'Hover Documentation') - end, - capabilities = capabilities, - cmd = { "rust-analyzer" }, - settings = { - ["rust-analyzer"] = { - -- enable clippy on save - checkOnSave = { - command = "clippy", - extraArgs = { "--all", "--", "-W", "clippy::all" }, - }, - rustfmt = { - extraArgs = { "+nightly" }, - }, - cargo = { - loadOutDirsFromCheck = true, - }, - procMacro = { - enable = true, - }, - }, - }, - }, -- rust-analyzer options - - -- debugging stuff - dap = { - adapter = { - type = "executable", - command = "lldb-vscode", - name = "rt_lldb", - }, + -- options same as lsp hover / vim.lsp.util.open_floating_preview() + hover_actions = { + -- the border that is used for the hover window + -- see vim.api.nvim_open_win() + border = { + { "╭", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╮", "FloatBorder" }, + { "│", "FloatBorder" }, + { "╯", "FloatBorder" }, + { "─", "FloatBorder" }, + { "╰", "FloatBorder" }, + { "│", "FloatBorder" }, + }, + -- whether the hover action window gets automatically focused + -- default: false + auto_focus = false, }, + -- settings for showing the crate graph based on graphviz and the dot + -- command + crate_graph = { + -- Backend used for displaying the graph + -- see: https://graphviz.org/docs/outputs/ + -- default: x11 + backend = "x11", + -- where to store the output, nil for no output stored (relative + -- path from pwd) + -- default: nil + output = nil, + -- true for all crates.io and external crates, false only the local + -- crates + -- default: true + full = true, + -- List of backends found on: https://graphviz.org/docs/outputs/ + -- Is used for input validation and autocompletion + -- Last updated: 2021-08-26 + enabled_graphviz_backends = { + "bmp", + "cgimage", + "canon", + "dot", + "gv", + "xdot", + "xdot1.2", + "xdot1.4", + "eps", + "exr", + "fig", + "gd", + "gd2", + "gif", + "gtk", + "ico", + "cmap", + "ismap", + "imap", + "cmapx", + "imap_np", + "cmapx_np", + "jpg", + "jpeg", + "jpe", + "jp2", + "json", + "json0", + "dot_json", + "xdot_json", + "pdf", + "pic", + "pct", + "pict", + "plain", + "plain-ext", + "png", + "pov", + "ps", + "ps2", + "psd", + "sgi", + "svg", + "svgz", + "tga", + "tiff", + "tif", + "tk", + "vml", + "vmlz", + "wbmp", + "webp", + "xlib", + "x11", + }, + }, + }, + + -- all the opts to send to nvim-lspconfig + -- these override the defaults set by rust-tools.nvim + -- see https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#rust_analyzer + server = { + -- standalone file support + -- setting it to false may improve startup time + standalone = true, + on_attach = function(client, bufnr) + local nmap = function(keys, func, desc) + if desc then + desc = 'LSP: ' .. desc + end + + vim.keymap.set('n', keys, func, { noremap = true, buffer = bufnr, desc = desc }) + end + on_attach(client, bufnr) + nmap('K', require 'rust-tools'.hover_actions.hover_actions, 'Hover Documentation') + end, + capabilities = capabilities, + cmd = { "rust-analyzer" }, + settings = { + ["rust-analyzer"] = { + -- enable clippy on save + checkOnSave = { + command = "clippy", + extraArgs = { "--all", "--", "-W", "clippy::all" }, + }, + rustfmt = { + extraArgs = { "+nightly" }, + }, + cargo = { + loadOutDirsFromCheck = true, + }, + procMacro = { + enable = true, + }, + }, + }, + }, -- rust-analyzer options + + -- debugging stuff + dap = { + adapter = { + type = "executable", + command = "lldb-vscode", + name = "rt_lldb", + }, + }, } require('zk').setup({ - picker = "telescope", - lsp = { - config = { - cmd = { "zk", "lsp" }, - name = "zk", - on_attach = on_attach, - }, - auto_attach = { - enable = true, - filetypes = { "markdown" } - }, + picker = "telescope", + lsp = { + config = { + cmd = { "zk", "lsp" }, + name = "zk", + on_attach = on_attach, }, + auto_attach = { + enable = true, + filetypes = { "markdown" } + }, + }, }) -- Custom ZkOrphans that determines unlinked notes -- `:ZkOrphans {tags = {"work"}}` require('zk.commands').add("ZkOrphans", function(options) - options = vim.tbl_extend("force", { orphan = true }, options or {}) - -- zk.edit opens notes picker - require('zk').edit(options, { title = "Zk Orphans (unlinked notes)" }) + options = vim.tbl_extend("force", { orphan = true }, options or {}) + -- zk.edit opens notes picker + require('zk').edit(options, { title = "Zk Orphans (unlinked notes)" }) end) -- -- ZkGrep: opens file picker @@ -1041,116 +1154,177 @@ end) -- Params: -- match_ctor: string | {match= :string,...} | "" | nil require('zk.commands').add("ZkGrep", function(match_ctor) - -- handle polymorphic `match_ctor` - local grep_str = match_ctor - local match - if match_ctor == nil or match_ctor == '' then - vim.fn.inputsave() - grep_str = vim.fn.input('Grep string: >') - vim.fn.inputrestore() - match = { match = grep_str } - elseif type(match_ctor) == 'string' then - match = { match = grep_str } - end - require('zk').edit(match, { title = "Grep: '" .. grep_str .. "'", mutli_select = false }) + -- handle polymorphic `match_ctor` + local grep_str = match_ctor + local match + if match_ctor == nil or match_ctor == '' then + vim.fn.inputsave() + grep_str = vim.fn.input('Grep string: >') + vim.fn.inputrestore() + match = { match = grep_str } + elseif type(match_ctor) == 'string' then + match = { match = grep_str } + end + require('zk').edit(match, { title = "Grep: '" .. grep_str .. "'", mutli_select = false }) end) -- Gitsigns require('gitsigns').setup { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - } + signs = { + add = { text = '+' }, + change = { text = '~' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + } } require('lualine').setup { - options = { - icons_enabled = true, - }, - sections = { - lualine_a = { 'mode' }, - lualine_b = { 'branch', 'diff', 'diagnostics' }, - lualine_c = { - { - 'filename', - file_status = true, - newfile_status = false, - path = 1, - symbols = { - modified = '[+]', - readonly = '[-]', - unnamed = '[Unnamed]', - newfile = '[New]', - }, - }, + options = { + icons_enabled = true, + }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { + { + 'filename', + file_status = true, + newfile_status = false, + path = 1, + symbols = { + modified = '[+]', + readonly = '[-]', + unnamed = '[Unnamed]', + newfile = '[New]', }, - lualine_x = { 'encoding', 'fileformat', 'filetype', }, - lualine_y = { 'progress' }, - lualine_z = { 'location' }, + }, }, - inactive_sections = { - lualine_a = {}, - lualine_b = {}, - lualine_c = { { 'filename', path = 1, file_status = true, }, }, - lualine_x = { 'location' }, - lualine_y = {}, - lualine_z = {}, - } + lualine_x = { 'encoding', 'fileformat', 'filetype', }, + lualine_y = { 'progress' }, + lualine_z = { 'location' }, + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = { { 'filename', path = 1, file_status = true, }, }, + lualine_x = { 'location' }, + lualine_y = {}, + lualine_z = {}, + } } require('nvim-surround').setup {} -require('tsql').setup() require('fidget').setup({ - text = { - spinner = "moon", -- animation shown when tasks are ongoing - done = "✔", -- character shown when all tasks are complete - commenced = "Started", -- message shown when task starts - completed = "Completed", -- message shown when task completes - }, - align = { - bottom = true, -- align fidgets along bottom edge of buffer - right = true, -- align fidgets along right edge of buffer - }, - timer = { - spinner_rate = 125, -- frame rate of spinner animation, in ms - fidget_decay = 2000, -- how long to keep around empty fidget, in ms - task_decay = 1000, -- how long to keep around completed task, in ms - }, - window = { - relative = "editor", -- where to anchor, either "win" or "editor" - blend = 100, -- &winblend for the window - zindex = nil, -- the zindex value for the window - border = "none", -- style of border for the fidget window - }, - fmt = { - leftpad = true, -- right-justify text in fidget box - stack_upwards = true, -- list of tasks grows upwards - max_width = 0, -- maximum width of the fidget box - fidget = -- function to format fidget title - function(fidget_name, spinner) - return string.format("%s %s", spinner, fidget_name) - end, - task = -- function to format each task line - function(task_name, message, percentage) - return string.format( - "%s%s [%s]", - message, - percentage and string.format(" (%s%%)", percentage) or "", - task_name - ) - end, - }, - sources = { - -- Sources to configure - ['*'] = { -- Name of source - ignore = false, -- Ignore notifications from this source - }, - }, - debug = { - logging = false, -- whether to enable logging, for debugging - strict = false, -- whether to interpret LSP strictly + text = { + spinner = "moon", -- animation shown when tasks are ongoing + done = "✔", -- character shown when all tasks are complete + commenced = "Started", -- message shown when task starts + completed = "Completed", -- message shown when task completes + }, + align = { + bottom = true, -- align fidgets along bottom edge of buffer + right = true, -- align fidgets along right edge of buffer + }, + timer = { + spinner_rate = 125, -- frame rate of spinner animation, in ms + fidget_decay = 2000, -- how long to keep around empty fidget, in ms + task_decay = 1000, -- how long to keep around completed task, in ms + }, + window = { + relative = "editor", -- where to anchor, either "win" or "editor" + blend = 100, -- &winblend for the window + zindex = nil, -- the zindex value for the window + border = "none", -- style of border for the fidget window + }, + fmt = { + leftpad = true, -- right-justify text in fidget box + stack_upwards = true, -- list of tasks grows upwards + max_width = 0, -- maximum width of the fidget box + fidget = -- function to format fidget title + function(fidget_name, spinner) + return string.format("%s %s", spinner, fidget_name) + end, + task = -- function to format each task line + function(task_name, message, percentage) + return string.format( + "%s%s [%s]", + message, + percentage and string.format(" (%s%%)", percentage) or "", + task_name + ) + end, + }, + sources = { + -- Sources to configure + ['*'] = { -- Name of source + ignore = false, -- Ignore notifications from this source }, + }, + debug = { + logging = false, -- whether to enable logging, for debugging + strict = false, -- whether to interpret LSP strictly + }, }) + +-- Messaages as buf because it's so limiting to work with builtin view menu from neovim +vim.api.nvim_create_user_command('ShowLogs', function(opts) + local plugin_name = opts.fargs[1] or PLUGIN_URI + local min_level = opts.fargs[2] or PLUGIN_LEVEL + local logfile = string.format("%s/%s.log", vim.api.nvim_call_function("stdpath", { "cache" }), plugin_name) + + -- Ensure that the logfile exists + local file = io.open(logfile, 'r') + if not file then + print(string.format("No logfile found for plugin '%s'", vim.inspect(plugin_name))) + print("min_level: " .. vim.inspect(min_level)) + return + end + file:close() + + vim.cmd('vnew ' .. logfile) + + -- Load messages from the log file + local file_messages = vim.fn.readfile(logfile) + local levels = { trace = 1, debug = 2, info = 3, warn = 4, error = 5, fatal = 6 } + local min_index = levels[min_level] or 3 + local filtered_messages = {} + for _, message in ipairs(file_messages) do + local level = message:match("^%[([a-z]+)") + if levels[level] and levels[level] >= min_index then + table.insert(filtered_messages, message) + end + end + + vim.api.nvim_buf_set_lines(0, 0, -1, false, filtered_messages) + vim.cmd('setlocal ft=log') + vim.cmd('setlocal nomodifiable') +end, { nargs = "*", }) + +require("colorizer").setup { + filetypes = { "*" }, + user_default_options = { + RGB = true, -- #RGB hex codes + RRGGBB = true, -- #RRGGBB hex codes + names = true, -- "Name" codes like Blue or blue + RRGGBBAA = true, -- #RRGGBBAA hex codes + AARRGGBB = true, -- 0xAARRGGBB hex codes + rgb_fn = true, -- CSS rgb() and rgba() functions + hsl_fn = true, -- CSS hsl() and hsla() functions + css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB + css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn + -- Available modes for `mode`: foreground, background, virtualtext + mode = "background", -- Set the display mode. + -- Available methods are false / true / "normal" / "lsp" / "both" + -- True is same as normal + tailwind = true, -- Enable tailwind colors + -- parsers can contain values used in |user_default_options| + sass = { enable = true, parsers = { "css" }, }, -- Enable sass colors + virtualtext = "■", + -- update color values even if buffer is not focused + -- example use: cmp_menu, cmp_docs + always_update = false + }, + -- all the sub-options of filetypes apply to buftypes + buftypes = {}, +} diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix index ecc36ab..a040407 100644 --- a/nix-conf/home-manager/base/neovim.nix +++ b/nix-conf/home-manager/base/neovim.nix @@ -1,5 +1,4 @@ -# TODO: vim-plug and Mason supports laziness. Probably worth it to explore incremental dependencies based on the project -# TODO: just install these things, then symlink to mason's bin directory +# TODO: vim-plug and Mason supports laziness. Probably worth it to explore incremental dependencies based on the project TODO: just install these things, then symlink to mason's bin directory # # One thing to consider, though, /nix/store of `nix-shell` or `nix-develop` # might be different from `home-manager`'s (~/.nix_profile/bin/jq) diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index 13cf0fe..51f864f 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -58,11 +58,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1684981077, - "narHash": "sha256-68X9cFm0RTZm8u0rXPbeBzOVUH5OoUGAfeHHVoxGd9o=", + "lastModified": 1686186025, + "narHash": "sha256-SuQjKsO1G87qM5j8VNtq6kIw4ILYE03Y8yL/FoKwR+4=", "owner": "ipetkov", "repo": "crane", - "rev": "35110cccf28823320f4fd697fcafcb5038683982", + "rev": "057d95721ee67d421391dda7031977d247ddec28", "type": "github" }, "original": { @@ -570,11 +570,11 @@ "systems": "systems_2" }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", "type": "github" }, "original": { @@ -818,11 +818,11 @@ ] }, "locked": { - "lastModified": 1686562199, - "narHash": "sha256-FG6kCtVjCh0dHnV4AsVfhfSyPhjnSVXucwqCdTpMASE=", + "lastModified": 1686638670, + "narHash": "sha256-+/5lqVzqeOguJlX/57LU2e3tChw5L/jpAOzyNsiveVg=", "owner": "nix-community", "repo": "home-manager", - "rev": "b0cdae4e9baa188d69ba84aa1b7406b7bebe37f6", + "rev": "c8dafb187b7b010bf279a7bf0842eaadf3e387a8", "type": "github" }, "original": { @@ -953,11 +953,11 @@ "topiary": "topiary" }, "locked": { - "lastModified": 1686315162, - "narHash": "sha256-KZZRTXSpxJDDGVbEdyTR/4Mu2COSMtrim+5iL7qwDTw=", + "lastModified": 1686564419, + "narHash": "sha256-DJGvo1wDBRQSjAHAiNb8dD/77/CHwpeBzBYasIb51Hk=", "owner": "tweag", "repo": "nickel", - "rev": "9fed1326c9306d7c339884584702ce570764beaf", + "rev": "25c509e0b19f5b38b61a28765f62ce5c20e3e476", "type": "github" }, "original": { @@ -1037,11 +1037,11 @@ ] }, "locked": { - "lastModified": 1685764721, - "narHash": "sha256-CIy1iwQTEKfZRrid4gBLA+r/LPGA9IUFo0lKJVyECGI=", + "lastModified": 1686574167, + "narHash": "sha256-hxE8z+S9E4Qw03D2VQRaJUmj9zep3FvhKz316JUZuPA=", "owner": "mic92", "repo": "nix-index-database", - "rev": "669ca1f2e2bc401abab6b837ae9c51503edc9b49", + "rev": "7e83b70f31f4483c07e6939166cb667ecb8d05d5", "type": "github" }, "original": { @@ -1150,16 +1150,16 @@ }, "nixpkgs-stable_2": { "locked": { - "lastModified": 1678872516, - "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-22.11", + "ref": "nixos-23.05", "repo": "nixpkgs", "type": "github" } @@ -1245,11 +1245,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1685655444, - "narHash": "sha256-6EujQNAeaUkWvpEZZcVF8qSfQrNVWFNNGbUJxv/A5a8=", + "lastModified": 1686412476, + "narHash": "sha256-inl9SVk6o5h75XKC79qrDCAobTD1Jxh6kVYTZKHzewA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e635192892f5abbc2289eaac3a73cdb249abaefd", + "rev": "21951114383770f96ae528d0ae68824557768e81", "type": "github" }, "original": { @@ -1513,11 +1513,11 @@ "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { - "lastModified": 1685361114, - "narHash": "sha256-4RjrlSb+OO+e1nzTExKW58o3WRwVGpXwj97iCta8aj4=", + "lastModified": 1686213770, + "narHash": "sha256-Re6xXLEqQ/HRnThryumyGzEf3Uv0Pl4cuG50MrDofP8=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "ca2fdbf3edda2a38140184da6381d49f8206eaf4", + "rev": "182af51202998af5b64ddecaa7ff9be06425399b", "type": "github" }, "original": { @@ -1599,11 +1599,11 @@ ] }, "locked": { - "lastModified": 1683080331, - "narHash": "sha256-nGDvJ1DAxZIwdn6ww8IFwzoHb2rqBP4wv/65Wt5vflk=", + "lastModified": 1685759304, + "narHash": "sha256-I3YBH6MS3G5kGzNuc1G0f9uYfTcNY9NYoRc3QsykLk4=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "d59c3fa0cba8336e115b376c2d9e91053aa59e56", + "rev": "c535b4f3327910c96dcf21851bbdd074d0760290", "type": "github" }, "original": { @@ -1624,11 +1624,11 @@ ] }, "locked": { - "lastModified": 1685759304, - "narHash": "sha256-I3YBH6MS3G5kGzNuc1G0f9uYfTcNY9NYoRc3QsykLk4=", + "lastModified": 1686364106, + "narHash": "sha256-h4gCQg+jizmAbdg6UPlhxQVk4A7Ar/zoLa0wx3wBya0=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "c535b4f3327910c96dcf21851bbdd074d0760290", + "rev": "ba011dd1c5028dbb880bc3b0f427e0ff689e6203", "type": "github" }, "original": { @@ -1768,11 +1768,11 @@ "nixpkgs": "nixpkgs_13" }, "locked": { - "lastModified": 1686537156, - "narHash": "sha256-mJD80brS6h6P4jzwdKID0S9RvfyiruxgJbXvPPIDqF0=", + "lastModified": 1686623191, + "narHash": "sha256-x2gQcKtSgfbZlcTaVvdMPbrXMRjUEYIV88yzsFww6D4=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "e75da5cfc7da874401decaa88f4ccb3b4d64d20d", + "rev": "e279547de84413ca1a65cec3f0f879709c8c65eb", "type": "github" }, "original": { @@ -1973,11 +1973,11 @@ "rust-overlay": "rust-overlay_4" }, "locked": { - "lastModified": 1685522994, - "narHash": "sha256-OJQ16KpYT3jGyP0WSI+jZQMU55/cnbzdYZKVBfx9wNk=", + "lastModified": 1686167925, + "narHash": "sha256-2OU00zeoIS2jFBdXKak1Y2txC6IXEP0LsIUKSvr0qbc=", "owner": "tweag", "repo": "topiary", - "rev": "b2399161f60c1eb3404e487b4471ff76455d7a94", + "rev": "61d076c216422af7f865e2ade3bbdb4729e767ef", "type": "github" }, "original": { diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index b4da2d7..0b20873 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -15,6 +15,7 @@ description = "simple home-manager config"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs-latest.url = "github:nixos/nixpkgs"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -52,6 +53,7 @@ , neovim-nightly-overlay , nickel , nix-boost + , nixpkgs-latest , ... }: let diff --git a/nix-conf/home-manager/overlays.nix b/nix-conf/home-manager/overlays.nix index c711e6a..3501dbe 100644 --- a/nix-conf/home-manager/overlays.nix +++ b/nix-conf/home-manager/overlays.nix @@ -5,6 +5,7 @@ flake_input@{ kpcli-py , system , nickel , nix-boost +, nixpkgs-latest , ... }: let @@ -63,6 +64,10 @@ let inherit (flake_input.nickel.packages.${system}) lsp-nls nickel nickelWasm; }); + + vimPlugins = (final: prev: { + inherit (nixpkgs-latest) vimPlugins; + }); in [ nix-boost.overlays.default From e67a18e465e909f695bfe7e5bef8dff37e89c7c9 Mon Sep 17 00:00:00 2001 From: Hung Date: Thu, 15 Jun 2023 12:46:01 -0700 Subject: [PATCH 57/64] fix: darwin spotlight patch; extra: debugging neovim-cmp type --- flake.lock | 18 ++--- native_configs/neovim/init.lua | 76 +++++++++++++++---- .../home-manager/base/darwin-spotlight.nix | 24 +++++- nix-conf/home-manager/flake.lock | 46 +++++++---- nix-conf/home-manager/flake.nix | 4 +- nix-conf/home-manager/overlays.nix | 3 +- scripts/hm-switch.sh | 4 +- 7 files changed, 128 insertions(+), 47 deletions(-) diff --git a/flake.lock b/flake.lock index e7e8ab9..e9b7ce5 100644 --- a/flake.lock +++ b/flake.lock @@ -62,11 +62,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1685948350, - "narHash": "sha256-1FldJ059so0X/rScdbIiOlQbjjSNCCTdj2cUr5pHU4A=", + "lastModified": 1686747123, + "narHash": "sha256-XUQK9kwHpTeilHoad7L4LjMCCyY13Oq383CoFADecRE=", "owner": "serokell", "repo": "deploy-rs", - "rev": "65211db63ba1199f09b4c9f27e5eba5ec50d76ac", + "rev": "724463b5a94daa810abfc64a4f87faef4e00f984", "type": "github" }, "original": { @@ -301,11 +301,11 @@ "paisano": "paisano" }, "locked": { - "lastModified": 1686502488, - "narHash": "sha256-sLSiDkU9oNpcl1QEge0xVviD7N87iVdrwl7l9i+6mxQ=", + "lastModified": 1686781920, + "narHash": "sha256-1KHvvV2qcypAC6Zn+7HL+VxOuVttB3Iqrp/kDwLbqiI=", "owner": "divnix", "repo": "hive", - "rev": "e8b46fa4d2917dfd456f3f040e9761262b4648d2", + "rev": "a057e2df518c7ecb0dd14bd42661dc11129609c4", "type": "github" }, "original": { @@ -504,11 +504,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1686501370, - "narHash": "sha256-G0WuM9fqTPRc2URKP9Lgi5nhZMqsfHGrdEbrLvAPJcg=", + "lastModified": 1686592866, + "narHash": "sha256-riGg89eWhXJcPNrQGcSwTEEm7CGxWC06oSX44hajeMw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "75a5ebf473cd60148ba9aec0d219f72e5cf52519", + "rev": "0eeebd64de89e4163f4d3cf34ffe925a5cf67a05", "type": "github" }, "original": { diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 5fcd059..38b72c8 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -1,5 +1,4 @@ --- What: Mono-file nvim configuration file Why: Easy to see through everything without needing to navigate thru files Features: --- - LSP +-- What: Mono-file nvim configuration file Why: Easy to see through everything without needing to navigate thru files Features: - LSP -- - Auto-complete (in insert mode: ctrl-space, navigate w/ Tab+S-Tab, confirm: Enter) -- - df to format document -- - Harpoon marks: Navigate through main files within each project @@ -29,10 +28,12 @@ for _, path in ipairs(vim.api.nvim_list_runtime_paths()) do end end +local wplug_log = require('plenary.log').new({ plugin = 'wplug_log', level = 'debug', use_console = false }) -- Do Plug if plugin not yet linked in `rtp`. This takes care of Nix-compatibility local function WPlug(plugin_path, ...) local plugin_name = string.lower(plugin_path:match("/([^/]+)$")) if not installed_plugins[plugin_name] then + wplug_log.info("Plugging " .. plugin_path) Plug(plugin_path, ...) end end @@ -262,6 +263,7 @@ vim.opt.listchars:append "eol:↴" require("indent_blankline").setup { show_end_of_line = true, space_char_blankline = " ", + } -- User command that transform into 2-spaces by translating to tabstop vim.api.nvim_create_user_command( @@ -535,7 +537,7 @@ require("inlay-hints").setup { -- renderer to use -- possible options are dynamic, eol, virtline and custom -- renderer = "inlay-hints/render/dynamic", - renderer = "inlay-hints/render/dynamic", + renderer = "inlay-hints/render/eol", hints = { parameter = { @@ -637,6 +639,42 @@ cmp.event:on( ) +---@alias EntryFilter {id: integer, compe: lsp.CompletionItem, return_type: string, return_type2: string, score: number, label: string, source_name: string, bufnr: number?, offset: number?, kind: lsp.CompletionItemKind } +---@param entry cmp.Entry +---@return EntryFilter +local function entry_filter_sync(entry) + local compe = entry:get_completion_item() + local return_type = compe.data and compe.data.return_type + local return_type2 = compe.detail + local score = entry.score + local label = compe.label + local source_name = entry.source.name + local bufnr = entry.context.bufnr + local offset = entry:get_offset() + local kind = entry:get_kind() + local id = entry.id + return { + id = id, + compe = compe, + return_type = return_type, + return_type2 = return_type2, + score = score, + label = label, + source_name = source_name, + bufnr = bufnr, + offset = offset, + kind = kind, + } +end + +---@param entry cmp.Entry +---@param callback fun(entry: EntryFilter): any +local function entry_filter(entry, callback) + entry:resolve(function() + callback(entry_filter_sync(entry)) + end) +end + ---@type cmp.ConfigSchema local cmp_config = { snippet = { @@ -645,7 +683,7 @@ local cmp_config = { end, }, mapping = cmp.mapping.preset.insert { - [' Date: Fri, 16 Jun 2023 16:12:54 -0700 Subject: [PATCH 58/64] wip: interface-like structure but im sadge on development with no type-safety --- docs/vim-plugins.md | 2 +- flake.lock | 199 ++--- native_configs/README.md | 11 +- native_configs/neovim/init.lua | 28 +- native_configs/starship/starship.toml | 5 + .../home-manager/base/darwin-spotlight.nix | 15 +- nix-conf/home-manager/base/graphics.nix | 2 +- nix-conf/home-manager/base/neovim.nix | 2 +- .../home-manager/base/private_chromium.nix | 1 + nix-conf/home-manager/base/shells.nix | 10 +- nix-conf/home-manager/flake.lock | 740 +++--------------- nix-conf/home-manager/flake.nix | 5 +- nix-conf/home-manager/overlays.nix | 6 - nix-conf/lib/serde/default.nix | 3 +- nix/cells/repo/home-modules.nix | 9 - nix/cells/repo/home-modules/default.nix | 241 ++++++ nix/cells/repo/home-modules/nixgl.nix | 40 + nix/cells/repo/home-modules/shells.nix | 121 +++ nix/cells/repo/home-profiles/default.nix | 60 ++ nix/cells/repo/home-profiles/neovim.nix | 181 +++++ nix/cells/repo/lib/default.nix | 35 + 21 files changed, 896 insertions(+), 820 deletions(-) delete mode 100644 nix/cells/repo/home-modules.nix create mode 100644 nix/cells/repo/home-modules/default.nix create mode 100644 nix/cells/repo/home-modules/nixgl.nix create mode 100644 nix/cells/repo/home-modules/shells.nix create mode 100644 nix/cells/repo/home-profiles/default.nix create mode 100644 nix/cells/repo/home-profiles/neovim.nix create mode 100644 nix/cells/repo/lib/default.nix diff --git a/docs/vim-plugins.md b/docs/vim-plugins.md index 2c10cc3..15ccabc 100644 --- a/docs/vim-plugins.md +++ b/docs/vim-plugins.md @@ -1,4 +1,4 @@ -# Vim Plugins +# Offset Vim Plugins onto nix packer The current [`scripts/vim.dsl`](../scripts/vim.dsl) grabs the upstream supported vim plugins onto a sqlite database to be stored in memory. We could perform some data exploration via this database diff --git a/flake.lock b/flake.lock index e9b7ce5..2a7e5b3 100644 --- a/flake.lock +++ b/flake.lock @@ -77,21 +77,18 @@ }, "devshell": { "inputs": { - "flake-utils": [ - "std", - "flake-utils" - ], "nixpkgs": [ "std", "nixpkgs" - ] + ], + "systems": "systems" }, "locked": { - "lastModified": 1682700442, - "narHash": "sha256-qjaAAcCYgp1pBBG7mY9z95ODUBZMtUpf0Qp3Gt/Wha0=", + "lastModified": 1686680692, + "narHash": "sha256-SsLZz3TDleraAiJq4EkmdyewSyiv5g0LZYc6vaLZOMQ=", "owner": "numtide", "repo": "devshell", - "rev": "fb6673fe9fe4409e3f43ca86968261e970918a83", + "rev": "fd6223370774dd9c33354e87a007004b5fd36442", "type": "github" }, "original": { @@ -117,10 +114,13 @@ }, "dmerge": { "inputs": { - "haumea": "haumea_2", - "namaka": "namaka", + "haumea": [ + "std", + "haumea" + ], "nixlib": [ "std", + "haumea", "nixpkgs" ], "yants": [ @@ -129,16 +129,16 @@ ] }, "locked": { - "lastModified": 1684178600, - "narHash": "sha256-EtSQcCHRQUBBEj4vbYU0vgPUYiKP261ero5k1QfQ3Bc=", + "lastModified": 1686862774, + "narHash": "sha256-ojGtRQ9pIOUrxsQEuEPerUkqIJEuod9hIflfNkY+9CE=", "owner": "divnix", "repo": "dmerge", - "rev": "ac9932f26325afac5baa59cf6478432d17762a4e", + "rev": "9f7f7a8349d33d7bd02e0f2b484b1f076e503a96", "type": "github" }, "original": { "owner": "divnix", - "ref": "0.2.0", + "ref": "0.2.1", "repo": "dmerge", "type": "github" } @@ -248,44 +248,19 @@ }, "haumea_2": { "inputs": { - "nixpkgs": [ - "std", - "dmerge", - "nixlib" - ] + "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1681176209, - "narHash": "sha256-bJLDun6esIyWtwRVXcsgzGbh4UKu8wJDrPgykqPyzmg=", + "lastModified": 1685133229, + "narHash": "sha256-FePm/Gi9PBSNwiDFq3N+DWdfxFq0UKsVVTJS3cQPn94=", "owner": "nix-community", "repo": "haumea", - "rev": "b915b66b27da3a595d77b139e945bb0a2fcac926", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "haumea", - "type": "github" - } - }, - "haumea_3": { - "inputs": { - "nixpkgs": [ - "std", - "paisano", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1681176209, - "narHash": "sha256-bJLDun6esIyWtwRVXcsgzGbh4UKu8wJDrPgykqPyzmg=", - "owner": "nix-community", - "repo": "haumea", - "rev": "b915b66b27da3a595d77b139e945bb0a2fcac926", + "rev": "34dd58385092a23018748b50f9b23de6266dffc2", "type": "github" }, "original": { "owner": "nix-community", + "ref": "v0.2.2", "repo": "haumea", "type": "github" } @@ -333,6 +308,7 @@ "inputs": { "nixlib": [ "std", + "haumea", "nixpkgs" ] }, @@ -362,11 +338,11 @@ ] }, "locked": { - "lastModified": 1677330646, - "narHash": "sha256-hUYCwJneMjnxTvj30Fjow6UMJUITqHlpUGpXMPXUJsU=", + "lastModified": 1685771919, + "narHash": "sha256-3lVKWrhNXjHJB6QkZ2SJaOs4X/mmYXtY6ovPVpDMOHc=", "owner": "nlewo", "repo": "nix2container", - "rev": "ebca8f58d450cae1a19c07701a5a8ae40afc9efc", + "rev": "95e2220911874064b5d809f8d35f7835184c4ddf", "type": "github" }, "original": { @@ -375,57 +351,6 @@ "type": "github" } }, - "namaka": { - "inputs": { - "haumea": [ - "std", - "dmerge", - "haumea" - ], - "nixpkgs": [ - "std", - "dmerge", - "nixlib" - ] - }, - "locked": { - "lastModified": 1683059428, - "narHash": "sha256-ZTMqleCWmuNWhZE375gtF1j1JRkaKEUFN1AM43e7h4Y=", - "owner": "nix-community", - "repo": "namaka", - "rev": "2deba2f416454aec770bc1cc7365e39c73e6b1d7", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "v0.1.1", - "repo": "namaka", - "type": "github" - } - }, - "namaka_2": { - "inputs": { - "haumea": [ - "std", - "paisano", - "haumea" - ], - "nixpkgs": "nixpkgs_5" - }, - "locked": { - "lastModified": 1681604203, - "narHash": "sha256-oA/fW/85GmSNprghgAnZi0XeVMvW9xVuCYprzPw2hz0=", - "owner": "nix-community", - "repo": "namaka", - "rev": "1550ddc025334cff2e8ec9021256473b2ffb27e5", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "namaka", - "type": "github" - } - }, "nixago": { "inputs": { "flake-utils": [ @@ -504,11 +429,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1686592866, - "narHash": "sha256-riGg89eWhXJcPNrQGcSwTEEm7CGxWC06oSX44hajeMw=", + "lastModified": 1686869522, + "narHash": "sha256-tbJ9B8WLCTnVP/LwESRlg0dII6Zyg2LmUU/mB9Lu98E=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0eeebd64de89e4163f4d3cf34ffe925a5cf67a05", + "rev": "7c67f006ea0e7d0265f16d7df07cc076fdffd91f", "type": "github" }, "original": { @@ -519,6 +444,21 @@ } }, "nixpkgs_4": { + "locked": { + "lastModified": 1681001314, + "narHash": "sha256-5sDnCLdrKZqxLPK4KA8+f4A3YKO/u6ElpMILvX0g72c=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "367c0e1086a4eb4502b24d872cea2c7acdd557f4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs_5": { "locked": { "lastModified": 1675940568, "narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=", @@ -534,22 +474,6 @@ "type": "github" } }, - "nixpkgs_5": { - "locked": { - "lastModified": 1680758185, - "narHash": "sha256-sCVWwfnk7zEX8Z+OItiH+pcSklrlsLZ4TJTtnxAYREw=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "0e19daa510e47a40e06257e205965f3b96ce0ac9", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_6": { "locked": { "lastModified": 1677063315, @@ -695,8 +619,6 @@ }, "paisano_2": { "inputs": { - "haumea": "haumea_3", - "namaka": "namaka_2", "nixpkgs": [ "std", "nixpkgs" @@ -708,16 +630,16 @@ ] }, "locked": { - "lastModified": 1685757649, - "narHash": "sha256-gu21uo35i5OguZ5laGpqIFgVRcowbjvLn2mxSyNKZfQ=", + "lastModified": 1686862844, + "narHash": "sha256-m8l/HpRBJnZ3c0F1u0IyQ3nYGWE0R9V5kfORuqZPzgk=", "owner": "paisano-nix", "repo": "core", - "rev": "db53b8a8e2e3e557bf5ec5842b7a52ee5de04e87", + "rev": "6674b3d3577212c1eeecd30d62d52edbd000e726", "type": "github" }, "original": { "owner": "paisano-nix", - "ref": "0.1.0", + "ref": "0.1.1", "repo": "core", "type": "github" } @@ -786,6 +708,7 @@ "devshell": "devshell", "dmerge": "dmerge", "flake-utils": "flake-utils", + "haumea": "haumea_2", "incl": "incl", "makes": [ "std", @@ -797,18 +720,18 @@ ], "n2c": "n2c", "nixago": "nixago", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_5", "paisano": "paisano_2", "paisano-mdbook-preprocessor": "paisano-mdbook-preprocessor", "paisano-tui": "paisano-tui", "yants": "yants_2" }, "locked": { - "lastModified": 1686337240, - "narHash": "sha256-JedAsyUIbSIhVrRWSl0R3lSWemVWsHg0w3MuzW7h4tg=", + "lastModified": 1686890041, + "narHash": "sha256-yLucgr7q8o63yJHLd5b5rF/h27ktYTQrn9rYxVxrs3E=", "owner": "divnix", "repo": "std", - "rev": "1bd99cec90a5cee8575f45dbc193d6dd860a5f35", + "rev": "8671b6892e45d795d7409940750832d68c929dcf", "type": "github" }, "original": { @@ -817,6 +740,21 @@ "type": "github" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1667395993, @@ -858,15 +796,16 @@ "inputs": { "nixpkgs": [ "std", + "haumea", "nixpkgs" ] }, "locked": { - "lastModified": 1667096281, - "narHash": "sha256-wRRec6ze0gJHmGn6m57/zhz/Kdvp9HS4Nl5fkQ+uIuA=", + "lastModified": 1686863218, + "narHash": "sha256-kooxYm3/3ornWtVBNHM3Zh020gACUyFX2G0VQXnB+mk=", "owner": "divnix", "repo": "yants", - "rev": "d18f356ec25cb94dc9c275870c3a7927a10f8c3c", + "rev": "8f0da0dba57149676aa4817ec0c880fbde7a648d", "type": "github" }, "original": { diff --git a/native_configs/README.md b/native_configs/README.md index 63955ee..f2414b2 100644 --- a/native_configs/README.md +++ b/native_configs/README.md @@ -1,3 +1,12 @@ # Native configs -Contains all configurations that are written in their native language +Contains all configurations that are written in their native configuration language. + +## Why native language? + +- Easier portability +- Nix can read from [JSON](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-fromJSON), +[TOML](https://nixos.org/manual/nix/stable/release-notes/rl-2.6.html#release-26-2022-01-24). +- We have also managed to hack together a [fromYaml](./../nix-conf/lib/serde/default.nix), +though it will not work for strictly pure builds or bootstrapping builds. + diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 38b72c8..d510a64 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -293,12 +293,19 @@ vim.api.nvim_create_user_command( -- telescope local fb_actions = require "telescope".extensions.file_browser.actions +local tel_actions = require("telescope.actions") +local tel_actionset = require("telescope.actions.set") + +local function term_height() + return vim.opt.lines:get() +end + require('telescope').setup { defaults = { mappings = { - i = { - [''] = false, - [''] = false, + n = { + [''] = function(prompt_bufnr) tel_actionset.shift_selection(prompt_bufnr, -math.floor(term_height() / 2)) end, + [''] = function(prompt_bufnr) tel_actionset.shift_selection(prompt_bufnr, math.floor(term_height() / 2)) end, }, }, }, @@ -361,13 +368,13 @@ end, { desc = '[F]ind [A]ll files' }) remap('n', 'fg', function() require('telescope.builtin').live_grep() -end, { desc = '[F]ind by [G]rep' }) +end, { desc = '[F]ind thru [G]rep' }) remap('n', 'fug', function() -- This relies on many factors: We use `rg` and that `-g '**/*'` effectively -- drops ignore rules like the default `.gitignore` rule. require('telescope.builtin').live_grep({ glob_pattern = '**/*' }) -end, { desc = '[F]ind by [u]nrestricted [G]rep' }) +end, { desc = '[F]ind thru [u]nrestricted [G]rep' }) remap('n', 'fb', function() require('telescope.builtin').buffers() @@ -427,7 +434,7 @@ end -- Close all tabs except the first one vim.api.nvim_set_keymap('n', 'x', ':tabdo if tabpagenr() > 1 | tabclose | endif', - { noremap = true, silent = true }) + { noremap = true, silent = true, desc = "Close all tabs except the first one", }) -- }}} @@ -749,7 +756,6 @@ local cmp_config = { entry_filter(entry, function(entry) if entry.source_name == "nvim_lsp" then log.debug('format:entry: ' .. vim.inspect(entry, { depth = 2 })) - end end) @@ -805,7 +811,7 @@ local cmp_config = { cmp.setup(vim.tbl_deep_extend("force", require('cmp.config.default')(), cmp_config)) -- set max autocomplete height. this prevents huge recommendations to take over the screen vim.o.pumheight = 15 -- 15/70 is good enough ratio for me. I generally go with 80-90 max height, though -vim.o.pumblend = 15 -- semi-transparent for the art, nothing too useful +vim.o.pumblend = 10 -- semi-transparent for the art, nothing too useful (neovim recommends 0-30) -- `/` cmdline search. cmp.setup.cmdline('/', { @@ -864,7 +870,10 @@ require("mason").setup({ }) require('mason-lspconfig').setup({ -- ensure_installed = servers, - ensure_installed = { "pylsp", "pyright", "tailwindcss", "svelte", "astro", "lua_ls", "tsserver" }, + ensure_installed = { + "pylsp", "pyright", "tailwindcss", "svelte", "astro", "lua_ls", "tsserver", + "ansiblels", "yamlls", "docker_compose_language_service", "jsonls", + }, automatic_installation = false, }) @@ -1206,7 +1215,6 @@ require('zk.commands').add("ZkGrep", function(match_ctor) if match_ctor == nil or match_ctor == '' then vim.fn.inputsave() grep_str = vim.fn.input('Grep string: >') - vim.fn.inputrestore() match = { match = grep_str } elseif type(match_ctor) == 'string' then match = { match = grep_str } diff --git a/native_configs/starship/starship.toml b/native_configs/starship/starship.toml index 14eaf5c..ab52873 100644 --- a/native_configs/starship/starship.toml +++ b/native_configs/starship/starship.toml @@ -3,6 +3,11 @@ [aws] symbol = " " +[c] +disabled = false +commmands = [ [ 'cc', '--version' ], [ 'gcc', '--version' ], [ 'clang', '--version' ] ] +detect_extensions = ["c", "h", "cc", "cpp", "hh", "hpp"] + [conda] symbol = " " diff --git a/nix-conf/home-manager/base/darwin-spotlight.nix b/nix-conf/home-manager/base/darwin-spotlight.nix index 6892fa3..800ffa9 100644 --- a/nix-conf/home-manager/base/darwin-spotlight.nix +++ b/nix-conf/home-manager/base/darwin-spotlight.nix @@ -1,12 +1,13 @@ -# This patch exists since Darwin's search bar requires solid apps and not -# symlinked -# TODO: QA -# - [x] works for base case -# - [x] works for repeated case -# - [ ] works after base case, then removed -# - [ ] works for repeated case, then removed { lib, pkgs, config, ... }: { + # This patch exists since Darwin's search bar requires solid apps and not + # symlinked + # TODO: QA + # - [x] works for base case + # - [x] works for repeated case + # - [ ] works after base case, then removed + # - [ ] works for repeated case, then removed + # Copy GUI apps to "~/Applications/Home Manager Apps" # Based on this comment: https://github.com/nix-community/home-manager/issues/1341#issuecomment-778820334 home.activation.patch-spotlight = diff --git a/nix-conf/home-manager/base/graphics.nix b/nix-conf/home-manager/base/graphics.nix index 646b720..71dfbae 100644 --- a/nix-conf/home-manager/base/graphics.nix +++ b/nix-conf/home-manager/base/graphics.nix @@ -30,7 +30,7 @@ in }; }; }; - # importing shells does not mean we're enabling everything, if we do mkDefault false + # NOTE: importing shells does not mean we're enabling everything, if we do mkDefault false # but the dilemma is, if the user import BOTH graphics.nix and shells.nix # they will also need to do `config.base.shells.enable` # generally, we want the behavior: import means enable diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix index a040407..ab74aab 100644 --- a/nix-conf/home-manager/base/neovim.nix +++ b/nix-conf/home-manager/base/neovim.nix @@ -28,7 +28,7 @@ let pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo pkgs.rust4cargo pkgs.nickel - pkgs.lsp-nls + pkgs.nls pkgs.go # doesn't work, Mason installs from runtime path diff --git a/nix-conf/home-manager/base/private_chromium.nix b/nix-conf/home-manager/base/private_chromium.nix index 6679332..981459e 100644 --- a/nix-conf/home-manager/base/private_chromium.nix +++ b/nix-conf/home-manager/base/private_chromium.nix @@ -21,6 +21,7 @@ in package = pkgs.ungoogled-chromium; extensions = let + # TODO: how about a chrome extension registry? mkChromiumExtForVersion = browserVersion: { id, sha256, extVersion, ... }: { inherit id; diff --git a/nix-conf/home-manager/base/shells.nix b/nix-conf/home-manager/base/shells.nix index 36b293e..5f85cc1 100644 --- a/nix-conf/home-manager/base/shells.nix +++ b/nix-conf/home-manager/base/shells.nix @@ -37,7 +37,6 @@ in }; }; config = myLib.mkIf cfg.enable { - xdg.configFile."starship.toml".source = "${proj_root.config.path}//starship/starship.toml"; # nix: Propagates the environment with packages and vars when enter (children of) # a directory with shell.nix-compatible and .envrc programs.direnv = { @@ -68,6 +67,15 @@ in programs.starship = { enable = true; enableZshIntegration = true; + settings = let + native = builtins.fromTOML (builtins.readFile "${proj_root.config.path}/starship/starship.toml"); + patch-nix = pkgs.lib.recursiveUpdate native ({ + c.commands = [ + ["nix" "run" "nixpkgs#clang" "--" "--version"] + ["nix" "run" "nixpkgs#gcc" "--" "--version"] + ]; + }); + in patch-nix; }; # Fuzzy finder. `fzf` for TUI, `fzf -f ''` for UNIX piping programs.fzf.enable = true; diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index c55775b..7a5c2ea 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -1,21 +1,5 @@ { "nodes": { - "advisory-db": { - "flake": false, - "locked": { - "lastModified": 1684292571, - "narHash": "sha256-OpCnswRyIATPNoiQR4O7jE7iAyI9dekG7HfYhgZI3aI=", - "owner": "rustsec", - "repo": "advisory-db", - "rev": "0e97e6e71f0dd52b4b4e0ab3fa6e5e5dd72f852a", - "type": "github" - }, - "original": { - "owner": "rustsec", - "repo": "advisory-db", - "type": "github" - } - }, "blank": { "locked": { "lastModified": 1625557891, @@ -51,58 +35,9 @@ "inputs": { "flake-compat": "flake-compat_4", "flake-utils": "flake-utils_4", - "nixpkgs": [ - "nickel", - "nixpkgs" - ], + "nixpkgs": "nixpkgs_3", "rust-overlay": "rust-overlay" }, - "locked": { - "lastModified": 1686186025, - "narHash": "sha256-SuQjKsO1G87qM5j8VNtq6kIw4ILYE03Y8yL/FoKwR+4=", - "owner": "ipetkov", - "repo": "crane", - "rev": "057d95721ee67d421391dda7031977d247ddec28", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "crane_2": { - "inputs": { - "flake-compat": "flake-compat_6", - "flake-utils": "flake-utils_6", - "nixpkgs": [ - "nickel", - "topiary", - "nixpkgs" - ], - "rust-overlay": "rust-overlay_3" - }, - "locked": { - "lastModified": 1684468982, - "narHash": "sha256-EoC1N5sFdmjuAP3UOkyQujSOT6EdcXTnRw8hPjJkEgc=", - "owner": "ipetkov", - "repo": "crane", - "rev": "99de890b6ef4b4aab031582125b6056b792a4a30", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "crane_3": { - "inputs": { - "flake-compat": "flake-compat_7", - "flake-utils": "flake-utils_9", - "nixpkgs": "nixpkgs_5", - "rust-overlay": "rust-overlay_5" - }, "locked": { "lastModified": 1681680516, "narHash": "sha256-EB8Adaeg4zgcYDJn9sR6UMjN/OHdIiMMK19+3LmmXQY=", @@ -117,17 +52,17 @@ "type": "github" } }, - "crane_4": { + "crane_2": { "inputs": { - "flake-compat": "flake-compat_9", - "flake-utils": "flake-utils_13", + "flake-compat": "flake-compat_6", + "flake-utils": "flake-utils_8", "nixpkgs": [ "nix-boost", "std", "paisano-mdbook-preprocessor", "nixpkgs" ], - "rust-overlay": "rust-overlay_7" + "rust-overlay": "rust-overlay_3" }, "locked": { "lastModified": 1676162383, @@ -199,7 +134,7 @@ }, "fenix": { "inputs": { - "nixpkgs": "nixpkgs_10", + "nixpkgs": "nixpkgs_8", "rust-analyzer-src": "rust-analyzer-src" }, "locked": { @@ -309,54 +244,6 @@ "type": "github" } }, - "flake-compat_7": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_8": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_9": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -438,88 +325,7 @@ }, "flake-utils_10": { "inputs": { - "systems": "systems_7" - }, - "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_11": { - "inputs": { - "systems": "systems_8" - }, - "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_12": { - "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_13": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_14": { - "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_15": { - "inputs": { - "systems": "systems_9" + "systems": "systems_4" }, "locked": { "lastModified": 1681202837, @@ -566,15 +372,12 @@ } }, "flake-utils_4": { - "inputs": { - "systems": "systems_2" - }, "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", "owner": "numtide", "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", "type": "github" }, "original": { @@ -585,14 +388,14 @@ }, "flake-utils_5": { "inputs": { - "systems": "systems_3" + "systems": "systems_2" }, "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { @@ -603,7 +406,7 @@ }, "flake-utils_6": { "inputs": { - "systems": "systems_4" + "systems": "systems_3" }, "locked": { "lastModified": 1681202837, @@ -620,15 +423,12 @@ } }, "flake-utils_7": { - "inputs": { - "systems": "systems_5" - }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "type": "github" }, "original": { @@ -638,15 +438,12 @@ } }, "flake-utils_8": { - "inputs": { - "systems": "systems_6" - }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { @@ -657,11 +454,11 @@ }, "flake-utils_9": { "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "owner": "numtide", "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "type": "github" }, "original": { @@ -694,28 +491,6 @@ "type": "github" } }, - "gitignore_2": { - "inputs": { - "nixpkgs": [ - "nickel", - "pre-commit-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, "gnmic": { "flake": false, "locked": { @@ -734,7 +509,7 @@ }, "gomod2nix": { "inputs": { - "nixpkgs": "nixpkgs_6", + "nixpkgs": "nixpkgs_4", "utils": "utils" }, "locked": { @@ -811,26 +586,6 @@ "type": "github" } }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1686852570, - "narHash": "sha256-Hzufya/HxjSliCwpuLJCGY0WCQajzcpsnhFGa+TCkCM=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "4e09c83255c5b23d58714d56672d3946faf1bcef", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, "incl": { "inputs": { "nixlib": [ @@ -943,39 +698,16 @@ "type": "github" } }, - "nickel": { - "inputs": { - "crane": "crane", - "flake-utils": "flake-utils_5", - "nixpkgs": "nixpkgs_3", - "pre-commit-hooks": "pre-commit-hooks", - "rust-overlay": "rust-overlay_2", - "topiary": "topiary" - }, - "locked": { - "lastModified": 1686837312, - "narHash": "sha256-/izfKcPXT/Y4N8zgAncPp7ov5Qb39J3p74FaNsLUk/c=", - "owner": "tweag", - "repo": "nickel", - "rev": "6f424fd5f8e9c5bcdc07d855427d3dce14cd247e", - "type": "github" - }, - "original": { - "owner": "tweag", - "repo": "nickel", - "type": "github" - } - }, "nix-boost": { "inputs": { "cargo-leptos": "cargo-leptos", - "crane": "crane_3", - "flake-compat": "flake-compat_8", + "crane": "crane", + "flake-compat": "flake-compat_5", "gnmic": "gnmic", "gomod2nix": "gomod2nix", - "nixpkgs": "nixpkgs_7", + "nixpkgs": "nixpkgs_5", "poetry2nix": "poetry2nix", - "rust-overlay": "rust-overlay_6", + "rust-overlay": "rust-overlay_2", "std": "std" }, "locked": { @@ -1015,21 +747,6 @@ "type": "github" } }, - "nix-filter": { - "locked": { - "lastModified": 1681154353, - "narHash": "sha256-MCJ5FHOlbfQRFwN0brqPbCunLEVw05D/3sRVoNVt2tI=", - "owner": "numtide", - "repo": "nix-filter", - "rev": "f529f42792ade8e32c4be274af6b6d60857fbee7", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "nix-filter", - "type": "github" - } - }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -1084,8 +801,8 @@ }, "nixgl": { "inputs": { - "flake-utils": "flake-utils_14", - "nixpkgs": "nixpkgs_11" + "flake-utils": "flake-utils_9", + "nixpkgs": "nixpkgs_9" }, "locked": { "lastModified": 1, @@ -1116,11 +833,11 @@ }, "nixpkgs-latest": { "locked": { - "lastModified": 1686856014, - "narHash": "sha256-3V2uo9xR7jMJLimzVGj7DO7qYwvZbf02UaXFIP3k0IE=", + "lastModified": 1686940302, + "narHash": "sha256-hTBVlV53sfi7ZyTkRKIVZy3V26ixnWGZnYrHvb9rCZU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7a53daed2a71fd4b7b177bc48f2f9c996a5bb4b2", + "rev": "1f5b5df0d309144d10d409d161b50adc94157ef6", "type": "github" }, "original": { @@ -1163,29 +880,13 @@ "type": "github" } }, - "nixpkgs-stable_2": { - "locked": { - "lastModified": 1685801374, - "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.05", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_10": { "locked": { - "lastModified": 1677063315, - "narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=", + "lastModified": 1686869522, + "narHash": "sha256-tbJ9B8WLCTnVP/LwESRlg0dII6Zyg2LmUU/mB9Lu98E=", "owner": "nixos", "repo": "nixpkgs", - "rev": "988cc958c57ce4350ec248d2d53087777f9e1949", + "rev": "7c67f006ea0e7d0265f16d7df07cc076fdffd91f", "type": "github" }, "original": { @@ -1196,37 +897,6 @@ } }, "nixpkgs_11": { - "locked": { - "lastModified": 1660551188, - "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "441dc5d512153039f19ef198e662e4f3dbb9fd65", - "type": "github" - }, - "original": { - "owner": "nixos", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_12": { - "locked": { - "lastModified": 1686592866, - "narHash": "sha256-riGg89eWhXJcPNrQGcSwTEEm7CGxWC06oSX44hajeMw=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "0eeebd64de89e4163f4d3cf34ffe925a5cf67a05", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_13": { "locked": { "lastModified": 1681358109, "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", @@ -1259,37 +929,6 @@ } }, "nixpkgs_3": { - "locked": { - "lastModified": 1686412476, - "narHash": "sha256-inl9SVk6o5h75XKC79qrDCAobTD1Jxh6kVYTZKHzewA=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "21951114383770f96ae528d0ae68824557768e81", - "type": "github" - }, - "original": { - "id": "nixpkgs", - "ref": "nixos-unstable", - "type": "indirect" - } - }, - "nixpkgs_4": { - "locked": { - "lastModified": 1681358109, - "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_5": { "locked": { "lastModified": 1680487167, "narHash": "sha256-9FNIqrxDZgSliGGN2XJJSvcDYmQbgOANaZA4UWnTdg4=", @@ -1305,7 +944,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_4": { "locked": { "lastModified": 1658285632, "narHash": "sha256-zRS5S/hoeDGUbO+L95wXG9vJNwsSYcl93XiD0HQBXLk=", @@ -1321,7 +960,7 @@ "type": "github" } }, - "nixpkgs_7": { + "nixpkgs_5": { "locked": { "lastModified": 1682526928, "narHash": "sha256-2cKh4O6t1rQ8Ok+v16URynmb0rV7oZPEbXkU0owNLQs=", @@ -1337,7 +976,7 @@ "type": "github" } }, - "nixpkgs_8": { + "nixpkgs_6": { "locked": { "lastModified": 1681358109, "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", @@ -1353,7 +992,7 @@ "type": "github" } }, - "nixpkgs_9": { + "nixpkgs_7": { "locked": { "lastModified": 1675940568, "narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=", @@ -1369,6 +1008,37 @@ "type": "github" } }, + "nixpkgs_8": { + "locked": { + "lastModified": 1677063315, + "narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "988cc958c57ce4350ec248d2d53087777f9e1949", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_9": { + "locked": { + "lastModified": 1660551188, + "narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "441dc5d512153039f19ef198e662e4f3dbb9fd65", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, "nosys": { "locked": { "lastModified": 1668010795, @@ -1437,7 +1107,7 @@ }, "paisano-mdbook-preprocessor": { "inputs": { - "crane": "crane_4", + "crane": "crane_2", "fenix": "fenix", "nixpkgs": [ "nix-boost", @@ -1493,7 +1163,7 @@ }, "poetry2nix": { "inputs": { - "flake-utils": "flake-utils_10", + "flake-utils": "flake-utils_5", "nixpkgs": [ "nix-boost", "nixpkgs" @@ -1513,34 +1183,6 @@ "type": "github" } }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": "flake-compat_5", - "flake-utils": [ - "nickel", - "flake-utils" - ], - "gitignore": "gitignore_2", - "nixpkgs": [ - "nickel", - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable_2" - }, - "locked": { - "lastModified": 1686213770, - "narHash": "sha256-Re6xXLEqQ/HRnThryumyGzEf3Uv0Pl4cuG50MrDofP8=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "182af51202998af5b64ddecaa7ff9be06425399b", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, "pre-commit-hooks-nix": { "inputs": { "flake-compat": "flake-compat_3", @@ -1572,16 +1214,17 @@ "inputs": { "flake-compat": "flake-compat", "flake-utils": "flake-utils", - "home-manager": "home-manager", + "home-manager": [ + "nixpkgs" + ], "kpcli-py": "kpcli-py", "neovim-nightly-overlay": "neovim-nightly-overlay", - "nickel": "nickel", "nix-boost": "nix-boost", "nix-index-database": "nix-index-database", "nixgl": "nixgl", - "nixpkgs": "nixpkgs_12", + "nixpkgs": "nixpkgs_10", "nixpkgs-latest": "nixpkgs-latest", - "rust-overlay": "rust-overlay_8" + "rust-overlay": "rust-overlay_4" } }, "rust-analyzer-src": { @@ -1602,106 +1245,6 @@ } }, "rust-overlay": { - "inputs": { - "flake-utils": [ - "nickel", - "crane", - "flake-utils" - ], - "nixpkgs": [ - "nickel", - "crane", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1685759304, - "narHash": "sha256-I3YBH6MS3G5kGzNuc1G0f9uYfTcNY9NYoRc3QsykLk4=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "c535b4f3327910c96dcf21851bbdd074d0760290", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_2": { - "inputs": { - "flake-utils": [ - "nickel", - "flake-utils" - ], - "nixpkgs": [ - "nickel", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1686364106, - "narHash": "sha256-h4gCQg+jizmAbdg6UPlhxQVk4A7Ar/zoLa0wx3wBya0=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "ba011dd1c5028dbb880bc3b0f427e0ff689e6203", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_3": { - "inputs": { - "flake-utils": [ - "nickel", - "topiary", - "crane", - "flake-utils" - ], - "nixpkgs": [ - "nickel", - "topiary", - "crane", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1683080331, - "narHash": "sha256-nGDvJ1DAxZIwdn6ww8IFwzoHb2rqBP4wv/65Wt5vflk=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "d59c3fa0cba8336e115b376c2d9e91053aa59e56", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_4": { - "inputs": { - "flake-utils": "flake-utils_8", - "nixpkgs": "nixpkgs_4" - }, - "locked": { - "lastModified": 1684808436, - "narHash": "sha256-WG5LgB1+Oguj4H4Bpqr5GoLSc382LyGlaToiOw5xhwA=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "a227d4571dd1f948138a40ea8b0d0c413eefb44b", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_5": { "inputs": { "flake-utils": [ "nix-boost", @@ -1728,10 +1271,10 @@ "type": "github" } }, - "rust-overlay_6": { + "rust-overlay_2": { "inputs": { - "flake-utils": "flake-utils_11", - "nixpkgs": "nixpkgs_8" + "flake-utils": "flake-utils_6", + "nixpkgs": "nixpkgs_6" }, "locked": { "lastModified": 1682561982, @@ -1747,7 +1290,7 @@ "type": "github" } }, - "rust-overlay_7": { + "rust-overlay_3": { "inputs": { "flake-utils": [ "nix-boost", @@ -1778,17 +1321,17 @@ "type": "github" } }, - "rust-overlay_8": { + "rust-overlay_4": { "inputs": { - "flake-utils": "flake-utils_15", - "nixpkgs": "nixpkgs_13" + "flake-utils": "flake-utils_10", + "nixpkgs": "nixpkgs_11" }, "locked": { - "lastModified": 1686795910, - "narHash": "sha256-jDa40qRZ0GRQtP9EMZdf+uCbvzuLnJglTUI2JoHfWDc=", + "lastModified": 1686882360, + "narHash": "sha256-6iWVGIdIzmx/CgXPVLPyyxxBhPGYMl8sG09S8hpQ6pc=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "5c2b97c0a9bc5217fc3dfb1555aae0fb756d99f9", + "rev": "b519b1d7a31f1bd35423990398adecc6f7dd4dd2", "type": "github" }, "original": { @@ -1807,7 +1350,7 @@ "blank": "blank", "devshell": "devshell", "dmerge": "dmerge", - "flake-utils": "flake-utils_12", + "flake-utils": "flake-utils_7", "incl": "incl", "makes": [ "nix-boost", @@ -1821,7 +1364,7 @@ ], "n2c": "n2c", "nixago": "nixago", - "nixpkgs": "nixpkgs_9", + "nixpkgs": "nixpkgs_7", "paisano": "paisano", "paisano-mdbook-preprocessor": "paisano-mdbook-preprocessor", "paisano-tui": "paisano-tui", @@ -1901,107 +1444,6 @@ "type": "github" } }, - "systems_5": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_6": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_7": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_8": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "systems_9": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "topiary": { - "inputs": { - "advisory-db": "advisory-db", - "crane": "crane_2", - "flake-utils": "flake-utils_7", - "nix-filter": "nix-filter", - "nixpkgs": [ - "nickel", - "nixpkgs" - ], - "rust-overlay": "rust-overlay_4" - }, - "locked": { - "lastModified": 1686167925, - "narHash": "sha256-2OU00zeoIS2jFBdXKak1Y2txC6IXEP0LsIUKSvr0qbc=", - "owner": "tweag", - "repo": "topiary", - "rev": "61d076c216422af7f865e2ade3bbdb4729e767ef", - "type": "github" - }, - "original": { - "owner": "tweag", - "repo": "topiary", - "type": "github" - } - }, "utils": { "locked": { "lastModified": 1653893745, diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index 5ec6ea5..cdb25ae 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -18,7 +18,8 @@ nixpkgs-latest.url = "github:nixos/nixpkgs"; home-manager = { url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; + # url = "github:pegasust/home-manager/starship-config-type"; + follows = "nixpkgs"; }; flake-utils.url = "github:numtide/flake-utils"; nixgl.url = "path:./../../out-of-tree/nixGL"; @@ -40,7 +41,6 @@ url = "github:mic92/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs"; }; - nickel.url = "github:tweag/nickel"; }; outputs = @@ -51,7 +51,6 @@ , flake-utils , kpcli-py , neovim-nightly-overlay - , nickel , nix-boost , nixpkgs-latest , ... diff --git a/nix-conf/home-manager/overlays.nix b/nix-conf/home-manager/overlays.nix index c873730..59db437 100644 --- a/nix-conf/home-manager/overlays.nix +++ b/nix-conf/home-manager/overlays.nix @@ -3,7 +3,6 @@ flake_input@{ kpcli-py , rust-overlay , neovim-nightly-overlay , system -, nickel , nix-boost , nixpkgs-latest , ... @@ -60,10 +59,6 @@ let rust4normi = nightlyRustWithExts rust-default-components; }); - nickel = (final: prev: { - inherit (flake_input.nickel.packages.${system}) - lsp-nls nickel nickelWasm; - }); vimPlugins = (final: prev: { inherit (nixpkgs-latest.legacyPackages.${system}) vimPlugins; @@ -76,6 +71,5 @@ in neovim-nightly-overlay.overlay rust kpcli-py - nickel vimPlugins ] diff --git a/nix-conf/lib/serde/default.nix b/nix-conf/lib/serde/default.nix index b4c9299..b734f4c 100644 --- a/nix-conf/lib/serde/default.nix +++ b/nix-conf/lib/serde/default.nix @@ -26,5 +26,6 @@ in ( builtins.readFile yamlPath) "any-output.json")); - # TODO: fromToml? + fromTOML = builtins.fromTOML; + fromJSON = builtins.fromJSON; } diff --git a/nix/cells/repo/home-modules.nix b/nix/cells/repo/home-modules.nix deleted file mode 100644 index 73e8273..0000000 --- a/nix/cells/repo/home-modules.nix +++ /dev/null @@ -1,9 +0,0 @@ -{inputs, cell}: { - nerd_font_module = {config, pkgs, ...}: { - fonts.fontconfig.enable = true; - home.packages = [ - (pkgs.nerdfonts.override { fonts = [ "Hack" ]; }) - ]; - base.alacritty.font.family = "Hack Nerd Font Mono"; - }; -} diff --git a/nix/cells/repo/home-modules/default.nix b/nix/cells/repo/home-modules/default.nix new file mode 100644 index 0000000..77286c3 --- /dev/null +++ b/nix/cells/repo/home-modules/default.nix @@ -0,0 +1,241 @@ +# This is an interface for home-profiles and should not contain opinionated +# configurations. It should provide alternative configurations, aggregates +# or new configurations +_imports@{inputs, cell}: let + namespace = "repo"; + imports = _imports // {inherit namespace;}; +in { + git = { config , lib , ... }: let + cfg = config."${namespace}".git; + baseAliases = { + a = "add"; + c = "commit"; + ca = "commit --amend"; + cm = "commit -m"; + lol = "log --graph --decorate --pretty=oneline --abbrev-commit"; + lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all"; + sts = "status"; + co = "checkout"; + b = "branch"; + }; + default-user = "Pegasust"; + default-email = "pegasucksgg@gmail.com"; + in { + options."${namespace}".git = { + aliases = lib.mkOption { + type = lib.types.attrs; + default = { }; + example = baseAliases; + description = '' + Additional git aliases. This settings comes with base configuration. + Redeclaring the base config will override the values. + ''; # TODO: Add baseAliases as string here (builtins.toString doesn't work) + }; + name = lib.mkOption { + type = lib.types.str; + default = default-user; + description = "Git username that appears on commits"; + example = default-user; + }; + email = lib.mkOption { + type = lib.types.str; + default = default-email; + example = default-email; + description = "Git email that appears on commits"; + }; + ignores = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ + ".vscode" # vscode settings + ".direnv" # .envrc cached outputs + ".DS_Store" # MacOS users, amrite + ]; + description = '' + .gitignore patterns that are applied in every "${namespace}"sitory. + This is useful for IDE-specific settings. + ''; + example = [ ".direnv" "node_modules" ]; + }; + enable = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Enables git + ''; + example = false; + }; + credentialCacheTimeoutSeconds = lib.mkOption { + type = lib.types.int; + default = 3000; + description = "Credential cache (in-memory store) for Git in seconds."; + example = 3000; + }; + }; + # TODO : anyway to override configuration? + # idk wtf I was thinking about. there is no context in this question + config.programs.git = { + inherit (cfg) enable ignores; + userName = cfg.name; + userEmail = cfg.email; + aliases = baseAliases // cfg.aliases; + extraConfig = { + # TODO: in the case of darwin, git always open up the built-in keychain. + # possibly something we can't really control since we don't have access to `nix-darwin` + credential.helper = "cache --timeout=${builtins.toString cfg.credentialCacheTimeoutSeconds}"; + }; + lfs.enable = true; + }; + }; + + alacritty = {config, lib}: let + inherit (inputs.cells.repo.lib) fromYAML; + cfg = config."${namespace}".alacritty; + in { + options."${namespace}".alacritty = { + font.family = lib.mkOption { + type = lib.types.nullOr lib.types.singleLineStr; + default = null; + description = '' + The font family for Alacritty + ''; + example = "DroidSansMono NF"; + }; + font.size = lib.mkOption { + type = lib.types.nullOr lib.types.number; + default = null; + description = '' + The default font size for Alacritty. This is probably measured in px. + ''; + example = 7.0; + }; + enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enables alacritty + ''; + example = true; + }; + config-file = lib.mkOption { + type = lib.types.path; + description = "Path to alacritty yaml"; + default = null; + example = "./config/alacritty.yaml"; + }; + }; + config.programs.alacritty = { + enable = cfg.enable; + settings = let ; + actualConfig = if cfg.config-file != null then fromYAML (builtins.readFile cfg.config-file) else {}; + in lib.recursiveUpdate actualConfig { + font.normal.family = opt-toNullable(opt-leftmostSome (builtins.map opt-fromNullable [ + cfg.font.family actualConfig.font.family actualConfig.font.normal.family + ])); + font.size = cfg.font.size or actualConfig.font.size or 7.0; + }; + }; + }; + + # TODO: chromium is not really supported on darwin + private_chromium = { config, pkgs, lib, ... }: let + cfg = config."${namespace}".private_chromium; + in { + options."${namespace}".private_chromium = { + enable = lib.mkOption { + type = lib.types.bool; + default = true; + example = false; + description = '' + Enable extremely lightweight chromium with vimium plugin + ''; + }; + }; + config = lib.mkIf (cfg.enable) { + # home.packages = [pkgs.ungoogled-chromium]; + programs.chromium = { + enable = true; + package = pkgs.ungoogled-chromium; + extensions = + let + # TODO: how about a chrome extension registry? + mkChromiumExtForVersion = browserVersion: { id, sha256, extVersion, ... }: + { + inherit id; + crxPath = builtins.fetchurl { + url = "https://clients2.google.com/service/update2/crx" + + "?response=redirect" + + "&acceptformat=crx2,crx3" + + "&prodversion=${browserVersion}" + + "&x=id%3D${id}%26installsource%3Dondemand%26uc"; + name = "${id}.crx"; + inherit sha256; + }; + version = extVersion; + }; + mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version); + in + [ + # vimium + (mkChromiumExt { + id = "dbepggeogbaibhgnhhndojpepiihcmeb"; + sha256 = "00qhbs41gx71q026xaflgwzzridfw1sx3i9yah45cyawv8q7ziic"; + extVersion = "1.67.4"; + }) + ]; + }; + }; + }; + + darwin-spotlight = { lib, pkgs, config, ... }: { + # This patch exists since Darwin's search bar requires solid apps and not + # symlinked + # TODO: QA + # - [x] works for base case + # - [x] works for repeated case + # - [ ] works after base case, then removed + # - [ ] works for repeated case, then removed + + # Copy GUI apps to "~/Applications/Home Manager Apps" + # Based on this comment: https://github.com/nix-community/home-manager/issues/1341#issuecomment-778820334 + home.activation.patch-spotlight = + if pkgs.stdenv.isDarwin then + let + apps = pkgs.buildEnv { + name = "home-manager-applications"; + paths = config.home.packages; + pathsToLink = "/Applications"; + }; + in + lib.hm.dag.entryAfter [ "linkGeneration" ] '' + # Install MacOS applications to the user environment. + HM_APPS="$HOME/Applications/Home Manager Apps" + # Reset current state + if [ -e "$HM_APPS" ]; then + $DRY_RUN_CMD mv "$HM_APPS" "$HM_APPS.$(date +%Y%m%d%H%M%S)" + fi + $DRY_RUN_CMD mkdir -p "$HM_APPS" + # .app dirs need to be actual directories for Finder to detect them as Apps. + # In the env of Apps we build, the .apps are symlinks. We pass all of them as + # arguments to cp and make it dereference those using -H + $DRY_RUN_CMD cp --archive -H --dereference ${apps}/Applications/* "$HM_APPS" + $DRY_RUN_CMD chmod +w -R "$HM_APPS" + '' + else + ""; + # We need this in case upstream home-manager changes the behavior of linking + # applications + home.activation.remove-patch-spotlight = + if pkgs.stdenv.isDarwin then + lib.hm.dag.entryBefore [ "checkLinkTargets" ] '' + HM_APPS="$HOME/Applications/Home Manager Apps" + # Reset current state + if [ -e "$HM_APPS" ]; then + $DRY_RUN_CMD mv "$HM_APPS" "$HM_APPS.$(date +%Y%m%d%H%M%S)" + fi + '' + else + ""; + }; + +} + diff --git a/nix/cells/repo/home-modules/nixgl.nix b/nix/cells/repo/home-modules/nixgl.nix new file mode 100644 index 0000000..6ee8452 --- /dev/null +++ b/nix/cells/repo/home-modules/nixgl.nix @@ -0,0 +1,40 @@ +{inputs, cell, namespace}: { pkgs, config, lib, ... }: +let + cfg = config."${namespace}".graphics; + cfgEnable = cfg.enable or (cfg.useNixGL.defaultPackage != null); + types = lib.types; +in +{ + imports = [ ./shells.nix ]; + options."${namespace}".nixgl = { + enable = lib.mkEnableOption "nixgl"; + useNixGL = { + package = lib.mkPackageOption pkgs "nixGL package" { + default = [ + "nixgl" + "auto" + "nixGLDefault" + ]; + }; + defaultPackage = lib.mkOption { + type = types.nullOr (types.enum [ "nixGLIntel" "nixGLNvidia" "nixGLNvidiaBumblebee" ]); + description = "Which nixGL package to be aliased as `nixGL` on the shell"; + default = null; + example = "nixGLIntel"; + }; + }; + }; + # NOTE: importing shells does not mean we're enabling everything, if we do mkDefault false + # but the dilemma is, if the user import BOTH graphics.nix and shells.nix + # they will also need to do `config."${namespace}".shells.enable` + # generally, we want the behavior: import means enable + config = lib.mkIf cfgEnable { + "${namespace}".graphics._enable = lib.mkForce true; + "${namespace}".shells = { + shellAliases = lib.mkIf (cfg.useNixGL.defaultPackage != null) { + nixGL = cfg.useNixGL.defaultPackage; + }; + }; + home.packages = [ cfg.useNixGL.package ]; + }; +} diff --git a/nix/cells/repo/home-modules/shells.nix b/nix/cells/repo/home-modules/shells.nix new file mode 100644 index 0000000..e3ed1a2 --- /dev/null +++ b/nix/cells/repo/home-modules/shells.nix @@ -0,0 +1,121 @@ +{inputs, cell, namespace}: { config +, lib +, pkgs +, ... +}: +let cfg = config."${namespace}".shells; +in +{ + options."${namespace}".shells = { + enable = lib.mkOption { + type = lib.types.bool; + description = "Enable umbrella shell configuration"; + default = true; + example = false; + }; + shellInitExtra = lib.mkOption { + type = lib.types.str; + description = "Extra shell init. The syntax should be sh-compliant"; + default = ""; + example = '' + # X11 support for WSL + export DISPLAY=$(ip route list default | awk '{print $3}'):0 + export LIBGL_ALWAYS_INDIRECT=1 + ''; + }; + shellAliases = lib.mkOption { + type = lib.types.attrs; + description = "Shell command aliases"; + default = { }; + example = { + nixGL = "nixGLIntel"; + }; + }; + }; + config = lib.mkIf cfg.enable { + # nix: Propagates the environment with packages and vars when enter (children of) + # a directory with shell.nix-compatible and .envrc + programs.direnv = { + enable = true; + nix-direnv.enable = true; + # nix-direnv.enableFlakes = true; # must remove. this will always be supported. + }; + # z as smarter cd + programs.zoxide = { + enable = true; + enableZshIntegration = true; + }; + programs.tmux = { + enable = true; + # extraConfigBeforePlugin = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"; + plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [ cpu net-speed ]; + extraConfig = (builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"); + }; + xdg.configFile."tmux/tmux.conf".text = lib.mkOrder 600 '' + set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M ' + ''; + # Colored ls + programs.exa = { + enable = true; + enableAliases = true; + }; + # Make the shell look beautiful + programs.starship = { + enable = true; + enableZshIntegration = true; + settings = let + native = builtins.fromTOML (builtins.readFile "${proj_root.config.path}/starship/starship.toml"); + patch-nix = pkgs.lib.recursiveUpdate native ({ + c.commands = [ + ["nix" "run" "nixpkgs#clang" "--" "--version"] + ["nix" "run" "nixpkgs#gcc" "--" "--version"] + ]; + }); + in patch-nix; + }; + # Fuzzy finder. `fzf` for TUI, `fzf -f ''` for UNIX piping + programs.fzf.enable = true; + programs.bash = { + enable = true; + enableCompletion = true; + initExtra = cfg.shellInitExtra or ""; + }; + programs.zsh = { + enable = true; + enableCompletion = true; + enableAutosuggestions = true; + shellAliases = { + nix-rebuild = "sudo nixos-rebuild switch"; + hm-switch = "home-manager switch --flake"; + } // (cfg.shellAliases or { }); + history = { + size = 10000; + path = "${config.xdg.dataHome}/zsh/history"; + }; + oh-my-zsh = { + enable = true; + plugins = [ + "git" # git command aliases: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git#aliases + "command-not-found" # suggests which package to install; does not support nixos (we have solution already) + "gitignore" # `gi list` -> `gi java >>.gitignore` + "ripgrep" # adds completion for `rg` + "rust" # compe for rustc/cargo + "poetry" # compe for poetry - Python's cargo + ]; + }; + sessionVariables = { + # Vim mode on the terminal + # VI_MODE_RESET_PROMPT_ON_MODE_CHANGE = true; + # VI_MODE_SET_CURSOR = true; + # ZVM_VI_ESCAPE_BINDKEY = ""; + ZVM_READKEY_ENGINE = "$ZVM_READKEY_ENGINE_NEX"; + ZVM_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) + ZVM_ESCAPE_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) + }; + initExtra = (cfg.shellInitExtra or "") + '' + source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh + ''; + + }; + }; +} diff --git a/nix/cells/repo/home-profiles/default.nix b/nix/cells/repo/home-profiles/default.nix new file mode 100644 index 0000000..1218017 --- /dev/null +++ b/nix/cells/repo/home-profiles/default.nix @@ -0,0 +1,60 @@ +_imports@{inputs, cell}: let + namespace = "repo"; + imports = _imports // {inherit namespace;}; +in { + neovim = import ./neovim.nix imports; + nerd_font_module = {config, pkgs, ...}: { + imports = [ + import inputs.cells."${namespace}" + ]; + fonts.fontconfig.enable = true; + home.packages = [ + (pkgs.nerdfonts.override { fonts = [ "Hack" ]; }) + ]; + "${namespace}".alacritty.font.family = "Hack Nerd Font Mono"; + }; + + secrets = { + age.secrets.s3fs = { + file = "${inputs.self}/secrets/s3fs.age"; + # mode = "600"; # owner + group only + # owner = "hungtr"; + # group = "users"; + }; + age.secrets."s3fs.digital-garden" = { + file = "${inputs.self}/secrets/s3fs.digital-garden.age"; + }; + age.secrets._nhitrl_cred = { + file = "${inputs.self}/secrets/_nhitrl.age"; + }; + age.secrets."wifi.env" = { + file = "${inputs.self}/secrets/wifi.env.age"; + }; + }; + + ssh = {config, lib, ...}: let cfg = config."${namespace}".ssh; in { + options."${namespace}".ssh.enable = lib.mkOption { + type = lib.types.bool; + default = true; + example = false; + description = '' + Enables SSH + ''; + }; + config.programs.ssh = { + inherit (cfg) enable; + forwardAgent = true; + includes = ["${inputs.self}/native_configs/ssh/config"]; + }; + }; + + alacritty = {config, lib,...}: let cfg = config."${namespace}".alacritty; in { + imports = [ + import "${inputs.cells.repo.home-modules.alacritty}" + ]; + configs."${namespace}".alacritty = { + enable = true; + config-file = "${inputs.self}//native-configs/alacritty/alacritty.yml"; + }; + }; +} diff --git a/nix/cells/repo/home-profiles/neovim.nix b/nix/cells/repo/home-profiles/neovim.nix new file mode 100644 index 0000000..c312876 --- /dev/null +++ b/nix/cells/repo/home-profiles/neovim.nix @@ -0,0 +1,181 @@ +# TODO: vim-plug and Mason supports laziness. Probably worth it to explore incremental dependencies based on the project TODO: just install these things, then symlink to mason's bin directory +# +# One thing to consider, though, /nix/store of `nix-shell` or `nix-develop` +# might be different from `home-manager`'s (~/.nix_profile/bin/jq) +{inputs, cell, namespace}: { pkgs, lib, config, ... }: +let + # NOTE: Add packages to nvim_pkgs instead, so that it's available at userspace + # and is added to the path after wrapping. + # check: nix repl `homeConfigurations.hungtr.config.programs.neovim.finalPackage.buildCommand` + # see: :/--suffix.*PATH + # there should be mentions of additional packages + my_neovim = pkgs.neovim-unwrapped; + rust_pkgs = (pkgs.rust-bin.selectLatestNightlyWith + ( + toolchain: + toolchain.default.override { + extensions = [ "rust-src" "rust-analyzer" "rust-docs" "rustfmt" "clippy" "miri" ]; + } + )); + nvim_pkgs = [ + # pkgs.gccStdenv + pkgs.tree-sitter + pkgs.fzf # file name fuzzy search + pkgs.ripgrep # content fuzzy search + pkgs.zk # Zettelkasten (limited support) + pkgs.fd # Required by a Telescope plugin (?) + pkgs.stdenv.cc.cc.lib + pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo + pkgs.rust4cargo + pkgs.nickel + pkgs.nls + + pkgs.go # doesn't work, Mason installs from runtime path + + # Language-specific stuffs + pkgs.sumneko-lua-language-server + # pkgs.python3Packages.python-lsp-server + pkgs.nodePackages.pyright + pkgs.python3Packages.pylint + pkgs.python3Packages.flake8 + # FIXME: installing ansible from here just doesn't work :/ + # pkgs.ansible-lint + # pkgs.python38Packages.ansible + # pkgs.ansible-language-server + # TODO: the devShell should provide rust-analyzer so that + # cargo test builds binaries compatible with rust-analyzer + + # pkgs.rust-analyzer + # rust_pkgs + # pkgs.evcxr # Rust REPL for Conjure! + ] ++ lib.optionals (pkgs.stdenv.isDarwin) ( + let + inherit (pkgs.darwin.apple_sdk.frameworks) System CoreFoundation; in + [ + System + CoreFoundation + ] + ); +in +{ + options.base.neovim = { + enable = lib.mkOption { + default = true; + description = "enable personalized neovim as default editor"; + type = lib.types.bool; + example = false; + }; + }; + config = lib.mkIf config.base.neovim.enable { + # home-manager + programs.neovim = { + enable = true; + package = my_neovim; + viAlias = true; + vimAlias = true; + withPython3 = true; + withNodeJs = true; + # NOTE: this adds path to the wrapped version of neovim + extraPackages = nvim_pkgs; + extraLuaConfig = (builtins.readFile "${inputs.self}/native_configs/neovim/init.lua"); + plugins = (let inherit (pkgs.vimPlugins) + plenary-nvim + + nvim-treesitter + nvim-treesitter-textobjects + nvim-treesitter-context + + telescope-fzf-native-nvim + telescope-file-browser-nvim + telescope-nvim + + nvim-lspconfig + + gruvbox-community + + neodev-nvim + + cmp-nvim-lsp + cmp-path + cmp-buffer + cmp-cmdline + nvim-cmp + + lspkind-nvim + nvim-autopairs + nvim-ts-autotag + guess-indent-nvim + harpoon + zk-nvim + luasnip + fidget-nvim + rust-tools-nvim + + cmp_luasnip + gitsigns-nvim + indent-blankline-nvim + lualine-nvim + mason-lspconfig-nvim + mason-nvim + neogit + nlua-nvim + nvim-jqx + nvim-surround + nvim-web-devicons + playground + todo-comments-nvim + trouble-nvim + vim-dispatch + vim-dispatch-neovim + vim-fugitive + vim-jack-in + + ; in [ + plenary-nvim + nvim-treesitter.withAllGrammars + nvim-treesitter-textobjects + telescope-fzf-native-nvim + telescope-file-browser-nvim + telescope-nvim + nvim-lspconfig + gruvbox-community + neodev-nvim + cmp-nvim-lsp + cmp-path + cmp-buffer + cmp-cmdline + nvim-cmp + lspkind-nvim + nvim-autopairs + nvim-ts-autotag + guess-indent-nvim + harpoon + zk-nvim + luasnip + nvim-treesitter-context + fidget-nvim + rust-tools-nvim + + cmp_luasnip + gitsigns-nvim + indent-blankline-nvim + lualine-nvim + mason-lspconfig-nvim + mason-nvim + neogit + nlua-nvim + nvim-jqx + nvim-surround + nvim-web-devicons + playground + todo-comments-nvim + trouble-nvim + vim-dispatch + vim-dispatch-neovim + vim-fugitive + vim-jack-in + ]); + }; + # home.packages = nvim_pkgs; + }; +} diff --git a/nix/cells/repo/lib/default.nix b/nix/cells/repo/lib/default.nix new file mode 100644 index 0000000..01aca6d --- /dev/null +++ b/nix/cells/repo/lib/default.nix @@ -0,0 +1,35 @@ +{inputs, cell}: let + namespace = "repo"; + + + yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand + outputPath { inherit yamlContent; nativeBuildInputs = [ pkgs.yq ]; } + # run yq which outputs '.' (no filter) on file at yamlPath + # note that $out is passed onto the bash/sh script for execution + '' + echo "$yamlContent" | yq >$out + '') + { }); +in { + fromYAML = yamlContent: bulitins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json")); + + # ctor + opt-some = a: [a]; + opt-none = []; + opt-none_thunk = _: []; + + # from-to null + opt-fromNullable = nullable: if nullable == null then [] else [nullable]; + opt-toNullable = opt-fork (a:a) (_: null); + + opt-map = builtins.map; + opt-filter = builtins.filter; + opt-fork = on_some: on_none: opt: if opt == [] then (on_none null) else (on_some (builtins.elemAt opt 0)); + + opt-unwrap = opt-fork (a:a) (_: throw "opt-unwrap: expected some, got none"); + opt-unwrapOrElse = opt-fork (a:a); + opt-unwrapOr = fallback_val: opt-fork (a:a) (_: fallback_val); + + opt-orElse = opt: fallback_opt: opt-fork (opt-some) (opt-none_thunk) (opt ++ fallback_opt); + opt-leftmostSome = opts: builtins.foldl' (opt-orElse) [] opts; +} From e7efe1a965e6bb9280c64dd3c97d8303bf2c4909 Mon Sep 17 00:00:00 2001 From: Hung Date: Sat, 17 Jun 2023 17:46:31 -0700 Subject: [PATCH 59/64] format with alejandra and other things --- default.nix | 12 +- dev-shell.nix | 17 +- flake.lock | 6 +- flake.nix | 30 +- hosts/Felia/hardware-configuration.nix | 47 +- hosts/bao/default.nix | 24 +- hosts/bao/hardware-configuration.nix | 25 +- hosts/default.nix | 120 ++--- hosts/homeless/hardware-configuration.nix | 37 +- hosts/lester/hardware-configuration.nix | 37 +- hosts/lizzi/default.nix | 23 +- hosts/lizzi/hardware-configuration.nix | 28 +- hosts/nyx/hardware-configuration.nix | 37 +- modules/amdgpu.sys.nix | 6 +- modules/base.sys.nix | 12 +- modules/default.nix | 2 +- modules/gpu.sys.nix | 6 +- modules/kde.sys.nix | 26 +- modules/minimal.sys.nix | 13 +- modules/mosh.sys.nix | 21 +- modules/nvgpu.sys.nix | 6 +- modules/opengl.sys.nix | 20 +- modules/secrets.nix | 4 +- modules/storage.perso.sys.nix | 161 +++--- modules/tailscale.sys.nix | 25 +- modules/wifi.sys.nix | 2 +- native_configs/README.md | 5 + native_configs/neovim/init.lua | 23 + nix-conf/home-manager/base/alacritty.nix | 90 ++-- .../home-manager/base/darwin-spotlight.nix | 39 +- nix-conf/home-manager/base/default.nix | 4 +- nix-conf/home-manager/base/git.nix | 17 +- nix-conf/home-manager/base/graphics.nix | 17 +- nix-conf/home-manager/base/keepass.nix | 32 +- nix-conf/home-manager/base/mkModuleArgs.nix | 32 +- nix-conf/home-manager/base/neovim.nix | 216 ++++---- .../home-manager/base/private_chromium.nix | 67 +-- .../home-manager/base/productive_desktop.nix | 6 +- nix-conf/home-manager/base/shells.nix | 50 +- nix-conf/home-manager/base/ssh.nix | 15 +- nix-conf/home-manager/default.nix | 12 +- nix-conf/home-manager/flake.lock | 18 +- nix-conf/home-manager/flake.nix | 244 ++++----- nix-conf/home-manager/home.nix | 76 +-- nix-conf/home-manager/overlays.nix | 60 ++- nix-conf/home-manager/profiles/default.nix | 5 +- nix-conf/lib/default.nix | 20 +- nix-conf/lib/serde/default.nix | 37 +- nix-conf/pkgs/default.nix | 11 +- nix-conf/pkgs/flake.nix | 14 +- nix-conf/secrets.nix | 10 +- nix-conf/system/configuration.nix | 112 +++-- nix-conf/system/flake.nix | 466 ++++++++++-------- nix-conf/system/hardware-configuration.nix | 37 +- nix-conf/system/nixos-wsl/default.nix | 11 +- nix-conf/system/nixos-wsl/flake.nix | 43 +- .../nixos-wsl/modules/build-tarball.nix | 31 +- .../nixos-wsl/modules/docker-desktop.nix | 25 +- .../nixos-wsl/modules/docker-native.nix | 20 +- .../system/nixos-wsl/modules/installer.nix | 54 +- nix-conf/system/nixos-wsl/modules/interop.nix | 92 ++-- .../system/nixos-wsl/modules/wsl-distro.nix | 88 ++-- nix-conf/system/nixos-wsl/syschdemd.nix | 18 +- .../profiles/Felia/hardware-configuration.nix | 47 +- .../profiles/bao/hardware-configuration.nix | 25 +- .../homeless/hardware-configuration.nix | 37 +- .../lester/hardware-configuration.nix | 37 +- .../profiles/lizzi/hardware-configuration.nix | 28 +- .../profiles/nyx/hardware-configuration.nix | 37 +- nix-conf/system/wsl-configuration.nix | 11 +- nix/cells/dotfiles/devshells.nix | 6 +- nix/cells/home-configs/default.nix | 6 + nix/cells/packages/default.nix | 5 + nix/cells/repo/home-modules/default.nix | 12 +- nix/cells/repo/home-modules/nixgl.nix | 21 +- nix/cells/repo/home-profiles/default.nix | 100 +++- nix/cells/repo/home-profiles/neovim.nix | 208 ++++---- .../shells.nix | 55 ++- nix/cells/repo/lib/default.nix | 1 + nix/cells/repo/userShells.nix | 5 +- out-of-tree/flake-compat/default.nix | 392 +++++++++------ out-of-tree/nixGL/all.nix | 16 +- out-of-tree/nixGL/default.nix | 53 +- out-of-tree/nixGL/flake.nix | 75 +-- out-of-tree/nixGL/nixGL.nix | 441 +++++++++-------- out-of-tree/nixGL/nixpkgs.nix | 8 +- secrets.nix | 39 +- secrets/default.nix | 12 +- shell.nix | 15 +- templates/default.nix | 7 +- templates/py-poetry/default.nix | 3 +- templates/py-poetry/flake.nix | 49 +- templates/py-poetry/shell.nix | 3 +- templates/rust-monorepo/default.nix | 3 +- templates/rust-monorepo/flake.nix | 38 +- templates/rust-monorepo/shell.nix | 3 +- templates/rust/default.nix | 3 +- templates/rust/flake.nix | 38 +- templates/rust/shell.nix | 3 +- templates/ts/turborepo/flake.nix | 89 ++-- users/default.nix | 10 +- 101 files changed, 2630 insertions(+), 2175 deletions(-) create mode 100644 nix/cells/home-configs/default.nix create mode 100644 nix/cells/packages/default.nix rename nix/cells/repo/{home-modules => home-profiles}/shells.nix (79%) diff --git a/default.nix b/default.nix index c5e301c..72e93e4 100644 --- a/default.nix +++ b/default.nix @@ -1,11 +1,13 @@ # We use top-level nix-flake, so default.nix is basically just a wrapper around ./flake.nix -(import +( + import ( - let + let lock = builtins.fromJSON (builtins.readFile ./flake.lock); c_ = import ./c_.nix; in - c_.fetchTree lock.nodes.flake-compat.locked + c_.fetchTree lock.nodes.flake-compat.locked ) - { src = ./.; } -).defaultNix + {src = ./.;} +) +.defaultNix diff --git a/dev-shell.nix b/dev-shell.nix index b94d9fc..399143e 100644 --- a/dev-shell.nix +++ b/dev-shell.nix @@ -1,13 +1,15 @@ -# Ideally, this should contain the barebone necessary for building/interacting +# Ideally, this should contain the barebone necessary for building/interacting # with tech used in this project # # Should also incorporate shortcuts like scripts/{hm-switch,conf-sysnix}.sh in here instead # # It should not contain PDE -{ pkgs ? import { } -, lib -, ... -}: pkgs.mkShell { +{ + pkgs ? import {}, + lib, + ... +}: +pkgs.mkShell { # mkShell doesn't care about the differences across nativeBuildInputs, # buildInputs, or packages buildInputs = [ @@ -20,10 +22,9 @@ ]; shellHook = '' - # Since we need late dispatch of ~, we have to put this in shellHook. - export SOPS_AGE_KEY_FILE=~/.config/sops/age/keys.txt + # Since we need late dispatch of ~, we have to put this in shellHook. + export SOPS_AGE_KEY_FILE=~/.config/sops/age/keys.txt ''; # env vars lol = "hello world"; } - diff --git a/flake.lock b/flake.lock index 2a7e5b3..52a579a 100644 --- a/flake.lock +++ b/flake.lock @@ -429,11 +429,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1686869522, - "narHash": "sha256-tbJ9B8WLCTnVP/LwESRlg0dII6Zyg2LmUU/mB9Lu98E=", + "lastModified": 1686960236, + "narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7c67f006ea0e7d0265f16d7df07cc076fdffd91f", + "rev": "04af42f3b31dba0ef742d254456dc4c14eedac86", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a20d8cf..f447ce7 100644 --- a/flake.nix +++ b/flake.nix @@ -9,10 +9,11 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; deploy-rs.url = "github:serokell/deploy-rs"; std.url = "github:divnix/std"; - hive.url = "github:divnix/hive"; + rust-overlay = "github:oxalica/rust-overlay.git"; }; - outputs = { std, hive, ... }@inputs: std.growOn + outputs = {std, ...} @ inputs: + std.growOn { # boilerplate inherit inputs; @@ -21,22 +22,23 @@ cellsFrom = ./nix/cells; # modules = ./nix/modules; - cellBlocks = - let - inherit (std.blockTypes) devshells functions; - in - [ - (devshells "devshells") - (devshells "userShells") - # (functions "host_profile") - # (functions "home_profile") - - ]; + cellBlocks = let + inherit (std.blockTypes) devshells functions; + in [ + (devshells "devshells") + (devshells "userShells") + (functions "home-profiles") + (functions "home-modules") + ]; } { - devShells = std.harvest [ [ "dotfiles" "devshells" ] ]; + devShells = std.harvest [["dotfiles" "devshells"]]; # nixosConfigurations = std.pick [ [ "dotfiles" "nixos" ] ]; # homeConfigurations = std.pick [ [ "dotfiles" "home" ] ]; homeModules = std.pick [["repo" "home-modules"]]; + + # TODO: Debug only + homeProfiles = std.pick [["repo" "home-profiles"]]; + packages = std.harvest [["repo" "home-configs"]]; }; } diff --git a/hosts/Felia/hardware-configuration.nix b/hosts/Felia/hardware-configuration.nix index 97c93fb..245f91b 100644 --- a/hosts/Felia/hardware-configuration.nix +++ b/hosts/Felia/hardware-configuration.nix @@ -1,15 +1,19 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = [ ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = []; - boot.initrd.availableKernelModules = [ ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = []; + boot.initrd.kernelModules = []; + boot.kernelModules = []; + boot.extraModulePackages = []; ## NOTE: These filesystems are mounted by a wrapper script from nix-wsl @@ -43,25 +47,22 @@ # fsType = "drvfs"; # }; - fileSystems."/mnt/c" = - { - device = "C:"; - fsType = "drvfs"; - }; + fileSystems."/mnt/c" = { + device = "C:"; + fsType = "drvfs"; + }; - fileSystems."/mnt/d" = - { - device = "D:"; - fsType = "drvfs"; - }; + fileSystems."/mnt/d" = { + device = "D:"; + fsType = "drvfs"; + }; - fileSystems."/mnt/f" = - { - device = "F:"; - fsType = "drvfs"; - }; + fileSystems."/mnt/f" = { + device = "F:"; + fsType = "drvfs"; + }; - swapDevices = [ ]; + swapDevices = []; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/bao/default.nix b/hosts/bao/default.nix index 6559c04..e4a829b 100644 --- a/hosts/bao/default.nix +++ b/hosts/bao/default.nix @@ -1,12 +1,12 @@ -{ nixpkgs -, agenix -, home-manager -, flake-utils -, nixgl -, rust-overlay -, flake-compat -, pkgs -, lib -, proj_root -}: { } - +{ + nixpkgs, + agenix, + home-manager, + flake-utils, + nixgl, + rust-overlay, + flake-compat, + pkgs, + lib, + proj_root, +}: {} diff --git a/hosts/bao/hardware-configuration.nix b/hosts/bao/hardware-configuration.nix index fb30806..e952c18 100644 --- a/hosts/bao/hardware-configuration.nix +++ b/hosts/bao/hardware-configuration.nix @@ -1,20 +1,23 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; boot.loader.systemd-boot.enable = true; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; # boot.initrd.kernelModules = [ "amdgpu" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" "coretemp" ]; - boot.extraModulePackages = [ ]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd" "coretemp"]; + boot.extraModulePackages = []; fileSystems."/" = # Might be wise to use /dev/nvme0p1 instead @@ -30,7 +33,7 @@ fsType = "vfat"; }; - swapDevices = [ ]; + swapDevices = []; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/default.nix b/hosts/default.nix index b1e6771..c2dd7b1 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,18 +1,18 @@ -{ nixpkgs -, agenix -, home-manager -, flake-utils -, nixgl -, rust-overlay -, flake-compat -, pkgs -, lib -, proj_root -, nixosDefaultVersion ? "22.05" -, defaultSystem ? "x86_64-linux" -, ... -}@finalInputs: -let +{ + nixpkgs, + agenix, + home-manager, + flake-utils, + nixgl, + rust-overlay, + flake-compat, + pkgs, + lib, + proj_root, + nixosDefaultVersion ? "22.05", + defaultSystem ? "x86_64-linux", + ... +} @ finalInputs: let config = { bao.metadata = { # req @@ -33,54 +33,58 @@ let ]; }; }; - propagate = hostConfig@{ metadata, nixosConfig }: - let - # req - inherit (metadata) hostName; - # opts - ssh_pubkey = lib.attrByPath [ "ssh_pubkey" ] null metadata; # metadata.ssh_pubkey??undefined - users = lib.attrByPath [ "users" ] { } metadata; - nixosVersion = lib.attrByPath [ "nixosVersion" ] nixosDefaultVersion metadata; - system = lib.attrByPath [ "system" ] defaultSystem metadata; - preset = lib.attrByPath [ "preset" ] "base" metadata; - # infer - hardwareConfig = import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix"; - # alias to prevent infinite recursion - _nixosConfig = nixosConfig; - in - { - inherit hostName ssh_pubkey users nixosVersion system preset hardwareConfig; - nixosConfig = _nixosConfig // { + propagate = hostConfig @ { + metadata, + nixosConfig, + }: let + # req + inherit (metadata) hostName; + # opts + ssh_pubkey = lib.attrByPath ["ssh_pubkey"] null metadata; # metadata.ssh_pubkey??undefined + users = lib.attrByPath ["users"] {} metadata; + nixosVersion = lib.attrByPath ["nixosVersion"] nixosDefaultVersion metadata; + system = lib.attrByPath ["system"] defaultSystem metadata; + preset = lib.attrByPath ["preset"] "base" metadata; + # infer + hardwareConfig = import "${proj_root.hosts.path}/${hostName}/hardware-configuration.nix"; + # alias to prevent infinite recursion + _nixosConfig = nixosConfig; + in { + inherit hostName ssh_pubkey users nixosVersion system preset hardwareConfig; + nixosConfig = + _nixosConfig + // { inherit system; - modules = [ - { - config._module.args = { - inherit proj_root; - my-lib = finalInputs.lib; - }; - } - hardwareConfig - { - system.stateVersion = nixosVersion; - networking.hostName = hostName; - users.users = users; - } - { - imports = [ agenix.nixosModule ]; - environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ]; - } - (import "${proj_root.modules.path}/secrets.nix") - (import "${proj_root.modules.path}/${preset}.sys.nix") - ] ++ _nixosConfig.modules; + modules = + [ + { + config._module.args = { + inherit proj_root; + my-lib = finalInputs.lib; + }; + } + hardwareConfig + { + system.stateVersion = nixosVersion; + networking.hostName = hostName; + users.users = users; + } + { + imports = [agenix.nixosModule]; + environment.systemPackages = [agenix.defaultPackage.x86_64-linux]; + } + (import "${proj_root.modules.path}/secrets.nix") + (import "${proj_root.modules.path}/${preset}.sys.nix") + ] + ++ _nixosConfig.modules; }; - }; + }; # we are blessed by the fact that we engulfed nixpkgs.lib.* at top level - mkHostFromPropagated = propagatedHostConfig@{ nixosConfig, ... }: nixpkgs.lib.nixosSystem nixosConfig; - mkHost = hostConfig: (lib.pipe [ propagate mkHostFromPropagated ] hostConfig); + mkHostFromPropagated = propagatedHostConfig @ {nixosConfig, ...}: nixpkgs.lib.nixosSystem nixosConfig; + mkHost = hostConfig: (lib.pipe [propagate mkHostFromPropagated] hostConfig); trimNull = lib.filterAttrsRecursive (name: value: value != null); flattenPubkey = lib.mapAttrs (hostName: meta_config: meta_config.metadata.ssh_pubkey); -in -{ +in { nixosConfigurations = lib.mapAttrs (name: hostConfig: mkHost hostConfig) config; # {bao = "ssh-ed25519 ..."; another_host = "ssh-rsa ...";} pubKeys = lib.getPubkey config; diff --git a/hosts/homeless/hardware-configuration.nix b/hosts/homeless/hardware-configuration.nix index e45b92a..e37389b 100644 --- a/hosts/homeless/hardware-configuration.nix +++ b/hosts/homeless/hardware-configuration.nix @@ -1,17 +1,20 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelParams = [ "console=ttyS0,19200n8" ]; + boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelParams = ["console=ttyS0,19200n8"]; boot.loader.grub.extraConfig = '' serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1 terminal_input serial; @@ -20,17 +23,15 @@ boot.loader.grub.forceInstall = true; boot.loader.grub.device = "nodev"; boot.loader.timeout = 10; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.kernelModules = []; + boot.extraModulePackages = []; - fileSystems."/" = - { - device = "/dev/sda"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/sda"; + fsType = "ext4"; + }; - swapDevices = - [{ device = "/dev/sdb"; }]; + swapDevices = [{device = "/dev/sdb";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/lester/hardware-configuration.nix b/hosts/lester/hardware-configuration.nix index e45b92a..e37389b 100644 --- a/hosts/lester/hardware-configuration.nix +++ b/hosts/lester/hardware-configuration.nix @@ -1,17 +1,20 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelParams = [ "console=ttyS0,19200n8" ]; + boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelParams = ["console=ttyS0,19200n8"]; boot.loader.grub.extraConfig = '' serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1 terminal_input serial; @@ -20,17 +23,15 @@ boot.loader.grub.forceInstall = true; boot.loader.grub.device = "nodev"; boot.loader.timeout = 10; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.kernelModules = []; + boot.extraModulePackages = []; - fileSystems."/" = - { - device = "/dev/sda"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/sda"; + fsType = "ext4"; + }; - swapDevices = - [{ device = "/dev/sdb"; }]; + swapDevices = [{device = "/dev/sdb";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/lizzi/default.nix b/hosts/lizzi/default.nix index 9596da8..e4a829b 100644 --- a/hosts/lizzi/default.nix +++ b/hosts/lizzi/default.nix @@ -1,11 +1,12 @@ -{ nixpkgs -, agenix -, home-manager -, flake-utils -, nixgl -, rust-overlay -, flake-compat -, pkgs -, lib -, proj_root -}: { } +{ + nixpkgs, + agenix, + home-manager, + flake-utils, + nixgl, + rust-overlay, + flake-compat, + pkgs, + lib, + proj_root, +}: {} diff --git a/hosts/lizzi/hardware-configuration.nix b/hosts/lizzi/hardware-configuration.nix index 5fa1db1..4078d1c 100644 --- a/hosts/lizzi/hardware-configuration.nix +++ b/hosts/lizzi/hardware-configuration.nix @@ -1,17 +1,20 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelParams = [ "console=ttyS0,19200n8" ]; + boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelParams = ["console=ttyS0,19200n8"]; boot.loader.grub.extraConfig = '' serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1 terminal_input serial; @@ -20,8 +23,8 @@ boot.loader.grub.forceInstall = true; boot.loader.grub.device = "nodev"; boot.loader.timeout = 10; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.kernelModules = []; + boot.extraModulePackages = []; fileSystems = { "/" = { @@ -35,8 +38,7 @@ }; }; - swapDevices = - [{ device = "/dev/sdb"; }]; + swapDevices = [{device = "/dev/sdb";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/hosts/nyx/hardware-configuration.nix b/hosts/nyx/hardware-configuration.nix index 88ffe66..4a88873 100644 --- a/hosts/nyx/hardware-configuration.nix +++ b/hosts/nyx/hardware-configuration.nix @@ -1,20 +1,23 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = []; + boot.extraModulePackages = []; - boot.kernelParams = [ "console=ttyS0,19200n8" ]; + boot.kernelParams = ["console=ttyS0,19200n8"]; boot.loader.grub.extraConfig = '' serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1 terminal_input serial; @@ -23,14 +26,12 @@ boot.loader.grub.forceInstall = true; boot.loader.grub.device = "nodev"; boot.loader.timeout = 10; - fileSystems."/" = - { - device = "/dev/sda"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/sda"; + fsType = "ext4"; + }; - swapDevices = - [{ device = "/dev/sdb"; }]; + swapDevices = [{device = "/dev/sdb";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/modules/amdgpu.sys.nix b/modules/amdgpu.sys.nix index d07dc1f..b4cf6be 100644 --- a/modules/amdgpu.sys.nix +++ b/modules/amdgpu.sys.nix @@ -1,6 +1,6 @@ { - imports = [ ./gpu.sys.nix ]; - boot.initrd.kernelModules = [ "amdgpu" ]; + imports = [./gpu.sys.nix]; + boot.initrd.kernelModules = ["amdgpu"]; services.xserver.enable = true; - services.xserver.videoDrivers = [ "amdgpu" ]; + services.xserver.videoDrivers = ["amdgpu"]; } diff --git a/modules/base.sys.nix b/modules/base.sys.nix index 8bc5c8a..9965573 100644 --- a/modules/base.sys.nix +++ b/modules/base.sys.nix @@ -1,7 +1,8 @@ -{ pkgs -, lib -, proj_root -, ... +{ + pkgs, + lib, + proj_root, + ... }: { imports = [ ./minimal.sys.nix @@ -9,7 +10,6 @@ ./tailscale.sys.nix ./ssh.sys.nix ]; - environment.systemPackages = [ pkgs.lm_sensors ]; + environment.systemPackages = [pkgs.lm_sensors]; time.timeZone = "America/Phoenix"; - } diff --git a/modules/default.nix b/modules/default.nix index be9a414..9fe8c60 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1 +1 @@ -inputs: { } +inputs: {} diff --git a/modules/gpu.sys.nix b/modules/gpu.sys.nix index 40a94e5..a98300b 100644 --- a/modules/gpu.sys.nix +++ b/modules/gpu.sys.nix @@ -1,8 +1,8 @@ -{ pkgs, ... }: { - environment.systemPackages = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ]; +{pkgs, ...}: { + environment.systemPackages = [pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools]; hardware.opengl = { enable = true; - extraPackages = [ pkgs.rocm-opencl-icd pkgs.rocm-opencl-runtime ]; + extraPackages = [pkgs.rocm-opencl-icd pkgs.rocm-opencl-runtime]; # Vulkan driSupport = true; driSupport32Bit = true; diff --git a/modules/kde.sys.nix b/modules/kde.sys.nix index e5b427f..8dca40a 100644 --- a/modules/kde.sys.nix +++ b/modules/kde.sys.nix @@ -1,6 +1,7 @@ -{ pkgs -, my-lib -, ... +{ + pkgs, + my-lib, + ... }: { environment.noXlibs = my-lib.mkForce false; # TODO: wireless networking @@ -11,15 +12,16 @@ services.xserver.displayManager.sddm.enable = true; services.xserver.desktopManager.plasma5 = { enable = true; - excludePackages = let plasma5 = pkgs.libsForQt5; in - [ - plasma5.elisa # audio viewer - plasma5.konsole # I use alacritty instaed - plasma5.plasma-browser-integration - plasma5.print-manager # will enable if I need - plasma5.khelpcenter # why not just write manpages instead :( - # plasma5.ksshaskpass # pls just put prompts on my dear terminal - ]; + excludePackages = let + plasma5 = pkgs.libsForQt5; + in [ + plasma5.elisa # audio viewer + plasma5.konsole # I use alacritty instaed + plasma5.plasma-browser-integration + plasma5.print-manager # will enable if I need + plasma5.khelpcenter # why not just write manpages instead :( + # plasma5.ksshaskpass # pls just put prompts on my dear terminal + ]; }; # disables KDE's setting of askpassword diff --git a/modules/minimal.sys.nix b/modules/minimal.sys.nix index da0b92c..bad84aa 100644 --- a/modules/minimal.sys.nix +++ b/modules/minimal.sys.nix @@ -1,10 +1,11 @@ -{ pkgs -, lib -, proj_root -, modulesPath -, ... +{ + pkgs, + lib, + proj_root, + modulesPath, + ... }: { - imports = [ "${modulesPath}/profiles/minimal.nix" ]; + imports = ["${modulesPath}/profiles/minimal.nix"]; # prune old builds after a while nix.settings.auto-optimise-store = true; nix.package = pkgs.nixFlakes; # nix flakes diff --git a/modules/mosh.sys.nix b/modules/mosh.sys.nix index 33571cd..89a2727 100644 --- a/modules/mosh.sys.nix +++ b/modules/mosh.sys.nix @@ -1,10 +1,11 @@ -{ pkgs -, lib -, config -, ... -}: -let cfg = config.mod.mosh; in { + pkgs, + lib, + config, + ... +}: let + cfg = config.mod.mosh; +in { options.mod.mosh = { enable = lib.mkOption { type = lib.types.bool; @@ -14,12 +15,14 @@ let cfg = config.mod.mosh; in }; }; config = lib.mkIf cfg.enable { - environment.systemPackages = [ pkgs.mosh ]; + environment.systemPackages = [pkgs.mosh]; networking.firewall = lib.mkIf config.networking.firewall.enable { allowedUDPPortRanges = [ - { from = 60000; to = 61000; } # mosh + { + from = 60000; + to = 61000; + } # mosh ]; }; }; } - diff --git a/modules/nvgpu.sys.nix b/modules/nvgpu.sys.nix index 4b6d3e7..e7f97cb 100644 --- a/modules/nvgpu.sys.nix +++ b/modules/nvgpu.sys.nix @@ -1,7 +1,7 @@ -{ config, ... }: { - imports = [ ./gpu.sys.nix ]; +{config, ...}: { + imports = [./gpu.sys.nix]; nixpkgs.config.allowUnfree = true; services.xserver.enable = true; - services.xserver.videoDrivers = [ "nvidia" ]; + services.xserver.videoDrivers = ["nvidia"]; hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; } diff --git a/modules/opengl.sys.nix b/modules/opengl.sys.nix index 42788f0..1a59513 100644 --- a/modules/opengl.sys.nix +++ b/modules/opengl.sys.nix @@ -1,15 +1,16 @@ -{ config, pkgs, lib }: -let - gpu_pkgs = [ pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools ]; +{ + config, + pkgs, + lib, +}: let + gpu_pkgs = [pkgs.clinfo pkgs.lshw pkgs.glxinfo pkgs.pciutils pkgs.vulkan-tools]; gpu_conf = { # openCL hardware.opengl = { enable = true; - extraPackages = - let - inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime; - in - [ rocm-opencl-icd rocm-opencl-runtime ]; + extraPackages = let + inherit (pkgs) rocm-opencl-icd rocm-opencl-runtime; + in [rocm-opencl-icd rocm-opencl-runtime]; # Vulkan driSupport = true; driSupport32Bit = true; @@ -18,4 +19,5 @@ let }; environment.systemPackages = gpu_pkgs; }; -in gpu_conf +in + gpu_conf diff --git a/modules/secrets.nix b/modules/secrets.nix index d491da3..ca3d586 100644 --- a/modules/secrets.nix +++ b/modules/secrets.nix @@ -1,6 +1,4 @@ -{ proj_root -, ... -}: { +{proj_root, ...}: { age.secrets.s3fs = { file = "${proj_root.secrets.path}/s3fs.age"; # mode = "600"; # owner + group only diff --git a/modules/storage.perso.sys.nix b/modules/storage.perso.sys.nix index ab8ac44..23096ee 100644 --- a/modules/storage.perso.sys.nix +++ b/modules/storage.perso.sys.nix @@ -1,5 +1,10 @@ # Personal configuration on storage solution -{ pkgs, config, lib, ... }: { +{ + pkgs, + config, + lib, + ... +}: { environment.systemPackages = [ pkgs.s3fs pkgs.cifs-utils @@ -9,87 +14,81 @@ # HACK: need to store secret somewhere so that root can access this # because autofs may run as root for now, we enforce putting the secret in this monorepo # TODO: make this configuration nix-less to show that it's 100% data - services.autofs = - let - # confToBackendArg {lol="what"; empty=""; name_only=null;} -> "lol=what,empty=,name_only" - # TODO: change null -> true/false. This allows overriding & better self-documentation - confToBackendArg = conf: (lib.concatStringsSep "," - (lib.mapAttrsToList (name: value: "${name}${lib.optionalString (value != null) "=${value}"}") conf)); + services.autofs = let + # confToBackendArg {lol="what"; empty=""; name_only=null;} -> "lol=what,empty=,name_only" + # TODO: change null -> true/false. This allows overriding & better self-documentation + confToBackendArg = conf: (lib.concatStringsSep "," + (lib.mapAttrsToList (name: value: "${name}${lib.optionalString (value != null) "=${value}"}") conf)); - # mount_dest: path ("wow") - # backend_args: nix attrs representing the arguments to be passed to s3fs - # ({"-fstype" = "fuse"; "use_cache" = "/tmp";}) - # bucket: bucket name (hungtr-hot) - # NOTE: s3 custom provider will be provided inside - # backend_args, so just put the bucket name here - # - #-> "${mount_dest} ${formatted_args} ${s3fs-bin}#${bucket}" - autofs-s3fs_entry = - { mount_dest - , backend_args ? { "-fstype" = "fuse"; } - , bucket - }@inputs: + # mount_dest: path ("wow") + # backend_args: nix attrs representing the arguments to be passed to s3fs + # ({"-fstype" = "fuse"; "use_cache" = "/tmp";}) + # bucket: bucket name (hungtr-hot) + # NOTE: s3 custom provider will be provided inside + # backend_args, so just put the bucket name here + # + #-> "${mount_dest} ${formatted_args} ${s3fs-bin}#${bucket}" + autofs-s3fs_entry = { + mount_dest, + backend_args ? {"-fstype" = "fuse";}, + bucket, + } @ inputs: let + s3fs-exec = "${pkgs.s3fs}/bin/s3fs"; + in "${mount_dest} ${confToBackendArg backend_args} :${s3fs-exec}\#${bucket}"; + personalStorage = [ + (autofs-s3fs_entry { + mount_dest = "garden"; + backend_args = { + "-fstype" = "fuse"; + use_cache = "/tmp"; + del_cache = null; + allow_other = null; + url = "https://v5h5.la11.idrivee2-14.com"; + passwd_file = config.age.secrets."s3fs.digital-garden".path; + dbglevel = "debug"; # enable this for better debugging info in journalctl + uid = "1000"; # default user + gid = "100"; # users + umask = "003"; # others read only, fully shared for users group + }; + bucket = "digital-garden"; + }) + ( let - s3fs-exec = "${pkgs.s3fs}/bin/s3fs"; - in - "${mount_dest} ${confToBackendArg backend_args} :${s3fs-exec}\#${bucket}"; - personalStorage = [ - (autofs-s3fs_entry { - mount_dest = "garden"; - backend_args = { - "-fstype" = "fuse"; - use_cache = "/tmp"; - del_cache = null; - allow_other = null; - url = "https://v5h5.la11.idrivee2-14.com"; - passwd_file = config.age.secrets."s3fs.digital-garden".path; - dbglevel = "debug"; # enable this for better debugging info in journalctl - uid = "1000"; # default user - gid = "100"; # users - umask = "003"; # others read only, fully shared for users group + args = { + "-fstype" = "cifs"; + credentials = config.age.secrets._nhitrl_cred.path; + user = null; + uid = "1001"; + gid = "100"; + dir_mode = "0777"; + file_mode = "0777"; }; - bucket = "digital-garden"; - }) - ( - let - args = { - "-fstype" = "cifs"; - credentials = config.age.secrets._nhitrl_cred.path; - user = null; - uid = "1001"; - gid = "100"; - dir_mode = "0777"; - file_mode = "0777"; - }; - in - "felia_d ${confToBackendArg args} ://felia.coati-celsius.ts.net/d" - ) - ( - let - args = { - "-fstype" = "cifs"; - credentials = config.age.secrets._nhitrl_cred.path; - user = null; - uid = "1001"; - gid = "100"; - dir_mode = "0777"; - file_mode = "0777"; - }; - in - "felia_f ${confToBackendArg args} ://felia.coati-celsius.ts.net/f" - ) - ]; - persoConf = pkgs.writeText "auto.personal" (builtins.concatStringsSep "\n" personalStorage); - in - { - enable = true; - # Creates /perso directory with every subdirectory declared by ${personalStorage} - # as of now (might be stale), /perso/hot is the only mount accessible - # that is also managed by s3fs - autoMaster = '' - /perso file:${persoConf} - ''; - timeout = 30; # default: 600, 600 seconds (10 mins) of inactivity => unmount - # debug = true; # writes to more to journalctl - }; + in "felia_d ${confToBackendArg args} ://felia.coati-celsius.ts.net/d" + ) + ( + let + args = { + "-fstype" = "cifs"; + credentials = config.age.secrets._nhitrl_cred.path; + user = null; + uid = "1001"; + gid = "100"; + dir_mode = "0777"; + file_mode = "0777"; + }; + in "felia_f ${confToBackendArg args} ://felia.coati-celsius.ts.net/f" + ) + ]; + persoConf = pkgs.writeText "auto.personal" (builtins.concatStringsSep "\n" personalStorage); + in { + enable = true; + # Creates /perso directory with every subdirectory declared by ${personalStorage} + # as of now (might be stale), /perso/hot is the only mount accessible + # that is also managed by s3fs + autoMaster = '' + /perso file:${persoConf} + ''; + timeout = 30; # default: 600, 600 seconds (10 mins) of inactivity => unmount + # debug = true; # writes to more to journalctl + }; } diff --git a/modules/tailscale.sys.nix b/modules/tailscale.sys.nix index 6e3e1bb..56711e6 100644 --- a/modules/tailscale.sys.nix +++ b/modules/tailscale.sys.nix @@ -1,22 +1,25 @@ -{ pkgs -, config -, lib -, ... -}: let cfg = config.mod.tailscale; in { - options.mod.tailscale = { +{ + pkgs, + config, + lib, + ... +}: let + cfg = config.mod.tailscale; +in { + options.mod.tailscale = { enable = lib.mkEnableOption "tailscale"; }; config = lib.mkIf cfg.enable { - environment.systemPackages = [ pkgs.tailscale ]; + environment.systemPackages = [pkgs.tailscale]; services.tailscale.enable = true; systemd.services.tailscale-autoconnect = { description = "Automatically connects to Tailscale"; # make sure tailscale is running before trying to connect to tailscale - after = [ "network-pre.target" "tailscale.service" ]; - wants = [ "network-pre.target" "tailscale.service" ]; - wantedBy = [ "multi-user.target" ]; + after = ["network-pre.target" "tailscale.service"]; + wants = ["network-pre.target" "tailscale.service"]; + wantedBy = ["multi-user.target"]; # set this service as a oneshot job serviceConfig.Type = "oneshot"; @@ -33,7 +36,7 @@ # ${pkgs.tailscale}/bin/tailscale up # blocks, doesn't give url # This time, configure device auth so that we authenticate from portal - # https://tailscale.com/kb/1099/device-authorization/#enable-device-authorization-for-your-network + # https://tailscale.com/kb/1099/device-authorization/#enable-device-authorization-for-your-network ${pkgs.tailscale}/bin/tailscale up -authkey tskey-auth-kJcgTG5CNTRL-PUVFkk31z1bThHpfq3FC5b1jcMmkW2EYW ''; }; diff --git a/modules/wifi.sys.nix b/modules/wifi.sys.nix index 1d615ee..2e1ea9e 100644 --- a/modules/wifi.sys.nix +++ b/modules/wifi.sys.nix @@ -1,4 +1,4 @@ -{ config, ... }: { +{config, ...}: { networking.wireless.enable = true; networking.wireless.environmentFile = config.age.secrets."wifi.env"; networking.wireless.networks = { diff --git a/native_configs/README.md b/native_configs/README.md index f2414b2..f322e6d 100644 --- a/native_configs/README.md +++ b/native_configs/README.md @@ -5,8 +5,13 @@ Contains all configurations that are written in their native configuration langu ## Why native language? - Easier portability +- Syntax highlighting and robust checking without needing to realize derivation - Nix can read from [JSON](https://nixos.org/manual/nix/stable/language/builtins.html#builtins-fromJSON), [TOML](https://nixos.org/manual/nix/stable/release-notes/rl-2.6.html#release-26-2022-01-24). - We have also managed to hack together a [fromYaml](./../nix-conf/lib/serde/default.nix), though it will not work for strictly pure builds or bootstrapping builds. +## When to use Nix to generate config? + +- Original configuraiton language requires too much duplication that can be solved with Nix + diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index d510a64..5c9386b 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -993,6 +993,29 @@ require('mason-lspconfig').setup_handlers({ }, } end, + ["nil_ls"] = function() + require('lspconfig').nil_ls.setup { + on_attach = on_attach, + capabilities = capabilities, + --- refer to https://github.com/oxalica/nil/blob/main/docs/configuration.md + --- for the list of configurations available for `nil_ls` + settings = { + ["nil"] = { + formatting = { + command = {"nix", "run", "nixpkgs#alejandra"}, + }, + nix = { + flake = { + -- calls `nix flake archive` to put a flake and its output to store + autoArchive = true, + -- auto eval flake inputs for improved completion + autoEvalInputs = true, + }, + }, + }, + }, + } + end, }) require("rust-tools").setup { tools = { diff --git a/nix-conf/home-manager/base/alacritty.nix b/nix-conf/home-manager/base/alacritty.nix index 5f08776..a05ed0d 100644 --- a/nix-conf/home-manager/base/alacritty.nix +++ b/nix-conf/home-manager/base/alacritty.nix @@ -1,53 +1,51 @@ -{ config -, proj_root -, myLib -, ... -}: -let +{ + config, + proj_root, + myLib, + ... +}: let inherit (myLib) fromYaml; actualConfig = fromYaml (builtins.readFile "${proj_root.config.path}//alacritty/alacritty.yml"); cfg = config.base.alacritty; -in -{ - options.base.alacritty = - { - font.family = myLib.mkOption { - type = myLib.types.singleLineStr; - default = actualConfig.font.normal.family; - description = '' - The font family for Alacritty - ''; - example = "DroidSansMono NF"; - }; - font.size = myLib.mkOption { - type = myLib.types.number; - default = actualConfig.font.size; - description = '' - The default font size for Alacritty. This is probably measured in px. - ''; - example = 7.0; - }; - enable = myLib.mkOption { - type = myLib.types.bool; - default = true; - description = '' - Enables alacritty - ''; - example = true; - }; - _actualConfig = myLib.mkOption { - type = myLib.types.attrs; - visible = false; - default = actualConfig; - description = "underlying default config"; - }; - additionalConfigPath = myLib.mkOption { - type = myLib.types.nullOr myLib.types.path; - visible = false; - default = null; - description = "impurely write our alacritty.yml to this path"; - }; +in { + options.base.alacritty = { + font.family = myLib.mkOption { + type = myLib.types.singleLineStr; + default = actualConfig.font.normal.family; + description = '' + The font family for Alacritty + ''; + example = "DroidSansMono NF"; }; + font.size = myLib.mkOption { + type = myLib.types.number; + default = actualConfig.font.size; + description = '' + The default font size for Alacritty. This is probably measured in px. + ''; + example = 7.0; + }; + enable = myLib.mkOption { + type = myLib.types.bool; + default = true; + description = '' + Enables alacritty + ''; + example = true; + }; + _actualConfig = myLib.mkOption { + type = myLib.types.attrs; + visible = false; + default = actualConfig; + description = "underlying default config"; + }; + additionalConfigPath = myLib.mkOption { + type = myLib.types.nullOr myLib.types.path; + visible = false; + default = null; + description = "impurely write our alacritty.yml to this path"; + }; + }; config.programs.alacritty = { enable = cfg.enable; diff --git a/nix-conf/home-manager/base/darwin-spotlight.nix b/nix-conf/home-manager/base/darwin-spotlight.nix index 800ffa9..6b9724a 100644 --- a/nix-conf/home-manager/base/darwin-spotlight.nix +++ b/nix-conf/home-manager/base/darwin-spotlight.nix @@ -1,25 +1,29 @@ -{ lib, pkgs, config, ... }: { + lib, + pkgs, + config, + ... +}: { # This patch exists since Darwin's search bar requires solid apps and not # symlinked # TODO: QA # - [x] works for base case # - [x] works for repeated case - # - [ ] works after base case, then removed + # - [ ] works after base case, then removed # - [ ] works for repeated case, then removed # Copy GUI apps to "~/Applications/Home Manager Apps" # Based on this comment: https://github.com/nix-community/home-manager/issues/1341#issuecomment-778820334 home.activation.patch-spotlight = - if pkgs.stdenv.isDarwin then - let - apps = pkgs.buildEnv { - name = "home-manager-applications"; - paths = config.home.packages; - pathsToLink = "/Applications"; - }; - in - lib.hm.dag.entryAfter [ "linkGeneration" ] '' + if pkgs.stdenv.isDarwin + then let + apps = pkgs.buildEnv { + name = "home-manager-applications"; + paths = config.home.packages; + pathsToLink = "/Applications"; + }; + in + lib.hm.dag.entryAfter ["linkGeneration"] '' # Install MacOS applications to the user environment. HM_APPS="$HOME/Applications/Home Manager Apps" # Reset current state @@ -33,19 +37,18 @@ $DRY_RUN_CMD cp --archive -H --dereference ${apps}/Applications/* "$HM_APPS" $DRY_RUN_CMD chmod +w -R "$HM_APPS" '' - else - ""; + else ""; # We need this in case upstream home-manager changes the behavior of linking # applications - home.activation.remove-patch-spotlight = - if pkgs.stdenv.isDarwin then - lib.hm.dag.entryBefore [ "checkLinkTargets" ] '' + home.activation.remove-patch-spotlight = + if pkgs.stdenv.isDarwin + then + lib.hm.dag.entryBefore ["checkLinkTargets"] '' HM_APPS="$HOME/Applications/Home Manager Apps" # Reset current state if [ -e "$HM_APPS" ]; then $DRY_RUN_CMD mv "$HM_APPS" "$HM_APPS.$(date +%Y%m%d%H%M%S)" fi '' - else - ""; + else ""; } diff --git a/nix-conf/home-manager/base/default.nix b/nix-conf/home-manager/base/default.nix index d3a0d50..6cb88af 100644 --- a/nix-conf/home-manager/base/default.nix +++ b/nix-conf/home-manager/base/default.nix @@ -1,6 +1,4 @@ -{nix-index-database -,... -}@inputs:{ +{nix-index-database, ...} @ inputs: { mkModuleArgs = import ./mkModuleArgs.nix; modules = [ ./alacritty.nix diff --git a/nix-conf/home-manager/base/git.nix b/nix-conf/home-manager/base/git.nix index cd57aa7..a563fee 100644 --- a/nix-conf/home-manager/base/git.nix +++ b/nix-conf/home-manager/base/git.nix @@ -1,8 +1,8 @@ -{ config -, myLib -, ... -}: -let +{ + config, + myLib, + ... +}: let cfg = config.base.git; baseAliases = { a = "add"; @@ -15,12 +15,11 @@ let co = "checkout"; b = "branch"; }; -in -{ +in { options.base.git = { aliases = myLib.mkOption { type = myLib.types.attrs; - default = { }; + default = {}; example = baseAliases; description = '' Additional git aliases. This settings comes with base configuration. @@ -50,7 +49,7 @@ in .gitignore patterns that are applied in every repository. This is useful for IDE-specific settings. ''; - example = [ ".direnv" "node_modules" ]; + example = [".direnv" "node_modules"]; }; enable = myLib.mkOption { type = myLib.types.bool; diff --git a/nix-conf/home-manager/base/graphics.nix b/nix-conf/home-manager/base/graphics.nix index 71dfbae..2527fe9 100644 --- a/nix-conf/home-manager/base/graphics.nix +++ b/nix-conf/home-manager/base/graphics.nix @@ -1,11 +1,14 @@ -{ pkgs, config, lib, ... }: -let +{ + pkgs, + config, + lib, + ... +}: let cfg = config.base.graphics; cfgEnable = cfg.enable or (cfg.useNixGL.defaultPackage != null); types = lib.types; -in -{ - imports = [ ./shells.nix ]; +in { + imports = [./shells.nix]; options.base.graphics = { enable = lib.mkEnableOption "graphics"; _enable = lib.mkOption { @@ -23,7 +26,7 @@ in ]; }; defaultPackage = lib.mkOption { - type = types.nullOr (types.enum [ "nixGLIntel" "nixGLNvidia" "nixGLNvidiaBumblebee" ]); + type = types.nullOr (types.enum ["nixGLIntel" "nixGLNvidia" "nixGLNvidiaBumblebee"]); description = "Which nixGL package to be aliased as `nixGL` on the shell"; default = null; example = "nixGLIntel"; @@ -41,6 +44,6 @@ in nixGL = cfg.useNixGL.defaultPackage; }; }; - home.packages = [ cfg.useNixGL.package ]; + home.packages = [cfg.useNixGL.package]; }; } diff --git a/nix-conf/home-manager/base/keepass.nix b/nix-conf/home-manager/base/keepass.nix index e985131..247adec 100644 --- a/nix-conf/home-manager/base/keepass.nix +++ b/nix-conf/home-manager/base/keepass.nix @@ -1,10 +1,14 @@ -{ config, proj_root, pkgs, lib, ... }: -let +{ + config, + proj_root, + pkgs, + lib, + ... +}: let cfg = config.base.keepass; trimNull = lib.filterAttrsRecursive (name: value: value != null); -in -{ - imports = [ ./graphics.nix ]; +in { + imports = [./graphics.nix]; options.base.keepass = { enable = lib.mkEnableOption "keepass"; use_gui = lib.mkOption { @@ -42,12 +46,18 @@ in }; }; config = lib.mkIf cfg.enable { - home.packages = [ - pkgs.kpcli-py # kp but is in cli - ] ++ (if cfg.use_gui or config.base.graphics._enable then [ - pkgs.keepass # Personal secret management - ] else [ ]); - home.file.".kp/config.ini".text = lib.generators.toINI { } (trimNull { + home.packages = + [ + pkgs.kpcli-py # kp but is in cli + ] + ++ ( + if cfg.use_gui or config.base.graphics._enable + then [ + pkgs.keepass # Personal secret management + ] + else [] + ); + home.file.".kp/config.ini".text = lib.generators.toINI {} (trimNull { default = { KEEPASSDB = cfg.path; KEEPASSDB_KEYFILE = cfg.keyfile_path; diff --git a/nix-conf/home-manager/base/mkModuleArgs.nix b/nix-conf/home-manager/base/mkModuleArgs.nix index 844e7c9..b5a0561 100644 --- a/nix-conf/home-manager/base/mkModuleArgs.nix +++ b/nix-conf/home-manager/base/mkModuleArgs.nix @@ -1,20 +1,20 @@ -# Turns given inputs into the standardized shape of the inputs to configure +# Turns given inputs into the standardized shape of the inputs to configure # custom base modules in this directory. -{ pkgs -, lib ? pkgs.lib -, ... -}@inputs: -let +{ + pkgs, + lib ? pkgs.lib, + ... +} @ inputs: let recursiveUpdate = lib.recursiveUpdate; - _lib = recursiveUpdate lib (import ../../lib { inherit pkgs lib; }); + _lib = recursiveUpdate lib (import ../../lib {inherit pkgs lib;}); proj_root = builtins.toString ./../../..; in -# TODO: Unpollute inputs -recursiveUpdate inputs { - proj_root = { - path = proj_root; - config.path = "${proj_root}/native_configs"; - scripts.path = "${proj_root}/scripts"; - }; - myLib = _lib; -} + # TODO: Unpollute inputs + recursiveUpdate inputs { + proj_root = { + path = proj_root; + config.path = "${proj_root}/native_configs"; + scripts.path = "${proj_root}/scripts"; + }; + myLib = _lib; + } diff --git a/nix-conf/home-manager/base/neovim.nix b/nix-conf/home-manager/base/neovim.nix index ab74aab..2083f16 100644 --- a/nix-conf/home-manager/base/neovim.nix +++ b/nix-conf/home-manager/base/neovim.nix @@ -2,68 +2,86 @@ # # One thing to consider, though, /nix/store of `nix-shell` or `nix-develop` # might be different from `home-manager`'s (~/.nix_profile/bin/jq) -{ pkgs, lib, config, proj_root, ... }: -let +{ + pkgs, + lib, + config, + proj_root, + ... +}: let # NOTE: Add packages to nvim_pkgs instead, so that it's available at userspace # and is added to the path after wrapping. # check: nix repl `homeConfigurations.hungtr.config.programs.neovim.finalPackage.buildCommand` # see: :/--suffix.*PATH # there should be mentions of additional packages my_neovim = pkgs.neovim-unwrapped; - rust_pkgs = (pkgs.rust-bin.selectLatestNightlyWith + rust_pkgs = + pkgs.rust-bin.selectLatestNightlyWith ( toolchain: - toolchain.default.override { - extensions = [ "rust-src" "rust-analyzer" "rust-docs" "rustfmt" "clippy" "miri" ]; - } - )); - nvim_pkgs = [ - # pkgs.gccStdenv - pkgs.tree-sitter - pkgs.fzf # file name fuzzy search - pkgs.ripgrep # content fuzzy search - pkgs.zk # Zettelkasten (limited support) - pkgs.fd # Required by a Telescope plugin (?) - pkgs.stdenv.cc.cc.lib - pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo - pkgs.rust4cargo - pkgs.nickel - pkgs.nls - - pkgs.go # doesn't work, Mason installs from runtime path - - # Language-specific stuffs - pkgs.sumneko-lua-language-server - # pkgs.python3Packages.python-lsp-server - pkgs.nodePackages.pyright - pkgs.python3Packages.pylint - pkgs.python3Packages.flake8 - # FIXME: installing ansible from here just doesn't work :/ - # pkgs.ansible-lint - # pkgs.python38Packages.ansible - # pkgs.ansible-language-server - # TODO: the devShell should provide rust-analyzer so that - # cargo test builds binaries compatible with rust-analyzer - - # pkgs.rust-analyzer - # rust_pkgs - # pkgs.evcxr # Rust REPL for Conjure! - ] ++ lib.optionals (pkgs.stdenv.isDarwin) ( - let - inherit (pkgs.darwin.apple_sdk.frameworks) System CoreFoundation; in + toolchain.default.override { + extensions = ["rust-src" "rust-analyzer" "rust-docs" "rustfmt" "clippy" "miri"]; + } + ); + nvim_pkgs = [ - System - CoreFoundation + # pkgs.gccStdenv + pkgs.tree-sitter + pkgs.fzf # file name fuzzy search + pkgs.ripgrep # content fuzzy search + pkgs.zk # Zettelkasten (limited support) + pkgs.fd # Required by a Telescope plugin (?) + pkgs.stdenv.cc.cc.lib + pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo + pkgs.rust4cargo + pkgs.nickel + pkgs.nls + + pkgs.go # doesn't work, Mason installs from runtime path + + # Language-specific stuffs + pkgs.sumneko-lua-language-server + # pkgs.python3Packages.python-lsp-server + pkgs.nodePackages.pyright + pkgs.python3Packages.pylint + pkgs.python3Packages.flake8 + # FIXME: installing ansible from here just doesn't work :/ + # pkgs.ansible-lint + # pkgs.python38Packages.ansible + # pkgs.ansible-language-server + # TODO: the devShell should provide rust-analyzer so that + # cargo test builds binaries compatible with rust-analyzer + + # pkgs.rust-analyzer + # rust_pkgs + # pkgs.evcxr # Rust REPL for Conjure! ] - ); -in -{ + ++ lib.optionals (pkgs.stdenv.isDarwin) ( + let + inherit (pkgs.darwin.apple_sdk.frameworks) System CoreFoundation; + in [ + System + CoreFoundation + ] + ); +in { options.base.neovim = { enable = lib.mkOption { default = true; description = "enable personalized neovim as default editor"; type = lib.types.bool; example = false; + f = let + adder = { + __functor = self: arg: + if builtins.isInt arg + then self // {x = self.x + arg;} + else self.x; + x = 0; + }; + in { + what = adder 1 2 3 {}; + }; }; }; config = lib.mkIf config.base.neovim.enable { @@ -76,60 +94,54 @@ in withPython3 = true; withNodeJs = true; extraPackages = nvim_pkgs; - extraLuaConfig = (builtins.readFile "${proj_root.config.path}//neovim/init.lua"); - plugins = (let inherit (pkgs.vimPlugins) - plenary-nvim - - nvim-treesitter - nvim-treesitter-textobjects - nvim-treesitter-context - - telescope-fzf-native-nvim - telescope-file-browser-nvim - telescope-nvim - - nvim-lspconfig - - gruvbox-community - - neodev-nvim - - cmp-nvim-lsp - cmp-path - cmp-buffer - cmp-cmdline - nvim-cmp - - lspkind-nvim - nvim-autopairs - nvim-ts-autotag - guess-indent-nvim - harpoon - zk-nvim - luasnip - fidget-nvim - rust-tools-nvim - - cmp_luasnip - gitsigns-nvim - indent-blankline-nvim - lualine-nvim - mason-lspconfig-nvim - mason-nvim - neogit - nlua-nvim - nvim-jqx - nvim-surround - nvim-web-devicons - playground - todo-comments-nvim - trouble-nvim - vim-dispatch - vim-dispatch-neovim - vim-fugitive - vim-jack-in - - ; in [ + extraLuaConfig = builtins.readFile "${proj_root.config.path}//neovim/init.lua"; + plugins = let + inherit + (pkgs.vimPlugins) + plenary-nvim + nvim-treesitter + nvim-treesitter-textobjects + nvim-treesitter-context + telescope-fzf-native-nvim + telescope-file-browser-nvim + telescope-nvim + nvim-lspconfig + gruvbox-community + neodev-nvim + cmp-nvim-lsp + cmp-path + cmp-buffer + cmp-cmdline + nvim-cmp + lspkind-nvim + nvim-autopairs + nvim-ts-autotag + guess-indent-nvim + harpoon + zk-nvim + luasnip + fidget-nvim + rust-tools-nvim + cmp_luasnip + gitsigns-nvim + indent-blankline-nvim + lualine-nvim + mason-lspconfig-nvim + mason-nvim + neogit + nlua-nvim + nvim-jqx + nvim-surround + nvim-web-devicons + playground + todo-comments-nvim + trouble-nvim + vim-dispatch + vim-dispatch-neovim + vim-fugitive + vim-jack-in + ; + in [ plenary-nvim nvim-treesitter.withAllGrammars nvim-treesitter-textobjects @@ -172,8 +184,8 @@ in vim-dispatch vim-dispatch-neovim vim-fugitive - vim-jack-in - ]); + vim-jack-in + ]; }; # home.packages = nvim_pkgs; }; diff --git a/nix-conf/home-manager/base/private_chromium.nix b/nix-conf/home-manager/base/private_chromium.nix index 981459e..9213ba0 100644 --- a/nix-conf/home-manager/base/private_chromium.nix +++ b/nix-conf/home-manager/base/private_chromium.nix @@ -1,9 +1,13 @@ # TODO: maybe throw if base.graphics is not enabled? # Though, headless chromium might be possible -{ config, pkgs, lib, ... }: -let cfg = config.base.private_chromium; -in { + config, + pkgs, + lib, + ... +}: let + cfg = config.base.private_chromium; +in { options.base.private_chromium = { enable = lib.mkOption { type = lib.types.bool; @@ -19,33 +23,36 @@ in programs.chromium = { enable = true; package = pkgs.ungoogled-chromium; - extensions = - let - # TODO: how about a chrome extension registry? - mkChromiumExtForVersion = browserVersion: { id, sha256, extVersion, ... }: - { - inherit id; - crxPath = builtins.fetchurl { - url = "https://clients2.google.com/service/update2/crx" + - "?response=redirect" + - "&acceptformat=crx2,crx3" + - "&prodversion=${browserVersion}" + - "&x=id%3D${id}%26installsource%3Dondemand%26uc"; - name = "${id}.crx"; - inherit sha256; - }; - version = extVersion; - }; - mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version); - in - [ - # vimium - (mkChromiumExt { - id = "dbepggeogbaibhgnhhndojpepiihcmeb"; - sha256 = "00qhbs41gx71q026xaflgwzzridfw1sx3i9yah45cyawv8q7ziic"; - extVersion = "1.67.4"; - }) - ]; + extensions = let + # TODO: how about a chrome extension registry? + mkChromiumExtForVersion = browserVersion: { + id, + sha256, + extVersion, + ... + }: { + inherit id; + crxPath = builtins.fetchurl { + url = + "https://clients2.google.com/service/update2/crx" + + "?response=redirect" + + "&acceptformat=crx2,crx3" + + "&prodversion=${browserVersion}" + + "&x=id%3D${id}%26installsource%3Dondemand%26uc"; + name = "${id}.crx"; + inherit sha256; + }; + version = extVersion; + }; + mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version); + in [ + # vimium + (mkChromiumExt { + id = "dbepggeogbaibhgnhhndojpepiihcmeb"; + sha256 = "00qhbs41gx71q026xaflgwzzridfw1sx3i9yah45cyawv8q7ziic"; + extVersion = "1.67.4"; + }) + ]; }; }; } diff --git a/nix-conf/home-manager/base/productive_desktop.nix b/nix-conf/home-manager/base/productive_desktop.nix index 944fbff..3227406 100644 --- a/nix-conf/home-manager/base/productive_desktop.nix +++ b/nix-conf/home-manager/base/productive_desktop.nix @@ -1,9 +1,9 @@ # A module that takes care of a GUI-ful, productive desktop environment -inputs@{ pkgs, ... }: { +inputs @ {pkgs, ...}: { imports = [ # slack - ({ pkgs, ... }: { - home.packages = [ + ({pkgs, ...}: { + home.packages = [ pkgs.slack ]; }) diff --git a/nix-conf/home-manager/base/shells.nix b/nix-conf/home-manager/base/shells.nix index 5f85cc1..3f9c06f 100644 --- a/nix-conf/home-manager/base/shells.nix +++ b/nix-conf/home-manager/base/shells.nix @@ -1,14 +1,14 @@ # Configurations for shell stuffs. # Should probably be decoupled even more for each feature -{ config -, proj_root -, myLib -, pkgs -, ... -}: -let cfg = config.base.shells; -in { + config, + proj_root, + myLib, + pkgs, + ... +}: let + cfg = config.base.shells; +in { options.base.shells = { enable = myLib.mkOption { type = myLib.types.bool; @@ -30,7 +30,7 @@ in shellAliases = myLib.mkOption { type = myLib.types.attrs; description = "Shell command aliases"; - default = { }; + default = {}; example = { nixGL = "nixGLIntel"; }; @@ -52,8 +52,8 @@ in programs.tmux = { enable = true; # extraConfigBeforePlugin = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"; - plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [ cpu net-speed ]; - extraConfig = (builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"); + plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [cpu net-speed]; + extraConfig = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"; }; xdg.configFile."tmux/tmux.conf".text = myLib.mkOrder 600 '' set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M ' @@ -67,15 +67,16 @@ in programs.starship = { enable = true; enableZshIntegration = true; - settings = let + settings = let native = builtins.fromTOML (builtins.readFile "${proj_root.config.path}/starship/starship.toml"); - patch-nix = pkgs.lib.recursiveUpdate native ({ + patch-nix = pkgs.lib.recursiveUpdate native { c.commands = [ ["nix" "run" "nixpkgs#clang" "--" "--version"] ["nix" "run" "nixpkgs#gcc" "--" "--version"] ]; - }); - in patch-nix; + }; + in + patch-nix; }; # Fuzzy finder. `fzf` for TUI, `fzf -f ''` for UNIX piping programs.fzf.enable = true; @@ -88,10 +89,12 @@ in enable = true; enableCompletion = true; enableAutosuggestions = true; - shellAliases = { - nix-rebuild = "sudo nixos-rebuild switch"; - hm-switch = "home-manager switch --flake"; - } // (cfg.shellAliases or { }); + shellAliases = + { + nix-rebuild = "sudo nixos-rebuild switch"; + hm-switch = "home-manager switch --flake"; + } + // (cfg.shellAliases or {}); history = { size = 10000; path = "${config.xdg.dataHome}/zsh/history"; @@ -119,10 +122,11 @@ in ZVM_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) ZVM_ESCAPE_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) }; - initExtra = (cfg.shellInitExtra or "") + '' - source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh - ''; - + initExtra = + (cfg.shellInitExtra or "") + + '' + source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh + ''; }; }; } diff --git a/nix-conf/home-manager/base/ssh.nix b/nix-conf/home-manager/base/ssh.nix index c95b3c0..b14912a 100644 --- a/nix-conf/home-manager/base/ssh.nix +++ b/nix-conf/home-manager/base/ssh.nix @@ -1,11 +1,11 @@ -{ config -, proj_root -, myLib -, ... -}: -let cfg = config.base.ssh; -in { + config, + proj_root, + myLib, + ... +}: let + cfg = config.base.ssh; +in { options.base.ssh.enable = myLib.mkOption { type = myLib.types.bool; default = true; @@ -20,4 +20,3 @@ in includes = ["${proj_root.config.path}/ssh/config"]; }; } - diff --git a/nix-conf/home-manager/default.nix b/nix-conf/home-manager/default.nix index a58ba64..c7b1026 100644 --- a/nix-conf/home-manager/default.nix +++ b/nix-conf/home-manager/default.nix @@ -1,11 +1,13 @@ # We use top-level nix-flake, so default.nix is basically just a wrapper around ./flake.nix -(import +( + import ( - let + let lock = builtins.fromJSON (builtins.readFile ./flake.lock); c_ = import ./../../c_.nix; in - c_.fetchTree lock.nodes.flake-compat.locked + c_.fetchTree lock.nodes.flake-compat.locked ) - { src = ./.; } -).defaultNix + {src = ./.;} +) +.defaultNix diff --git a/nix-conf/home-manager/flake.lock b/nix-conf/home-manager/flake.lock index 7a5c2ea..b2bb132 100644 --- a/nix-conf/home-manager/flake.lock +++ b/nix-conf/home-manager/flake.lock @@ -833,11 +833,11 @@ }, "nixpkgs-latest": { "locked": { - "lastModified": 1686940302, - "narHash": "sha256-hTBVlV53sfi7ZyTkRKIVZy3V26ixnWGZnYrHvb9rCZU=", + "lastModified": 1687044368, + "narHash": "sha256-7eBtV3lgfgjeyBDa20Xr4O9mlcAHHFYpvo6m16tgLcY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1f5b5df0d309144d10d409d161b50adc94157ef6", + "rev": "b621273236ab985db5ff7e91171624f2e07e82a1", "type": "github" }, "original": { @@ -882,11 +882,11 @@ }, "nixpkgs_10": { "locked": { - "lastModified": 1686869522, - "narHash": "sha256-tbJ9B8WLCTnVP/LwESRlg0dII6Zyg2LmUU/mB9Lu98E=", + "lastModified": 1686960236, + "narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7c67f006ea0e7d0265f16d7df07cc076fdffd91f", + "rev": "04af42f3b31dba0ef742d254456dc4c14eedac86", "type": "github" }, "original": { @@ -1327,11 +1327,11 @@ "nixpkgs": "nixpkgs_11" }, "locked": { - "lastModified": 1686882360, - "narHash": "sha256-6iWVGIdIzmx/CgXPVLPyyxxBhPGYMl8sG09S8hpQ6pc=", + "lastModified": 1686968542, + "narHash": "sha256-Gjlj7UeHqMFRAYyefeoLnSjLo8V+0XheIamojNEyTbE=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "b519b1d7a31f1bd35423990398adecc6f7dd4dd2", + "rev": "01d84cd842e48e89be67e4c2d9dc46aa7709adc5", "type": "github" }, "original": { diff --git a/nix-conf/home-manager/flake.nix b/nix-conf/home-manager/flake.nix index cdb25ae..499f6a8 100644 --- a/nix-conf/home-manager/flake.nix +++ b/nix-conf/home-manager/flake.nix @@ -43,82 +43,88 @@ }; }; - outputs = - flake_inputs@{ nixpkgs - , home-manager - , nixgl - , rust-overlay - , flake-utils - , kpcli-py - , neovim-nightly-overlay - , nix-boost - , nixpkgs-latest - , ... - }: - let - # config_fn:: system -> config - cross_platform = config_fn: ({ - packages = builtins.foldl' - (prev: system: prev // { + outputs = flake_inputs @ { + nixpkgs, + home-manager, + nixgl, + rust-overlay, + flake-utils, + kpcli-py, + neovim-nightly-overlay, + nix-boost, + nixpkgs-latest, + ... + }: let + # config_fn:: system -> config + cross_platform = config_fn: { + packages = + builtins.foldl' + (prev: system: + prev + // { "${system}" = config_fn system; }) - { } - flake-utils.lib.defaultSystems; - }); - in - cross_platform (system: - let - overlays = import ./overlays.nix (flake_inputs // { inherit system; }); + {} + flake-utils.lib.defaultSystems; + }; + in + cross_platform (system: let + overlays = import ./overlays.nix (flake_inputs // {inherit system;}); # pkgs = nixpkgs.legacyPackages.${system}.appendOverlays overlays; pkgs = import nixpkgs { inherit system overlays; - config = { allowUnfree = true; }; + config = {allowUnfree = true;}; }; # lib = (import ../lib { inherit pkgs; lib = pkgs.lib; }); base = import ./base flake_inputs; inherit (base) mkModuleArgs; - nerd_font_module = { config, pkgs, ... }: { + nerd_font_module = { + config, + pkgs, + ... + }: { fonts.fontconfig.enable = true; home.packages = [ # list of fonts are available at https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/data/fonts/nerdfonts/shas.nix - (pkgs.nerdfonts.override { fonts = [ "Hack" ]; }) + (pkgs.nerdfonts.override {fonts = ["Hack"];}) ]; base.alacritty.font.family = "Hack Nerd Font Mono"; }; - in - { + in { debug = { inherit overlays pkgs base; }; - homeConfigurations = - let - x11_wsl = '' - # x11 output for WSL - export DISPLAY=$(ip route list default | awk '{print $3}'):0 - export LIBGL_ALWAYS_INDIRECT=1 - ''; - in - { - "hungtr" = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = base.modules ++ [ + homeConfigurations = let + x11_wsl = '' + # x11 output for WSL + export DISPLAY=$(ip route list default | awk '{print $3}'):0 + export LIBGL_ALWAYS_INDIRECT=1 + ''; + in { + "hungtr" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = + base.modules + ++ [ ./home.nix ]; - # optionally pass inarguments to module - # we migrate this from in-place modules to allow flexibility - # in this case, we can add "home" to input arglist of home.nix - extraSpecialArgs = mkModuleArgs { - inherit pkgs; - myHome = { - username = "hungtr"; - homeDirectory = "/home/hungtr"; - }; + # optionally pass inarguments to module + # we migrate this from in-place modules to allow flexibility + # in this case, we can add "home" to input arglist of home.nix + extraSpecialArgs = mkModuleArgs { + inherit pkgs; + myHome = { + username = "hungtr"; + homeDirectory = "/home/hungtr"; }; }; - "hungtr@bao" = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = base.modules ++ [ + }; + "hungtr@bao" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = + base.modules + ++ [ ./home.nix nerd_font_module ./base/productive_desktop.nix @@ -131,21 +137,23 @@ base.graphics.useNixGL.enable = true; } ]; - # optionally pass inarguments to module - # we migrate this from in-place modules to allow flexibility - # in this case, we can add "home" to input arglist of home.nix - extraSpecialArgs = mkModuleArgs { - inherit pkgs; - myHome = { - username = "hungtr"; - homeDirectory = "/home/hungtr"; - }; + # optionally pass inarguments to module + # we migrate this from in-place modules to allow flexibility + # in this case, we can add "home" to input arglist of home.nix + extraSpecialArgs = mkModuleArgs { + inherit pkgs; + myHome = { + username = "hungtr"; + homeDirectory = "/home/hungtr"; }; }; - # Personal darwin, effectively serves as the Darwin edge channel - "hungtran" = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = base.modules ++ [ + }; + # Personal darwin, effectively serves as the Darwin edge channel + "hungtran" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = + base.modules + ++ [ ./home.nix { base.graphics.enable = false; @@ -166,18 +174,20 @@ ]; } ]; - extraSpecialArgs = mkModuleArgs { - inherit pkgs; - myHome = { - username = "hungtran"; - homeDirectory = "/Users/hungtran"; - }; + extraSpecialArgs = mkModuleArgs { + inherit pkgs; + myHome = { + username = "hungtran"; + homeDirectory = "/Users/hungtran"; }; }; - # Work darwin - "htran" = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = base.modules ++ [ + }; + # Work darwin + "htran" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = + base.modules + ++ [ ./home.nix ./base/productive_desktop.nix ./base/darwin-spotlight.nix @@ -198,42 +208,46 @@ pkgs.postman ]; } - { base.keepass.enable = pkgs.lib.mkForce false; } + {base.keepass.enable = pkgs.lib.mkForce false;} ]; - extraSpecialArgs = mkModuleArgs { - inherit pkgs; - myHome = { - username = "htran"; - homeDirectory = "/Users/htran"; - }; + extraSpecialArgs = mkModuleArgs { + inherit pkgs; + myHome = { + username = "htran"; + homeDirectory = "/Users/htran"; }; }; - "nixos@Felia" = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [ - ./home.nix - { - base.shells = { - shellInitExtra = '' - '' + x11_wsl; - }; - } - ]; - # optionally pass inarguments to module - # we migrate this from in-place modules to allow flexibility - # in this case, we can add "home" to input arglist of home.nix - extraSpecialArgs = mkModuleArgs { - inherit pkgs; - myHome = { - username = "nixos"; - homeDirectory = "/home/nixos"; + }; + "nixos@Felia" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ + ./home.nix + { + base.shells = { + shellInitExtra = + '' + '' + + x11_wsl; }; + } + ]; + # optionally pass inarguments to module + # we migrate this from in-place modules to allow flexibility + # in this case, we can add "home" to input arglist of home.nix + extraSpecialArgs = mkModuleArgs { + inherit pkgs; + myHome = { + username = "nixos"; + homeDirectory = "/home/nixos"; }; }; - # Personal laptop - hwtr = home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = base.modules ++ [ + }; + # Personal laptop + hwtr = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = + base.modules + ++ [ ./home.nix ./base/graphics.nix { @@ -244,17 +258,17 @@ ./base/productive_desktop.nix ]; - extraSpecialArgs = mkModuleArgs { - inherit pkgs; - myHome = { - username = "hwtr"; - homeDirectory = "/home/hwtr"; - packages = [ - pkgs.postman - ]; - }; + extraSpecialArgs = mkModuleArgs { + inherit pkgs; + myHome = { + username = "hwtr"; + homeDirectory = "/home/hwtr"; + packages = [ + pkgs.postman + ]; }; }; }; + }; }); } diff --git a/nix-conf/home-manager/home.nix b/nix-conf/home-manager/home.nix index c6b4a75..3c1dfde 100644 --- a/nix-conf/home-manager/home.nix +++ b/nix-conf/home-manager/home.nix @@ -3,18 +3,17 @@ # This file represents the base settings for each machine # Additional configurations goes to profiles/ # or inlined in flake.nix -{ config # Represents the realized final configuration -, pkgs # This is by default just ``= import {}` -, myHome -, myLib -, option # The options we're given, this might be useful for typesafety? -, proj_root -, ... -}: -let - inherit (myLib) fromYaml; -in { + config, # Represents the realized final configuration + pkgs, # This is by default just ``= import {}` + myHome, + myLib, + option, # The options we're given, this might be useful for typesafety? + proj_root, + ... +}: let + inherit (myLib) fromYaml; +in { imports = [ ./base/neovim.nix ./base/keepass.nix @@ -24,34 +23,41 @@ in homeDirectory = myHome.homeDirectory; stateVersion = myHome.stateVersion or "22.05"; }; - home.packages = pkgs.lib.unique ([ - # pkgs.ncdu - pkgs.rclone # cloud file operations - pkgs.htop # system diagnostics in CLI - pkgs.ripgrep # content fuzzy search - pkgs.unzip # compression - pkgs.zip # compression + home.packages = pkgs.lib.unique ( + [ + # pkgs.ncdu + pkgs.rclone # cloud file operations + pkgs.htop # system diagnostics in CLI + pkgs.ripgrep # content fuzzy search + pkgs.unzip # compression + pkgs.zip # compression - # cool utilities - pkgs.yq-go # Yaml adaptor for jq (only pretty print, little query) - # pkgs.xorg.xclock # TODO: only include if have gui # For testing GL installation - # pkgs.logseq # TODO: only include if have GL # Obsidian alt - pkgs.mosh # Parsec for SSH - # pkgs.nixops_unstable # nixops v2 # insecure for now - pkgs.lynx # Web browser at your local terminal - pkgs.zk + # cool utilities + pkgs.yq-go # Yaml adaptor for jq (only pretty print, little query) + # pkgs.xorg.xclock # TODO: only include if have gui # For testing GL installation + # pkgs.logseq # TODO: only include if have GL # Obsidian alt + pkgs.mosh # Parsec for SSH + # pkgs.nixops_unstable # nixops v2 # insecure for now + pkgs.lynx # Web browser at your local terminal + pkgs.zk - # pkgs.tailscale # VPC;; This should be installed in system-nix - pkgs.python310 # dev packages should be in project - # pkgs.python310.numpy - # pkgs.python310Packages.tensorflow - # pkgs.python310Packages.scikit-learn - ] ++ (myHome.packages or [ ]) ++ (if pkgs.system == "x86_64-linux" then [ - pkgs.logseq - ] else [ ]) + # pkgs.tailscale # VPC;; This should be installed in system-nix + pkgs.python310 # dev packages should be in project + # pkgs.python310.numpy + # pkgs.python310Packages.tensorflow + # pkgs.python310Packages.scikit-learn + ] + ++ (myHome.packages or []) + ++ ( + if pkgs.system == "x86_64-linux" + then [ + pkgs.logseq + ] + else [] + ) ); - ## Configs ## + ## Configs ## xdg.configFile."zk/config.toml".source = "${proj_root.config.path}//zk/config.toml"; ## Programs ## diff --git a/nix-conf/home-manager/overlays.nix b/nix-conf/home-manager/overlays.nix index 59db437..0bd9639 100644 --- a/nix-conf/home-manager/overlays.nix +++ b/nix-conf/home-manager/overlays.nix @@ -1,14 +1,14 @@ -flake_input@{ kpcli-py -, nixgl -, rust-overlay -, neovim-nightly-overlay -, system -, nix-boost -, nixpkgs-latest -, ... -}: -let - kpcli-py = (final: prev: { +flake_input @ { + kpcli-py, + nixgl, + rust-overlay, + neovim-nightly-overlay, + system, + nix-boost, + nixpkgs-latest, + ... +}: let + kpcli-py = final: prev: { # use python3.9, which works because of cython somehow? kpcli-py = final.poetry2nix.mkPoetryApplication { projectDir = flake_input.kpcli-py; @@ -16,12 +16,12 @@ let # tableformatter requires setuptools tableformatter = super.tableformatter.overridePythonAttrs ( old: { - buildInputs = (old.buildInputs or [ ]) ++ [ self.setuptools self.cython_3 ]; + buildInputs = (old.buildInputs or []) ++ [self.setuptools self.cython_3]; src = old.src; } ); kpcli = super.kpcli.overridePythonAttrs (old: { - buildInputs = (old.buildInputs or [ ]) ++ [ self.setuptools ]; + buildInputs = (old.buildInputs or []) ++ [self.setuptools]; }); # ubersmith = super.ubersmith.overridePythonAttrs (old: { @@ -37,34 +37,30 @@ let # sha256 = "sha256-Dystt7CBtjpLkgzCsAif8WkkYYeLyh7VMehAtwoDGuM="; # }; # }); - }); }; - }); + }; - rust = (final: prev: - let - nightlyRustWithExts = exts: final.rust-bin.selectLatestNightlyWith ( + rust = final: prev: let + nightlyRustWithExts = exts: + final.rust-bin.selectLatestNightlyWith ( toolchain: (toolchain.minimal.override { extensions = exts; }) ); - # https://rust-lang.github.io/rustup/concepts/profiles.html - rust-default-components = [ "rust-docs" "rustfmt" "clippy" ]; - rust-dev-components = rust-default-components ++ [ "rust-src" "rust-analyzer" "miri" ]; - in - { - rust4devs = nightlyRustWithExts rust-dev-components; - rust4cargo = nightlyRustWithExts [ ]; - rust4normi = nightlyRustWithExts rust-default-components; - }); + # https://rust-lang.github.io/rustup/concepts/profiles.html + rust-default-components = ["rust-docs" "rustfmt" "clippy"]; + rust-dev-components = rust-default-components ++ ["rust-src" "rust-analyzer" "miri"]; + in { + rust4devs = nightlyRustWithExts rust-dev-components; + rust4cargo = nightlyRustWithExts []; + rust4normi = nightlyRustWithExts rust-default-components; + }; - - vimPlugins = (final: prev: { + vimPlugins = final: prev: { inherit (nixpkgs-latest.legacyPackages.${system}) vimPlugins; - }); -in -[ + }; +in [ nix-boost.overlays.default nixgl.overlays.default rust-overlay.overlays.default diff --git a/nix-conf/home-manager/profiles/default.nix b/nix-conf/home-manager/profiles/default.nix index 1734c70..e52952a 100644 --- a/nix-conf/home-manager/profiles/default.nix +++ b/nix-conf/home-manager/profiles/default.nix @@ -1,5 +1,8 @@ # main module exporter for different configuration profiles -{ pkgs, libs, ... } @ inputs: { + pkgs, + libs, + ... +} @ inputs: { hwtr = import ./hwtr.nix; } diff --git a/nix-conf/lib/default.nix b/nix-conf/lib/default.nix index c7ec7d9..66449f9 100644 --- a/nix-conf/lib/default.nix +++ b/nix-conf/lib/default.nix @@ -1,12 +1,12 @@ -{ pkgs -, lib ? pkgs.lib -, ... -}@flake_import: -let - serde = import ./serde { inherit pkgs lib; }; +{ + pkgs, + lib ? pkgs.lib, + ... +} @ flake_import: let + serde = import ./serde {inherit pkgs lib;}; recursiveUpdate = lib.recursiveUpdate; in -recursiveUpdate (recursiveUpdate pkgs.lib lib) { - fromYaml = serde.fromYaml; - fromYamlPath = serde.fromYamlPath; -} + recursiveUpdate (recursiveUpdate pkgs.lib lib) { + fromYaml = serde.fromYaml; + fromYamlPath = serde.fromYamlPath; + } diff --git a/nix-conf/lib/serde/default.nix b/nix-conf/lib/serde/default.nix index b734f4c..dd4c05f 100644 --- a/nix-conf/lib/serde/default.nix +++ b/nix-conf/lib/serde/default.nix @@ -1,31 +1,38 @@ # Takes care of serializing and deserializing to some formats # Blame: Pegasust # TODO: Add to* formats from pkgs.formats.* -{ pkgs -, lib -} @ inputs: -let - yamlToJsonDrv = yamlContent: outputPath: pkgs.callPackage - ({ runCommand }: +{ + pkgs, + lib, +} @ inputs: let + yamlToJsonDrv = yamlContent: outputPath: + pkgs.callPackage + ({runCommand}: # runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33 - runCommand outputPath { inherit yamlContent; nativeBuildInputs = [ pkgs.yq ]; } + runCommand outputPath { + inherit yamlContent; + nativeBuildInputs = [pkgs.yq]; + } # run yq which outputs '.' (no filter) on file at yamlPath # note that $out is passed onto the bash/sh script for execution '' echo "$yamlContent" | yq >$out '') - { }; -in -{ + {}; +in { # Takes in a yaml string and produces a derivation with translated JSON at $outputPath # similar to builtins.fromJSON, turns a YAML string to nix attrset fromYaml = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv yamlContent "any_output.json")); - fromYamlPath = yamlPath: builtins.fromJSON ( - builtins.readFile ( - yamlToJsonDrv + fromYamlPath = yamlPath: + builtins.fromJSON ( + builtins.readFile ( + yamlToJsonDrv ( - builtins.readFile yamlPath) - "any-output.json")); + builtins.readFile yamlPath + ) + "any-output.json" + ) + ); fromTOML = builtins.fromTOML; fromJSON = builtins.fromJSON; } diff --git a/nix-conf/pkgs/default.nix b/nix-conf/pkgs/default.nix index 7f47280..1f03b27 100644 --- a/nix-conf/pkgs/default.nix +++ b/nix-conf/pkgs/default.nix @@ -1,10 +1,11 @@ # This module aims to be merge (not inject/override) with top-level pkgs to provide # personalized/custom packages -{ pkgs -, lib -, naersk # rust packages -, ... -}@pkgs_input: { +{ + pkgs, + lib, + naersk, # rust packages + ... +} @ pkgs_input: { # dot-hwtr = import "./dot-hwtr" pkgs_input; cargo-bacon = pkgs.rustPlatform.buildRustPackage rec { pname = "bacon"; diff --git a/nix-conf/pkgs/flake.nix b/nix-conf/pkgs/flake.nix index 2e17df4..2af6c0c 100644 --- a/nix-conf/pkgs/flake.nix +++ b/nix-conf/pkgs/flake.nix @@ -4,10 +4,12 @@ rust-overlay.url = "github:oxalica/rust-overlay"; naersk.url = "gihub:nix-community/naersk"; }; - outputs = { nixpkgs, rust-overlay, naersk }: - let - pkgs = import nixpkgs { overlays = [ rust-overlay.overlays.default ]; }; - lib = pkgs.lib; - in - (import ./default.nix { inherit pkgs lib naersk; }); + outputs = { + nixpkgs, + rust-overlay, + naersk, + }: let + pkgs = import nixpkgs {overlays = [rust-overlay.overlays.default];}; + lib = pkgs.lib; + in (import ./default.nix {inherit pkgs lib naersk;}); } diff --git a/nix-conf/secrets.nix b/nix-conf/secrets.nix index 0c5bf16..ec5a5f3 100644 --- a/nix-conf/secrets.nix +++ b/nix-conf/secrets.nix @@ -10,10 +10,8 @@ let all = users // systems; # stands for calculus c_ = builtins; -in -{ - "system/secrets/s3fs.age".publicKeys = c_.attrValues (all); - "system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all); - "system/secrets/_nhitrl.age".publicKeys = c_.attrValues (all); - +in { + "system/secrets/s3fs.age".publicKeys = c_.attrValues all; + "system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues all; + "system/secrets/_nhitrl.age".publicKeys = c_.attrValues all; } diff --git a/nix-conf/system/configuration.nix b/nix-conf/system/configuration.nix index e4318dd..6c18c04 100755 --- a/nix-conf/system/configuration.nix +++ b/nix-conf/system/configuration.nix @@ -1,61 +1,71 @@ -{ lib, pkgs, config, modulesPath, specialArgs, ... }: -let +{ + lib, + pkgs, + config, + modulesPath, + specialArgs, + ... +}: let hostname = specialArgs.hostname; enableSSH = specialArgs.enableSSH or true; - _networking = lib.recursiveUpdate { hostName = hostname; } (specialArgs._networking or { }); - _boot = specialArgs._boot or { }; - _services = specialArgs._services or { }; + _networking = lib.recursiveUpdate {hostName = hostname;} (specialArgs._networking or {}); + _boot = specialArgs._boot or {}; + _services = specialArgs._services or {}; includeHardware = specialArgs.includeHardware or true; proj_root = builtins.toString ./../..; in -with lib; -{ - imports = (if includeHardware then [ - "${proj_root}/hosts/${hostname}/hardware-configuration.nix" - ] else [ ]) ++ [ - "${modulesPath}/profiles/minimal.nix" - "${proj_root}/modules/tailscale.sys.nix" - "${proj_root}/modules/mosh.sys.nix" - ]; - boot = _boot; + with lib; { + imports = + ( + if includeHardware + then [ + "${proj_root}/hosts/${hostname}/hardware-configuration.nix" + ] + else [] + ) + ++ [ + "${modulesPath}/profiles/minimal.nix" + "${proj_root}/modules/tailscale.sys.nix" + "${proj_root}/modules/mosh.sys.nix" + ]; + boot = _boot; - # prune old builds - nix.settings.auto-optimise-store = true; + # prune old builds + nix.settings.auto-optimise-store = true; - # Enable nix flakes - nix.package = pkgs.nixFlakes; - nix.extraOptions = '' - experimental-features = nix-command flakes - ''; - users.users.hungtr = { - isNormalUser = true; - home = "/home/hungtr"; - description = "pegasust/hungtr"; - extraGroups = [ "wheel" "networkmanager" "audio" ]; - }; - users.users.root = { - # openssh runs in root, no? This is because port < 1024 requires root. - openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile "${proj_root}/native_configs/ssh/authorized_keys"); - }; + # Enable nix flakes + nix.package = pkgs.nixFlakes; + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + users.users.hungtr = { + isNormalUser = true; + home = "/home/hungtr"; + description = "pegasust/hungtr"; + extraGroups = ["wheel" "networkmanager" "audio"]; + }; + users.users.root = { + # openssh runs in root, no? This is because port < 1024 requires root. + openssh.authorizedKeys.keys = lib.strings.splitString "\n" (builtins.readFile "${proj_root}/native_configs/ssh/authorized_keys"); + }; - # Some basic programs - programs.neovim = { - enable = true; - defaultEditor = true; - }; + # Some basic programs + programs.neovim = { + enable = true; + defaultEditor = true; + }; - programs.git = { - enable = true; - # more information should be configured under user level - # See other config at @/home-nix - }; - - environment.systemPackages = [ - pkgs.gnumake - pkgs.wget - pkgs.inetutils # network diag - pkgs.mtr # network diag - pkgs.sysstat # sys diag - ]; -} + programs.git = { + enable = true; + # more information should be configured under user level + # See other config at @/home-nix + }; + environment.systemPackages = [ + pkgs.gnumake + pkgs.wget + pkgs.inetutils # network diag + pkgs.mtr # network diag + pkgs.sysstat # sys diag + ]; + } diff --git a/nix-conf/system/flake.nix b/nix-conf/system/flake.nix index 970abbb..2b94aa3 100644 --- a/nix-conf/system/flake.nix +++ b/nix-conf/system/flake.nix @@ -7,208 +7,227 @@ }; }; - outputs = { self, nixpkgs, agenix, ... }: - let - lib = nixpkgs.lib; - proj_root = ./../..; - # TODO: Change respectively to the system or make a nix shell to alias `nix run github:ryantm/agenix -- ` - base_modules = [ - agenix.nixosModule - { - age.secrets.s3fs = { - file = ../../secrets/s3fs.age; - # mode = "600"; # owner + group only - # owner = "hungtr"; - # group = "users"; - }; - age.secrets."s3fs.digital-garden" = { - file = ../../secrets/s3fs.digital-garden.age; - }; - age.secrets._nhitrl_cred = { - file = ../../secrets/_nhitrl.age; - }; - environment.systemPackages = [ agenix.defaultPackage.x86_64-linux ]; - } - ]; - in - { - # Windows with NixOS WSL - nixosConfigurations.Felia = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = base_modules ++ [ + outputs = { + self, + nixpkgs, + agenix, + ... + }: let + lib = nixpkgs.lib; + proj_root = ./../..; + # TODO: Change respectively to the system or make a nix shell to alias `nix run github:ryantm/agenix -- ` + base_modules = [ + agenix.nixosModule + { + age.secrets.s3fs = { + file = ../../secrets/s3fs.age; + # mode = "600"; # owner + group only + # owner = "hungtr"; + # group = "users"; + }; + age.secrets."s3fs.digital-garden" = { + file = ../../secrets/s3fs.digital-garden.age; + }; + age.secrets._nhitrl_cred = { + file = ../../secrets/_nhitrl.age; + }; + environment.systemPackages = [agenix.defaultPackage.x86_64-linux]; + } + ]; + in { + # Windows with NixOS WSL + nixosConfigurations.Felia = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = + base_modules + ++ [ ./wsl-configuration.nix { system.stateVersion = "22.05"; } ]; - specialArgs = { - # includeHardware = false; - hostname = "Felia"; - _services.openssh = { - permitRootLogin = "no"; - enable = true; - }; + specialArgs = { + # includeHardware = false; + hostname = "Felia"; + _services.openssh = { + permitRootLogin = "no"; + enable = true; }; }; - nixosConfigurations.lizzi = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = base_modules ++ [ + }; + nixosConfigurations.lizzi = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = + base_modules + ++ [ ./configuration.nix { system.stateVersion = "22.05"; mod.tailscale.enable = true; } ]; - specialArgs = { - hostname = "lizzi"; - _networking = { - interfaces.eth1.ipv4.addresses = [{ + specialArgs = { + hostname = "lizzi"; + _networking = { + interfaces.eth1.ipv4.addresses = [ + { address = "71.0.0.1"; prefixLength = 24; - }]; - firewall = { - enable = true; - allowedTCPPorts = [ 80 443 22 ]; - }; - useDHCP = false; - # required so that we get IP address from linode - interfaces.eth0.useDHCP = true; - }; - _boot.loader.grub.enable = true; - _boot.loader.grub.version = 2; - _services.openssh = { - permitRootLogin = "no"; + } + ]; + firewall = { enable = true; + allowedTCPPorts = [80 443 22]; }; - _services.gitea = { - enable = true; - stateDir = "/gitea"; - rootUrl = "https://git.pegasust.com"; - settings = { - repository = { - "ENABLE_PUSH_CREATE_USER" = true; - "ENABLE_PUSH_CREATE_ORG" = true; - }; - }; - }; - # Highly suspect that thanks to nginx, ipv6 is disabled? - _services.nginx = { - enable = true; - clientMaxBodySize = "100m"; # Allow big file transfers over git :^) - recommendedGzipSettings = true; - recommendedOptimisation = true; - recommendedProxySettings = true; - recommendedTlsSettings = true; - virtualHosts."git.pegasust.com" = { - # Gitea hostname - sslCertificate = "/var/lib/acme/git.pegasust.com/fullchain.pem"; - sslCertificateKey = "/var/lib/acme/git.pegasust.com/key.pem"; - forceSSL = true; # Runs on port 80 and 443 - locations."/".proxyPass = "http://localhost:3000/"; # Proxy to Gitea + useDHCP = false; + # required so that we get IP address from linode + interfaces.eth0.useDHCP = true; + }; + _boot.loader.grub.enable = true; + _boot.loader.grub.version = 2; + _services.openssh = { + permitRootLogin = "no"; + enable = true; + }; + _services.gitea = { + enable = true; + stateDir = "/gitea"; + rootUrl = "https://git.pegasust.com"; + settings = { + repository = { + "ENABLE_PUSH_CREATE_USER" = true; + "ENABLE_PUSH_CREATE_ORG" = true; }; }; }; + # Highly suspect that thanks to nginx, ipv6 is disabled? + _services.nginx = { + enable = true; + clientMaxBodySize = "100m"; # Allow big file transfers over git :^) + recommendedGzipSettings = true; + recommendedOptimisation = true; + recommendedProxySettings = true; + recommendedTlsSettings = true; + virtualHosts."git.pegasust.com" = { + # Gitea hostname + sslCertificate = "/var/lib/acme/git.pegasust.com/fullchain.pem"; + sslCertificateKey = "/var/lib/acme/git.pegasust.com/key.pem"; + forceSSL = true; # Runs on port 80 and 443 + locations."/".proxyPass = "http://localhost:3000/"; # Proxy to Gitea + }; + }; }; - # Generic machine - nixosConfigurations.pixi = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = base_modules ++ [ + }; + # Generic machine + nixosConfigurations.pixi = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = + base_modules + ++ [ ./configuration.nix { system.stateVersion = "22.05"; } ]; - specialArgs = { - hostname = "pixi"; - _networking = { - # interfaces.eth1.ipv4.addresses = [{ - # address = "71.0.0.1"; - # prefixLength = 24; - # }]; - firewall = { - enable = false; - allowedTCPPorts = [ 80 443 22 ]; - }; - useDHCP = false; - # interfaces.eth0.useDHCP = true; + specialArgs = { + hostname = "pixi"; + _networking = { + # interfaces.eth1.ipv4.addresses = [{ + # address = "71.0.0.1"; + # prefixLength = 24; + # }]; + firewall = { + enable = false; + allowedTCPPorts = [80 443 22]; }; - _boot.loader.grub.enable = true; - _boot.loader.grub.version = 2; - _services.openssh = { - permitRootLogin = "no"; - enable = true; - }; - _services.gitea = { - enable = true; - stateDir = "/gitea"; - rootUrl = "https://git.pegasust.com"; - settings = { - repository = { - "ENABLE_PUSH_CREATE_USER" = true; - "ENABLE_PUSH_CREATE_ORG" = true; - }; - }; - }; - _services.nginx = { - enable = true; - clientMaxBodySize = "100m"; # Allow big file transfers over git :^) - recommendedGzipSettings = true; - recommendedOptimisation = true; - recommendedProxySettings = true; - recommendedTlsSettings = true; - virtualHosts."git.pegasust.com" = { - # Gitea hostname - sslCertificate = "/var/lib/acme/git.pegasust.com/fullchain.pem"; - sslCertificateKey = "/var/lib/acme/git.pegasust.com/key.pem"; - forceSSL = true; # Runs on port 80 and 443 - locations."/".proxyPass = "http://localhost:3000/"; # Proxy to Gitea + useDHCP = false; + # interfaces.eth0.useDHCP = true; + }; + _boot.loader.grub.enable = true; + _boot.loader.grub.version = 2; + _services.openssh = { + permitRootLogin = "no"; + enable = true; + }; + _services.gitea = { + enable = true; + stateDir = "/gitea"; + rootUrl = "https://git.pegasust.com"; + settings = { + repository = { + "ENABLE_PUSH_CREATE_USER" = true; + "ENABLE_PUSH_CREATE_ORG" = true; }; }; }; + _services.nginx = { + enable = true; + clientMaxBodySize = "100m"; # Allow big file transfers over git :^) + recommendedGzipSettings = true; + recommendedOptimisation = true; + recommendedProxySettings = true; + recommendedTlsSettings = true; + virtualHosts."git.pegasust.com" = { + # Gitea hostname + sslCertificate = "/var/lib/acme/git.pegasust.com/fullchain.pem"; + sslCertificateKey = "/var/lib/acme/git.pegasust.com/key.pem"; + forceSSL = true; # Runs on port 80 and 443 + locations."/".proxyPass = "http://localhost:3000/"; # Proxy to Gitea + }; + }; }; - nixosConfigurations.nyx = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = base_modules ++ [ + }; + nixosConfigurations.nyx = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = + base_modules + ++ [ ./configuration.nix { system.stateVersion = "22.05"; } ]; - specialArgs = { - hostname = "nyx"; - _networking = { - enableIPv6 = false; - interfaces.eth1.ipv4.addresses = [{ + specialArgs = { + hostname = "nyx"; + _networking = { + enableIPv6 = false; + interfaces.eth1.ipv4.addresses = [ + { address = "71.0.0.2"; prefixLength = 24; - }]; - firewall.enable = true; - useDHCP = false; - interfaces.eth0.useDHCP = true; - }; - _boot.loader.grub.enable = true; - _boot.loader.grub.version = 2; - _services.openssh = { - permitRootLogin = "no"; - enable = true; - }; + } + ]; + firewall.enable = true; + useDHCP = false; + interfaces.eth0.useDHCP = true; + }; + _boot.loader.grub.enable = true; + _boot.loader.grub.version = 2; + _services.openssh = { + permitRootLogin = "no"; + enable = true; }; }; - nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = base_modules ++ [ + }; + nixosConfigurations.nixos = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = + base_modules + ++ [ ./configuration.nix { system.stateVersion = "22.05"; } ]; - specialArgs = { - hostname = "nixos"; - }; + specialArgs = { + hostname = "nixos"; }; - nixosConfigurations.htran-dev = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = base_modules ++ [ + }; + nixosConfigurations.htran-dev = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = + base_modules + ++ [ ./configuration.nix { system.stateVersion = "22.11"; @@ -218,29 +237,34 @@ # interface = "ens32"; }; networking.interfaces.ens32.ipv4.addresses = [ - { address = "10.100.200.230"; prefixLength = 24; } + { + address = "10.100.200.230"; + prefixLength = 24; + } ]; } ]; - specialArgs = { - hostname = "htran-dev"; - _networking = { - firewall.enable = true; - useDHCP = false; - interfaces.eth0.useDHCP = true; - }; - _boot.loader.grub.enable = true; - _boot.loader.grub.version = 2; - _services.openssh = { - permitRootLogin = "no"; - enable = true; - }; + specialArgs = { + hostname = "htran-dev"; + _networking = { + firewall.enable = true; + useDHCP = false; + interfaces.eth0.useDHCP = true; + }; + _boot.loader.grub.enable = true; + _boot.loader.grub.version = 2; + _services.openssh = { + permitRootLogin = "no"; + enable = true; }; }; - nixosConfigurations.bao = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs.hostname = "bao"; - modules = base_modules ++ [ + }; + nixosConfigurations.bao = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs.hostname = "bao"; + modules = + base_modules + ++ [ ./configuration.nix ./../../modules/storage.perso.sys.nix ./../../modules/kde.sys.nix @@ -248,59 +272,63 @@ ./../../modules/pulseaudio.sys.nix ./../../modules/opengl.sys.nix ./../../modules/nvgpu.sys.nix - ({ config, pkgs, lib, ... }: - { - mod.tailscale.enable = true; - # Use UEFI - boot.loader.systemd-boot.enable = true; + ({ + config, + pkgs, + lib, + ... + }: { + mod.tailscale.enable = true; + # Use UEFI + boot.loader.systemd-boot.enable = true; - networking.hostName = "bao"; # Define your hostname. - # Pick only one of the below networking options. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. + networking.hostName = "bao"; # Define your hostname. + # Pick only one of the below networking options. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - time.timeZone = "America/Phoenix"; - # Configure keymap in X11 - services.xserver.layout = "us"; - # services.xserver.xkbOptions = { - # "eurosign:e"; - # "caps:escape" # map caps to escape. - # }; + time.timeZone = "America/Phoenix"; + # Configure keymap in X11 + services.xserver.layout = "us"; + # services.xserver.xkbOptions = { + # "eurosign:e"; + # "caps:escape" # map caps to escape. + # }; - # Enable CUPS to print documents. - # services.printing.enable = true; + # Enable CUPS to print documents. + # services.printing.enable = true; - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - # Just an initial user to get this started lol - users.users.user = { - initialPassword = "pw123"; - extraGroups = [ "wheel" "networkmanager" "audio" ]; - isNormalUser = true; - }; + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + # Just an initial user to get this started lol + users.users.user = { + initialPassword = "pw123"; + extraGroups = ["wheel" "networkmanager" "audio"]; + isNormalUser = true; + }; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; - # List services that you want to enable: + # List services that you want to enable: - # Enable the OpenSSH daemon. - services.openssh.enable = true; + # Enable the OpenSSH daemon. + services.openssh.enable = true; - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "22.11"; # Did you read the comment? - }) + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "22.11"; # Did you read the comment? + }) ]; - }; }; + }; } diff --git a/nix-conf/system/hardware-configuration.nix b/nix-conf/system/hardware-configuration.nix index e45b92a..e37389b 100644 --- a/nix-conf/system/hardware-configuration.nix +++ b/nix-conf/system/hardware-configuration.nix @@ -1,17 +1,20 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelParams = [ "console=ttyS0,19200n8" ]; + boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelParams = ["console=ttyS0,19200n8"]; boot.loader.grub.extraConfig = '' serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1 terminal_input serial; @@ -20,17 +23,15 @@ boot.loader.grub.forceInstall = true; boot.loader.grub.device = "nodev"; boot.loader.timeout = 10; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.kernelModules = []; + boot.extraModulePackages = []; - fileSystems."/" = - { - device = "/dev/sda"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/sda"; + fsType = "ext4"; + }; - swapDevices = - [{ device = "/dev/sdb"; }]; + swapDevices = [{device = "/dev/sdb";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nix-conf/system/nixos-wsl/default.nix b/nix-conf/system/nixos-wsl/default.nix index 873ece4..0205bc8 100644 --- a/nix-conf/system/nixos-wsl/default.nix +++ b/nix-conf/system/nixos-wsl/default.nix @@ -3,11 +3,12 @@ let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; - } + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + } ) { src = ./.; - }).defaultNix + }) +.defaultNix diff --git a/nix-conf/system/nixos-wsl/flake.nix b/nix-conf/system/nixos-wsl/flake.nix index 8a62b47..a0996c1 100644 --- a/nix-conf/system/nixos-wsl/flake.nix +++ b/nix-conf/system/nixos-wsl/flake.nix @@ -11,9 +11,13 @@ }; }; - outputs = { self, nixpkgs, flake-utils, ... }: + outputs = { + self, + nixpkgs, + flake-utils, + ... + }: { - nixosModules.wsl = { imports = [ ./modules/build-tarball.nix @@ -31,26 +35,25 @@ ./configuration.nix ]; }; - - } // - flake-utils.lib.eachSystem - (with flake-utils.lib.system; [ "x86_64-linux" "aarch64-linux" ]) - (system: - let - pkgs = import nixpkgs { inherit system; }; - in - { - checks.check-format = pkgs.runCommand "check-format" - { - buildInputs = with pkgs; [ nixpkgs-fmt ]; - } '' + } + // flake-utils.lib.eachSystem + (with flake-utils.lib.system; ["x86_64-linux" "aarch64-linux"]) + ( + system: let + pkgs = import nixpkgs {inherit system;}; + in { + checks.check-format = + pkgs.runCommand "check-format" + { + buildInputs = with pkgs; [nixpkgs-fmt]; + } '' nixpkgs-fmt --check ${./.} mkdir $out # success ''; - devShell = pkgs.mkShell { - nativeBuildInputs = with pkgs; [ nixpkgs-fmt ]; - }; - } - ); + devShell = pkgs.mkShell { + nativeBuildInputs = with pkgs; [nixpkgs-fmt]; + }; + } + ); } diff --git a/nix-conf/system/nixos-wsl/modules/build-tarball.nix b/nix-conf/system/nixos-wsl/modules/build-tarball.nix index feba78d..f0d82e0 100644 --- a/nix-conf/system/nixos-wsl/modules/build-tarball.nix +++ b/nix-conf/system/nixos-wsl/modules/build-tarball.nix @@ -1,12 +1,22 @@ -{ config, pkgs, lib, ... }: -with builtins; with lib; -let - pkgs2storeContents = l: map (x: { object = x; symlink = "none"; }) l; +{ + config, + pkgs, + lib, + ... +}: +with builtins; with lib; let + pkgs2storeContents = l: + map (x: { + object = x; + symlink = "none"; + }) + l; nixpkgs = lib.cleanSource pkgs.path; - channelSources = pkgs.runCommand "nixos-${config.system.nixos.version}" - { preferLocalBuild = true; } + channelSources = + pkgs.runCommand "nixos-${config.system.nixos.version}" + {preferLocalBuild = true;} '' mkdir -p $out cp -prd ${nixpkgs.outPath} $out/nixos @@ -58,10 +68,7 @@ let sed -i 's|import \./default\.nix|import \./nixos-wsl|' ./etc/nixos/configuration.nix ''} ''; - -in -{ - +in { options.wsl.tarball = { includeConfig = mkOption { type = types.bool; @@ -70,13 +77,12 @@ in }; }; - config = mkIf config.wsl.enable { # These options make no sense without the wsl-distro module anyway system.build.tarball = pkgs.callPackage "${nixpkgs}/nixos/lib/make-system-tarball.nix" { # No contents, structure will be added by prepare script - contents = [ ]; + contents = []; fileName = "nixos-wsl-${pkgs.hostPlatform.system}"; @@ -92,6 +98,5 @@ in compressCommand = "gzip"; compressionExtension = ".gz"; }; - }; } diff --git a/nix-conf/system/nixos-wsl/modules/docker-desktop.nix b/nix-conf/system/nixos-wsl/modules/docker-desktop.nix index ade86e9..273769b 100644 --- a/nix-conf/system/nixos-wsl/modules/docker-desktop.nix +++ b/nix-conf/system/nixos-wsl/modules/docker-desktop.nix @@ -1,20 +1,23 @@ -{ config, lib, pkgs, ... }: -with builtins; with lib; { - +{ + config, + lib, + pkgs, + ... +}: +with builtins; +with lib; { imports = [ - (mkRenamedOptionModule [ "wsl" "docker" ] [ "wsl" "docker-desktop" ]) + (mkRenamedOptionModule ["wsl" "docker"] ["wsl" "docker-desktop"]) ]; options.wsl.docker-desktop = with types; { enable = mkEnableOption "Docker Desktop integration"; }; - config = - let - cfg = config.wsl.docker-desktop; - in + config = let + cfg = config.wsl.docker-desktop; + in mkIf (config.wsl.enable && cfg.enable) { - environment.systemPackages = with pkgs; [ docker docker-compose @@ -25,7 +28,7 @@ with builtins; with lib; { script = '' ${config.wsl.automountPath}/wsl/docker-desktop/docker-desktop-user-distro proxy --docker-desktop-root ${config.wsl.automountPath}/wsl/docker-desktop ''; - wantedBy = [ "multi-user.target" ]; + wantedBy = ["multi-user.target"]; serviceConfig = { Restart = "on-failure"; RestartSec = "30s"; @@ -35,7 +38,5 @@ with builtins; with lib; { users.groups.docker.members = [ config.wsl.defaultUser ]; - }; - } diff --git a/nix-conf/system/nixos-wsl/modules/docker-native.nix b/nix-conf/system/nixos-wsl/modules/docker-native.nix index 35d10ef..823a769 100644 --- a/nix-conf/system/nixos-wsl/modules/docker-native.nix +++ b/nix-conf/system/nixos-wsl/modules/docker-native.nix @@ -1,6 +1,11 @@ -{ config, lib, pkgs, ... }: -with builtins; with lib; { - +{ + config, + lib, + pkgs, + ... +}: +with builtins; +with lib; { options.wsl.docker-native = with types; { enable = mkEnableOption "Native Docker integration in NixOS."; @@ -15,14 +20,13 @@ with builtins; with lib; { }; }; - config = - let - cfg = config.wsl.docker-native; - in + config = let + cfg = config.wsl.docker-native; + in mkIf (config.wsl.enable && cfg.enable) { nixpkgs.overlays = [ (self: super: { - docker = super.docker.override { iptables = pkgs.iptables-legacy; }; + docker = super.docker.override {iptables = pkgs.iptables-legacy;}; }) ]; diff --git a/nix-conf/system/nixos-wsl/modules/installer.nix b/nix-conf/system/nixos-wsl/modules/installer.nix index 45d191a..20ac4fb 100644 --- a/nix-conf/system/nixos-wsl/modules/installer.nix +++ b/nix-conf/system/nixos-wsl/modules/installer.nix @@ -1,11 +1,19 @@ -{ config, lib, pkgs, ... }: -with builtins; with lib; { - +{ + config, + lib, + pkgs, + ... +}: +with builtins; +with lib; { config = mkIf config.wsl.enable ( let mkTarball = pkgs.callPackage "${lib.cleanSource pkgs.path}/nixos/lib/make-system-tarball.nix"; - pkgs2storeContents = map (x: { object = x; symlink = "none"; }); + pkgs2storeContents = map (x: { + object = x; + symlink = "none"; + }); rootfs = let tarball = config.system.build.tarball; in "${tarball}/tarball/${tarball.fileName}.tar${tarball.extension}"; @@ -39,25 +47,39 @@ with builtins; with lib; { passwd = pkgs.writeText "passwd" '' root:x:0:0:System administrator:/root:${installer} ''; - in - { - + in { system.build.installer = mkTarball { fileName = "nixos-wsl-installer"; compressCommand = "gzip"; compressionExtension = ".gz"; extraArgs = "--hard-dereference"; - storeContents = with pkgs; pkgs2storeContents [ - installer - ]; + storeContents = with pkgs; + pkgs2storeContents [ + installer + ]; contents = [ - { source = config.environment.etc."wsl.conf".source; target = "/etc/wsl.conf"; } - { source = config.environment.etc."fstab".source; target = "/etc/fstab"; } - { source = passwd; target = "/etc/passwd"; } - { source = "${pkgs.busybox}/bin/busybox"; target = "/bin/sh"; } - { source = "${pkgs.busybox}/bin/busybox"; target = "/bin/mount"; } + { + source = config.environment.etc."wsl.conf".source; + target = "/etc/wsl.conf"; + } + { + source = config.environment.etc."fstab".source; + target = "/etc/fstab"; + } + { + source = passwd; + target = "/etc/passwd"; + } + { + source = "${pkgs.busybox}/bin/busybox"; + target = "/bin/sh"; + } + { + source = "${pkgs.busybox}/bin/busybox"; + target = "/bin/mount"; + } ]; extraCommands = pkgs.writeShellScript "prepare" '' @@ -66,8 +88,6 @@ with builtins; with lib; { ln -s /init bin/wslpath ''; }; - } ); - } diff --git a/nix-conf/system/nixos-wsl/modules/interop.nix b/nix-conf/system/nixos-wsl/modules/interop.nix index b7babfb..4557aee 100644 --- a/nix-conf/system/nixos-wsl/modules/interop.nix +++ b/nix-conf/system/nixos-wsl/modules/interop.nix @@ -1,9 +1,12 @@ -{ lib, pkgs, config, ... }: - -with builtins; with lib; { + lib, + pkgs, + config, + ... +}: +with builtins; with lib; { imports = [ - (mkRenamedOptionModule [ "wsl" "compatibility" "interopPreserveArgvZero" ] [ "wsl" "interop" "preserveArgvZero" ]) + (mkRenamedOptionModule ["wsl" "compatibility" "interopPreserveArgvZero"] ["wsl" "interop" "preserveArgvZero"]) ]; options.wsl.interop = with types; { @@ -32,57 +35,56 @@ with builtins; with lib; }; }; - config = - let - cfg = config.wsl.interop; - in + config = let + cfg = config.wsl.interop; + in mkIf config.wsl.enable { - boot.binfmt.registrations = mkIf cfg.register { - WSLInterop = - let - compat = cfg.preserveArgvZero; + WSLInterop = let + compat = cfg.preserveArgvZero; - # WSL Preview 0.58 and up registers the /init binfmt interp for Windows executable - # with the "preserve argv[0]" flag, so if you run `./foo.exe`, the interp gets invoked - # as `/init foo.exe ./foo.exe`. - # argv[0] --^ ^-- actual path - # - # Older versions expect to be called without the argv[0] bit, simply as `/init ./foo.exe`. - # - # We detect that by running `/init /known-not-existing-path.exe` and checking the exit code: - # the new style interp expects at least two arguments, so exits with exit code 1, - # presumably meaning "parsing error"; the old style interp attempts to actually run - # the executable, fails to find it, and exits with 255. - compatWrapper = pkgs.writeShellScript "nixos-wsl-binfmt-hack" '' - /init /nixos-wsl-does-not-exist.exe - [ $? -eq 255 ] && shift - exec /init "$@" - ''; + # WSL Preview 0.58 and up registers the /init binfmt interp for Windows executable + # with the "preserve argv[0]" flag, so if you run `./foo.exe`, the interp gets invoked + # as `/init foo.exe ./foo.exe`. + # argv[0] --^ ^-- actual path + # + # Older versions expect to be called without the argv[0] bit, simply as `/init ./foo.exe`. + # + # We detect that by running `/init /known-not-existing-path.exe` and checking the exit code: + # the new style interp expects at least two arguments, so exits with exit code 1, + # presumably meaning "parsing error"; the old style interp attempts to actually run + # the executable, fails to find it, and exits with 255. + compatWrapper = pkgs.writeShellScript "nixos-wsl-binfmt-hack" '' + /init /nixos-wsl-does-not-exist.exe + [ $? -eq 255 ] && shift + exec /init "$@" + ''; - # use the autodetect hack if unset, otherwise call /init directly - interpreter = if compat == null then compatWrapper else "/init"; + # use the autodetect hack if unset, otherwise call /init directly + interpreter = + if compat == null + then compatWrapper + else "/init"; - # enable for the wrapper and autodetect hack - preserveArgvZero = if compat == false then false else true; - in - { - magicOrExtension = "MZ"; - fixBinary = true; - wrapInterpreterInShell = false; - inherit interpreter preserveArgvZero; - }; + # enable for the wrapper and autodetect hack + preserveArgvZero = + if compat == false + then false + else true; + in { + magicOrExtension = "MZ"; + fixBinary = true; + wrapInterpreterInShell = false; + inherit interpreter preserveArgvZero; + }; }; # Include Windows %PATH% in Linux $PATH. environment.extraInit = mkIf cfg.includePath ''PATH="$PATH:$WSLPATH"''; - warnings = - let - registrations = config.boot.binfmt.registrations; - in + warnings = let + registrations = config.boot.binfmt.registrations; + in optional (!(registrations ? WSLInterop) && (length (attrNames config.boot.binfmt.registrations)) != 0) "Having any binfmt registrations without re-registering WSLInterop (wsl.interop.register) will break running .exe files from WSL2"; }; - - } diff --git a/nix-conf/system/nixos-wsl/modules/wsl-distro.nix b/nix-conf/system/nixos-wsl/modules/wsl-distro.nix index 4c6eda5..c7ba346 100644 --- a/nix-conf/system/nixos-wsl/modules/wsl-distro.nix +++ b/nix-conf/system/nixos-wsl/modules/wsl-distro.nix @@ -1,42 +1,45 @@ -{ lib, pkgs, config, ... }: - -with builtins; with lib; { - options.wsl = with types; - let - coercedToStr = coercedTo (oneOf [ bool path int ]) (toString) str; - in - { - enable = mkEnableOption "support for running NixOS as a WSL distribution"; - automountPath = mkOption { - type = str; - default = "/mnt"; - description = "The path where windows drives are mounted (e.g. /mnt/c)"; - }; - automountOptions = mkOption { - type = str; - default = "metadata,uid=1000,gid=100"; - description = "Options to use when mounting windows drives"; - }; - defaultUser = mkOption { - type = str; - default = "nixos"; - description = "The name of the default user"; - }; - startMenuLaunchers = mkEnableOption "shortcuts for GUI applications in the windows start menu"; - wslConf = mkOption { - type = attrsOf (attrsOf (oneOf [ string int bool ])); - description = "Entries that are added to /etc/wsl.conf"; - }; + lib, + pkgs, + config, + ... +}: +with builtins; with lib; { + options.wsl = with types; let + coercedToStr = coercedTo (oneOf [bool path int]) toString str; + in { + enable = mkEnableOption "support for running NixOS as a WSL distribution"; + automountPath = mkOption { + type = str; + default = "/mnt"; + description = "The path where windows drives are mounted (e.g. /mnt/c)"; }; + automountOptions = mkOption { + type = str; + default = "metadata,uid=1000,gid=100"; + description = "Options to use when mounting windows drives"; + }; + defaultUser = mkOption { + type = str; + default = "nixos"; + description = "The name of the default user"; + }; + startMenuLaunchers = mkEnableOption "shortcuts for GUI applications in the windows start menu"; + wslConf = mkOption { + type = attrsOf (attrsOf (oneOf [string int bool])); + description = "Entries that are added to /etc/wsl.conf"; + }; + }; - config = - let - cfg = config.wsl; - syschdemd = import ../syschdemd.nix { inherit lib pkgs config; inherit (cfg) automountPath defaultUser; defaultUserHome = config.users.users.${cfg.defaultUser}.home; }; - in + config = let + cfg = config.wsl; + syschdemd = import ../syschdemd.nix { + inherit lib pkgs config; + inherit (cfg) automountPath defaultUser; + defaultUserHome = config.users.users.${cfg.defaultUser}.home; + }; + in mkIf cfg.enable { - wsl.wslConf = { automount = { enabled = true; @@ -57,9 +60,8 @@ with builtins; with lib; hardware.opengl.enable = true; # Enable GPU acceleration environment = { - etc = { - "wsl.conf".text = generators.toINI { } cfg.wslConf; + "wsl.conf".text = generators.toINI {} cfg.wslConf; # DNS settings are managed by WSL hosts.enable = !config.wsl.wslConf.network.generateHosts; @@ -67,7 +69,7 @@ with builtins; with lib; }; systemPackages = [ - (pkgs.runCommand "wslpath" { } '' + (pkgs.runCommand "wslpath" {} '' mkdir -p $out/bin ln -s /init $out/bin/wslpath '') @@ -79,13 +81,13 @@ with builtins; with lib; users.users.${cfg.defaultUser} = { isNormalUser = true; uid = 1000; - extraGroups = [ "wheel" ]; # Allow the default user to use sudo + extraGroups = ["wheel"]; # Allow the default user to use sudo }; users.users.root = { shell = "${syschdemd}/bin/syschdemd"; # Otherwise WSL fails to login as root with "initgroups failed 5" - extraGroups = [ "root" ]; + extraGroups = ["root"]; }; security.sudo = { @@ -97,7 +99,7 @@ with builtins; with lib; system.activationScripts = { copy-launchers = mkIf cfg.startMenuLaunchers ( - stringAfter [ ] '' + stringAfter [] '' for x in applications icons; do echo "Copying /usr/share/$x" mkdir -p /usr/share/$x @@ -105,7 +107,7 @@ with builtins; with lib; done '' ); - populateBin = stringAfter [ ] '' + populateBin = stringAfter [] '' echo "setting up /bin..." ln -sf /init /bin/wslpath ln -sf ${pkgs.bashInteractive}/bin/bash /bin/sh @@ -134,6 +136,6 @@ with builtins; with lib; enableEmergencyMode = false; }; - warnings = (optional (config.systemd.services.systemd-resolved.enable && config.wsl.wslConf.network.generateResolvConf) "systemd-resolved is enabled, but resolv.conf is managed by WSL"); + warnings = optional (config.systemd.services.systemd-resolved.enable && config.wsl.wslConf.network.generateResolvConf) "systemd-resolved is enabled, but resolv.conf is managed by WSL"; }; } diff --git a/nix-conf/system/nixos-wsl/syschdemd.nix b/nix-conf/system/nixos-wsl/syschdemd.nix index 406dd86..b912fb6 100644 --- a/nix-conf/system/nixos-wsl/syschdemd.nix +++ b/nix-conf/system/nixos-wsl/syschdemd.nix @@ -1,19 +1,19 @@ -{ lib -, pkgs -, config -, automountPath -, defaultUser -, defaultUserHome ? "/home/${defaultUser}" -, ... +{ + lib, + pkgs, + config, + automountPath, + defaultUser, + defaultUserHome ? "/home/${defaultUser}", + ... }: - pkgs.substituteAll { name = "syschdemd"; src = ./syschdemd.sh; dir = "bin"; isExecutable = true; - buildInputs = with pkgs; [ daemonize ]; + buildInputs = with pkgs; [daemonize]; inherit defaultUser defaultUserHome; inherit (pkgs) daemonize; diff --git a/nix-conf/system/profiles/Felia/hardware-configuration.nix b/nix-conf/system/profiles/Felia/hardware-configuration.nix index 97c93fb..245f91b 100644 --- a/nix-conf/system/profiles/Felia/hardware-configuration.nix +++ b/nix-conf/system/profiles/Felia/hardware-configuration.nix @@ -1,15 +1,19 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = [ ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = []; - boot.initrd.availableKernelModules = [ ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = []; + boot.initrd.kernelModules = []; + boot.kernelModules = []; + boot.extraModulePackages = []; ## NOTE: These filesystems are mounted by a wrapper script from nix-wsl @@ -43,25 +47,22 @@ # fsType = "drvfs"; # }; - fileSystems."/mnt/c" = - { - device = "C:"; - fsType = "drvfs"; - }; + fileSystems."/mnt/c" = { + device = "C:"; + fsType = "drvfs"; + }; - fileSystems."/mnt/d" = - { - device = "D:"; - fsType = "drvfs"; - }; + fileSystems."/mnt/d" = { + device = "D:"; + fsType = "drvfs"; + }; - fileSystems."/mnt/f" = - { - device = "F:"; - fsType = "drvfs"; - }; + fileSystems."/mnt/f" = { + device = "F:"; + fsType = "drvfs"; + }; - swapDevices = [ ]; + swapDevices = []; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nix-conf/system/profiles/bao/hardware-configuration.nix b/nix-conf/system/profiles/bao/hardware-configuration.nix index 3d4935d..aa90f0a 100644 --- a/nix-conf/system/profiles/bao/hardware-configuration.nix +++ b/nix-conf/system/profiles/bao/hardware-configuration.nix @@ -1,19 +1,22 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; # boot.initrd.kernelModules = [ "amdgpu" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-amd" "coretemp" ]; - boot.extraModulePackages = [ ]; + boot.initrd.kernelModules = []; + boot.kernelModules = ["kvm-amd" "coretemp"]; + boot.extraModulePackages = []; fileSystems."/" = # Might be wise to use /dev/nvme0p1 instead @@ -29,7 +32,7 @@ fsType = "vfat"; }; - swapDevices = [ ]; + swapDevices = []; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nix-conf/system/profiles/homeless/hardware-configuration.nix b/nix-conf/system/profiles/homeless/hardware-configuration.nix index e45b92a..e37389b 100644 --- a/nix-conf/system/profiles/homeless/hardware-configuration.nix +++ b/nix-conf/system/profiles/homeless/hardware-configuration.nix @@ -1,17 +1,20 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelParams = [ "console=ttyS0,19200n8" ]; + boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelParams = ["console=ttyS0,19200n8"]; boot.loader.grub.extraConfig = '' serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1 terminal_input serial; @@ -20,17 +23,15 @@ boot.loader.grub.forceInstall = true; boot.loader.grub.device = "nodev"; boot.loader.timeout = 10; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.kernelModules = []; + boot.extraModulePackages = []; - fileSystems."/" = - { - device = "/dev/sda"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/sda"; + fsType = "ext4"; + }; - swapDevices = - [{ device = "/dev/sdb"; }]; + swapDevices = [{device = "/dev/sdb";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nix-conf/system/profiles/lester/hardware-configuration.nix b/nix-conf/system/profiles/lester/hardware-configuration.nix index e45b92a..e37389b 100644 --- a/nix-conf/system/profiles/lester/hardware-configuration.nix +++ b/nix-conf/system/profiles/lester/hardware-configuration.nix @@ -1,17 +1,20 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelParams = [ "console=ttyS0,19200n8" ]; + boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelParams = ["console=ttyS0,19200n8"]; boot.loader.grub.extraConfig = '' serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1 terminal_input serial; @@ -20,17 +23,15 @@ boot.loader.grub.forceInstall = true; boot.loader.grub.device = "nodev"; boot.loader.timeout = 10; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.kernelModules = []; + boot.extraModulePackages = []; - fileSystems."/" = - { - device = "/dev/sda"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/sda"; + fsType = "ext4"; + }; - swapDevices = - [{ device = "/dev/sdb"; }]; + swapDevices = [{device = "/dev/sdb";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nix-conf/system/profiles/lizzi/hardware-configuration.nix b/nix-conf/system/profiles/lizzi/hardware-configuration.nix index 5fa1db1..4078d1c 100644 --- a/nix-conf/system/profiles/lizzi/hardware-configuration.nix +++ b/nix-conf/system/profiles/lizzi/hardware-configuration.nix @@ -1,17 +1,20 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelParams = [ "console=ttyS0,19200n8" ]; + boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelParams = ["console=ttyS0,19200n8"]; boot.loader.grub.extraConfig = '' serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1 terminal_input serial; @@ -20,8 +23,8 @@ boot.loader.grub.forceInstall = true; boot.loader.grub.device = "nodev"; boot.loader.timeout = 10; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.kernelModules = []; + boot.extraModulePackages = []; fileSystems = { "/" = { @@ -35,8 +38,7 @@ }; }; - swapDevices = - [{ device = "/dev/sdb"; }]; + swapDevices = [{device = "/dev/sdb";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nix-conf/system/profiles/nyx/hardware-configuration.nix b/nix-conf/system/profiles/nyx/hardware-configuration.nix index 88ffe66..4a88873 100644 --- a/nix-conf/system/profiles/nyx/hardware-configuration.nix +++ b/nix-conf/system/profiles/nyx/hardware-configuration.nix @@ -1,20 +1,23 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: - { - imports = - [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; + config, + lib, + pkgs, + modulesPath, + ... +}: { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; - boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.initrd.availableKernelModules = ["virtio_pci" "virtio_scsi" "ahci" "sd_mod"]; + boot.initrd.kernelModules = []; + boot.kernelModules = []; + boot.extraModulePackages = []; - boot.kernelParams = [ "console=ttyS0,19200n8" ]; + boot.kernelParams = ["console=ttyS0,19200n8"]; boot.loader.grub.extraConfig = '' serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1 terminal_input serial; @@ -23,14 +26,12 @@ boot.loader.grub.forceInstall = true; boot.loader.grub.device = "nodev"; boot.loader.timeout = 10; - fileSystems."/" = - { - device = "/dev/sda"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/sda"; + fsType = "ext4"; + }; - swapDevices = - [{ device = "/dev/sdb"; }]; + swapDevices = [{device = "/dev/sdb";}]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nix-conf/system/wsl-configuration.nix b/nix-conf/system/wsl-configuration.nix index 48fd9d3..e40b36c 100755 --- a/nix-conf/system/wsl-configuration.nix +++ b/nix-conf/system/wsl-configuration.nix @@ -1,10 +1,7 @@ -{ lib, ... }: - -with lib; -let +{lib, ...}: +with lib; let nixos-wsl = import ./nixos-wsl; -in -{ +in { imports = [ ./configuration.nix nixos-wsl.nixosModules.wsl @@ -21,9 +18,7 @@ in # Enable integration with Docker Desktop (needs to be installed) docker-desktop.enable = true; - }; # users.users..uid = 1000; # networking.hostName = "nixos"; - } diff --git a/nix/cells/dotfiles/devshells.nix b/nix/cells/dotfiles/devshells.nix index fe24e92..177c8be 100644 --- a/nix/cells/dotfiles/devshells.nix +++ b/nix/cells/dotfiles/devshells.nix @@ -1,6 +1,8 @@ -{inputs, cell}: let +{ + inputs, + cell, +}: let inherit (inputs) std nixpkgs; - in { default = std.lib.dev.mkShell { name = "default"; diff --git a/nix/cells/home-configs/default.nix b/nix/cells/home-configs/default.nix new file mode 100644 index 0000000..656a82c --- /dev/null +++ b/nix/cells/home-configs/default.nix @@ -0,0 +1,6 @@ +{ + inputs, + cell, +}: let +in { +} diff --git a/nix/cells/packages/default.nix b/nix/cells/packages/default.nix new file mode 100644 index 0000000..aa49c70 --- /dev/null +++ b/nix/cells/packages/default.nix @@ -0,0 +1,5 @@ +{ + inputs, + cell, +}: { +} diff --git a/nix/cells/repo/home-modules/default.nix b/nix/cells/repo/home-modules/default.nix index 77286c3..b5e90df 100644 --- a/nix/cells/repo/home-modules/default.nix +++ b/nix/cells/repo/home-modules/default.nix @@ -102,7 +102,7 @@ in { }; font.size = lib.mkOption { type = lib.types.nullOr lib.types.number; - default = null; + default = 11.0; description = '' The default font size for Alacritty. This is probably measured in px. ''; @@ -116,7 +116,7 @@ in { ''; example = true; }; - config-file = lib.mkOption { + config-path = lib.mkOption { type = lib.types.path; description = "Path to alacritty yaml"; default = null; @@ -126,12 +126,10 @@ in { config.programs.alacritty = { enable = cfg.enable; settings = let ; - actualConfig = if cfg.config-file != null then fromYAML (builtins.readFile cfg.config-file) else {}; + actualConfig = if cfg.config-path != null then fromYAML (builtins.readFile cfg.config-path) else {}; in lib.recursiveUpdate actualConfig { - font.normal.family = opt-toNullable(opt-leftmostSome (builtins.map opt-fromNullable [ - cfg.font.family actualConfig.font.family actualConfig.font.normal.family - ])); - font.size = cfg.font.size or actualConfig.font.size or 7.0; + font.normal.family = lib.mkIf (font.family != null) font.family; + font.size = lib.mkIf (font.size != null) font.size; }; }; }; diff --git a/nix/cells/repo/home-modules/nixgl.nix b/nix/cells/repo/home-modules/nixgl.nix index 6ee8452..38162fd 100644 --- a/nix/cells/repo/home-modules/nixgl.nix +++ b/nix/cells/repo/home-modules/nixgl.nix @@ -1,11 +1,18 @@ -{inputs, cell, namespace}: { pkgs, config, lib, ... }: -let +{ + inputs, + cell, + namespace, +}: { + pkgs, + config, + lib, + ... +}: let cfg = config."${namespace}".graphics; cfgEnable = cfg.enable or (cfg.useNixGL.defaultPackage != null); types = lib.types; -in -{ - imports = [ ./shells.nix ]; +in { + imports = [./shells.nix]; options."${namespace}".nixgl = { enable = lib.mkEnableOption "nixgl"; useNixGL = { @@ -17,7 +24,7 @@ in ]; }; defaultPackage = lib.mkOption { - type = types.nullOr (types.enum [ "nixGLIntel" "nixGLNvidia" "nixGLNvidiaBumblebee" ]); + type = types.nullOr (types.enum ["nixGLIntel" "nixGLNvidia" "nixGLNvidiaBumblebee"]); description = "Which nixGL package to be aliased as `nixGL` on the shell"; default = null; example = "nixGLIntel"; @@ -35,6 +42,6 @@ in nixGL = cfg.useNixGL.defaultPackage; }; }; - home.packages = [ cfg.useNixGL.package ]; + home.packages = [cfg.useNixGL.package]; }; } diff --git a/nix/cells/repo/home-profiles/default.nix b/nix/cells/repo/home-profiles/default.nix index 1218017..79bd3f5 100644 --- a/nix/cells/repo/home-profiles/default.nix +++ b/nix/cells/repo/home-profiles/default.nix @@ -1,15 +1,27 @@ -_imports@{inputs, cell}: let +# This creates a layer that is specific to some profiles, but may require +# some variants in environment like username/email, work-oriented or personal +# and many more +_imports @ { + inputs, + cell, +}: let + # TODO: I don't think abstracting namespace away is a good idea in this case namespace = "repo"; imports = _imports // {inherit namespace;}; in { neovim = import ./neovim.nix imports; - nerd_font_module = {config, pkgs, ...}: { + nerd_font_module = { + config, + pkgs, + ... + }: { imports = [ - import inputs.cells."${namespace}" + import + inputs.cells."${namespace}" ]; fonts.fontconfig.enable = true; home.packages = [ - (pkgs.nerdfonts.override { fonts = [ "Hack" ]; }) + (pkgs.nerdfonts.override {fonts = ["Hack"];}) ]; "${namespace}".alacritty.font.family = "Hack Nerd Font Mono"; }; @@ -32,7 +44,13 @@ in { }; }; - ssh = {config, lib, ...}: let cfg = config."${namespace}".ssh; in { + ssh = { + config, + lib, + ... + }: let + cfg = config."${namespace}".ssh; + in { options."${namespace}".ssh.enable = lib.mkOption { type = lib.types.bool; default = true; @@ -48,13 +66,79 @@ in { }; }; - alacritty = {config, lib,...}: let cfg = config."${namespace}".alacritty; in { + alacritty = { + config, + lib, + ... + }: let + cfg = config."${namespace}".alacritty; + in { imports = [ - import "${inputs.cells.repo.home-modules.alacritty}" + import + "${inputs.cells.repo.home-modules.alacritty}" ]; configs."${namespace}".alacritty = { enable = true; - config-file = "${inputs.self}//native-configs/alacritty/alacritty.yml"; + config-path = "${inputs.self}//native-configs/alacritty/alacritty.yml"; + font.size = 11.0; + font.family = "Hack Nerd Font Mono"; + }; + }; + + shells = import ./shells.nix imports; + + git = { + config, + pkgs, + lib, + ... + }: let + baseAliases = { + a = "add"; + c = "commit"; + ca = "commit --amend"; + cm = "commit -m"; + lol = "log --graph --decorate --pretty=oneline --abbrev-commit"; + lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all"; + sts = "status"; + co = "checkout"; + b = "branch"; + }; + in { + options."${namespace}".git = { + aliases = lib.mkOption { + type = lib.types.attrs; + default = {}; + example = baseAliases; + description = '' + Additional git aliases. This config is merged on top of base aliases. + ''; + }; + name = lib.mkOption { + type = lib.types.str; + default = "Pegasust"; + description = "Git username that appears on commits"; + example = "Pegasust"; + }; + email = lib.mkOption { + type = lib.types.str; + default = "pegasucksgg@gmail.com"; + example = "peagsucksgg@gmail.com"; + description = "Git email that appears on commits"; + }; + ignores = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ + ".vscode" # vscode settings + ".direnv" # .envrc cached outputs + ".DS_Store" # MacOS users, amrite + ]; + description = '' + .gitignore patterns that are applied in every repository. + This is useful for IDE-specific or environment-specific settings. + ''; + example = [".direnv" "node_modules"]; + }; }; }; } diff --git a/nix/cells/repo/home-profiles/neovim.nix b/nix/cells/repo/home-profiles/neovim.nix index c312876..56fa549 100644 --- a/nix/cells/repo/home-profiles/neovim.nix +++ b/nix/cells/repo/home-profiles/neovim.nix @@ -2,62 +2,72 @@ # # One thing to consider, though, /nix/store of `nix-shell` or `nix-develop` # might be different from `home-manager`'s (~/.nix_profile/bin/jq) -{inputs, cell, namespace}: { pkgs, lib, config, ... }: -let +{ + inputs, + cell, + namespace, +}: { + pkgs, + lib, + config, + ... +}: let # NOTE: Add packages to nvim_pkgs instead, so that it's available at userspace # and is added to the path after wrapping. # check: nix repl `homeConfigurations.hungtr.config.programs.neovim.finalPackage.buildCommand` # see: :/--suffix.*PATH # there should be mentions of additional packages my_neovim = pkgs.neovim-unwrapped; - rust_pkgs = (pkgs.rust-bin.selectLatestNightlyWith + rust_pkgs = + pkgs.rust-bin.selectLatestNightlyWith ( toolchain: - toolchain.default.override { - extensions = [ "rust-src" "rust-analyzer" "rust-docs" "rustfmt" "clippy" "miri" ]; - } - )); - nvim_pkgs = [ - # pkgs.gccStdenv - pkgs.tree-sitter - pkgs.fzf # file name fuzzy search - pkgs.ripgrep # content fuzzy search - pkgs.zk # Zettelkasten (limited support) - pkgs.fd # Required by a Telescope plugin (?) - pkgs.stdenv.cc.cc.lib - pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo - pkgs.rust4cargo - pkgs.nickel - pkgs.nls - - pkgs.go # doesn't work, Mason installs from runtime path - - # Language-specific stuffs - pkgs.sumneko-lua-language-server - # pkgs.python3Packages.python-lsp-server - pkgs.nodePackages.pyright - pkgs.python3Packages.pylint - pkgs.python3Packages.flake8 - # FIXME: installing ansible from here just doesn't work :/ - # pkgs.ansible-lint - # pkgs.python38Packages.ansible - # pkgs.ansible-language-server - # TODO: the devShell should provide rust-analyzer so that - # cargo test builds binaries compatible with rust-analyzer - - # pkgs.rust-analyzer - # rust_pkgs - # pkgs.evcxr # Rust REPL for Conjure! - ] ++ lib.optionals (pkgs.stdenv.isDarwin) ( - let - inherit (pkgs.darwin.apple_sdk.frameworks) System CoreFoundation; in + toolchain.default.override { + extensions = ["rust-src" "rust-analyzer" "rust-docs" "rustfmt" "clippy" "miri"]; + } + ); + nvim_pkgs = [ - System - CoreFoundation + # pkgs.gccStdenv + pkgs.tree-sitter + pkgs.fzf # file name fuzzy search + pkgs.ripgrep # content fuzzy search + pkgs.zk # Zettelkasten (limited support) + pkgs.fd # Required by a Telescope plugin (?) + pkgs.stdenv.cc.cc.lib + pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo + pkgs.rust4cargo + pkgs.nickel + pkgs.nls + + pkgs.go # doesn't work, Mason installs from runtime path + + # Language-specific stuffs + pkgs.sumneko-lua-language-server + # pkgs.python3Packages.python-lsp-server + pkgs.nodePackages.pyright + pkgs.python3Packages.pylint + pkgs.python3Packages.flake8 + # FIXME: installing ansible from here just doesn't work :/ + # pkgs.ansible-lint + # pkgs.python38Packages.ansible + # pkgs.ansible-language-server + # TODO: the devShell should provide rust-analyzer so that + # cargo test builds binaries compatible with rust-analyzer + + # pkgs.rust-analyzer + # rust_pkgs + # pkgs.evcxr # Rust REPL for Conjure! ] - ); -in -{ + ++ lib.optionals (pkgs.stdenv.isDarwin) ( + let + inherit (pkgs.darwin.apple_sdk.frameworks) System CoreFoundation; + in [ + System + CoreFoundation + ] + ); +in { options.base.neovim = { enable = lib.mkOption { default = true; @@ -77,60 +87,54 @@ in withNodeJs = true; # NOTE: this adds path to the wrapped version of neovim extraPackages = nvim_pkgs; - extraLuaConfig = (builtins.readFile "${inputs.self}/native_configs/neovim/init.lua"); - plugins = (let inherit (pkgs.vimPlugins) - plenary-nvim - - nvim-treesitter - nvim-treesitter-textobjects - nvim-treesitter-context - - telescope-fzf-native-nvim - telescope-file-browser-nvim - telescope-nvim - - nvim-lspconfig - - gruvbox-community - - neodev-nvim - - cmp-nvim-lsp - cmp-path - cmp-buffer - cmp-cmdline - nvim-cmp - - lspkind-nvim - nvim-autopairs - nvim-ts-autotag - guess-indent-nvim - harpoon - zk-nvim - luasnip - fidget-nvim - rust-tools-nvim - - cmp_luasnip - gitsigns-nvim - indent-blankline-nvim - lualine-nvim - mason-lspconfig-nvim - mason-nvim - neogit - nlua-nvim - nvim-jqx - nvim-surround - nvim-web-devicons - playground - todo-comments-nvim - trouble-nvim - vim-dispatch - vim-dispatch-neovim - vim-fugitive - vim-jack-in - - ; in [ + extraLuaConfig = builtins.readFile "${inputs.self}/native_configs/neovim/init.lua"; + plugins = let + inherit + (pkgs.vimPlugins) + plenary-nvim + nvim-treesitter + nvim-treesitter-textobjects + nvim-treesitter-context + telescope-fzf-native-nvim + telescope-file-browser-nvim + telescope-nvim + nvim-lspconfig + gruvbox-community + neodev-nvim + cmp-nvim-lsp + cmp-path + cmp-buffer + cmp-cmdline + nvim-cmp + lspkind-nvim + nvim-autopairs + nvim-ts-autotag + guess-indent-nvim + harpoon + zk-nvim + luasnip + fidget-nvim + rust-tools-nvim + cmp_luasnip + gitsigns-nvim + indent-blankline-nvim + lualine-nvim + mason-lspconfig-nvim + mason-nvim + neogit + nlua-nvim + nvim-jqx + nvim-surround + nvim-web-devicons + playground + todo-comments-nvim + trouble-nvim + vim-dispatch + vim-dispatch-neovim + vim-fugitive + vim-jack-in + ; + in [ plenary-nvim nvim-treesitter.withAllGrammars nvim-treesitter-textobjects @@ -173,8 +177,8 @@ in vim-dispatch vim-dispatch-neovim vim-fugitive - vim-jack-in - ]); + vim-jack-in + ]; }; # home.packages = nvim_pkgs; }; diff --git a/nix/cells/repo/home-modules/shells.nix b/nix/cells/repo/home-profiles/shells.nix similarity index 79% rename from nix/cells/repo/home-modules/shells.nix rename to nix/cells/repo/home-profiles/shells.nix index e3ed1a2..9e89729 100644 --- a/nix/cells/repo/home-modules/shells.nix +++ b/nix/cells/repo/home-profiles/shells.nix @@ -1,11 +1,15 @@ -{inputs, cell, namespace}: { config -, lib -, pkgs -, ... -}: -let cfg = config."${namespace}".shells; -in { + inputs, + cell, + namespace, +}: { + config, + lib, + pkgs, + ... +}: let + cfg = config."${namespace}".shells; +in { options."${namespace}".shells = { enable = lib.mkOption { type = lib.types.bool; @@ -26,7 +30,7 @@ in shellAliases = lib.mkOption { type = lib.types.attrs; description = "Shell command aliases"; - default = { }; + default = {}; example = { nixGL = "nixGLIntel"; }; @@ -47,9 +51,8 @@ in }; programs.tmux = { enable = true; - # extraConfigBeforePlugin = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"; - plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [ cpu net-speed ]; - extraConfig = (builtins.readFile "${proj_root.config.path}/tmux/tmux.conf"); + plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [cpu net-speed]; + extraConfig = builtins.readFile "${innputs.self}/native_configs/tmux/tmux.conf"; }; xdg.configFile."tmux/tmux.conf".text = lib.mkOrder 600 '' set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M ' @@ -63,15 +66,16 @@ in programs.starship = { enable = true; enableZshIntegration = true; - settings = let - native = builtins.fromTOML (builtins.readFile "${proj_root.config.path}/starship/starship.toml"); - patch-nix = pkgs.lib.recursiveUpdate native ({ + settings = let + native = builtins.fromTOML (builtins.readFile "${inputs.self}/native_configs/starship/starship.toml"); + patch-nix = pkgs.lib.recursiveUpdate native { c.commands = [ ["nix" "run" "nixpkgs#clang" "--" "--version"] ["nix" "run" "nixpkgs#gcc" "--" "--version"] ]; - }); - in patch-nix; + }; + in + patch-nix; }; # Fuzzy finder. `fzf` for TUI, `fzf -f ''` for UNIX piping programs.fzf.enable = true; @@ -84,10 +88,12 @@ in enable = true; enableCompletion = true; enableAutosuggestions = true; - shellAliases = { - nix-rebuild = "sudo nixos-rebuild switch"; - hm-switch = "home-manager switch --flake"; - } // (cfg.shellAliases or { }); + shellAliases = + { + nix-rebuild = "sudo nixos-rebuild switch"; + hm-switch = "home-manager switch --flake"; + } + // (cfg.shellAliases or {}); history = { size = 10000; path = "${config.xdg.dataHome}/zsh/history"; @@ -112,10 +118,11 @@ in ZVM_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) ZVM_ESCAPE_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) }; - initExtra = (cfg.shellInitExtra or "") + '' - source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh - ''; - + initExtra = + (cfg.shellInitExtra or "") + + '' + source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh + ''; }; }; } diff --git a/nix/cells/repo/lib/default.nix b/nix/cells/repo/lib/default.nix index 01aca6d..2e7bc77 100644 --- a/nix/cells/repo/lib/default.nix +++ b/nix/cells/repo/lib/default.nix @@ -13,6 +13,7 @@ in { fromYAML = yamlContent: bulitins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json")); + # NOTE: Deprecate # ctor opt-some = a: [a]; opt-none = []; diff --git a/nix/cells/repo/userShells.nix b/nix/cells/repo/userShells.nix index 3d5b345..660b472 100644 --- a/nix/cells/repo/userShells.nix +++ b/nix/cells/repo/userShells.nix @@ -1,4 +1,7 @@ -{inputs, cell}: { +{ + inputs, + cell, +}: { htran = inputs.cells.dotfiles.devshells.default; hungtran = inputs.cells.dotfiles.devshells.default; } diff --git a/out-of-tree/flake-compat/default.nix b/out-of-tree/flake-compat/default.nix index c966c6d..a6744f0 100644 --- a/out-of-tree/flake-compat/default.nix +++ b/out-of-tree/flake-compat/default.nix @@ -4,182 +4,264 @@ # calls the flake's 'outputs' function. It then returns an attrset # containing 'defaultNix' (to be used in 'default.nix'), 'shellNix' # (to be used in 'shell.nix'). - -{ src, system ? builtins.currentSystem or "unknown-system" }: - -let - +{ + src, + system ? builtins.currentSystem or "unknown-system", +}: let lockFilePath = src + "/flake.lock"; lockFile = builtins.fromJSON (builtins.readFile lockFilePath); - fetchTree = - info: - if info.type == "github" then - { outPath = - fetchTarball - ({ url = "https://api.${info.host or "github.com"}/repos/${info.owner}/${info.repo}/tarball/${info.rev}"; } - // (if info ? narHash then { sha256 = info.narHash; } else {}) - ); - rev = info.rev; - shortRev = builtins.substring 0 7 info.rev; + fetchTree = info: + if info.type == "github" + then { + outPath = + fetchTarball + ( + {url = "https://api.${info.host or "github.com"}/repos/${info.owner}/${info.repo}/tarball/${info.rev}";} + // ( + if info ? narHash + then {sha256 = info.narHash;} + else {} + ) + ); + rev = info.rev; + shortRev = builtins.substring 0 7 info.rev; + lastModified = info.lastModified; + lastModifiedDate = formatSecondsSinceEpoch info.lastModified; + narHash = info.narHash; + } + else if info.type == "git" + then + { + outPath = + builtins.fetchGit + ( + {url = info.url;} + // ( + if info ? rev + then {inherit (info) rev;} + else {} + ) + // ( + if info ? ref + then {inherit (info) ref;} + else {} + ) + // ( + if info ? submodules + then {inherit (info) submodules;} + else {} + ) + ); lastModified = info.lastModified; lastModifiedDate = formatSecondsSinceEpoch info.lastModified; narHash = info.narHash; } - else if info.type == "git" then - { outPath = - builtins.fetchGit - ({ url = info.url; } - // (if info ? rev then { inherit (info) rev; } else {}) - // (if info ? ref then { inherit (info) ref; } else {}) - // (if info ? submodules then { inherit (info) submodules; } else {}) - ); - lastModified = info.lastModified; - lastModifiedDate = formatSecondsSinceEpoch info.lastModified; - narHash = info.narHash; - } // (if info ? rev then { - rev = info.rev; - shortRev = builtins.substring 0 7 info.rev; - } else { - }) - else if info.type == "path" then - { outPath = builtins.path { - path = if builtins.substring 0 1 info.path != "/" - then src + ("/" + info.path) # make this absolute path by prepending ./ + // ( + if info ? rev + then { + rev = info.rev; + shortRev = builtins.substring 0 7 info.rev; + } + else { + } + ) + else if info.type == "path" + then { + outPath = builtins.path { + path = + if builtins.substring 0 1 info.path != "/" + then src + ("/" + info.path) # make this absolute path by prepending ./ else info.path; # it's already an absolute path }; - narHash = info.narHash; - } - else if info.type == "tarball" then - { outPath = - fetchTarball - ({ inherit (info) url; } - // (if info ? narHash then { sha256 = info.narHash; } else {}) - ); - } - else if info.type == "gitlab" then - { inherit (info) rev narHash lastModified; - outPath = - fetchTarball - ({ url = "https://${info.host or "gitlab.com"}/api/v4/projects/${info.owner}%2F${info.repo}/repository/archive.tar.gz?sha=${info.rev}"; } - // (if info ? narHash then { sha256 = info.narHash; } else {}) - ); - shortRev = builtins.substring 0 7 info.rev; - } + narHash = info.narHash; + } + else if info.type == "tarball" + then { + outPath = + fetchTarball + ( + {inherit (info) url;} + // ( + if info ? narHash + then {sha256 = info.narHash;} + else {} + ) + ); + } + else if info.type == "gitlab" + then { + inherit (info) rev narHash lastModified; + outPath = + fetchTarball + ( + {url = "https://${info.host or "gitlab.com"}/api/v4/projects/${info.owner}%2F${info.repo}/repository/archive.tar.gz?sha=${info.rev}";} + // ( + if info ? narHash + then {sha256 = info.narHash;} + else {} + ) + ); + shortRev = builtins.substring 0 7 info.rev; + } else # FIXME: add Mercurial, tarball inputs. throw "flake input has unsupported input type '${info.type}'"; - callFlake4 = flakeSrc: locks: - let - flake = import (flakeSrc + "/flake.nix"); + callFlake4 = flakeSrc: locks: let + flake = import (flakeSrc + "/flake.nix"); - inputs = builtins.mapAttrs (n: v: - if v.flake or true - then callFlake4 (fetchTree (v.locked // v.info)) v.inputs - else fetchTree (v.locked // v.info)) locks; + inputs = builtins.mapAttrs (n: v: + if v.flake or true + then callFlake4 (fetchTree (v.locked // v.info)) v.inputs + else fetchTree (v.locked // v.info)) + locks; - outputs = flakeSrc // (flake.outputs (inputs // {self = outputs;})); - in - assert flake.edition == 201909; - outputs; + outputs = flakeSrc // (flake.outputs (inputs // {self = outputs;})); + in + assert flake.edition == 201909; outputs; - callLocklessFlake = flakeSrc: - let - flake = import (flakeSrc + "/flake.nix"); - outputs = flakeSrc // (flake.outputs ({ self = outputs; })); - in outputs; + callLocklessFlake = flakeSrc: let + flake = import (flakeSrc + "/flake.nix"); + outputs = flakeSrc // (flake.outputs {self = outputs;}); + in + outputs; rootSrc = let # Try to clean the source tree by using fetchGit, if this source # tree is a valid git repository. tryFetchGit = src: if isGit && !isShallow - then - let res = builtins.fetchGit src; - in if res.rev == "0000000000000000000000000000000000000000" then removeAttrs res ["rev" "shortRev"] else res - else { outPath = src; }; + then let + res = builtins.fetchGit src; + in + if res.rev == "0000000000000000000000000000000000000000" + then removeAttrs res ["rev" "shortRev"] + else res + else {outPath = src;}; # NB git worktrees have a file for .git, so we don't check the type of .git isGit = builtins.pathExists (src + "/.git"); isShallow = builtins.pathExists (src + "/.git/shallow"); - in - { lastModified = 0; lastModifiedDate = formatSecondsSinceEpoch 0; } - // (if src ? outPath then src else tryFetchGit src); + { + lastModified = 0; + lastModifiedDate = formatSecondsSinceEpoch 0; + } + // ( + if src ? outPath + then src + else tryFetchGit src + ); # Format number of seconds in the Unix epoch as %Y%m%d%H%M%S. - formatSecondsSinceEpoch = t: - let - rem = x: y: x - x / y * y; - days = t / 86400; - secondsInDay = rem t 86400; - hours = secondsInDay / 3600; - minutes = (rem secondsInDay 3600) / 60; - seconds = rem t 60; + formatSecondsSinceEpoch = t: let + rem = x: y: x - x / y * y; + days = t / 86400; + secondsInDay = rem t 86400; + hours = secondsInDay / 3600; + minutes = (rem secondsInDay 3600) / 60; + seconds = rem t 60; - # Courtesy of https://stackoverflow.com/a/32158604. - z = days + 719468; - era = (if z >= 0 then z else z - 146096) / 146097; - doe = z - era * 146097; - yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; - y = yoe + era * 400; - doy = doe - (365 * yoe + yoe / 4 - yoe / 100); - mp = (5 * doy + 2) / 153; - d = doy - (153 * mp + 2) / 5 + 1; - m = mp + (if mp < 10 then 3 else -9); - y' = y + (if m <= 2 then 1 else 0); + # Courtesy of https://stackoverflow.com/a/32158604. + z = days + 719468; + era = + ( + if z >= 0 + then z + else z - 146096 + ) + / 146097; + doe = z - era * 146097; + yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; + y = yoe + era * 400; + doy = doe - (365 * yoe + yoe / 4 - yoe / 100); + mp = (5 * doy + 2) / 153; + d = doy - (153 * mp + 2) / 5 + 1; + m = + mp + + ( + if mp < 10 + then 3 + else -9 + ); + y' = + y + + ( + if m <= 2 + then 1 + else 0 + ); - pad = s: if builtins.stringLength s < 2 then "0" + s else s; - in "${toString y'}${pad (toString m)}${pad (toString d)}${pad (toString hours)}${pad (toString minutes)}${pad (toString seconds)}"; + pad = s: + if builtins.stringLength s < 2 + then "0" + s + else s; + in "${toString y'}${pad (toString m)}${pad (toString d)}${pad (toString hours)}${pad (toString minutes)}${pad (toString seconds)}"; allNodes = builtins.mapAttrs - (key: node: - let - sourceInfo = - if key == lockFile.root - then rootSrc - else fetchTree (node.info or {} // removeAttrs node.locked ["dir"]); + ( + key: node: let + sourceInfo = + if key == lockFile.root + then rootSrc + else fetchTree (node.info or {} // removeAttrs node.locked ["dir"]); - subdir = if key == lockFile.root then "" else node.locked.dir or ""; + subdir = + if key == lockFile.root + then "" + else node.locked.dir or ""; - flake = import (sourceInfo + (if subdir != "" then "/" else "") + subdir + "/flake.nix"); + flake = import (sourceInfo + + ( + if subdir != "" + then "/" + else "" + ) + + subdir + + "/flake.nix"); - inputs = builtins.mapAttrs - (inputName: inputSpec: allNodes.${resolveInput inputSpec}) - (node.inputs or {}); + inputs = + builtins.mapAttrs + (inputName: inputSpec: allNodes.${resolveInput inputSpec}) + (node.inputs or {}); - # Resolve a input spec into a node name. An input spec is - # either a node name, or a 'follows' path from the root - # node. - resolveInput = inputSpec: - if builtins.isList inputSpec - then getInputByPath lockFile.root inputSpec - else inputSpec; + # Resolve a input spec into a node name. An input spec is + # either a node name, or a 'follows' path from the root + # node. + resolveInput = inputSpec: + if builtins.isList inputSpec + then getInputByPath lockFile.root inputSpec + else inputSpec; - # Follow an input path (e.g. ["dwarffs" "nixpkgs"]) from the - # root node, returning the final node. - getInputByPath = nodeName: path: - if path == [] - then nodeName - else - getInputByPath - # Since this could be a 'follows' input, call resolveInput. - (resolveInput lockFile.nodes.${nodeName}.inputs.${builtins.head path}) - (builtins.tail path); - - outputs = flake.outputs (inputs // { self = result; }); - - result = outputs // sourceInfo // { inherit inputs; inherit outputs; inherit sourceInfo; }; - in - if node.flake or true then - assert builtins.isFunction flake.outputs; - result + # Follow an input path (e.g. ["dwarffs" "nixpkgs"]) from the + # root node, returning the final node. + getInputByPath = nodeName: path: + if path == [] + then nodeName else - sourceInfo - ) - lockFile.nodes; + getInputByPath + # Since this could be a 'follows' input, call resolveInput. + (resolveInput lockFile.nodes.${nodeName}.inputs.${builtins.head path}) + (builtins.tail path); + + outputs = flake.outputs (inputs // {self = result;}); + + result = + outputs + // sourceInfo + // { + inherit inputs; + inherit outputs; + inherit sourceInfo; + }; + in + if node.flake or true + then assert builtins.isFunction flake.outputs; result + else sourceInfo + ) + lockFile.nodes; result = if !(builtins.pathExists lockFilePath) @@ -189,16 +271,30 @@ let else if lockFile.version >= 5 && lockFile.version <= 7 then allNodes.${lockFile.root} else throw "lock file '${lockFilePath}' has unsupported version ${toString lockFile.version}"; +in rec { + defaultNix = + (builtins.removeAttrs result ["__functor"]) + // ( + if result ? defaultPackage.${system} + then {default = result.defaultPackage.${system};} + else {} + ) + // ( + if result ? packages.${system}.default + then {default = result.packages.${system}.default;} + else {} + ); -in - rec { - defaultNix = - (builtins.removeAttrs result ["__functor"]) - // (if result ? defaultPackage.${system} then { default = result.defaultPackage.${system}; } else {}) - // (if result ? packages.${system}.default then { default = result.packages.${system}.default; } else {}); - - shellNix = - defaultNix - // (if result ? devShell.${system} then { default = result.devShell.${system}; } else {}) - // (if result ? devShells.${system}.default then { default = result.devShells.${system}.default; } else {}); - } + shellNix = + defaultNix + // ( + if result ? devShell.${system} + then {default = result.devShell.${system};} + else {} + ) + // ( + if result ? devShells.${system}.default + then {default = result.devShells.${system}.default;} + else {} + ); +} diff --git a/out-of-tree/nixGL/all.nix b/out-of-tree/nixGL/all.nix index 20d1862..e6b729d 100644 --- a/out-of-tree/nixGL/all.nix +++ b/out-of-tree/nixGL/all.nix @@ -1,25 +1,25 @@ let - pkgs = import ./nixpkgs.nix { config = { allowUnfree = true; }; }; + pkgs = import ./nixpkgs.nix {config = {allowUnfree = true;};}; pure = pkgs.recurseIntoAttrs (pkgs.callPackage ./nixGL.nix { nvidiaVersion = "440.82"; nvidiaHash = "edd415acf2f75a659e0f3b4f27c1fab770cf21614e84a18152d94f0d004a758e"; }); - versionFile440 = (pkgs.callPackage ./nixGL.nix { + versionFile440 = pkgs.callPackage ./nixGL.nix { nvidiaVersionFile = pkgs.writeText "nvidia-version-440.82" '' NVRM version: NVIDIA UNIX x86_64 Kernel Module 440.82 Wed Apr 1 20:04:33 UTC 2020 GCC version: gcc version 9.3.0 (Arch Linux 9.3.0-1) ''; - }); + }; - versionFile510 = (pkgs.callPackage ./nixGL.nix { + versionFile510 = pkgs.callPackage ./nixGL.nix { nvidiaVersionFile = pkgs.writeText "nvidia-version-510.54" '' NVRM version: NVIDIA UNIX x86_64 Kernel Module 510.54 Wed Apr 1 20:04:33 UTC 2020 GCC version: gcc version 9.3.0 (Arch Linux 9.3.0-1) ''; - }); + }; in -(with pure; [ nixGLIntel nixVulkanNvidia nixGLNvidia nixVulkanIntel ]) -++ (with versionFile440.auto; [ nixGLNvidia nixGLDefault nixVulkanNvidia ]) -++ (with versionFile510.auto; [ nixGLNvidia nixGLDefault nixVulkanNvidia ]) + (with pure; [nixGLIntel nixVulkanNvidia nixGLNvidia nixVulkanIntel]) + ++ (with versionFile440.auto; [nixGLNvidia nixGLDefault nixVulkanNvidia]) + ++ (with versionFile510.auto; [nixGLNvidia nixGLDefault nixVulkanNvidia]) diff --git a/out-of-tree/nixGL/default.nix b/out-of-tree/nixGL/default.nix index 3419421..576e843 100644 --- a/out-of-tree/nixGL/default.nix +++ b/out-of-tree/nixGL/default.nix @@ -1,36 +1,41 @@ { ## Nvidia informations. # Version of the system kernel module. Let it to null to enable auto-detection. - nvidiaVersion ? null -, # Hash of the Nvidia driver .run file. null is fine, but fixing a value here + nvidiaVersion ? null, + # Hash of the Nvidia driver .run file. null is fine, but fixing a value here # will be more reproducible and more efficient. - nvidiaHash ? null -, # Alternatively, you can pass a path that points to a nvidia version file + nvidiaHash ? null, + # Alternatively, you can pass a path that points to a nvidia version file # and let nixGL extract the version from it. That file must be a copy of # /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see # https://github.com/NixOS/nix/issues/3539 ). - nvidiaVersionFile ? null -, # Enable 32 bits driver + nvidiaVersionFile ? null, + # Enable 32 bits driver # This is on by default, you can switch it to off if you want to reduce a # bit the size of nixGL closure. - enable32bits ? true -, # Make sure to enable config.allowUnfree to the instance of nixpkgs to be + enable32bits ? true, + # Make sure to enable config.allowUnfree to the instance of nixpkgs to be # able to access the nvidia drivers. - pkgs ? import { - config = { allowUnfree = true; }; - } -, # Enable all Intel specific extensions which only works on x86_64 - enableIntelX86Extensions ? true + pkgs ? + import { + config = {allowUnfree = true;}; + }, + # Enable all Intel specific extensions which only works on x86_64 + enableIntelX86Extensions ? true, }: pkgs.callPackage ./nixGL.nix ({ - inherit - nvidiaVersion - nvidiaVersionFile - nvidiaHash - enable32bits - ; -} // (if enableIntelX86Extensions then { } -else { - intel-media-driver = null; - vaapiIntel = null; -})) + inherit + nvidiaVersion + nvidiaVersionFile + nvidiaHash + enable32bits + ; + } + // ( + if enableIntelX86Extensions + then {} + else { + intel-media-driver = null; + vaapiIntel = null; + } + )) diff --git a/out-of-tree/nixGL/flake.nix b/out-of-tree/nixGL/flake.nix index 92fd789..1e05255 100644 --- a/out-of-tree/nixGL/flake.nix +++ b/out-of-tree/nixGL/flake.nix @@ -4,45 +4,46 @@ inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.nixpkgs.url = "github:nixos/nixpkgs"; - outputs = { self, nixpkgs, flake-utils }: - (flake-utils.lib.eachDefaultSystem (system: - let - isIntelX86Platform = system == "x86_64-linux"; - nix_pkgs = import nixpkgs { inherit system; }; - pkgs = import ./default.nix { - pkgs = nix_pkgs; + outputs = { + self, + nixpkgs, + flake-utils, + }: + (flake-utils.lib.eachDefaultSystem (system: let + isIntelX86Platform = system == "x86_64-linux"; + nix_pkgs = import nixpkgs {inherit system;}; + pkgs = import ./default.nix { + pkgs = nix_pkgs; + enable32bits = isIntelX86Platform; + enableIntelX86Extensions = isIntelX86Platform; + }; + in rec { + packages = { + # makes it easy to use "nix run nixGL --impure -- program" + default = pkgs.auto.nixGLDefault; + + nixGLDefault = pkgs.auto.nixGLDefault; + nixGLNvidia = pkgs.auto.nixGLNvidia; + nixGLNvidiaBumblebee = pkgs.auto.nixGLNvidiaBumblebee; + nixGLIntel = pkgs.nixGLIntel; + nixVulkanNvidia = pkgs.auto.nixVulkanNvidia; + nixVulkanIntel = pkgs.nixVulkanIntel; + }; + + # deprecated attributes for retro compatibility + defaultPackage = packages; + })) + // rec { + # deprecated attributes for retro compatibility + overlay = overlays.default; + overlays.default = final: _: let + isIntelX86Platform = final.system == "x86_64-linux"; + in { + nixgl = import ./default.nix { + pkgs = final; enable32bits = isIntelX86Platform; enableIntelX86Extensions = isIntelX86Platform; }; - in - rec { - - packages = { - # makes it easy to use "nix run nixGL --impure -- program" - default = pkgs.auto.nixGLDefault; - - nixGLDefault = pkgs.auto.nixGLDefault; - nixGLNvidia = pkgs.auto.nixGLNvidia; - nixGLNvidiaBumblebee = pkgs.auto.nixGLNvidiaBumblebee; - nixGLIntel = pkgs.nixGLIntel; - nixVulkanNvidia = pkgs.auto.nixVulkanNvidia; - nixVulkanIntel = pkgs.nixVulkanIntel; - - }; - - # deprecated attributes for retro compatibility - defaultPackage = packages; - })) // rec { - # deprecated attributes for retro compatibility - overlay = overlays.default; - overlays.default = final: _: - let isIntelX86Platform = final.system == "x86_64-linux"; - in { - nixgl = import ./default.nix { - pkgs = final; - enable32bits = isIntelX86Platform; - enableIntelX86Extensions = isIntelX86Platform; - }; - }; + }; }; } diff --git a/out-of-tree/nixGL/nixGL.nix b/out-of-tree/nixGL/nixGL.nix index fa74b0c..f1308fa 100644 --- a/out-of-tree/nixGL/nixGL.nix +++ b/out-of-tree/nixGL/nixGL.nix @@ -1,45 +1,46 @@ { # # Nvidia informations. # Version of the system kernel module. Let it to null to enable auto-detection. - nvidiaVersion ? null -, # Hash of the Nvidia driver .run file. null is fine, but fixing a value here + nvidiaVersion ? null, + # Hash of the Nvidia driver .run file. null is fine, but fixing a value here # will be more reproducible and more efficient. - nvidiaHash ? null -, # Alternatively, you can pass a path that points to a nvidia version file + nvidiaHash ? null, + # Alternatively, you can pass a path that points to a nvidia version file # and let nixGL extract the version from it. That file must be a copy of # /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see # https://github.com/NixOS/nix/issues/3539 ). - nvidiaVersionFile ? null -, # Enable 32 bits driver + nvidiaVersionFile ? null, + # Enable 32 bits driver # This is one by default, you can switch it to off if you want to reduce a # bit the size of nixGL closure. - enable32bits ? true -, writeTextFile -, shellcheck -, pcre -, runCommand -, linuxPackages -, fetchurl -, lib -, runtimeShell -, bumblebee -, libglvnd -, vulkan-validation-layers -, mesa -, libvdpau-va-gl -, intel-media-driver -, vaapiIntel -, pkgsi686Linux -, driversi686Linux -, zlib -, libdrm -, xorg -, wayland -, gcc -}: - -let - writeExecutable = { name, text }: + enable32bits ? true, + writeTextFile, + shellcheck, + pcre, + runCommand, + linuxPackages, + fetchurl, + lib, + runtimeShell, + bumblebee, + libglvnd, + vulkan-validation-layers, + mesa, + libvdpau-va-gl, + intel-media-driver, + vaapiIntel, + pkgsi686Linux, + driversi686Linux, + zlib, + libdrm, + xorg, + wayland, + gcc, +}: let + writeExecutable = { + name, + text, + }: writeTextFile { inherit name text; @@ -59,230 +60,234 @@ let fetch_db = builtins.fromJSON (builtins.readFile ./nvidia_versions.json); top = rec { /* - It contains the builder for different nvidia configuration, parametrized by - the version of the driver and sha256 sum of the driver installer file. + It contains the builder for different nvidia configuration, parametrized by + the version of the driver and sha256 sum of the driver installer file. */ - nvidiaPackages = { version, sha256 ? fetch_db."${version}".sha256 }: - let - nvidiaDrivers = (linuxPackages.nvidia_x11.override { }).overrideAttrs - (oldAttrs: { - pname = "nvidia"; - name = "nvidia-x11-${version}-nixGL"; - inherit version; - src = - let - url = - "https://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}.run"; - in - fetchurl { inherit url sha256; }; - useGLVND = true; - }); - nvidiaLibsOnly = nvidiaDrivers.override { - libsOnly = true; - kernel = null; - }; - nixNvidiaWrapper = api: - writeExecutable { - name = "nix${api}Nvidia-${version}"; - text = '' - #!${runtimeShell} - ${lib.optionalString (api == "Vulkan") - "export VK_LAYER_PATH=${vulkan-validation-layers}/share/vulkan/explicit_layer.d"} - NVIDIA_JSON=(${nvidiaLibsOnly}/share/glvnd/egl_vendor.d/*nvidia.json) - ${lib.optionalString enable32bits "NVIDIA_JSON32=(${nvidiaLibsOnly.lib32}/share/glvnd/egl_vendor.d/*nvidia.json)"} - - ${''export __EGL_VENDOR_LIBRARY_FILENAMES=''${NVIDIA_JSON[*]}${ - lib.optionalString enable32bits - '':''${NVIDIA_JSON32[*]}'' - }"''${__EGL_VENDOR_LIBRARY_FILENAMES:+:$__EGL_VENDOR_LIBRARY_FILENAMES}"'' - } - - ${ - lib.optionalString (api == "Vulkan") - ''export VK_ICD_FILENAMES=${nvidiaLibsOnly}/share/vulkan/icd.d/nvidia_icd.json${ - lib.optionalString enable32bits - ":${nvidiaLibsOnly.lib32}/share/vulkan/icd.d/nvidia_icd.json" - }"''${VK_ICD_FILENAMES:+:$VK_ICD_FILENAMES}"'' - } - export LD_LIBRARY_PATH=${ - lib.makeLibraryPath ([ libglvnd nvidiaLibsOnly ] - ++ lib.optional (api == "Vulkan") vulkan-validation-layers - ++ lib.optionals enable32bits [ - nvidiaLibsOnly.lib32 - pkgsi686Linux.libglvnd - ]) - }"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - exec "$@" - ''; - }; - in - { - inherit nvidiaDrivers nvidiaLibsOnly; - - nixGLNvidiaBumblebee = writeExecutable { - name = "nixGLNvidiaBumblebee-${version}"; + nvidiaPackages = { + version, + sha256 ? fetch_db."${version}".sha256, + }: let + nvidiaDrivers = + (linuxPackages.nvidia_x11.override {}).overrideAttrs + (oldAttrs: { + pname = "nvidia"; + name = "nvidia-x11-${version}-nixGL"; + inherit version; + src = let + url = "https://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}.run"; + in + fetchurl {inherit url sha256;}; + useGLVND = true; + }); + nvidiaLibsOnly = nvidiaDrivers.override { + libsOnly = true; + kernel = null; + }; + nixNvidiaWrapper = api: + writeExecutable { + name = "nix${api}Nvidia-${version}"; text = '' #!${runtimeShell} - export LD_LIBRARY_PATH=${ - lib.makeLibraryPath [ nvidiaDrivers ] - }"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - ${ - bumblebee.override { - nvidia_x11 = nvidiaDrivers; - nvidia_x11_i686 = nvidiaDrivers.lib32; - } - }/bin/optirun --ldpath ${ - lib.makeLibraryPath ([ libglvnd nvidiaDrivers ] + ${lib.optionalString (api == "Vulkan") + "export VK_LAYER_PATH=${vulkan-validation-layers}/share/vulkan/explicit_layer.d"} + NVIDIA_JSON=(${nvidiaLibsOnly}/share/glvnd/egl_vendor.d/*nvidia.json) + ${lib.optionalString enable32bits "NVIDIA_JSON32=(${nvidiaLibsOnly.lib32}/share/glvnd/egl_vendor.d/*nvidia.json)"} + + ${''export __EGL_VENDOR_LIBRARY_FILENAMES=''${NVIDIA_JSON[*]}${ + lib.optionalString enable32bits + '':''${NVIDIA_JSON32[*]}'' + }"''${__EGL_VENDOR_LIBRARY_FILENAMES:+:$__EGL_VENDOR_LIBRARY_FILENAMES}"''} + + ${ + lib.optionalString (api == "Vulkan") + ''export VK_ICD_FILENAMES=${nvidiaLibsOnly}/share/vulkan/icd.d/nvidia_icd.json${ + lib.optionalString enable32bits + ":${nvidiaLibsOnly.lib32}/share/vulkan/icd.d/nvidia_icd.json" + }"''${VK_ICD_FILENAMES:+:$VK_ICD_FILENAMES}"'' + } + export LD_LIBRARY_PATH=${ + lib.makeLibraryPath ([libglvnd nvidiaLibsOnly] + ++ lib.optional (api == "Vulkan") vulkan-validation-layers ++ lib.optionals enable32bits [ - nvidiaDrivers.lib32 + nvidiaLibsOnly.lib32 pkgsi686Linux.libglvnd ]) - } "$@" + }"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + exec "$@" ''; }; + in { + inherit nvidiaDrivers nvidiaLibsOnly; - # TODO: 32bit version? Not tested. - inherit nixNvidiaWrapper; - - # TODO: 32bit version? Not tested. - nixGLNvidia = nixNvidiaWrapper "GL"; - - # TODO: 32bit version? Not tested. - nixVulkanNvidia = nixNvidiaWrapper "Vulkan"; + nixGLNvidiaBumblebee = writeExecutable { + name = "nixGLNvidiaBumblebee-${version}"; + text = '' + #!${runtimeShell} + export LD_LIBRARY_PATH=${ + lib.makeLibraryPath [nvidiaDrivers] + }"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + ${ + bumblebee.override { + nvidia_x11 = nvidiaDrivers; + nvidia_x11_i686 = nvidiaDrivers.lib32; + } + }/bin/optirun --ldpath ${ + lib.makeLibraryPath ([libglvnd nvidiaDrivers] + ++ lib.optionals enable32bits [ + nvidiaDrivers.lib32 + pkgsi686Linux.libglvnd + ]) + } "$@" + ''; }; + # TODO: 32bit version? Not tested. + inherit nixNvidiaWrapper; + + # TODO: 32bit version? Not tested. + nixGLNvidia = nixNvidiaWrapper "GL"; + + # TODO: 32bit version? Not tested. + nixVulkanNvidia = nixNvidiaWrapper "Vulkan"; + }; + nixGLIntel = writeExecutable { name = "nixGLIntel"; # add the 32 bits drivers if needed - text = - let - mesa-drivers = [ mesa.drivers ] - ++ lib.optional enable32bits pkgsi686Linux.mesa.drivers; - intel-driver = [ intel-media-driver vaapiIntel ] - # Note: intel-media-driver is disabled for i686 until https://github.com/NixOS/nixpkgs/issues/140471 is fixed - ++ lib.optionals enable32bits [ /* pkgsi686Linux.intel-media-driver */ driversi686Linux.vaapiIntel ]; - libvdpau = [ libvdpau-va-gl ] - ++ lib.optional enable32bits pkgsi686Linux.libvdpau-va-gl; - glxindirect = runCommand "mesa_glxindirect" { } ( - '' - mkdir -p $out/lib - ln -s ${mesa.drivers}/lib/libGLX_mesa.so.0 $out/lib/libGLX_indirect.so.0 - '' - ); - in - '' - #!${runtimeShell} - export LIBGL_DRIVERS_PATH=${lib.makeSearchPathOutput "lib" "lib/dri" mesa-drivers} - export LIBVA_DRIVERS_PATH=${lib.makeSearchPathOutput "out" "lib/dri" intel-driver} - ${''export __EGL_VENDOR_LIBRARY_FILENAMES=${mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json${ + text = let + mesa-drivers = + [mesa.drivers] + ++ lib.optional enable32bits pkgsi686Linux.mesa.drivers; + intel-driver = + [intel-media-driver vaapiIntel] + # Note: intel-media-driver is disabled for i686 until https://github.com/NixOS/nixpkgs/issues/140471 is fixed + ++ lib.optionals enable32bits [ + /* + pkgsi686Linux.intel-media-driver + */ + driversi686Linux.vaapiIntel + ]; + libvdpau = + [libvdpau-va-gl] + ++ lib.optional enable32bits pkgsi686Linux.libvdpau-va-gl; + glxindirect = runCommand "mesa_glxindirect" {} '' + mkdir -p $out/lib + ln -s ${mesa.drivers}/lib/libGLX_mesa.so.0 $out/lib/libGLX_indirect.so.0 + ''; + in '' + #!${runtimeShell} + export LIBGL_DRIVERS_PATH=${lib.makeSearchPathOutput "lib" "lib/dri" mesa-drivers} + export LIBVA_DRIVERS_PATH=${lib.makeSearchPathOutput "out" "lib/dri" intel-driver} + ${''export __EGL_VENDOR_LIBRARY_FILENAMES=${mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json${ lib.optionalString enable32bits ":${pkgsi686Linux.mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json" - }"''${__EGL_VENDOR_LIBRARY_FILENAMES:+:$__EGL_VENDOR_LIBRARY_FILENAMES}"'' - } - export LD_LIBRARY_PATH=${lib.makeLibraryPath mesa-drivers}:${lib.makeSearchPathOutput "lib" "lib/vdpau" libvdpau}:${glxindirect}/lib:${lib.makeLibraryPath [libglvnd]}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - exec "$@" - ''; + }"''${__EGL_VENDOR_LIBRARY_FILENAMES:+:$__EGL_VENDOR_LIBRARY_FILENAMES}"''} + export LD_LIBRARY_PATH=${lib.makeLibraryPath mesa-drivers}:${lib.makeSearchPathOutput "lib" "lib/vdpau" libvdpau}:${glxindirect}/lib:${lib.makeLibraryPath [libglvnd]}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + exec "$@" + ''; }; nixVulkanIntel = writeExecutable { name = "nixVulkanIntel"; - text = - let - # generate a file with the listing of all the icd files - icd = runCommand "mesa_icd" { } ( - # 64 bits icd - '' - ls ${mesa.drivers}/share/vulkan/icd.d/*.json > f - '' - # 32 bits ones - + lib.optionalString enable32bits '' - ls ${pkgsi686Linux.mesa.drivers}/share/vulkan/icd.d/*.json >> f - '' - # concat everything as a one line string with ":" as seperator - + ''cat f | xargs | sed "s/ /:/g" > $out'' - ); - in - '' - #!${runtimeShell} - if [ -n "$LD_LIBRARY_PATH" ]; then - echo "Warning, nixVulkanIntel overwriting existing LD_LIBRARY_PATH" 1>&2 - fi - export VK_LAYER_PATH=${vulkan-validation-layers}/share/vulkan/explicit_layer.d - ICDS=$(cat ${icd}) - export VK_ICD_FILENAMES=$ICDS"''${VK_ICD_FILENAMES:+:$VK_ICD_FILENAMES}" - export LD_LIBRARY_PATH=${ - lib.makeLibraryPath [ - zlib - libdrm - xorg.libX11 - xorg.libxcb - xorg.libxshmfence - wayland - gcc.cc - ] - }"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" - exec "$@" - ''; + text = let + # generate a file with the listing of all the icd files + icd = runCommand "mesa_icd" {} ( + # 64 bits icd + '' + ls ${mesa.drivers}/share/vulkan/icd.d/*.json > f + '' + # 32 bits ones + + lib.optionalString enable32bits '' + ls ${pkgsi686Linux.mesa.drivers}/share/vulkan/icd.d/*.json >> f + '' + # concat everything as a one line string with ":" as seperator + + ''cat f | xargs | sed "s/ /:/g" > $out'' + ); + in '' + #!${runtimeShell} + if [ -n "$LD_LIBRARY_PATH" ]; then + echo "Warning, nixVulkanIntel overwriting existing LD_LIBRARY_PATH" 1>&2 + fi + export VK_LAYER_PATH=${vulkan-validation-layers}/share/vulkan/explicit_layer.d + ICDS=$(cat ${icd}) + export VK_ICD_FILENAMES=$ICDS"''${VK_ICD_FILENAMES:+:$VK_ICD_FILENAMES}" + export LD_LIBRARY_PATH=${ + lib.makeLibraryPath [ + zlib + libdrm + xorg.libX11 + xorg.libxcb + xorg.libxshmfence + wayland + gcc.cc + ] + }"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" + exec "$@" + ''; }; nixGLCommon = nixGL: - runCommand "nixGL" { } '' + runCommand "nixGL" {} '' mkdir -p "$out/bin" # star because nixGLNvidia... have version prefixed name cp ${nixGL}/bin/* "$out/bin/nixGL"; ''; - auto = - let - _nvidiaVersionFile = - if nvidiaVersionFile != null then - nvidiaVersionFile - else + auto = let + _nvidiaVersionFile = + if nvidiaVersionFile != null + then nvidiaVersionFile + else # HACK: Get the version from /proc. It turns out that /proc is mounted # inside of the build sandbox and varies from machine to machine. # # builtins.readFile is not able to read /proc files. See # https://github.com/NixOS/nix/issues/3539. - runCommand "impure-nvidia-version-file" - { - # To avoid sharing the build result over time or between machine, - # Add an impure parameter to force the rebuild on each access. - # time = builtins.currentTime; - preferLocalBuild = true; - allowSubstitutes = false; - } "cp /proc/driver/nvidia/version $out 2> /dev/null || touch $out"; + runCommand "impure-nvidia-version-file" + { + # To avoid sharing the build result over time or between machine, + # Add an impure parameter to force the rebuild on each access. + # time = builtins.currentTime; + preferLocalBuild = true; + allowSubstitutes = false; + } "cp /proc/driver/nvidia/version $out 2> /dev/null || touch $out"; - # The nvidia version. Either fixed by the `nvidiaVersion` argument, or - # auto-detected. Auto-detection is impure. - nvidiaVersionAuto = - if nvidiaVersion != null then - nvidiaVersion - else + # The nvidia version. Either fixed by the `nvidiaVersion` argument, or + # auto-detected. Auto-detection is impure. + nvidiaVersionAuto = + if nvidiaVersion != null + then nvidiaVersion + else # Get if from the nvidiaVersionFile - let - data = builtins.readFile _nvidiaVersionFile; - versionMatch = builtins.match ".*Module ([0-9.]+) .*" data; - in - if versionMatch != null then builtins.head versionMatch else null; + let + data = builtins.readFile _nvidiaVersionFile; + versionMatch = builtins.match ".*Module ([0-9.]+) .*" data; + in + if versionMatch != null + then builtins.head versionMatch + else null; - autoNvidia = nvidiaPackages { version = nvidiaVersionAuto; }; - in + autoNvidia = nvidiaPackages {version = nvidiaVersionAuto;}; + in rec { # The output derivation contains nixGL which point either to # nixGLNvidia or nixGLIntel using an heuristic. nixGLDefault = - if nvidiaVersionAuto != null then - nixGLCommon autoNvidia.nixGLNvidia - else - nixGLCommon nixGLIntel; - } // autoNvidia; + if nvidiaVersionAuto != null + then nixGLCommon autoNvidia.nixGLNvidia + else nixGLCommon nixGLIntel; + } + // autoNvidia; }; in -top // (if nvidiaVersion != null then - top.nvidiaPackages - { - version = nvidiaVersion; - sha256 = nvidiaHash; - } -else - { }) + top + // ( + if nvidiaVersion != null + then + top.nvidiaPackages + { + version = nvidiaVersion; + sha256 = nvidiaHash; + } + else {} + ) diff --git a/out-of-tree/nixGL/nixpkgs.nix b/out-of-tree/nixGL/nixpkgs.nix index a4e1b5b..cb10cbb 100644 --- a/out-of-tree/nixGL/nixpkgs.nix +++ b/out-of-tree/nixGL/nixpkgs.nix @@ -1,7 +1,7 @@ let rev = "4f6d8095fd51"; in -import (fetchTarball { - url = "https://github.com/nixos/nixpkgs/archive/${rev}.tar.gz"; - sha256 = "14sm0bjjcmi9qmznwy3nkd2vbhj5xcshgm54a5wiprl9ssvxqw53"; -}) + import (fetchTarball { + url = "https://github.com/nixos/nixpkgs/archive/${rev}.tar.gz"; + sha256 = "14sm0bjjcmi9qmznwy3nkd2vbhj5xcshgm54a5wiprl9ssvxqw53"; + }) diff --git a/secrets.nix b/secrets.nix index 04e5d81..7b07703 100644 --- a/secrets.nix +++ b/secrets.nix @@ -1,22 +1,29 @@ +# WARNING: currently not usable anymore let - inherit ((import - ( - let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; - } - ) - { src = ./.; } - ).defaultNix) secrets; + inherit + (( + import + ( + let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + in + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + } + ) + {src = ./.;} + ) + .defaultNix) + secrets + ; inherit (secrets) pubKeys; inherit (pubKeys) users hosts; all = users // hosts; c_ = builtins; -in -{ - "secrets/s3fs.age".publicKeys = c_.attrValues (all); - "secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all); - "secrets/_nhitrl.age".publicKeys = c_.attrValues (all); - "secrets/wifi.env.age".publicKeys = c_.attrValues (all); +in { + "secrets/s3fs.age".publicKeys = c_.attrValues all; + "secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues all; + "secrets/_nhitrl.age".publicKeys = c_.attrValues all; + "secrets/wifi.env.age".publicKeys = c_.attrValues all; } diff --git a/secrets/default.nix b/secrets/default.nix index 0624482..6763449 100644 --- a/secrets/default.nix +++ b/secrets/default.nix @@ -1,6 +1,5 @@ # TODO: put ssh keys as user/host config -inputs: -let +inputs: let # user-specific (~/.ssh/id_ed25519.pub) users = { "hungtr@bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z"; @@ -12,9 +11,8 @@ let all = users // systems; # stands for calculus c_ = builtins; -in -{ - "system/secrets/s3fs.age".publicKeys = c_.attrValues (all); - "system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues (all); - "system/secrets/_nhitrl.age".publicKeys = c_.attrValues (all); +in { + "system/secrets/s3fs.age".publicKeys = c_.attrValues all; + "system/secrets/s3fs.digital-garden.age".publicKeys = c_.attrValues all; + "system/secrets/_nhitrl.age".publicKeys = c_.attrValues all; } diff --git a/shell.nix b/shell.nix index a521cfd..34ba877 100644 --- a/shell.nix +++ b/shell.nix @@ -1,11 +1,14 @@ # This uses the exported devShells from flake.nix # the default or base version of nix-shell can be found in dev-shell.nix instead # This architecture is because we use top-level flake.nix -(import +( + import ( - let - lock = builtins.fromJSON (builtins.readFile ./flake.lock); - in (import ./c_.nix).fetchTree lock.nodes.flake-compat.locked + let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + in + (import ./c_.nix).fetchTree lock.nodes.flake-compat.locked ) - { src = ./.; } -).shellNix + {src = ./.;} +) +.shellNix diff --git a/templates/default.nix b/templates/default.nix index e16c790..c5b6e42 100644 --- a/templates/default.nix +++ b/templates/default.nix @@ -1,8 +1,9 @@ # TODO: templates should be able to have initial states like # repo name, author,... -{ pkgs -, lib -, ... +{ + pkgs, + lib, + ... }: { rust = { path = ./rust; diff --git a/templates/py-poetry/default.nix b/templates/py-poetry/default.nix index 89308a3..2346806 100644 --- a/templates/py-poetry/default.nix +++ b/templates/py-poetry/default.nix @@ -7,4 +7,5 @@ ) { src = ./.; - }).defaultNix + }) +.defaultNix diff --git a/templates/py-poetry/flake.nix b/templates/py-poetry/flake.nix index d8a8e70..1409639 100644 --- a/templates/py-poetry/flake.nix +++ b/templates/py-poetry/flake.nix @@ -1,29 +1,30 @@ { inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - outputs = { self, nixpkgs }: - let - supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; - forAllSystems = nixpkgs.lib.genAttrs supportedSystems; - pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); - in - { - packages = forAllSystems (system: { - default = pkgs.${system}.poetry2nix.mkPoetryApplication { projectDir = self; }; - }); + outputs = { + self, + nixpkgs, + }: let + supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); + in { + packages = forAllSystems (system: { + default = pkgs.${system}.poetry2nix.mkPoetryApplication {projectDir = self;}; + }); - devShells = forAllSystems (system: { - bootstrap = pkgs.${system}.mkShellNoCC { - packages = [ - pkgs.${system}.poetry - ]; - }; - default = pkgs.${system}.mkShellNoCC { - packages = [ - (pkgs.${system}.poetry2nix.mkPoetryEnv { projectDir = self; }) - pkgs.${system}.poetry - ]; - }; - }); - }; + devShells = forAllSystems (system: { + bootstrap = pkgs.${system}.mkShellNoCC { + packages = [ + pkgs.${system}.poetry + ]; + }; + default = pkgs.${system}.mkShellNoCC { + packages = [ + (pkgs.${system}.poetry2nix.mkPoetryEnv {projectDir = self;}) + pkgs.${system}.poetry + ]; + }; + }); + }; } diff --git a/templates/py-poetry/shell.nix b/templates/py-poetry/shell.nix index 47458ad..3c038e9 100644 --- a/templates/py-poetry/shell.nix +++ b/templates/py-poetry/shell.nix @@ -7,4 +7,5 @@ ) { src = ./.; - }).shellNix + }) +.shellNix diff --git a/templates/rust-monorepo/default.nix b/templates/rust-monorepo/default.nix index 89308a3..2346806 100644 --- a/templates/rust-monorepo/default.nix +++ b/templates/rust-monorepo/default.nix @@ -7,4 +7,5 @@ ) { src = ./.; - }).defaultNix + }) +.defaultNix diff --git a/templates/rust-monorepo/flake.nix b/templates/rust-monorepo/flake.nix index a75001f..ec12b02 100644 --- a/templates/rust-monorepo/flake.nix +++ b/templates/rust-monorepo/flake.nix @@ -6,23 +6,29 @@ rust-overlay.url = "github:oxalica/rust-overlay"; }; - outputs = { self, nixpkgs, utils, naersk, rust-overlay }: - utils.lib.eachDefaultSystem (system: - let - overlays = [ rust-overlay.overlays.default ]; - pkgs = import nixpkgs { inherit system overlays; }; - rust_pkgs = (pkgs.rust-bin.selectLatestNightlyWith - ( - toolchain: + outputs = { + self, + nixpkgs, + utils, + naersk, + rust-overlay, + }: + utils.lib.eachDefaultSystem (system: let + overlays = [rust-overlay.overlays.default]; + pkgs = import nixpkgs {inherit system overlays;}; + rust_pkgs = + pkgs.rust-bin.selectLatestNightlyWith + ( + toolchain: toolchain.default.override { - extensions = [ "rust-src" "rust-analyzer" "rust-docs" "clippy" "miri" ]; + extensions = ["rust-src" "rust-analyzer" "rust-docs" "clippy" "miri"]; } - )); - naersk-lib = pkgs.callPackage naersk { }; - in - { - defaultPackage = naersk-lib.buildPackage ./.; - devShell = with pkgs; mkShell { + ); + naersk-lib = pkgs.callPackage naersk {}; + in { + defaultPackage = naersk-lib.buildPackage ./.; + devShell = with pkgs; + mkShell { buildInputs = [ rust_pkgs # rust's compiler is quite powerful enough to the point where @@ -37,5 +43,5 @@ # nix flake update # is this even needed? ''; }; - }); + }); } diff --git a/templates/rust-monorepo/shell.nix b/templates/rust-monorepo/shell.nix index 47458ad..3c038e9 100644 --- a/templates/rust-monorepo/shell.nix +++ b/templates/rust-monorepo/shell.nix @@ -7,4 +7,5 @@ ) { src = ./.; - }).shellNix + }) +.shellNix diff --git a/templates/rust/default.nix b/templates/rust/default.nix index 89308a3..2346806 100644 --- a/templates/rust/default.nix +++ b/templates/rust/default.nix @@ -7,4 +7,5 @@ ) { src = ./.; - }).defaultNix + }) +.defaultNix diff --git a/templates/rust/flake.nix b/templates/rust/flake.nix index a75001f..ec12b02 100644 --- a/templates/rust/flake.nix +++ b/templates/rust/flake.nix @@ -6,23 +6,29 @@ rust-overlay.url = "github:oxalica/rust-overlay"; }; - outputs = { self, nixpkgs, utils, naersk, rust-overlay }: - utils.lib.eachDefaultSystem (system: - let - overlays = [ rust-overlay.overlays.default ]; - pkgs = import nixpkgs { inherit system overlays; }; - rust_pkgs = (pkgs.rust-bin.selectLatestNightlyWith - ( - toolchain: + outputs = { + self, + nixpkgs, + utils, + naersk, + rust-overlay, + }: + utils.lib.eachDefaultSystem (system: let + overlays = [rust-overlay.overlays.default]; + pkgs = import nixpkgs {inherit system overlays;}; + rust_pkgs = + pkgs.rust-bin.selectLatestNightlyWith + ( + toolchain: toolchain.default.override { - extensions = [ "rust-src" "rust-analyzer" "rust-docs" "clippy" "miri" ]; + extensions = ["rust-src" "rust-analyzer" "rust-docs" "clippy" "miri"]; } - )); - naersk-lib = pkgs.callPackage naersk { }; - in - { - defaultPackage = naersk-lib.buildPackage ./.; - devShell = with pkgs; mkShell { + ); + naersk-lib = pkgs.callPackage naersk {}; + in { + defaultPackage = naersk-lib.buildPackage ./.; + devShell = with pkgs; + mkShell { buildInputs = [ rust_pkgs # rust's compiler is quite powerful enough to the point where @@ -37,5 +43,5 @@ # nix flake update # is this even needed? ''; }; - }); + }); } diff --git a/templates/rust/shell.nix b/templates/rust/shell.nix index 47458ad..3c038e9 100644 --- a/templates/rust/shell.nix +++ b/templates/rust/shell.nix @@ -7,4 +7,5 @@ ) { src = ./.; - }).shellNix + }) +.shellNix diff --git a/templates/ts/turborepo/flake.nix b/templates/ts/turborepo/flake.nix index 8446117..a9be22e 100644 --- a/templates/ts/turborepo/flake.nix +++ b/templates/ts/turborepo/flake.nix @@ -9,45 +9,52 @@ turbo.url = "github:dlip/turbo"; }; - outputs = { self, turbo, flake-utils, nixpkgs }: - with flake-utils; lib.eachSystem lib.defaultSystems (sys: - let - overlays = [ turbo.overlay ]; - # pkgs is our tweaked nixpkgs - pkgs = import nixpkgs { system = sys; overlays = overlays; }; - shellMsg = '' - echo "Hello from nix ${sys}" - echo "Local development may use our remote planetscale database (pscale login && pnpm dev:infra; pnpm dev)" - echo "Or from the specified docker-compose.yml (pnpm dev:local_infra && pnpm dev)" - echo "See more on CONTRIBUTING.md" - ''; - in - { - devShell = pkgs.mkShell { - nativeBuildInputs = [ pkgs.bashInteractive ]; - buildInputs = [ - pkgs.nodejs-18_x - pkgs.nodePackages.pnpm - pkgs.nodePackages.prisma - pkgs.prisma-engines - pkgs.turbo - # pkgs.turbo-tooling - pkgs.jq - pkgs.pscale - pkgs.act # Github workflow - ]; - shellHook = - # https://github.com/prisma/prisma/issues/3026#issuecomment-927258138 - # nix-direnv is required (impure build?) https://github.com/nix-community/nix-direnv - '' - export PRISMA_MIGRATION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/migration-engine" - export PRISMA_QUERY_ENGINE_BINARY="${pkgs.prisma-engines}/bin/query-engine" - export PRISMA_QUERY_ENGINE_LIBRARY="${pkgs.prisma-engines}/lib/libquery_engine.node" - export PRISMA_INTROSPECTION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/introspection-engine" - export PRISMA_FMT_BINARY="${pkgs.prisma-engines}/bin/prisma-fmt" - export TURBO_BINARY_PATH="${pkgs.turbo}/bin/turbo" - pnpm install - '' + shellMsg; - }; - }); + outputs = { + self, + turbo, + flake-utils, + nixpkgs, + }: + with flake-utils; lib.eachSystem lib.defaultSystems (sys: let + overlays = [turbo.overlay]; + # pkgs is our tweaked nixpkgs + pkgs = import nixpkgs { + system = sys; + overlays = overlays; + }; + shellMsg = '' + echo "Hello from nix ${sys}" + echo "Local development may use our remote planetscale database (pscale login && pnpm dev:infra; pnpm dev)" + echo "Or from the specified docker-compose.yml (pnpm dev:local_infra && pnpm dev)" + echo "See more on CONTRIBUTING.md" + ''; + in { + devShell = pkgs.mkShell { + nativeBuildInputs = [pkgs.bashInteractive]; + buildInputs = [ + pkgs.nodejs-18_x + pkgs.nodePackages.pnpm + pkgs.nodePackages.prisma + pkgs.prisma-engines + pkgs.turbo + # pkgs.turbo-tooling + pkgs.jq + pkgs.pscale + pkgs.act # Github workflow + ]; + shellHook = + # https://github.com/prisma/prisma/issues/3026#issuecomment-927258138 + # nix-direnv is required (impure build?) https://github.com/nix-community/nix-direnv + '' + export PRISMA_MIGRATION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/migration-engine" + export PRISMA_QUERY_ENGINE_BINARY="${pkgs.prisma-engines}/bin/query-engine" + export PRISMA_QUERY_ENGINE_LIBRARY="${pkgs.prisma-engines}/lib/libquery_engine.node" + export PRISMA_INTROSPECTION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/introspection-engine" + export PRISMA_FMT_BINARY="${pkgs.prisma-engines}/bin/prisma-fmt" + export TURBO_BINARY_PATH="${pkgs.turbo}/bin/turbo" + pnpm install + '' + + shellMsg; + }; + }); } diff --git a/users/default.nix b/users/default.nix index 030b376..5757c4b 100644 --- a/users/default.nix +++ b/users/default.nix @@ -1,13 +1,11 @@ -{ lib, ... }@inputs: -let +{lib, ...} @ inputs: let config = { - hungtr.metadata = { }; + hungtr.metadata = {}; "hungtr@bao".metadata = { ssh_pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z"; }; }; -in -{ - homeConfigurations = { }; +in { + homeConfigurations = {}; pubKeys = lib.getPubkey config; } From 6352f821c371f16a9f1bacc48af186d2d9b8b697 Mon Sep 17 00:00:00 2001 From: Hung Date: Sat, 17 Jun 2023 20:32:15 -0700 Subject: [PATCH 60/64] add some more hints on the default settings for neovim; just go with alejandra formatter; add more docs on qa --- docs/manual-test/tailwind-color-cmp.md | 12 + native_configs/neovim/init.lua | 65 +++- nix-conf/home-manager/home.nix | 9 +- nix-conf/lib/serde/default.nix | 3 +- nix-conf/pkgs/default.nix | 3 +- .../nixos-wsl/modules/build-tarball.nix | 6 +- nix-conf/system/nixos-wsl/modules/interop.nix | 3 +- .../system/nixos-wsl/modules/wsl-distro.nix | 3 +- nix/cells/home-configs/default.nix | 3 +- nix/cells/packages/default.nix | 3 +- nix/cells/repo/home-modules/default.nix | 350 +++++++++--------- nix/cells/repo/lib/default.nix | 31 +- out-of-tree/flake-compat/default.nix | 15 +- 13 files changed, 296 insertions(+), 210 deletions(-) create mode 100644 docs/manual-test/tailwind-color-cmp.md diff --git a/docs/manual-test/tailwind-color-cmp.md b/docs/manual-test/tailwind-color-cmp.md new file mode 100644 index 0000000..2a6247b --- /dev/null +++ b/docs/manual-test/tailwind-color-cmp.md @@ -0,0 +1,12 @@ +# Neovim: Testing cmp for color with Tailwind + +- [ ] It should detect a project uses tailwind, maybe via some kind of config file +(`tailwind.config.{cjs,mjs,js,ts,json,tsx,toml,yaml}`), or just based on the +string content or via tree-stiter. Check this by `:LspInfo` and `tailwindcss-lsp` +should attach to the current buffer that has tailwind-css string +- [ ] Type in a classname `text-red-500`, just stop at somewhere and start +browsing the cmp-lsp window. It should show a color in place of `lspkind`. +This validates `tailwindcss-colorizer-cmp.nvim` is good +- [ ] Hit that autocomplete, the string should show the color red. This validates +`nvim-colorizer.lua` is properly setup. + diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 5c9386b..6030a33 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -104,7 +104,7 @@ WPlug('kyazdani42/nvim-web-devicons') -- icons for folder and filetype WPlug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog WPlug('folke/todo-comments.nvim') -- Highlights TODO WPlug('NvChad/nvim-colorizer.lua') -- color highlighter with tailwind support -WPlug('roobert/tailwindcss-colorizer-cmp.nvim') -- color highlighter with tailwind support +WPlug('roobert/tailwindcss-colorizer-cmp.nvim') -- color for tailiwnd for compe -- other utilities WPlug('nvim-treesitter/nvim-treesitter-context') -- Top one-liner context of func/class scope @@ -112,6 +112,7 @@ WPlug('nvim-treesitter/playground') -- Sees Treesitter AST - less h WPlug('saadparwaiz1/cmp_luasnip') -- snippet engine WPlug('L3MON4D3/LuaSnip') -- snippet engine WPlug('mickael-menu/zk-nvim') -- Zettelkasten +WPlug('folke/neodev.nvim') -- Neovim + lua development setup -- Switch cases: -- `gsp` -> PascalCase (classes), `gsc` -> camelCase (Java), `gs_` -> snake_case (C/C++/Rust) -- `gsu` -> UPPER_CASE (CONSTs), `gsk` -> kebab-case (Clojure), `gsK` -> Title-Kebab-Case @@ -241,7 +242,57 @@ colorscheme gruvbox ]]) require('hlargs').setup() require('nvim-web-devicons').setup() -require('trouble').setup() +require('trouble').setup { + position = "bottom", -- position of the list can be: bottom, top, left, right + height = 10, -- height of the trouble list when position is top or bottom + width = 50, -- width of the list when position is left or right + icons = true, -- use devicons for filenames + mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" + severity = nil, -- nil (ALL) or vim.diagnostic.severity.ERROR | WARN | INFO | HINT + fold_open = "", -- icon used for open folds + fold_closed = "", -- icon used for closed folds + group = true, -- group results by file + padding = true, -- add an extra new line on top of the list + action_keys = { + -- key mappings for actions in the trouble list + -- map to {} to remove a mapping, for example: + -- close = {}, + close = "q", -- close the list + cancel = "", -- cancel the preview and get back to your last window / buffer / cursor + refresh = "r", -- manually refresh + jump = { "", "" }, -- jump to the diagnostic or open / close folds + open_split = { "" }, -- open buffer in new split + open_vsplit = { "" }, -- open buffer in new vsplit + open_tab = { "" }, -- open buffer in new tab + jump_close = { "o" }, -- jump to the diagnostic and close the list + toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode + switch_severity = "s", -- switch "diagnostics" severity filter level to HINT / INFO / WARN / ERROR + toggle_preview = "P", -- toggle auto_preview + hover = "K", -- opens a small popup with the full multiline message + preview = "p", -- preview the diagnostic location + close_folds = { "zM", "zm" }, -- close all folds + open_folds = { "zR", "zr" }, -- open all folds + toggle_fold = { "zA", "za" }, -- toggle fold of current file + previous = "k", -- previous item + next = "j" -- next item + }, + indent_lines = true, -- add an indent guide below the fold icons + auto_open = false, -- automatically open the list when you have diagnostics + auto_close = false, -- automatically close the list when you have no diagnostics + auto_preview = true, -- automatically preview the location of the diagnostic. to close preview and go back to last window + auto_fold = false, -- automatically fold a file trouble list at creation + auto_jump = { "lsp_definitions" }, -- for the given modes, automatically jump if there is only a single result + signs = { + -- icons / text used for a diagnostic + error = "", + warning = "", + hint = "", + information = "", + other = "", + }, + use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client +} + -- TODO: Any way to collect all the TODOs and its variants? require('todo-comments').setup() @@ -922,10 +973,10 @@ require('mason-lspconfig').setup_handlers({ defaultConfig = { indent_style = "space", indent_size = 4, - } - } - } - } + }, + }, + }, + }, } end, ["pyright"] = function() @@ -1002,7 +1053,7 @@ require('mason-lspconfig').setup_handlers({ settings = { ["nil"] = { formatting = { - command = {"nix", "run", "nixpkgs#alejandra"}, + command = { "nix", "run", "nixpkgs#alejandra" }, }, nix = { flake = { diff --git a/nix-conf/home-manager/home.nix b/nix-conf/home-manager/home.nix index 3c1dfde..4510639 100644 --- a/nix-conf/home-manager/home.nix +++ b/nix-conf/home-manager/home.nix @@ -4,11 +4,14 @@ # Additional configurations goes to profiles/ # or inlined in flake.nix { - config, # Represents the realized final configuration - pkgs, # This is by default just ``= import {}` + config, + # Represents the realized final configuration + pkgs, + # This is by default just ``= import {}` myHome, myLib, - option, # The options we're given, this might be useful for typesafety? + option, + # The options we're given, this might be useful for typesafety? proj_root, ... }: let diff --git a/nix-conf/lib/serde/default.nix b/nix-conf/lib/serde/default.nix index dd4c05f..8a50344 100644 --- a/nix-conf/lib/serde/default.nix +++ b/nix-conf/lib/serde/default.nix @@ -9,7 +9,8 @@ pkgs.callPackage ({runCommand}: # runCommand source: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/trivial-builders.nix#L33 - runCommand outputPath { + runCommand outputPath + { inherit yamlContent; nativeBuildInputs = [pkgs.yq]; } diff --git a/nix-conf/pkgs/default.nix b/nix-conf/pkgs/default.nix index 1f03b27..81eccdd 100644 --- a/nix-conf/pkgs/default.nix +++ b/nix-conf/pkgs/default.nix @@ -3,7 +3,8 @@ { pkgs, lib, - naersk, # rust packages + naersk, + # rust packages ... } @ pkgs_input: { # dot-hwtr = import "./dot-hwtr" pkgs_input; diff --git a/nix-conf/system/nixos-wsl/modules/build-tarball.nix b/nix-conf/system/nixos-wsl/modules/build-tarball.nix index f0d82e0..7f974af 100644 --- a/nix-conf/system/nixos-wsl/modules/build-tarball.nix +++ b/nix-conf/system/nixos-wsl/modules/build-tarball.nix @@ -4,9 +4,11 @@ lib, ... }: -with builtins; with lib; let +with builtins; +with lib; let pkgs2storeContents = l: - map (x: { + map + (x: { object = x; symlink = "none"; }) diff --git a/nix-conf/system/nixos-wsl/modules/interop.nix b/nix-conf/system/nixos-wsl/modules/interop.nix index 4557aee..ae825eb 100644 --- a/nix-conf/system/nixos-wsl/modules/interop.nix +++ b/nix-conf/system/nixos-wsl/modules/interop.nix @@ -4,7 +4,8 @@ config, ... }: -with builtins; with lib; { +with builtins; +with lib; { imports = [ (mkRenamedOptionModule ["wsl" "compatibility" "interopPreserveArgvZero"] ["wsl" "interop" "preserveArgvZero"]) ]; diff --git a/nix-conf/system/nixos-wsl/modules/wsl-distro.nix b/nix-conf/system/nixos-wsl/modules/wsl-distro.nix index c7ba346..bf4f58c 100644 --- a/nix-conf/system/nixos-wsl/modules/wsl-distro.nix +++ b/nix-conf/system/nixos-wsl/modules/wsl-distro.nix @@ -4,7 +4,8 @@ config, ... }: -with builtins; with lib; { +with builtins; +with lib; { options.wsl = with types; let coercedToStr = coercedTo (oneOf [bool path int]) toString str; in { diff --git a/nix/cells/home-configs/default.nix b/nix/cells/home-configs/default.nix index 656a82c..027783e 100644 --- a/nix/cells/home-configs/default.nix +++ b/nix/cells/home-configs/default.nix @@ -2,5 +2,4 @@ inputs, cell, }: let -in { -} +in {} diff --git a/nix/cells/packages/default.nix b/nix/cells/packages/default.nix index aa49c70..d2b2fc2 100644 --- a/nix/cells/packages/default.nix +++ b/nix/cells/packages/default.nix @@ -1,5 +1,4 @@ { inputs, cell, -}: { -} +}: {} diff --git a/nix/cells/repo/home-modules/default.nix b/nix/cells/repo/home-modules/default.nix index b5e90df..34e5d8a 100644 --- a/nix/cells/repo/home-modules/default.nix +++ b/nix/cells/repo/home-modules/default.nix @@ -1,188 +1,200 @@ # This is an interface for home-profiles and should not contain opinionated # configurations. It should provide alternative configurations, aggregates # or new configurations -_imports@{inputs, cell}: let +_imports@{ inputs, cell }: +let namespace = "repo"; - imports = _imports // {inherit namespace;}; -in { - git = { config , lib , ... }: let - cfg = config."${namespace}".git; - baseAliases = { - a = "add"; - c = "commit"; - ca = "commit --amend"; - cm = "commit -m"; - lol = "log --graph --decorate --pretty=oneline --abbrev-commit"; - lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all"; - sts = "status"; - co = "checkout"; - b = "branch"; - }; - default-user = "Pegasust"; - default-email = "pegasucksgg@gmail.com"; - in { - options."${namespace}".git = { - aliases = lib.mkOption { - type = lib.types.attrs; - default = { }; - example = baseAliases; - description = '' - Additional git aliases. This settings comes with base configuration. - Redeclaring the base config will override the values. - ''; # TODO: Add baseAliases as string here (builtins.toString doesn't work) + imports = _imports // { inherit namespace; }; +in +{ + git = { config, lib, ... }: + let + cfg = config."${namespace}".git; + baseAliases = { + a = "add"; + c = "commit"; + ca = "commit --amend"; + cm = "commit -m"; + lol = "log --graph --decorate --pretty=oneline --abbrev-commit"; + lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all"; + sts = "status"; + co = "checkout"; + b = "branch"; }; - name = lib.mkOption { - type = lib.types.str; - default = default-user; - description = "Git username that appears on commits"; - example = default-user; + default-user = "Pegasust"; + default-email = "pegasucksgg@gmail.com"; + in + { + options."${namespace}".git = { + aliases = lib.mkOption { + type = lib.types.attrs; + default = { }; + example = baseAliases; + description = '' + Additional git aliases. This settings comes with base configuration. + Redeclaring the base config will override the values. + ''; # TODO: Add baseAliases as string here (builtins.toString doesn't work) + }; + name = lib.mkOption { + type = lib.types.str; + default = default-user; + description = "Git username that appears on commits"; + example = default-user; + }; + email = lib.mkOption { + type = lib.types.str; + default = default-email; + example = default-email; + description = "Git email that appears on commits"; + }; + ignores = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ + ".vscode" # vscode settings + ".direnv" # .envrc cached outputs + ".DS_Store" # MacOS users, amrite + ]; + description = '' + .gitignore patterns that are applied in every "${namespace}"sitory. + This is useful for IDE-specific settings. + ''; + example = [ ".direnv" "node_modules" ]; + }; + enable = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Enables git + ''; + example = false; + }; + credentialCacheTimeoutSeconds = lib.mkOption { + type = lib.types.int; + default = 3000; + description = "Credential cache (in-memory store) for Git in seconds."; + example = 3000; + }; }; - email = lib.mkOption { - type = lib.types.str; - default = default-email; - example = default-email; - description = "Git email that appears on commits"; - }; - ignores = lib.mkOption { - type = lib.types.listOf lib.types.str; - default = [ - ".vscode" # vscode settings - ".direnv" # .envrc cached outputs - ".DS_Store" # MacOS users, amrite - ]; - description = '' - .gitignore patterns that are applied in every "${namespace}"sitory. - This is useful for IDE-specific settings. - ''; - example = [ ".direnv" "node_modules" ]; - }; - enable = lib.mkOption { - type = lib.types.bool; - default = true; - description = '' - Enables git - ''; - example = false; - }; - credentialCacheTimeoutSeconds = lib.mkOption { - type = lib.types.int; - default = 3000; - description = "Credential cache (in-memory store) for Git in seconds."; - example = 3000; + # TODO : anyway to override configuration? + # idk wtf I was thinking about. there is no context in this question + config.programs.git = { + inherit (cfg) enable ignores; + userName = cfg.name; + userEmail = cfg.email; + aliases = baseAliases // cfg.aliases; + extraConfig = { + # TODO: in the case of darwin, git always open up the built-in keychain. + # possibly something we can't really control since we don't have access to `nix-darwin` + credential.helper = "cache --timeout=${builtins.toString cfg.credentialCacheTimeoutSeconds}"; + }; + lfs.enable = true; }; }; - # TODO : anyway to override configuration? - # idk wtf I was thinking about. there is no context in this question - config.programs.git = { - inherit (cfg) enable ignores; - userName = cfg.name; - userEmail = cfg.email; - aliases = baseAliases // cfg.aliases; - extraConfig = { - # TODO: in the case of darwin, git always open up the built-in keychain. - # possibly something we can't really control since we don't have access to `nix-darwin` - credential.helper = "cache --timeout=${builtins.toString cfg.credentialCacheTimeoutSeconds}"; - }; - lfs.enable = true; - }; - }; - alacritty = {config, lib}: let - inherit (inputs.cells.repo.lib) fromYAML; - cfg = config."${namespace}".alacritty; - in { - options."${namespace}".alacritty = { - font.family = lib.mkOption { - type = lib.types.nullOr lib.types.singleLineStr; - default = null; - description = '' - The font family for Alacritty - ''; - example = "DroidSansMono NF"; + alacritty = { config, lib }: + let + inherit (inputs.cells.repo.lib) fromYAML; + cfg = config."${namespace}".alacritty; + in + { + options."${namespace}".alacritty = { + font.family = lib.mkOption { + type = lib.types.nullOr lib.types.singleLineStr; + default = null; + description = '' + The font family for Alacritty + ''; + example = "DroidSansMono NF"; + }; + font.size = lib.mkOption { + type = lib.types.nullOr lib.types.number; + default = 11.0; + description = '' + The default font size for Alacritty. This is probably measured in px. + ''; + example = 7.0; + }; + enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enables alacritty + ''; + example = true; + }; + config-path = lib.mkOption { + type = lib.types.path; + description = "Path to alacritty yaml"; + default = null; + example = "./config/alacritty.yaml"; + }; }; - font.size = lib.mkOption { - type = lib.types.nullOr lib.types.number; - default = 11.0; - description = '' - The default font size for Alacritty. This is probably measured in px. - ''; - example = 7.0; - }; - enable = lib.mkOption { - type = lib.types.bool; - default = false; - description = '' - Enables alacritty - ''; - example = true; - }; - config-path = lib.mkOption { - type = lib.types.path; - description = "Path to alacritty yaml"; - default = null; - example = "./config/alacritty.yaml"; + config.programs.alacritty = { + enable = cfg.enable; + settings = + let + ; + actualConfig = + if cfg.config-path != null then fromYAML (builtins.readFile cfg.config-path) else { }; + in + lib.recursiveUpdate actualConfig { + font.normal.family = lib.mkIf (font.family != null) font.family; + font.size = lib.mkIf (font.size != null) font.size; + }; }; }; - config.programs.alacritty = { - enable = cfg.enable; - settings = let ; - actualConfig = if cfg.config-path != null then fromYAML (builtins.readFile cfg.config-path) else {}; - in lib.recursiveUpdate actualConfig { - font.normal.family = lib.mkIf (font.family != null) font.family; - font.size = lib.mkIf (font.size != null) font.size; - }; - }; - }; # TODO: chromium is not really supported on darwin - private_chromium = { config, pkgs, lib, ... }: let - cfg = config."${namespace}".private_chromium; - in { - options."${namespace}".private_chromium = { - enable = lib.mkOption { - type = lib.types.bool; - default = true; - example = false; - description = '' - Enable extremely lightweight chromium with vimium plugin - ''; + private_chromium = { config, pkgs, lib, ... }: + let + cfg = config."${namespace}".private_chromium; + in + { + options."${namespace}".private_chromium = { + enable = lib.mkOption { + type = lib.types.bool; + default = true; + example = false; + description = '' + Enable extremely lightweight chromium with vimium plugin + ''; + }; }; - }; - config = lib.mkIf (cfg.enable) { - # home.packages = [pkgs.ungoogled-chromium]; - programs.chromium = { - enable = true; - package = pkgs.ungoogled-chromium; - extensions = - let - # TODO: how about a chrome extension registry? - mkChromiumExtForVersion = browserVersion: { id, sha256, extVersion, ... }: - { - inherit id; - crxPath = builtins.fetchurl { - url = "https://clients2.google.com/service/update2/crx" + - "?response=redirect" + - "&acceptformat=crx2,crx3" + - "&prodversion=${browserVersion}" + - "&x=id%3D${id}%26installsource%3Dondemand%26uc"; - name = "${id}.crx"; - inherit sha256; + config = lib.mkIf (cfg.enable) { + # home.packages = [pkgs.ungoogled-chromium]; + programs.chromium = { + enable = true; + package = pkgs.ungoogled-chromium; + extensions = + let + # TODO: how about a chrome extension registry? + mkChromiumExtForVersion = browserVersion: { id, sha256, extVersion, ... }: + { + inherit id; + crxPath = builtins.fetchurl { + url = "https://clients2.google.com/service/update2/crx" + + "?response=redirect" + + "&acceptformat=crx2,crx3" + + "&prodversion=${browserVersion}" + + "&x=id%3D${id}%26installsource%3Dondemand%26uc"; + name = "${id}.crx"; + inherit sha256; + }; + version = extVersion; }; - version = extVersion; - }; - mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version); - in - [ - # vimium - (mkChromiumExt { - id = "dbepggeogbaibhgnhhndojpepiihcmeb"; - sha256 = "00qhbs41gx71q026xaflgwzzridfw1sx3i9yah45cyawv8q7ziic"; - extVersion = "1.67.4"; - }) - ]; + mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version); + in + [ + # vimium + (mkChromiumExt { + id = "dbepggeogbaibhgnhhndojpepiihcmeb"; + sha256 = "00qhbs41gx71q026xaflgwzzridfw1sx3i9yah45cyawv8q7ziic"; + extVersion = "1.67.4"; + }) + ]; + }; }; }; - }; darwin-spotlight = { lib, pkgs, config, ... }: { # This patch exists since Darwin's search bar requires solid apps and not @@ -222,7 +234,7 @@ in { ""; # We need this in case upstream home-manager changes the behavior of linking # applications - home.activation.remove-patch-spotlight = + home.activation.remove-patch-spotlight = if pkgs.stdenv.isDarwin then lib.hm.dag.entryBefore [ "checkLinkTargets" ] '' HM_APPS="$HOME/Applications/Home Manager Apps" @@ -234,6 +246,6 @@ in { else ""; }; - + } diff --git a/nix/cells/repo/lib/default.nix b/nix/cells/repo/lib/default.nix index 2e7bc77..a44fed5 100644 --- a/nix/cells/repo/lib/default.nix +++ b/nix/cells/repo/lib/default.nix @@ -1,36 +1,39 @@ -{inputs, cell}: let +{ inputs, cell }: +let namespace = "repo"; yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand - outputPath { inherit yamlContent; nativeBuildInputs = [ pkgs.yq ]; } - # run yq which outputs '.' (no filter) on file at yamlPath - # note that $out is passed onto the bash/sh script for execution - '' - echo "$yamlContent" | yq >$out - '') + outputPath + { inherit yamlContent; nativeBuildInputs = [ pkgs.yq ]; } + # run yq which outputs '.' (no filter) on file at yamlPath + # note that $out is passed onto the bash/sh script for execution + '' + echo "$yamlContent" | yq >$out + '') { }); -in { +in +{ fromYAML = yamlContent: bulitins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json")); # NOTE: Deprecate # ctor - opt-some = a: [a]; - opt-none = []; - opt-none_thunk = _: []; + opt-some = a: [ a ]; + opt-none = [ ]; + opt-none_thunk = _: [ ]; # from-to null - opt-fromNullable = nullable: if nullable == null then [] else [nullable]; + opt-fromNullable = nullable: if nullable == null then [ ] else [ nullable ]; opt-toNullable = opt-fork (a:a) (_: null); opt-map = builtins.map; opt-filter = builtins.filter; - opt-fork = on_some: on_none: opt: if opt == [] then (on_none null) else (on_some (builtins.elemAt opt 0)); + opt-fork = on_some: on_none: opt: if opt == [ ] then (on_none null) else (on_some (builtins.elemAt opt 0)); opt-unwrap = opt-fork (a:a) (_: throw "opt-unwrap: expected some, got none"); opt-unwrapOrElse = opt-fork (a:a); opt-unwrapOr = fallback_val: opt-fork (a:a) (_: fallback_val); opt-orElse = opt: fallback_opt: opt-fork (opt-some) (opt-none_thunk) (opt ++ fallback_opt); - opt-leftmostSome = opts: builtins.foldl' (opt-orElse) [] opts; + opt-leftmostSome = opts: builtins.foldl' (opt-orElse) [ ] opts; } diff --git a/out-of-tree/flake-compat/default.nix b/out-of-tree/flake-compat/default.nix index a6744f0..d925572 100644 --- a/out-of-tree/flake-compat/default.nix +++ b/out-of-tree/flake-compat/default.nix @@ -64,8 +64,7 @@ rev = info.rev; shortRev = builtins.substring 0 7 info.rev; } - else { - } + else {} ) else if info.type == "path" then { @@ -112,11 +111,13 @@ callFlake4 = flakeSrc: locks: let flake = import (flakeSrc + "/flake.nix"); - inputs = builtins.mapAttrs (n: v: - if v.flake or true - then callFlake4 (fetchTree (v.locked // v.info)) v.inputs - else fetchTree (v.locked // v.info)) - locks; + inputs = + builtins.mapAttrs + (n: v: + if v.flake or true + then callFlake4 (fetchTree (v.locked // v.info)) v.inputs + else fetchTree (v.locked // v.info)) + locks; outputs = flakeSrc // (flake.outputs (inputs // {self = outputs;})); in From d5d4415d5cacd87fd52f6dfbedd8c7b0a8444f0e Mon Sep 17 00:00:00 2001 From: Hung Date: Sat, 17 Jun 2023 20:33:06 -0700 Subject: [PATCH 61/64] ts-ql is useless :) --- native_configs/neovim/init.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index 6030a33..b12556d 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -118,7 +118,6 @@ WPlug('folke/neodev.nvim') -- Neovim + lua development set -- `gsu` -> UPPER_CASE (CONSTs), `gsk` -> kebab-case (Clojure), `gsK` -> Title-Kebab-Case -- `gs.` -> dot.case (R) WPlug('arthurxavierx/vim-caser') -- switch cases -WPlug('~/local_repos/ts-ql') -- workspace code intelligence --------- vim.call('plug#end') From 820736fc8ccc41668d37413acd031e5202032020 Mon Sep 17 00:00:00 2001 From: Hung Date: Sat, 17 Jun 2023 23:31:47 -0700 Subject: [PATCH 62/64] wip: more migrations, mostly adding nix-index, kpcli-py, and nix-boost integration --- flake.lock | 1441 ++++++++++++++++++++-- flake.nix | 37 +- native_configs/neovim/init.lua | 2 +- nix-conf/home-manager/home.nix | 3 - nix/cells/dotfiles/packages/default.nix | 22 + nix/cells/home-configs/default.nix | 5 - nix/cells/packages/default.nix | 4 - nix/cells/repo/home-configs/default.nix | 44 + nix/cells/repo/home-profiles/default.nix | 47 + nix/cells/repo/home-profiles/neovim.nix | 15 +- nix/cells/repo/lib/default.nix | 29 +- nix/cells/repo/packages/default.nix | 6 + 12 files changed, 1502 insertions(+), 153 deletions(-) create mode 100644 nix/cells/dotfiles/packages/default.nix delete mode 100644 nix/cells/home-configs/default.nix delete mode 100644 nix/cells/packages/default.nix create mode 100644 nix/cells/repo/home-configs/default.nix create mode 100644 nix/cells/repo/packages/default.nix diff --git a/flake.lock b/flake.lock index 52a579a..676ed68 100644 --- a/flake.lock +++ b/flake.lock @@ -15,7 +15,7 @@ "type": "github" } }, - "colmena": { + "blank_2": { "locked": { "lastModified": 1625557891, "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", @@ -30,16 +30,79 @@ "type": "github" } }, + "cargo-leptos": { + "flake": false, + "locked": { + "lastModified": 1686759547, + "narHash": "sha256-hZevu2lwyYFenABu1uV7/mZc7SXfLzR6Pdmc3zHJ2vw=", + "owner": "leptos-rs", + "repo": "cargo-leptos", + "rev": "75d3905cad6feb68be14659a802f75f48034a4ac", + "type": "github" + }, + "original": { + "owner": "leptos-rs", + "repo": "cargo-leptos", + "type": "github" + } + }, "crane": { "inputs": { - "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_2", + "flake-compat": "flake-compat_4", + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_3", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1686621798, + "narHash": "sha256-FUwWszmSiDzUdTk8f69xwMoYlhdPaLvDaIYOE/y6VXc=", + "owner": "ipetkov", + "repo": "crane", + "rev": "75f7d715f8088f741be9981405f6444e2d49efdd", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "crane_2": { + "inputs": { + "flake-compat": "flake-compat_6", + "flake-utils": "flake-utils_7", + "nixpkgs": [ + "nix-boost", + "std", + "paisano-mdbook-preprocessor", + "nixpkgs" + ], + "rust-overlay": "rust-overlay_3" + }, + "locked": { + "lastModified": 1676162383, + "narHash": "sha256-krUCKdz7ebHlFYm/A7IbKDnj2ZmMMm3yIEQcooqm7+E=", + "owner": "ipetkov", + "repo": "crane", + "rev": "6fb400ec631b22ccdbc7090b38207f7fb5cfb5f2", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "crane_3": { + "inputs": { + "flake-compat": "flake-compat_7", + "flake-utils": "flake-utils_10", "nixpkgs": [ "std", "paisano-mdbook-preprocessor", "nixpkgs" ], - "rust-overlay": "rust-overlay" + "rust-overlay": "rust-overlay_4" }, "locked": { "lastModified": 1676162383, @@ -78,10 +141,11 @@ "devshell": { "inputs": { "nixpkgs": [ + "nix-boost", "std", "nixpkgs" ], - "systems": "systems" + "systems": "systems_4" }, "locked": { "lastModified": 1686680692, @@ -97,22 +161,63 @@ "type": "github" } }, - "disko": { + "devshell_2": { + "inputs": { + "nixpkgs": [ + "std", + "nixpkgs" + ], + "systems": "systems_6" + }, "locked": { - "lastModified": 1625557891, - "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", - "owner": "divnix", - "repo": "blank", - "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", + "lastModified": 1686680692, + "narHash": "sha256-SsLZz3TDleraAiJq4EkmdyewSyiv5g0LZYc6vaLZOMQ=", + "owner": "numtide", + "repo": "devshell", + "rev": "fd6223370774dd9c33354e87a007004b5fd36442", "type": "github" }, "original": { - "owner": "divnix", - "repo": "blank", + "owner": "numtide", + "repo": "devshell", "type": "github" } }, "dmerge": { + "inputs": { + "haumea": [ + "nix-boost", + "std", + "haumea" + ], + "nixlib": [ + "nix-boost", + "std", + "haumea", + "nixpkgs" + ], + "yants": [ + "nix-boost", + "std", + "yants" + ] + }, + "locked": { + "lastModified": 1686862774, + "narHash": "sha256-ojGtRQ9pIOUrxsQEuEPerUkqIJEuod9hIflfNkY+9CE=", + "owner": "divnix", + "repo": "dmerge", + "rev": "9f7f7a8349d33d7bd02e0f2b484b1f076e503a96", + "type": "github" + }, + "original": { + "owner": "divnix", + "ref": "0.2.1", + "repo": "dmerge", + "type": "github" + } + }, + "dmerge_2": { "inputs": { "haumea": [ "std", @@ -145,7 +250,7 @@ }, "fenix": { "inputs": { - "nixpkgs": "nixpkgs_6", + "nixpkgs": "nixpkgs_9", "rust-analyzer-src": "rust-analyzer-src" }, "locked": { @@ -162,6 +267,25 @@ "type": "github" } }, + "fenix_2": { + "inputs": { + "nixpkgs": "nixpkgs_13", + "rust-analyzer-src": "rust-analyzer-src_2" + }, + "locked": { + "lastModified": 1677306201, + "narHash": "sha256-VZ9x7qdTosFvVsrpgFHrtYfT6PU3yMIs7NRYn9ELapI=", + "owner": "nix-community", + "repo": "fenix", + "rev": "0923f0c162f65ae40261ec940406049726cfeab4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -194,13 +318,169 @@ "type": "github" } }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_5": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_6": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_7": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1680392223, + "narHash": "sha256-n3g7QFr85lDODKt250rkZj2IFS3i4/8HBU2yKHO3tqw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "dcc36e45d054d7bb554c9cdab69093debd91a0b5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1678379998, + "narHash": "sha256-TZdfNqftHhDuIFwBcN9MUThx5sQXCTeZk9je5byPKRw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c13d60b89adea3dc20704c045ec4d50dd964d447", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly-overlay", + "hercules-ci-effects", + "hercules-ci-agent", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1678379998, + "narHash": "sha256-TZdfNqftHhDuIFwBcN9MUThx5sQXCTeZk9je5byPKRw=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c13d60b89adea3dc20704c045ec4d50dd964d447", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_10": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { @@ -224,31 +504,201 @@ "type": "github" } }, - "haumea": { + "flake-utils_3": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_6": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_7": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_8": { + "inputs": { + "systems": "systems_5" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_9": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { "inputs": { "nixpkgs": [ - "hive", + "neovim-nightly-overlay", + "hercules-ci-effects", + "hercules-ci-agent", + "pre-commit-hooks-nix", "nixpkgs" ] }, "locked": { - "lastModified": 1681873442, - "narHash": "sha256-wsOEGbDKf+M/THE7JZi43s4szXTuIaiQNBxlb5Lnxs0=", + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gnmic": { + "flake": false, + "locked": { + "lastModified": 1686895285, + "narHash": "sha256-97QB49OAqt0zamA+SRZKkgj0GE/u0MTzHHjEEFuGb5s=", + "owner": "openconfig", + "repo": "gnmic", + "rev": "6413a00addb79e9762d5ad3e77866b1da0a532fb", + "type": "github" + }, + "original": { + "owner": "openconfig", + "repo": "gnmic", + "type": "github" + } + }, + "gomod2nix": { + "inputs": { + "nixpkgs": "nixpkgs_4", + "utils": "utils_2" + }, + "locked": { + "lastModified": 1677459247, + "narHash": "sha256-JbakfAiPYmCCV224yAMq/XO0udN5coWv/oazblMKdoY=", "owner": "nix-community", - "repo": "haumea", - "rev": "85038436851caf5bbf652a2fedf38b2b28e38caf", + "repo": "gomod2nix", + "rev": "3cbf3a51fe32e2f57af4c52744e7228bab22983d", "type": "github" }, "original": { "owner": "nix-community", - "ref": "v0.2.1", - "repo": "haumea", + "repo": "gomod2nix", "type": "github" } }, - "haumea_2": { + "haskell-flake": { + "locked": { + "lastModified": 1678138103, + "narHash": "sha256-D0lao82bV3t2gEFjHiU6RN233t+1MnkQV+bq8MEu2ic=", + "owner": "hercules-ci", + "repo": "haskell-flake", + "rev": "1e1660e6dd00838ba73bc7952e6e73be67da18d1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "ref": "0.1-extraLibraries", + "repo": "haskell-flake", + "type": "github" + } + }, + "haumea": { "inputs": { - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_7" }, "locked": { "lastModified": 1685133229, @@ -265,46 +715,113 @@ "type": "github" } }, - "hive": { + "haumea_2": { "inputs": { - "colmena": "colmena", - "disko": "disko", - "haumea": "haumea", - "home-manager": "home-manager", - "nixos-generators": "nixos-generators", - "nixpkgs": "nixpkgs_2", - "paisano": "paisano" + "nixpkgs": "nixpkgs_11" }, "locked": { - "lastModified": 1686781920, - "narHash": "sha256-1KHvvV2qcypAC6Zn+7HL+VxOuVttB3Iqrp/kDwLbqiI=", - "owner": "divnix", - "repo": "hive", - "rev": "a057e2df518c7ecb0dd14bd42661dc11129609c4", + "lastModified": 1685133229, + "narHash": "sha256-FePm/Gi9PBSNwiDFq3N+DWdfxFq0UKsVVTJS3cQPn94=", + "owner": "nix-community", + "repo": "haumea", + "rev": "34dd58385092a23018748b50f9b23de6266dffc2", "type": "github" }, "original": { - "owner": "divnix", - "repo": "hive", + "owner": "nix-community", + "ref": "v0.2.2", + "repo": "haumea", + "type": "github" + } + }, + "hercules-ci-agent": { + "inputs": { + "flake-parts": "flake-parts_3", + "haskell-flake": "haskell-flake", + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs_2", + "pre-commit-hooks-nix": "pre-commit-hooks-nix" + }, + "locked": { + "lastModified": 1678446614, + "narHash": "sha256-Z6Gsba5ahn/N0QlF0vJfIEfnZgCs4qr1IZtXAqjbE7s=", + "owner": "hercules-ci", + "repo": "hercules-ci-agent", + "rev": "0b90d1a87c117a5861785cb85833dd1c9df0b6ef", + "type": "github" + }, + "original": { + "id": "hercules-ci-agent", + "type": "indirect" + } + }, + "hercules-ci-effects": { + "inputs": { + "flake-parts": "flake-parts_2", + "hercules-ci-agent": "hercules-ci-agent", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1681898675, + "narHash": "sha256-nIJ7CAdiHv4i1no/VgDoeTJLzbLYwu5+/Ycoyzn0S78=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "15ff4f63e5f28070391a5b09a82f6d5c6cc5c9d0", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", "type": "github" } }, "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, "locked": { - "lastModified": 1625557891, - "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", - "owner": "divnix", - "repo": "blank", - "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", + "lastModified": 1687041769, + "narHash": "sha256-lPDVNMrDF/hOVy+P8pEtKzvSN/Akk9RbDcyNuvW1T+M=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "edf9cf65238609db16680be74fe28d4d4858476e", "type": "github" }, "original": { - "owner": "divnix", - "repo": "blank", + "owner": "nix-community", + "repo": "home-manager", "type": "github" } }, "incl": { + "inputs": { + "nixlib": [ + "nix-boost", + "std", + "haumea", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1669263024, + "narHash": "sha256-E/+23NKtxAqYG/0ydYgxlgarKnxmDbg6rCMWnOBqn9Q=", + "owner": "divnix", + "repo": "incl", + "rev": "ce7bebaee048e4cd7ebdb4cee7885e00c4e2abca", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "incl", + "type": "github" + } + }, + "incl_2": { "inputs": { "nixlib": [ "std", @@ -326,7 +843,50 @@ "type": "github" } }, + "kpcli-py": { + "flake": false, + "locked": { + "lastModified": 1679142558, + "narHash": "sha256-l18PBzf/P7d3BPcFb5gSDX863MsC7S747qooyg0u2lA=", + "owner": "rebkwok", + "repo": "kpcli", + "rev": "1c64e7274345d28ebc2607e22211a4ee9f6dbe7f", + "type": "github" + }, + "original": { + "owner": "rebkwok", + "repo": "kpcli", + "type": "github" + } + }, "n2c": { + "inputs": { + "flake-utils": [ + "nix-boost", + "std", + "flake-utils" + ], + "nixpkgs": [ + "nix-boost", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1685771919, + "narHash": "sha256-3lVKWrhNXjHJB6QkZ2SJaOs4X/mmYXtY6ovPVpDMOHc=", + "owner": "nlewo", + "repo": "nix2container", + "rev": "95e2220911874064b5d809f8d35f7835184c4ddf", + "type": "github" + }, + "original": { + "owner": "nlewo", + "repo": "nix2container", + "type": "github" + } + }, + "n2c_2": { "inputs": { "flake-utils": [ "std", @@ -351,7 +911,158 @@ "type": "github" } }, + "neovim-flake": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "neovim-nightly-overlay", + "nixpkgs" + ] + }, + "locked": { + "dir": "contrib", + "lastModified": 1682581904, + "narHash": "sha256-9P4T2erXXrPxXTTLgD29U/IdKCOYqP4xbwdYswtVBA8=", + "owner": "neovim", + "repo": "neovim", + "rev": "d321deb4a9b05e9d81b79ac166274f4a6e7981bf", + "type": "github" + }, + "original": { + "dir": "contrib", + "owner": "neovim", + "repo": "neovim", + "type": "github" + } + }, + "neovim-nightly-overlay": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts", + "hercules-ci-effects": "hercules-ci-effects", + "neovim-flake": "neovim-flake", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1684067841, + "narHash": "sha256-UzOHzcx5KrysKdLZuyU2k5RipVa6wP8EbVeqF/C7OLM=", + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "rev": "88a6c749a7d126c49f3374f9f28ca452ea9419b8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "neovim-nightly-overlay", + "rev": "88a6c749a7d126c49f3374f9f28ca452ea9419b8", + "type": "github" + } + }, + "nix-boost": { + "inputs": { + "cargo-leptos": "cargo-leptos", + "crane": "crane", + "flake-compat": "flake-compat_5", + "gnmic": "gnmic", + "gomod2nix": "gomod2nix", + "nixpkgs": "nixpkgs_5", + "poetry2nix": "poetry2nix", + "rust-overlay": "rust-overlay_2", + "std": "std" + }, + "locked": { + "lastModified": 1687069436, + "narHash": "sha256-GdtAbw1o5lF6kad/INP/UMhq+LtK80BI+StwdNKJQlo=", + "ref": "bleed", + "rev": "5812ec3cbb89f0e954db3ee66644e7c7f6e70444", + "revCount": 88, + "type": "git", + "url": "https://git.pegasust.com/pegasust/nix-boost" + }, + "original": { + "ref": "bleed", + "type": "git", + "url": "https://git.pegasust.com/pegasust/nix-boost" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "neovim-nightly-overlay", + "hercules-ci-effects", + "hercules-ci-agent", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1673295039, + "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nix-index-database": { + "inputs": { + "nixpkgs": [ + "nixpkgs-latest" + ] + }, + "locked": { + "lastModified": 1686740472, + "narHash": "sha256-b668DY2qGdBCUwIkk6Z32bcpCsUISQJrEEvhtn1gGgY=", + "owner": "mic92", + "repo": "nix-index-database", + "rev": "e11c61073b777e025993c5ef63ddbf776a9cca15", + "type": "github" + }, + "original": { + "owner": "mic92", + "repo": "nix-index-database", + "type": "github" + } + }, "nixago": { + "inputs": { + "flake-utils": [ + "nix-boost", + "std", + "flake-utils" + ], + "nixago-exts": [ + "nix-boost", + "std", + "blank" + ], + "nixpkgs": [ + "nix-boost", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1683210100, + "narHash": "sha256-bhGDOlkWtlhVECpoOog4fWiFJmLCpVEg09a40aTjCbw=", + "owner": "nix-community", + "repo": "nixago", + "rev": "1da60ad9412135f9ed7a004669fdcf3d378ec630", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixago", + "type": "github" + } + }, + "nixago_2": { "inputs": { "flake-utils": [ "std", @@ -380,21 +1091,6 @@ "type": "github" } }, - "nixos-generators": { - "locked": { - "lastModified": 1625557891, - "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", - "owner": "divnix", - "repo": "blank", - "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", - "type": "github" - }, - "original": { - "owner": "divnix", - "repo": "blank", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1671417167, @@ -411,23 +1107,56 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs-latest": { "locked": { - "lastModified": 1675940568, - "narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=", + "lastModified": 1687069429, + "narHash": "sha256-AEBWBsIxyE5YJrY4ih/KDgCMSufVD3Dec9ruVuXbuFo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6ccc4a59c3f1b56d039d93da52696633e641bc71", + "rev": "192011a33fdfda7b9a1bc42fba5c964fd5452d54", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, - "nixpkgs_3": { + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1678375444, + "narHash": "sha256-XIgHfGvjFvZQ8hrkfocanCDxMefc/77rXeHvYdzBMc8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "130fa0baaa2b93ec45523fdcde942f6844ee9f6e", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1673800717, + "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_10": { "locked": { "lastModified": 1686960236, "narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=", @@ -443,7 +1172,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_11": { "locked": { "lastModified": 1681001314, "narHash": "sha256-5sDnCLdrKZqxLPK4KA8+f4A3YKO/u6ElpMILvX0g72c=", @@ -458,7 +1187,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_12": { "locked": { "lastModified": 1675940568, "narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=", @@ -474,7 +1203,134 @@ "type": "github" } }, + "nixpkgs_13": { + "locked": { + "lastModified": 1677063315, + "narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "988cc958c57ce4350ec248d2d53087777f9e1949", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1678293141, + "narHash": "sha256-lLlQHaR0y+q6nd6kfpydPTGHhl1rS9nU9OQmztzKOYs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c90c4025bb6e0c4eaf438128a3b2640314b1c58d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1685714850, + "narHash": "sha256-OcvbIJq4CGwwFr9m7M/SQcDPZ64hhR4t77oZgEeh7ZY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c6ffce3d5df7b4c588ce80a0c6e2d2348a611707", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1658285632, + "narHash": "sha256-zRS5S/hoeDGUbO+L95wXG9vJNwsSYcl93XiD0HQBXLk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5342fc6fb59d0595d26883c3cadff16ce58e44f3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1686960236, + "narHash": "sha256-AYCC9rXNLpUWzD9hm+askOfpliLEC9kwAo7ITJc4HIw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "04af42f3b31dba0ef742d254456dc4c14eedac86", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_6": { + "locked": { + "lastModified": 1681358109, + "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_7": { + "locked": { + "lastModified": 1681001314, + "narHash": "sha256-5sDnCLdrKZqxLPK4KA8+f4A3YKO/u6ElpMILvX0g72c=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "367c0e1086a4eb4502b24d872cea2c7acdd557f4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs_8": { + "locked": { + "lastModified": 1675940568, + "narHash": "sha256-epG6pOT9V0kS+FUqd7R6/CWkgnZx2DMT5Veqo+y6G3c=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6ccc4a59c3f1b56d039d93da52696633e641bc71", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_9": { "locked": { "lastModified": 1677063315, "narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=", @@ -523,27 +1379,56 @@ "paisano": { "inputs": { "nixpkgs": [ - "hive", + "nix-boost", + "std", "nixpkgs" ], "nosys": "nosys", - "yants": "yants" + "yants": [ + "nix-boost", + "std", + "yants" + ] }, "locked": { - "lastModified": 1678562978, - "narHash": "sha256-GaPyKdB0RvSBIgPxKkdJHTG/FyKsT0Ku5zifLEjr3QQ=", - "owner": "divnix", - "repo": "paisano", - "rev": "f71a2db9414d66663c03a65ade97a9f353fb6d55", + "lastModified": 1686862844, + "narHash": "sha256-m8l/HpRBJnZ3c0F1u0IyQ3nYGWE0R9V5kfORuqZPzgk=", + "owner": "paisano-nix", + "repo": "core", + "rev": "6674b3d3577212c1eeecd30d62d52edbd000e726", "type": "github" }, "original": { - "owner": "divnix", - "repo": "paisano", + "owner": "paisano-nix", + "ref": "0.1.1", + "repo": "core", "type": "github" } }, "paisano-actions": { + "inputs": { + "nixpkgs": [ + "nix-boost", + "std", + "paisano-mdbook-preprocessor", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1677306424, + "narHash": "sha256-H9/dI2rGEbKo4KEisqbRPHFG2ajF8Tm111NPdKGIf28=", + "owner": "paisano-nix", + "repo": "actions", + "rev": "65ec4e080b3480167fc1a748c89a05901eea9a9b", + "type": "github" + }, + "original": { + "owner": "paisano-nix", + "repo": "actions", + "type": "github" + } + }, + "paisano-actions_2": { "inputs": { "nixpkgs": [ "std", @@ -567,13 +1452,42 @@ }, "paisano-mdbook-preprocessor": { "inputs": { - "crane": "crane", + "crane": "crane_2", "fenix": "fenix", "nixpkgs": [ + "nix-boost", "std", "nixpkgs" ], "paisano-actions": "paisano-actions", + "std": [ + "nix-boost", + "std" + ] + }, + "locked": { + "lastModified": 1680654400, + "narHash": "sha256-Qdpio+ldhUK3zfl22Mhf8HUULdUOJXDWDdO7MIK69OU=", + "owner": "paisano-nix", + "repo": "mdbook-paisano-preprocessor", + "rev": "11a8fc47f574f194a7ae7b8b98001f6143ba4cf1", + "type": "github" + }, + "original": { + "owner": "paisano-nix", + "repo": "mdbook-paisano-preprocessor", + "type": "github" + } + }, + "paisano-mdbook-preprocessor_2": { + "inputs": { + "crane": "crane_3", + "fenix": "fenix_2", + "nixpkgs": [ + "std", + "nixpkgs" + ], + "paisano-actions": "paisano-actions_2", "std": [ "std" ] @@ -593,6 +1507,33 @@ } }, "paisano-tui": { + "inputs": { + "nixpkgs": [ + "nix-boost", + "std", + "blank" + ], + "std": [ + "nix-boost", + "std" + ] + }, + "locked": { + "lastModified": 1681847764, + "narHash": "sha256-mdd7PJW1BZvxy0cIKsPfAO+ohVl/V7heE5ZTAHzTdv8=", + "owner": "paisano-nix", + "repo": "tui", + "rev": "3096bad91cae73ab8ab3367d31f8a143d248a244", + "type": "github" + }, + "original": { + "owner": "paisano-nix", + "ref": "0.1.1", + "repo": "tui", + "type": "github" + } + }, + "paisano-tui_2": { "inputs": { "nixpkgs": [ "std", @@ -644,12 +1585,88 @@ "type": "github" } }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils_4", + "nixpkgs": [ + "nix-boost", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1686970505, + "narHash": "sha256-s3gtsusfeIoMYy0BTXXfoDq1IeDj8rPl4JMcR97H9XU=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "95d3cbc56d21917abace0cc1de10997469eb80b4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, + "poetry2nix_2": { + "inputs": { + "flake-utils": "flake-utils_8", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1686970505, + "narHash": "sha256-s3gtsusfeIoMYy0BTXXfoDq1IeDj8rPl4JMcR97H9XU=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "95d3cbc56d21917abace0cc1de10997469eb80b4", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, + "pre-commit-hooks-nix": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": [ + "neovim-nightly-overlay", + "hercules-ci-effects", + "hercules-ci-agent", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1678376203, + "narHash": "sha256-3tyYGyC8h7fBwncLZy5nCUjTJPrHbmNwp47LlNLOHSM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "1a20b9708962096ec2481eeb2ddca29ed747770a", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "deploy-rs": "deploy-rs", - "hive": "hive", - "nixpkgs": "nixpkgs_3", - "std": "std" + "home-manager": "home-manager", + "kpcli-py": "kpcli-py", + "neovim-nightly-overlay": "neovim-nightly-overlay", + "nix-boost": "nix-boost", + "nix-index-database": "nix-index-database", + "nixpkgs": "nixpkgs_10", + "nixpkgs-latest": "nixpkgs-latest", + "poetry2nix": "poetry2nix_2", + "std": "std_2" } }, "rust-analyzer-src": { @@ -669,7 +1686,101 @@ "type": "github" } }, + "rust-analyzer-src_2": { + "flake": false, + "locked": { + "lastModified": 1677221702, + "narHash": "sha256-1M+58rC4eTCWNmmX0hQVZP20t3tfYNunl9D/PrGUyGE=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "f5401f620699b26ed9d47a1d2e838143a18dbe3b", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, "rust-overlay": { + "inputs": { + "flake-utils": [ + "nix-boost", + "crane", + "flake-utils" + ], + "nixpkgs": [ + "nix-boost", + "crane", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1685759304, + "narHash": "sha256-I3YBH6MS3G5kGzNuc1G0f9uYfTcNY9NYoRc3QsykLk4=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "c535b4f3327910c96dcf21851bbdd074d0760290", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_2": { + "inputs": { + "flake-utils": "flake-utils_5", + "nixpkgs": "nixpkgs_6" + }, + "locked": { + "lastModified": 1687055571, + "narHash": "sha256-UvLoO6u5n9TzY80BpM4DaacxvyJl7u9mm9CA72d309g=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "2de557c780dcb127128ae987fca9d6c2b0d7dc0f", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_3": { + "inputs": { + "flake-utils": [ + "nix-boost", + "std", + "paisano-mdbook-preprocessor", + "crane", + "flake-utils" + ], + "nixpkgs": [ + "nix-boost", + "std", + "paisano-mdbook-preprocessor", + "crane", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1675391458, + "narHash": "sha256-ukDKZw922BnK5ohL9LhwtaDAdCsJL7L6ScNEyF1lO9w=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "383a4acfd11d778d5c2efcf28376cbd845eeaedf", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_4": { "inputs": { "flake-utils": [ "std", @@ -701,15 +1812,60 @@ "std": { "inputs": { "arion": [ + "nix-boost", "std", "blank" ], "blank": "blank", "devshell": "devshell", "dmerge": "dmerge", - "flake-utils": "flake-utils", - "haumea": "haumea_2", + "flake-utils": "flake-utils_6", + "haumea": "haumea", "incl": "incl", + "makes": [ + "nix-boost", + "std", + "blank" + ], + "microvm": [ + "nix-boost", + "std", + "blank" + ], + "n2c": "n2c", + "nixago": "nixago", + "nixpkgs": "nixpkgs_8", + "paisano": "paisano", + "paisano-mdbook-preprocessor": "paisano-mdbook-preprocessor", + "paisano-tui": "paisano-tui", + "yants": "yants" + }, + "locked": { + "lastModified": 1686890041, + "narHash": "sha256-yLucgr7q8o63yJHLd5b5rF/h27ktYTQrn9rYxVxrs3E=", + "owner": "divnix", + "repo": "std", + "rev": "8671b6892e45d795d7409940750832d68c929dcf", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "std", + "type": "github" + } + }, + "std_2": { + "inputs": { + "arion": [ + "std", + "blank" + ], + "blank": "blank_2", + "devshell": "devshell_2", + "dmerge": "dmerge_2", + "flake-utils": "flake-utils_9", + "haumea": "haumea_2", + "incl": "incl_2", "makes": [ "std", "blank" @@ -718,12 +1874,12 @@ "std", "blank" ], - "n2c": "n2c", - "nixago": "nixago", - "nixpkgs": "nixpkgs_5", + "n2c": "n2c_2", + "nixago": "nixago_2", + "nixpkgs": "nixpkgs_12", "paisano": "paisano_2", - "paisano-mdbook-preprocessor": "paisano-mdbook-preprocessor", - "paisano-tui": "paisano-tui", + "paisano-mdbook-preprocessor": "paisano-mdbook-preprocessor_2", + "paisano-tui": "paisano-tui_2", "yants": "yants_2" }, "locked": { @@ -755,6 +1911,81 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_6": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1667395993, @@ -770,20 +2001,36 @@ "type": "github" } }, + "utils_2": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "yants": { "inputs": { "nixpkgs": [ - "hive", - "paisano", + "nix-boost", + "std", + "haumea", "nixpkgs" ] }, "locked": { - "lastModified": 1677285314, - "narHash": "sha256-hlAcg2514zKrPu8jn24BUsIjjvXvCLdw1jvKgBTpqko=", + "lastModified": 1686863218, + "narHash": "sha256-kooxYm3/3ornWtVBNHM3Zh020gACUyFX2G0VQXnB+mk=", "owner": "divnix", "repo": "yants", - "rev": "9eab24b273ce021406c852166c216b86e2bb4ec4", + "rev": "8f0da0dba57149676aa4817ec0c880fbde7a648d", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index f447ce7..0e06186 100644 --- a/flake.nix +++ b/flake.nix @@ -7,12 +7,37 @@ description = "My personal configuration in Nix (and some native configurations)"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs-latest.url = "github:nixos/nixpkgs"; deploy-rs.url = "github:serokell/deploy-rs"; std.url = "github:divnix/std"; - rust-overlay = "github:oxalica/rust-overlay.git"; + poetry2nix = { + url = "github:nix-community/poetry2nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + neovim-nightly-overlay = { + # need to pin this until darwin build is successful again. + url = "github:nix-community/neovim-nightly-overlay?rev=88a6c749a7d126c49f3374f9f28ca452ea9419b8"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-boost = { + url = "git+https://git.pegasust.com/pegasust/nix-boost?ref=bleed"; + }; + kpcli-py = { + url = "github:rebkwok/kpcli"; + flake = false; + }; + nix-index-database = { + url = "github:mic92/nix-index-database"; + # Should show the latest nixpkgs whenever possible + inputs.nixpkgs.follows = "nixpkgs-latest"; + }; }; - outputs = {std, ...} @ inputs: + outputs = {self, std, ...} @ inputs: std.growOn { # boilerplate @@ -32,13 +57,13 @@ ]; } { - devShells = std.harvest [["dotfiles" "devshells"]]; + devShells = std.harvest self [["dotfiles" "devshells"]]; # nixosConfigurations = std.pick [ [ "dotfiles" "nixos" ] ]; # homeConfigurations = std.pick [ [ "dotfiles" "home" ] ]; - homeModules = std.pick [["repo" "home-modules"]]; + homeModules = std.pick self [["repo" "home-modules"]]; # TODO: Debug only - homeProfiles = std.pick [["repo" "home-profiles"]]; - packages = std.harvest [["repo" "home-configs"]]; + homeProfiles = std.pick self [["repo" "home-profiles"]]; + packages = std.harvest self [["repo" "home-configs"] ["repo" "packages"]]; }; } diff --git a/native_configs/neovim/init.lua b/native_configs/neovim/init.lua index b12556d..ff1c73c 100644 --- a/native_configs/neovim/init.lua +++ b/native_configs/neovim/init.lua @@ -900,7 +900,7 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities() -- default language servers local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'lua_ls', 'cmake', 'tailwindcss', 'prismals', - 'rnix', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels", + 'nil_ls', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels", "jsonls", "denols", "gopls", "nickel_ls", 'pylsp', } require("mason").setup({ diff --git a/nix-conf/home-manager/home.nix b/nix-conf/home-manager/home.nix index 4510639..9c5f86e 100644 --- a/nix-conf/home-manager/home.nix +++ b/nix-conf/home-manager/home.nix @@ -67,9 +67,6 @@ in { programs.jq = { enable = true; }; - # not exist in home-manager - # have to do it at system level - # services.ntp.enable = true; # automatic time programs.nix-index = { enable = true; enableBashIntegration = true; diff --git a/nix/cells/dotfiles/packages/default.nix b/nix/cells/dotfiles/packages/default.nix new file mode 100644 index 0000000..8b6a4e8 --- /dev/null +++ b/nix/cells/dotfiles/packages/default.nix @@ -0,0 +1,22 @@ +{ + inputs, + cell, +}: let + inherit (inputs.poetry2nix) mkPoetryApplication defaultPoetryOverrides; +in { + kpcli-py = mkPoetryApplication { + projectDir = inputs.kpcli-py; + overrides = defaultPoetryOverrides.extend (self: super: { + # TODO: add this to upstream poetry2nix + tableformatter = super.tableformatter.overridePythonAttrs (old: { + buildInputs = (old.buildInputs or []) ++ [self.setuptools self.cython_3]; + src = old.src; + }); + + kpcli = super.kpcli.overridePythonAttrs (old: { + buildInputs = (old.buildInputs or []) ++ [self.setuptools]; + }); + }); + }; + +} diff --git a/nix/cells/home-configs/default.nix b/nix/cells/home-configs/default.nix deleted file mode 100644 index 027783e..0000000 --- a/nix/cells/home-configs/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - inputs, - cell, -}: let -in {} diff --git a/nix/cells/packages/default.nix b/nix/cells/packages/default.nix deleted file mode 100644 index d2b2fc2..0000000 --- a/nix/cells/packages/default.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ - inputs, - cell, -}: {} diff --git a/nix/cells/repo/home-configs/default.nix b/nix/cells/repo/home-configs/default.nix new file mode 100644 index 0000000..0aeec55 --- /dev/null +++ b/nix/cells/repo/home-configs/default.nix @@ -0,0 +1,44 @@ +# TODO: this should use winnow with a fair matching of supported systems +{ + inputs, + cell, +}: let + inherit (cell) home-profiles home-modules; + inherit (inputs) home-manager; + pkgs = inputs.nixpkgs; + + # hm is derivation that is compatible with homeConfigurations + home-config = {supported_systems, hm, tested_systems ? []}: + hm // { + _supported_systems = supported_systems; + _tested_systems = tested_systems; + }; + + base-modules = [ + home-profiles.alacritty + home-profiles.git + home-profiles.ssh + home-profiles.shells + ({config.programs.home-manager.enable = true;}) + home-profiles.nix-index + ]; +in { + htran = home-config { + supported_systems = ["aarch64-darwin" "x86_64-darwin"]; + tested_systems = ["aarch64-darwin"]; + hm = home-manager.lib.homeConfigurations { + inherit pkgs; + modules = base-modules ++ [ + home-profiles.nerd_font_module + home-profiles.git-htran + home-profiles.dev-packages + home-profiles.zk + home-modules.darwin-spotlight + ]; + # TODO: might need config prefix. remove this todo after QA + home.username = "htran"; + home.homeDirectory = "/Users/htran"; + home.stateVersion = "23.11"; + }; + }; +} diff --git a/nix/cells/repo/home-profiles/default.nix b/nix/cells/repo/home-profiles/default.nix index 79bd3f5..7bb29de 100644 --- a/nix/cells/repo/home-profiles/default.nix +++ b/nix/cells/repo/home-profiles/default.nix @@ -141,4 +141,51 @@ in { }; }; }; + + git-htran = { + imports = [inputs.cells.repo.home-profiles.git]; + config.git."${namespace}".name = "htran"; + config.git."${namespace}".email = "htran@egihosting.com"; + }; + + git-pegasust = { + imports = [inputs.cells.repo.home-profiles.git]; + config.git."${namespace}".name = "pegasust"; + config.git."${namespace}".email = "pegasucksgg@gmail.com"; + }; + + dev-packages = let pkgs = inputs.nixpkgs; in { + programs.jq.enable = true; + home.packages = [ + pkgs.htop + pkgs.ripgrep + pkgs.unzip + pkgs.zip + + pkgs.yq-go + pkgs.mosh + pkgs.python310 + ]; + }; + + # Local nixpkgs search and fallback if command not found to search from nixpkgs + nix-index = { + imports = [ + inputs.nix-index-database.hmModules.nix-index + ]; + programs.nix-index = { + enable = true; + enableBashIntegration = true; + enableZshIntegration = true; + }; + }; + + # digital garden stack + zk = { + xdg.configFile."zk/config.toml".source = "${inputs.self}/native_configs/zk/config.toml"; + # NB: lib.mkMerge + home.packages = [ + inputs.nixpkgs.zk + ]; + }; } diff --git a/nix/cells/repo/home-profiles/neovim.nix b/nix/cells/repo/home-profiles/neovim.nix index 56fa549..dae5545 100644 --- a/nix/cells/repo/home-profiles/neovim.nix +++ b/nix/cells/repo/home-profiles/neovim.nix @@ -18,14 +18,7 @@ # see: :/--suffix.*PATH # there should be mentions of additional packages my_neovim = pkgs.neovim-unwrapped; - rust_pkgs = - pkgs.rust-bin.selectLatestNightlyWith - ( - toolchain: - toolchain.default.override { - extensions = ["rust-src" "rust-analyzer" "rust-docs" "rustfmt" "clippy" "miri"]; - } - ); + inherit (inputs) system; nvim_pkgs = [ # pkgs.gccStdenv @@ -35,8 +28,8 @@ pkgs.zk # Zettelkasten (limited support) pkgs.fd # Required by a Telescope plugin (?) pkgs.stdenv.cc.cc.lib - pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo - pkgs.rust4cargo + pkgs.nil # oxalica's better nix language server + inputs.nix-boost.packages."${system}".rust4cargo pkgs.nickel pkgs.nls @@ -90,7 +83,7 @@ in { extraLuaConfig = builtins.readFile "${inputs.self}/native_configs/neovim/init.lua"; plugins = let inherit - (pkgs.vimPlugins) + (inputs.nixpkgs-latest.vimPlugins) plenary-nvim nvim-treesitter nvim-treesitter-textobjects diff --git a/nix/cells/repo/lib/default.nix b/nix/cells/repo/lib/default.nix index a44fed5..65c97f6 100644 --- a/nix/cells/repo/lib/default.nix +++ b/nix/cells/repo/lib/default.nix @@ -1,7 +1,6 @@ { inputs, cell }: let - namespace = "repo"; - + namespace = "repo"; # ignore: unused yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand outputPath @@ -10,30 +9,8 @@ let # note that $out is passed onto the bash/sh script for execution '' echo "$yamlContent" | yq >$out - '') - { }); + ''); in { - fromYAML = yamlContent: bulitins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json")); - - # NOTE: Deprecate - # ctor - opt-some = a: [ a ]; - opt-none = [ ]; - opt-none_thunk = _: [ ]; - - # from-to null - opt-fromNullable = nullable: if nullable == null then [ ] else [ nullable ]; - opt-toNullable = opt-fork (a:a) (_: null); - - opt-map = builtins.map; - opt-filter = builtins.filter; - opt-fork = on_some: on_none: opt: if opt == [ ] then (on_none null) else (on_some (builtins.elemAt opt 0)); - - opt-unwrap = opt-fork (a:a) (_: throw "opt-unwrap: expected some, got none"); - opt-unwrapOrElse = opt-fork (a:a); - opt-unwrapOr = fallback_val: opt-fork (a:a) (_: fallback_val); - - opt-orElse = opt: fallback_opt: opt-fork (opt-some) (opt-none_thunk) (opt ++ fallback_opt); - opt-leftmostSome = opts: builtins.foldl' (opt-orElse) [ ] opts; + fromYAML = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json")); } diff --git a/nix/cells/repo/packages/default.nix b/nix/cells/repo/packages/default.nix new file mode 100644 index 0000000..a66539c --- /dev/null +++ b/nix/cells/repo/packages/default.nix @@ -0,0 +1,6 @@ +{ + inputs, + cell, +}: { + inherit (inputs.cells.dotfiles.packages) kpcli-py; +} From 3f1f1c8f6f289e9fcae49909004fbe13e1e01890 Mon Sep 17 00:00:00 2001 From: Hung Date: Sun, 18 Jun 2023 00:52:08 -0700 Subject: [PATCH 63/64] wip: fix some more boneheads; stuck at starshpi not accepting nested list --- flake.lock | 79 ++++-------------------- flake.nix | 13 ++-- nix/cells/dotfiles/packages/default.nix | 4 +- nix/cells/repo/home-configs/default.nix | 14 +++-- nix/cells/repo/home-modules/default.nix | 7 +-- nix/cells/repo/home-profiles/default.nix | 17 +++-- nix/cells/repo/home-profiles/neovim.nix | 2 +- nix/cells/repo/home-profiles/shells.nix | 2 +- 8 files changed, 42 insertions(+), 96 deletions(-) diff --git a/flake.lock b/flake.lock index 676ed68..cb85208 100644 --- a/flake.lock +++ b/flake.lock @@ -96,7 +96,7 @@ "crane_3": { "inputs": { "flake-compat": "flake-compat_7", - "flake-utils": "flake-utils_10", + "flake-utils": "flake-utils_9", "nixpkgs": [ "std", "paisano-mdbook-preprocessor", @@ -167,7 +167,7 @@ "std", "nixpkgs" ], - "systems": "systems_6" + "systems": "systems_5" }, "locked": { "lastModified": 1686680692, @@ -474,21 +474,6 @@ "type": "github" } }, - "flake-utils_10": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "flake-utils_2": { "locked": { "lastModified": 1667395993, @@ -589,15 +574,12 @@ } }, "flake-utils_8": { - "inputs": { - "systems": "systems_5" - }, "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", "owner": "numtide", "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", "type": "github" }, "original": { @@ -608,11 +590,11 @@ }, "flake-utils_9": { "locked": { - "lastModified": 1659877975, - "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", - "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { @@ -1109,11 +1091,11 @@ }, "nixpkgs-latest": { "locked": { - "lastModified": 1687069429, - "narHash": "sha256-AEBWBsIxyE5YJrY4ih/KDgCMSufVD3Dec9ruVuXbuFo=", + "lastModified": 1687069865, + "narHash": "sha256-+JcVIxijVccnSnbGl8INEKkRo3GzHZ7iBm4EZ2MC1O8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "192011a33fdfda7b9a1bc42fba5c964fd5452d54", + "rev": "5630d719e9e90f66f9eaa4a2d00b303dbee9f4c3", "type": "github" }, "original": { @@ -1607,27 +1589,6 @@ "type": "github" } }, - "poetry2nix_2": { - "inputs": { - "flake-utils": "flake-utils_8", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1686970505, - "narHash": "sha256-s3gtsusfeIoMYy0BTXXfoDq1IeDj8rPl4JMcR97H9XU=", - "owner": "nix-community", - "repo": "poetry2nix", - "rev": "95d3cbc56d21917abace0cc1de10997469eb80b4", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "poetry2nix", - "type": "github" - } - }, "pre-commit-hooks-nix": { "inputs": { "flake-compat": "flake-compat_3", @@ -1665,7 +1626,6 @@ "nix-index-database": "nix-index-database", "nixpkgs": "nixpkgs_10", "nixpkgs-latest": "nixpkgs-latest", - "poetry2nix": "poetry2nix_2", "std": "std_2" } }, @@ -1863,7 +1823,7 @@ "blank": "blank_2", "devshell": "devshell_2", "dmerge": "dmerge_2", - "flake-utils": "flake-utils_9", + "flake-utils": "flake-utils_8", "haumea": "haumea_2", "incl": "incl_2", "makes": [ @@ -1971,21 +1931,6 @@ "type": "github" } }, - "systems_6": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "utils": { "locked": { "lastModified": 1667395993, diff --git a/flake.nix b/flake.nix index 0e06186..58b6fa1 100644 --- a/flake.nix +++ b/flake.nix @@ -10,10 +10,6 @@ nixpkgs-latest.url = "github:nixos/nixpkgs"; deploy-rs.url = "github:serokell/deploy-rs"; std.url = "github:divnix/std"; - poetry2nix = { - url = "github:nix-community/poetry2nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -48,12 +44,15 @@ # modules = ./nix/modules; cellBlocks = let - inherit (std.blockTypes) devshells functions; + inherit (std.blockTypes) devshells functions anything installables; in [ (devshells "devshells") (devshells "userShells") (functions "home-profiles") (functions "home-modules") + (anything "home-configs") + (installables "packages") + (anything "lib") ]; } { @@ -61,9 +60,11 @@ # nixosConfigurations = std.pick [ [ "dotfiles" "nixos" ] ]; # homeConfigurations = std.pick [ [ "dotfiles" "home" ] ]; homeModules = std.pick self [["repo" "home-modules"]]; + packages = std.harvest self [["repo" "packages"]]; + legacyPackages = std.harvest self [["repo" "home-configs"]]; + lib = std.pick self [["repo" "lib"]]; # TODO: Debug only homeProfiles = std.pick self [["repo" "home-profiles"]]; - packages = std.harvest self [["repo" "home-configs"] ["repo" "packages"]]; }; } diff --git a/nix/cells/dotfiles/packages/default.nix b/nix/cells/dotfiles/packages/default.nix index 8b6a4e8..22d70e4 100644 --- a/nix/cells/dotfiles/packages/default.nix +++ b/nix/cells/dotfiles/packages/default.nix @@ -2,7 +2,9 @@ inputs, cell, }: let - inherit (inputs.poetry2nix) mkPoetryApplication defaultPoetryOverrides; + inherit (inputs.nixpkgs) system; + inherit (inputs.nix-boost.pkgs."${system}".mypkgs) poetry2nix; + inherit (poetry2nix) mkPoetryApplication defaultPoetryOverrides; in { kpcli-py = mkPoetryApplication { projectDir = inputs.kpcli-py; diff --git a/nix/cells/repo/home-configs/default.nix b/nix/cells/repo/home-configs/default.nix index 0aeec55..b2964a5 100644 --- a/nix/cells/repo/home-configs/default.nix +++ b/nix/cells/repo/home-configs/default.nix @@ -23,10 +23,10 @@ home-profiles.nix-index ]; in { - htran = home-config { + homeConfigurations.htran = home-config { supported_systems = ["aarch64-darwin" "x86_64-darwin"]; tested_systems = ["aarch64-darwin"]; - hm = home-manager.lib.homeConfigurations { + hm = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = base-modules ++ [ home-profiles.nerd_font_module @@ -34,11 +34,13 @@ in { home-profiles.dev-packages home-profiles.zk home-modules.darwin-spotlight + + ({ + home.username = "htran"; + home.homeDirectory = "/Users/htran"; + home.stateVersion = "23.11"; + }) ]; - # TODO: might need config prefix. remove this todo after QA - home.username = "htran"; - home.homeDirectory = "/Users/htran"; - home.stateVersion = "23.11"; }; }; } diff --git a/nix/cells/repo/home-modules/default.nix b/nix/cells/repo/home-modules/default.nix index 34e5d8a..d5f18c7 100644 --- a/nix/cells/repo/home-modules/default.nix +++ b/nix/cells/repo/home-modules/default.nix @@ -91,7 +91,7 @@ in }; }; - alacritty = { config, lib }: + alacritty = { config, lib, ... }: let inherit (inputs.cells.repo.lib) fromYAML; cfg = config."${namespace}".alacritty; @@ -133,13 +133,12 @@ in enable = cfg.enable; settings = let - ; actualConfig = if cfg.config-path != null then fromYAML (builtins.readFile cfg.config-path) else { }; in lib.recursiveUpdate actualConfig { - font.normal.family = lib.mkIf (font.family != null) font.family; - font.size = lib.mkIf (font.size != null) font.size; + font.normal.family = lib.mkIf (cfg.font.family != null) cfg.font.family; + font.size = lib.mkIf (cfg.font.size != null) cfg.font.size; }; }; }; diff --git a/nix/cells/repo/home-profiles/default.nix b/nix/cells/repo/home-profiles/default.nix index 7bb29de..d26c2c2 100644 --- a/nix/cells/repo/home-profiles/default.nix +++ b/nix/cells/repo/home-profiles/default.nix @@ -15,10 +15,6 @@ in { pkgs, ... }: { - imports = [ - import - inputs.cells."${namespace}" - ]; fonts.fontconfig.enable = true; home.packages = [ (pkgs.nerdfonts.override {fonts = ["Hack"];}) @@ -74,12 +70,11 @@ in { cfg = config."${namespace}".alacritty; in { imports = [ - import - "${inputs.cells.repo.home-modules.alacritty}" + inputs.cells.repo.home-modules.alacritty ]; - configs."${namespace}".alacritty = { + config."${namespace}".alacritty = { enable = true; - config-path = "${inputs.self}//native-configs/alacritty/alacritty.yml"; + config-path = "${inputs.self}//native_configs/alacritty/alacritty.yml"; font.size = 11.0; font.family = "Hack Nerd Font Mono"; }; @@ -144,8 +139,10 @@ in { git-htran = { imports = [inputs.cells.repo.home-profiles.git]; - config.git."${namespace}".name = "htran"; - config.git."${namespace}".email = "htran@egihosting.com"; + config."${namespace}".git = { + name = "htran"; + email = "htran@egihosting.com"; + }; }; git-pegasust = { diff --git a/nix/cells/repo/home-profiles/neovim.nix b/nix/cells/repo/home-profiles/neovim.nix index dae5545..eb49566 100644 --- a/nix/cells/repo/home-profiles/neovim.nix +++ b/nix/cells/repo/home-profiles/neovim.nix @@ -18,7 +18,7 @@ # see: :/--suffix.*PATH # there should be mentions of additional packages my_neovim = pkgs.neovim-unwrapped; - inherit (inputs) system; + inherit (inputs.nixpkgs) system; nvim_pkgs = [ # pkgs.gccStdenv diff --git a/nix/cells/repo/home-profiles/shells.nix b/nix/cells/repo/home-profiles/shells.nix index 9e89729..ac8fd1a 100644 --- a/nix/cells/repo/home-profiles/shells.nix +++ b/nix/cells/repo/home-profiles/shells.nix @@ -52,7 +52,7 @@ in { programs.tmux = { enable = true; plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [cpu net-speed]; - extraConfig = builtins.readFile "${innputs.self}/native_configs/tmux/tmux.conf"; + extraConfig = builtins.readFile "${inputs.self}/native_configs/tmux/tmux.conf"; }; xdg.configFile."tmux/tmux.conf".text = lib.mkOrder 600 '' set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M ' From f454e55e80a3fc9e66120ae0dac1c903d172134c Mon Sep 17 00:00:00 2001 From: htran Date: Sun, 18 Jun 2023 02:06:08 -0700 Subject: [PATCH 64/64] std actually works now --- .gitignore | 1 + native_configs/starship/starship.toml | 2 +- nix-conf/home-manager/base/shells.nix | 11 +++++--- nix/cells/repo/home-configs/default.nix | 3 ++- nix/cells/repo/home-profiles/default.nix | 34 ++++++++++++++++-------- nix/cells/repo/home-profiles/neovim.nix | 2 +- nix/cells/repo/home-profiles/shells.nix | 13 ++++++--- 7 files changed, 44 insertions(+), 22 deletions(-) diff --git a/.gitignore b/.gitignore index b2be92b..726d2d6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ result +.direnv diff --git a/native_configs/starship/starship.toml b/native_configs/starship/starship.toml index ab52873..3334c74 100644 --- a/native_configs/starship/starship.toml +++ b/native_configs/starship/starship.toml @@ -5,7 +5,7 @@ symbol = " " [c] disabled = false -commmands = [ [ 'cc', '--version' ], [ 'gcc', '--version' ], [ 'clang', '--version' ] ] +# commands = [ [ 'cc', '--version' ], [ 'gcc', '--version' ], [ 'clang', '--version' ] ] detect_extensions = ["c", "h", "cc", "cpp", "hh", "hpp"] [conda] diff --git a/nix-conf/home-manager/base/shells.nix b/nix-conf/home-manager/base/shells.nix index 3f9c06f..e5bd1f1 100644 --- a/nix-conf/home-manager/base/shells.nix +++ b/nix-conf/home-manager/base/shells.nix @@ -70,10 +70,13 @@ in { settings = let native = builtins.fromTOML (builtins.readFile "${proj_root.config.path}/starship/starship.toml"); patch-nix = pkgs.lib.recursiveUpdate native { - c.commands = [ - ["nix" "run" "nixpkgs#clang" "--" "--version"] - ["nix" "run" "nixpkgs#gcc" "--" "--version"] - ]; + # WARNING: home-manager fails on here for some reason. Likely not at the + # validation phase (type-checking), but at evaluation phaase (stringify) + # c.commands = [ + # ["nix" "run" "nixpkgs#clang" "--" "--version"] + # ["nix" "run" "nixpkgs#gcc" "--" "--version"] + # ]; + c.commands = "fuk"; }; in patch-nix; diff --git a/nix/cells/repo/home-configs/default.nix b/nix/cells/repo/home-configs/default.nix index b2964a5..4384ab5 100644 --- a/nix/cells/repo/home-configs/default.nix +++ b/nix/cells/repo/home-configs/default.nix @@ -16,11 +16,12 @@ base-modules = [ home-profiles.alacritty - home-profiles.git + # home-profiles.git home-profiles.ssh home-profiles.shells ({config.programs.home-manager.enable = true;}) home-profiles.nix-index + home-profiles.neovim ]; in { homeConfigurations.htran = home-config { diff --git a/nix/cells/repo/home-profiles/default.nix b/nix/cells/repo/home-profiles/default.nix index d26c2c2..3092407 100644 --- a/nix/cells/repo/home-profiles/default.nix +++ b/nix/cells/repo/home-profiles/default.nix @@ -8,6 +8,7 @@ _imports @ { # TODO: I don't think abstracting namespace away is a good idea in this case namespace = "repo"; imports = _imports // {inherit namespace;}; + inherit (cell) home-modules; in { neovim = import ./neovim.nix imports; nerd_font_module = { @@ -15,11 +16,11 @@ in { pkgs, ... }: { - fonts.fontconfig.enable = true; - home.packages = [ + config.fonts.fontconfig.enable = true; + config.home.packages = [ (pkgs.nerdfonts.override {fonts = ["Hack"];}) ]; - "${namespace}".alacritty.font.family = "Hack Nerd Font Mono"; + config."${namespace}".alacritty.font.family = "Hack Nerd Font Mono"; }; secrets = { @@ -99,8 +100,12 @@ in { co = "checkout"; b = "branch"; }; + cfg = config."${namespace}".profile.git; in { - options."${namespace}".git = { + imports = [ + home-modules.git + ]; + options."${namespace}".profile.git = { aliases = lib.mkOption { type = lib.types.attrs; default = {}; @@ -135,11 +140,16 @@ in { example = [".direnv" "node_modules"]; }; }; + # WARNING: This should be completed wtf + config."${namespace}".git = { + inherit (cfg) name email ignores aliases; + enable = true; + }; }; git-htran = { imports = [inputs.cells.repo.home-profiles.git]; - config."${namespace}".git = { + config."${namespace}".profile.git = { name = "htran"; email = "htran@egihosting.com"; }; @@ -147,8 +157,10 @@ in { git-pegasust = { imports = [inputs.cells.repo.home-profiles.git]; - config.git."${namespace}".name = "pegasust"; - config.git."${namespace}".email = "pegasucksgg@gmail.com"; + config."${namespace}".profile.git = { + email = "pegasucksgg@gmail.com"; + name = "pegasust"; + }; }; dev-packages = let pkgs = inputs.nixpkgs; in { @@ -170,7 +182,7 @@ in { imports = [ inputs.nix-index-database.hmModules.nix-index ]; - programs.nix-index = { + config.programs.nix-index = { enable = true; enableBashIntegration = true; enableZshIntegration = true; @@ -179,9 +191,9 @@ in { # digital garden stack zk = { - xdg.configFile."zk/config.toml".source = "${inputs.self}/native_configs/zk/config.toml"; - # NB: lib.mkMerge - home.packages = [ + config.xdg.configFile."zk/config.toml".source = "${inputs.self}/native_configs/zk/config.toml"; + # NB: this is done with lib.mkMerge + config.home.packages = [ inputs.nixpkgs.zk ]; }; diff --git a/nix/cells/repo/home-profiles/neovim.nix b/nix/cells/repo/home-profiles/neovim.nix index eb49566..16f9c91 100644 --- a/nix/cells/repo/home-profiles/neovim.nix +++ b/nix/cells/repo/home-profiles/neovim.nix @@ -83,7 +83,7 @@ in { extraLuaConfig = builtins.readFile "${inputs.self}/native_configs/neovim/init.lua"; plugins = let inherit - (inputs.nixpkgs-latest.vimPlugins) + (inputs.nixpkgs-latest.legacyPackages.${system}.vimPlugins) plenary-nvim nvim-treesitter nvim-treesitter-textobjects diff --git a/nix/cells/repo/home-profiles/shells.nix b/nix/cells/repo/home-profiles/shells.nix index ac8fd1a..dd06096 100644 --- a/nix/cells/repo/home-profiles/shells.nix +++ b/nix/cells/repo/home-profiles/shells.nix @@ -69,10 +69,15 @@ in { settings = let native = builtins.fromTOML (builtins.readFile "${inputs.self}/native_configs/starship/starship.toml"); patch-nix = pkgs.lib.recursiveUpdate native { - c.commands = [ - ["nix" "run" "nixpkgs#clang" "--" "--version"] - ["nix" "run" "nixpkgs#gcc" "--" "--version"] - ]; + # WARNING: home-manager fails on here for some reason. Likely not at the + # validation phase (type-checking), but at evaluation phaase (stringify) + # I'm thinking when `settings` are evaluated, it has some sort of + # recursive processing before it gets turned into a toml + # c.commands = [ + # ["nix" "run" "nixpkgs#clang" "--" "--version"] + # ["nix" "run" "nixpkgs#gcc" "--" "--version"] + # ]; + c.disabled = true; }; in patch-nix;