From a3ec0d281433f9ba3a1b9723a19cc29302d96eb6 Mon Sep 17 00:00:00 2001 From: David Arnold Date: Tue, 20 Jul 2021 23:36:41 -0500 Subject: [PATCH] imp: use bud nixos-/devhsllModules and hide rebiding both modules depend on `self`/`inputs` available as special args for both, devshell & nixos modules, so bump to an improved `digga`, as well. --- flake.lock | 12 ++++----- flake.nix | 7 ++--- shell/default.nix | 67 +++++------------------------------------------ shell/devos.nix | 61 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+), 71 deletions(-) create mode 100644 shell/devos.nix diff --git a/flake.lock b/flake.lock index 31b5a93..560b208 100644 --- a/flake.lock +++ b/flake.lock @@ -46,11 +46,11 @@ ] }, "locked": { - "lastModified": 1626456025, - "narHash": "sha256-TrKfxVir+TilnqSNYokxJKx2ugEem7Khv4YmSwqj9JQ=", + "lastModified": 1626840404, + "narHash": "sha256-6HKRxPlVO4iKyPNAjkjku3JzGX1lgJ+93ieWAx7MY60=", "owner": "divnix", "repo": "bud", - "rev": "59c10c3879b11371944ab664462fe2e9366cfb44", + "rev": "452ec18574b6e4d8b8a6aae9e190255d4c89768c", "type": "github" }, "original": { @@ -172,11 +172,11 @@ ] }, "locked": { - "lastModified": 1626836850, - "narHash": "sha256-qMZ4T0ig9bBHsiu1nEnYzI6JjXjpJv2fnBexpJ8cw+0=", + "lastModified": 1626841951, + "narHash": "sha256-tppFdKz4fvt7gYsMotT/kWSIzKWcdDsMCkQzn6mGRCA=", "owner": "divnix", "repo": "digga", - "rev": "af700c53c6c955a46ae834c1e6e7c6bb5cb1adeb", + "rev": "f676b7899541836129c188f8a23c21f439a02960", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index c81a7fa..640dd15 100644 --- a/flake.nix +++ b/flake.nix @@ -70,9 +70,6 @@ , deploy , ... } @ inputs: - let - bud' = bud self; # rebind to access self.budModules - in digga.lib.mkFlake { inherit self inputs; @@ -117,7 +114,7 @@ ci-agent.nixosModules.agent-profile home.nixosModules.home-manager agenix.nixosModules.age - (bud.nixosModules.bud bud') + bud.nixosModules.bud ]; }; @@ -150,7 +147,7 @@ }; # digga.lib.importers.rakeLeaves ./users/hm; }; - devshell.modules = [ (import ./shell bud') ]; + devshell = ./shell; homeConfigurations = digga.lib.mkHomeConfigurations self.nixosConfigurations; diff --git a/shell/default.nix b/shell/default.nix index edad83c..aef90a5 100644 --- a/shell/default.nix +++ b/shell/default.nix @@ -1,63 +1,10 @@ -bud: -{ pkgs, extraModulesPath, ... }: -let - - hooks = import ./hooks; - - pkgWithCategory = category: package: { inherit package category; }; - linter = pkgWithCategory "linter"; - docs = pkgWithCategory "docs"; - devos = pkgWithCategory "devos"; - -in +{ self, inputs, ... }: { - _file = toString ./.; - - imports = [ "${extraModulesPath}/git/hooks.nix" ]; - git = { inherit hooks; }; - - # tempfix: remove when merged https://github.com/numtide/devshell/pull/123 - devshell.startup.load_profiles = pkgs.lib.mkForce (pkgs.lib.noDepEntry '' - # PATH is devshell's exorbitant privilige: - # fence against its pollution - _PATH=''${PATH} - # Load installed profiles - for file in "$DEVSHELL_DIR/etc/profile.d/"*.sh; do - # If that folder doesn't exist, bash loves to return the whole glob - [[ -f "$file" ]] && source "$file" - done - # Exert exorbitant privilige and leave no trace - export PATH=''${_PATH} - unset _PATH - ''); - - packages = with pkgs; [ - git-crypt + externalModules = with inputs; [ + bud.devshellModules.bud + ]; + modules = [ + ./devos.nix ]; - - commands = with pkgs; [ - (devos (bud { inherit pkgs; })) - (devos nixUnstable) - (devos agenix) - { - category = "devos"; - name = pkgs.nvfetcher-bin.pname; - help = pkgs.nvfetcher-bin.meta.description; - command = "cd $DEVSHELL_ROOT/pkgs; ${pkgs.nvfetcher-bin}/bin/nvfetcher -c ./sources.toml --no-output $@; nixpkgs-fmt _sources/"; - } - (linter nixpkgs-fmt) - (linter editorconfig-checker) - # (docs python3Packages.grip) too many deps - (docs mdbook) - ] - - ++ lib.optional - (pkgs ? deploy-rs) - (devos deploy-rs.deploy-rs) - - ++ lib.optional - (system != "i686-linux") - (devos cachix) - - ; } + diff --git a/shell/devos.nix b/shell/devos.nix new file mode 100644 index 0000000..83101d2 --- /dev/null +++ b/shell/devos.nix @@ -0,0 +1,61 @@ +{ pkgs, extraModulesPath, ... }: +let + + hooks = import ./hooks; + + pkgWithCategory = category: package: { inherit package category; }; + linter = pkgWithCategory "linter"; + docs = pkgWithCategory "docs"; + devos = pkgWithCategory "devos"; + +in +{ + _file = toString ./.; + + imports = [ "${extraModulesPath}/git/hooks.nix" ]; + git = { inherit hooks; }; + + # tempfix: remove when merged https://github.com/numtide/devshell/pull/123 + devshell.startup.load_profiles = pkgs.lib.mkForce (pkgs.lib.noDepEntry '' + # PATH is devshell's exorbitant privilige: + # fence against its pollution + _PATH=''${PATH} + # Load installed profiles + for file in "$DEVSHELL_DIR/etc/profile.d/"*.sh; do + # If that folder doesn't exist, bash loves to return the whole glob + [[ -f "$file" ]] && source "$file" + done + # Exert exorbitant privilige and leave no trace + export PATH=''${_PATH} + unset _PATH + ''); + + packages = with pkgs; [ + git-crypt + ]; + + commands = with pkgs; [ + (devos nixUnstable) + (devos agenix) + { + category = "devos"; + name = pkgs.nvfetcher-bin.pname; + help = pkgs.nvfetcher-bin.meta.description; + command = "cd $DEVSHELL_ROOT/pkgs; ${pkgs.nvfetcher-bin}/bin/nvfetcher -c ./sources.toml --no-output $@; nixpkgs-fmt _sources/"; + } + (linter nixpkgs-fmt) + (linter editorconfig-checker) + # (docs python3Packages.grip) too many deps + (docs mdbook) + ] + + ++ lib.optional + (pkgs ? deploy-rs) + (devos deploy-rs.deploy-rs) + + ++ lib.optional + (system != "i686-linux") + (devos cachix) + + ; +}