split nix flake config in separate files

This commit is contained in:
Sebastian Wendel 2022-12-23 00:04:21 +01:00
parent 87ecf5ad32
commit 6b22151f69
No known key found for this signature in database
GPG key ID: 1422B7DF78144640
3 changed files with 64 additions and 62 deletions

View file

@ -14,72 +14,14 @@
};
};
outputs = {
self,
nixpkgs,
flake-utils,
pre-commit-hooks,
...
}:
} @ inputs:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
checks = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = flake-utils.lib.cleanSource ./.;
hooks = {
alejandra.enable = true;
nix-linter.enable = true;
statix .enable = true;
};
settings.nix-linter.checks = [
"DIYInherit"
"EmptyInherit"
"EmptyLet"
"EtaReduce"
"LetInInheritRecset"
"ListLiteralConcat"
"NegateAtom"
"SequentialLet"
"SetLiteralUpdate"
"UnfortunateArgName"
"UnneededRec"
"UnusedArg"
"UnusedLetBind"
"UpdateEmptySet"
"BetaReduction"
"EmptyVariadicParamSet"
"UnneededAntiquote"
"no-FreeLetInFunc"
"no-AlphabeticalArgs"
"no-AlphabeticalBindings"
];
};
};
devShell = with pkgs;
mkShell {
name = "srx.nix.astro";
nativeBuildInputs = with pkgs; [
alejandra
editorconfig-checker
git
nix-linter
pre-commit
rnix-lsp
vscodium-fhs
yarn
nodejs
];
postInstall = '''';
shellHook = ''
${self.checks.${system}.pre-commit-check.shellHook}
'';
};
hydraJobs = {};
# packages.default = self.packages.${system};
system: {
checks = import ./nix/checks.nix inputs system;
devShells.default = import ./nix/shell.nix inputs system;
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;

39
nix/checks.nix Normal file
View file

@ -0,0 +1,39 @@
{
self,
pre-commit-hooks,
...
}: system:
with self.pkgs.${system}; {
pre-commit-check =
pre-commit-hooks.lib.${system}.run
{
src = lib.cleanSource ../.;
hooks = {
alejandra.enable = true;
nix-linter.enable = true;
statix .enable = true;
};
settings.nix-linter.checks = [
"DIYInherit"
"EmptyInherit"
"EmptyLet"
"EtaReduce"
"LetInInheritRecset"
"ListLiteralConcat"
"NegateAtom"
"SequentialLet"
"SetLiteralUpdate"
"UnfortunateArgName"
"UnneededRec"
"UnusedArg"
"UnusedLetBind"
"UpdateEmptySet"
"BetaReduction"
"EmptyVariadicParamSet"
"UnneededAntiquote"
"no-FreeLetInFunc"
"no-AlphabeticalArgs"
"no-AlphabeticalBindings"
];
};
}

21
nix/shell.nix Normal file
View file

@ -0,0 +1,21 @@
{self, ...}: system:
with self.pkgs.${system};
mkShell {
name = "srx.nix.astro";
nativeBuildInputs = with pkgs; [
alejandra
editorconfig-checker
git
nix-linter
nodejs
pre-commit
rnix-lsp
vscodium-fhs
yarn
yarn2nix
];
postInstall = '''';
shellHook = ''
${self.checks.${system}.pre-commit-check.shellHook}
'';
}