diff --git a/flake.lock b/flake.lock index a3e0c904..3036624a 100644 --- a/flake.lock +++ b/flake.lock @@ -58,11 +58,11 @@ }, "devshell": { "locked": { - "lastModified": 1612486691, - "narHash": "sha256-WluAIsf/HMYeg8PnM1sODRmiEOzt1wjjY+l8tbttLSI=", + "lastModified": 1613310953, + "narHash": "sha256-GhAwxJ0Jfsj8LIQmEQylpVkcThUJgPChjo48DZeBQZA=", "owner": "numtide", "repo": "devshell", - "rev": "02933029b06747c7523f3a6f677df06d4cfdfc7b", + "rev": "f64db97388dda7c2c6f8fb7aa5d6d08365fb1e01", "type": "github" }, "original": { diff --git a/shell/default.nix b/shell/default.nix index 5ee4e70e..8fa5014b 100644 --- a/shell/default.nix +++ b/shell/default.nix @@ -13,50 +13,32 @@ let flk = pkgs.callPackage ./flk.nix { }; - inherit (flk) name; in -pkgs.devshell.mkShell { - inherit name; +pkgs.devshell.mkShell +{ + imports = [ (pkgs.devshell.importTOML ./devshell.toml) ]; - packages = with pkgs; with installPkgs; [ - git-crypt + packages = with installPkgs; [ nixos-install nixos-generate-config nixos-enter - ] ++ lib.optional (system == "x86_64-linux") deploy-rs; - - env = { inherit name; }; + ] ++ lib.optional (system == "x86_64-linux") pkgs.deploy-rs; git.hooks = { - enable = true; pre-commit.text = lib.fileContents ./pre-commit.sh; }; - commands = with pkgs; let - mkCommand = category: package: { - inherit package category; - name = package.pname or package.name; - help = package.meta.description; - }; - - mapCmd = category: map (mkCommand category); - in - mapCmd "main" - ( - [ flk git ] ++ - lib.optional (system != "i686-linux") cachix - ) ++ - mapCmd "linters" [ nixpkgs-fmt editorconfig-checker ] ++ - mapCmd "documentation" [ python3Packages.grip mdbook ] ++ [ + commands = with pkgs; [ + { + package = flk; + } { name = "nix"; help = nixFlakes.meta.description; - category = "main"; command = '' ${nixFlakes}/bin/nix --option experimental-features \ "nix-command flakes ca-references" "$@" ''; } - ]; - + ] ++ lib.optional (system != "i686-linux") { package = cachix; }; } diff --git a/shell/devshell.toml b/shell/devshell.toml new file mode 100644 index 00000000..f261fdc3 --- /dev/null +++ b/shell/devshell.toml @@ -0,0 +1,29 @@ +imports = [ "git.hooks" ] + +[devshell] +packages = [ + "git-crypt" +] + +[[commands]] +package = "git" +category = "vcs" + +[[commands]] +package = "nixpkgs-fmt" +category = "linters" + +[[commands]] +package = "editorconfig-checker" +category = "linters" + +[[commands]] +package = "python3Packages.grip" +category = "documentation" + +[[commands]] +package = "mdbook" +category = "documentation" + +[git.hooks] +enable = true