hooks
This commit is contained in:
parent
ef7e64f2b1
commit
cc62f8a2b9
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
||||||
.direnv/
|
.direnv/
|
||||||
|
|
||||||
|
.pre-commit-config.yaml
|
||||||
|
|
4
disk.sh
Normal file → Executable file
4
disk.sh
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
@ -72,7 +74,7 @@ while true; do
|
||||||
printf '\n'
|
printf '\n'
|
||||||
read -r -s -p 'Re-enter password: ' repassword
|
read -r -s -p 'Re-enter password: ' repassword
|
||||||
printf '\n'
|
printf '\n'
|
||||||
if [[ "$password" == "$repassword" ]]; then
|
if [[ $password == "$repassword" ]]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
138
flake.lock
138
flake.lock
|
@ -43,6 +43,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-parts": {
|
"flake-parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
|
@ -61,13 +77,55 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"git-hooks": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"gitignore": "gitignore",
|
||||||
|
"nixpkgs": "nixpkgs_2",
|
||||||
|
"nixpkgs-stable": "nixpkgs-stable"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1732021966,
|
||||||
|
"narHash": "sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE=",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "git-hooks.nix",
|
||||||
|
"rev": "3308484d1a443fc5bc92012435d79e80458fe43c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "git-hooks.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gitignore": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"git-hooks",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1709087332,
|
||||||
|
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"hardware": {
|
"hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1732483221,
|
"lastModified": 1733066523,
|
||||||
"narHash": "sha256-kF6rDeCshoCgmQz+7uiuPdREVFuzhIorGOoPXMalL2U=",
|
"narHash": "sha256-aQorWITXZu7b095UwnpUvcGt9dNJie/GO9r4hZfe2sU=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"rev": "45348ad6fb8ac0e8415f6e5e96efe47dd7f39405",
|
"rev": "fe01780d356d70fd119a19277bff71d3e78dad00",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -99,7 +157,7 @@
|
||||||
},
|
},
|
||||||
"hxwrap": {
|
"hxwrap": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_3"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1730417950,
|
"lastModified": 1730417950,
|
||||||
|
@ -143,7 +201,39 @@
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz"
|
"url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs-stable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1730741070,
|
||||||
|
"narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "d063c1dd113c91ab27959ba540c0d9753409edf3",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-24.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1730768919,
|
||||||
|
"narHash": "sha256-8AKquNnnSaJRXZxc5YmF/WfmxiHX6MMZZasRP6RRQkE=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "a04d33c0c3f1a59a2c1cb0c6e34cd24500e5a1dc",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_3": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1730200266,
|
"lastModified": 1730200266,
|
||||||
"narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=",
|
"narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=",
|
||||||
|
@ -159,7 +249,7 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_3": {
|
"nixpkgs_4": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1732837521,
|
"lastModified": 1732837521,
|
||||||
"narHash": "sha256-jNRNr49UiuIwaarqijgdTR2qLPifxsVhlJrKzQ8XUIE=",
|
"narHash": "sha256-jNRNr49UiuIwaarqijgdTR2qLPifxsVhlJrKzQ8XUIE=",
|
||||||
|
@ -175,13 +265,31 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs_5": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1731890469,
|
||||||
|
"narHash": "sha256-D1FNZ70NmQEwNxpSSdTXCSklBH1z2isPR84J6DQrJGs=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "5083ec887760adfe12af64830a66807423a859a7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"agenix": "agenix",
|
"agenix": "agenix",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
|
"git-hooks": "git-hooks",
|
||||||
"hardware": "hardware",
|
"hardware": "hardware",
|
||||||
"hxwrap": "hxwrap",
|
"hxwrap": "hxwrap",
|
||||||
"nixpkgs": "nixpkgs_3"
|
"nixpkgs": "nixpkgs_4",
|
||||||
|
"treefmt": "treefmt"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
|
@ -198,6 +306,24 @@
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"treefmt": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs_5"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1732894027,
|
||||||
|
"narHash": "sha256-2qbdorpq0TXHBWbVXaTqKoikN4bqAtAplTwGuII+oAc=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"rev": "6209c381904cab55796c5d7350e89681d3b2a8ef",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
45
flake.nix
45
flake.nix
|
@ -4,6 +4,8 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
git-hooks.url = "github:cachix/git-hooks.nix";
|
||||||
|
treefmt.url = "github:numtide/treefmt-nix";
|
||||||
hardware.url = "github:NixOS/nixos-hardware";
|
hardware.url = "github:NixOS/nixos-hardware";
|
||||||
agenix.url = "github:ryantm/agenix";
|
agenix.url = "github:ryantm/agenix";
|
||||||
hxwrap.url = "github:lukaswrz/hxwrap";
|
hxwrap.url = "github:lukaswrz/hxwrap";
|
||||||
|
@ -12,9 +14,15 @@
|
||||||
outputs = {
|
outputs = {
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
flake-parts,
|
flake-parts,
|
||||||
|
treefmt,
|
||||||
...
|
...
|
||||||
} @ inputs:
|
} @ inputs:
|
||||||
flake-parts.lib.mkFlake {inherit inputs;} {
|
flake-parts.lib.mkFlake {inherit inputs;} {
|
||||||
|
imports = [
|
||||||
|
inputs.git-hooks.flakeModule
|
||||||
|
inputs.treefmt.flakeModule
|
||||||
|
];
|
||||||
|
|
||||||
systems = ["x86_64-linux" "aarch64-linux"];
|
systems = ["x86_64-linux" "aarch64-linux"];
|
||||||
|
|
||||||
flake = let
|
flake = let
|
||||||
|
@ -31,15 +39,44 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
perSystem = {
|
perSystem = {
|
||||||
inputs',
|
config,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
inputs',
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
devShells.default = pkgs.mkShellNoCC {
|
treefmt = ./treefmt.nix;
|
||||||
packages = [inputs'.agenix.packages.agenix];
|
|
||||||
|
pre-commit = {
|
||||||
|
check.enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
hooks = {
|
||||||
|
treefmt.enable = true;
|
||||||
|
deadnix.enable = true;
|
||||||
|
statix.enable = true;
|
||||||
|
shellcheck = {
|
||||||
|
enable = true;
|
||||||
|
excludes = [
|
||||||
|
"^\.envrc$"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
flake-checker.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
formatter = pkgs.alejandra;
|
devShells.default = pkgs.mkShellNoCC {
|
||||||
|
inherit (config.pre-commit.devShell) shellHook;
|
||||||
|
|
||||||
|
inputsFrom = [
|
||||||
|
config.pre-commit.devShell
|
||||||
|
config.treefmt.build.devShell
|
||||||
|
];
|
||||||
|
|
||||||
|
packages = [
|
||||||
|
inputs'.agenix.packages.agenix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
packages.disk = pkgs.writeShellApplication {
|
packages.disk = pkgs.writeShellApplication {
|
||||||
name = "disk";
|
name = "disk";
|
||||||
|
|
2
lib.nix
2
lib.nix
|
@ -69,7 +69,7 @@ lib: _: {
|
||||||
class: map (name: {inherit class name;}) (dirsIn (hostsDir + "/${class}"))
|
class: map (name: {inherit class name;}) (dirsIn (hostsDir + "/${class}"))
|
||||||
)
|
)
|
||||||
classes)
|
classes)
|
||||||
(map (obj: lib.nameValuePair obj.name (commonNixosSystem obj)))
|
(map (args: lib.nameValuePair args.name (commonNixosSystem args)))
|
||||||
builtins.listToAttrs
|
builtins.listToAttrs
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
19
treefmt.nix
Normal file
19
treefmt.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
projectRootFile = ".git/config";
|
||||||
|
enableDefaultExcludes = true;
|
||||||
|
|
||||||
|
settings.global.excludes = [
|
||||||
|
"LICENSE"
|
||||||
|
"*.age"
|
||||||
|
"*.envrc"
|
||||||
|
];
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
alejandra.enable = true;
|
||||||
|
shfmt = {
|
||||||
|
enable = true;
|
||||||
|
indent_size = 2;
|
||||||
|
};
|
||||||
|
mdformat.enable = true;
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue