1
1
mirror of https://github.com/divnix/digga.git synced 2024-12-23 16:11:51 +03:00

shell: use devshell.toml

This commit is contained in:
Timothy DeHerrera 2021-02-17 11:49:13 -07:00
parent 0e27b367d7
commit b41c738f39
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
3 changed files with 42 additions and 31 deletions

View File

@ -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": {

View File

@ -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; };
}

29
shell/devshell.toml Normal file
View 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