shell: use devshell.toml
This commit is contained in:
parent
0e27b367d7
commit
b41c738f39
3 changed files with 42 additions and 31 deletions
|
@ -58,11 +58,11 @@
|
||||||
},
|
},
|
||||||
"devshell": {
|
"devshell": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1612486691,
|
"lastModified": 1613310953,
|
||||||
"narHash": "sha256-WluAIsf/HMYeg8PnM1sODRmiEOzt1wjjY+l8tbttLSI=",
|
"narHash": "sha256-GhAwxJ0Jfsj8LIQmEQylpVkcThUJgPChjo48DZeBQZA=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "devshell",
|
"repo": "devshell",
|
||||||
"rev": "02933029b06747c7523f3a6f677df06d4cfdfc7b",
|
"rev": "f64db97388dda7c2c6f8fb7aa5d6d08365fb1e01",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -13,50 +13,32 @@ let
|
||||||
|
|
||||||
flk = pkgs.callPackage ./flk.nix { };
|
flk = pkgs.callPackage ./flk.nix { };
|
||||||
|
|
||||||
inherit (flk) name;
|
|
||||||
in
|
in
|
||||||
pkgs.devshell.mkShell {
|
pkgs.devshell.mkShell
|
||||||
inherit name;
|
{
|
||||||
|
imports = [ (pkgs.devshell.importTOML ./devshell.toml) ];
|
||||||
|
|
||||||
packages = with pkgs; with installPkgs; [
|
packages = with installPkgs; [
|
||||||
git-crypt
|
|
||||||
nixos-install
|
nixos-install
|
||||||
nixos-generate-config
|
nixos-generate-config
|
||||||
nixos-enter
|
nixos-enter
|
||||||
] ++ lib.optional (system == "x86_64-linux") deploy-rs;
|
] ++ lib.optional (system == "x86_64-linux") pkgs.deploy-rs;
|
||||||
|
|
||||||
env = { inherit name; };
|
|
||||||
|
|
||||||
git.hooks = {
|
git.hooks = {
|
||||||
enable = true;
|
|
||||||
pre-commit.text = lib.fileContents ./pre-commit.sh;
|
pre-commit.text = lib.fileContents ./pre-commit.sh;
|
||||||
};
|
};
|
||||||
|
|
||||||
commands = with pkgs; let
|
commands = with pkgs; [
|
||||||
mkCommand = category: package: {
|
{
|
||||||
inherit package category;
|
package = flk;
|
||||||
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 ] ++ [
|
|
||||||
{
|
{
|
||||||
name = "nix";
|
name = "nix";
|
||||||
help = nixFlakes.meta.description;
|
help = nixFlakes.meta.description;
|
||||||
category = "main";
|
|
||||||
command = ''
|
command = ''
|
||||||
${nixFlakes}/bin/nix --option experimental-features \
|
${nixFlakes}/bin/nix --option experimental-features \
|
||||||
"nix-command flakes ca-references" "$@"
|
"nix-command flakes ca-references" "$@"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
];
|
] ++ lib.optional (system != "i686-linux") { package = cachix; };
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
29
shell/devshell.toml
Normal file
29
shell/devshell.toml
Normal file
|
@ -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
|
Loading…
Reference in a new issue