split nix flake config in separate files
This commit is contained in:
parent
87ecf5ad32
commit
6b22151f69
66
flake.nix
66
flake.nix
|
@ -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
39
nix/checks.nix
Normal 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
21
nix/shell.nix
Normal 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}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue