1
0
Fork 0

Clean-up flake-module

This commit is contained in:
Malte 2023-02-11 21:32:56 +01:00
parent fe31ccaec3
commit fce15e4760
6 changed files with 55 additions and 59 deletions

52
flake-module.nix Normal file
View file

@ -0,0 +1,52 @@
{inputs, ...}: {
imports = [
inputs.pre-commit-hooks.flakeModule
./nixos/flake-module.nix
./home-manager/flake-module.nix
./packages/flake-module.nix
./overlays/flake-module.nix
];
systems = ["x86_64-linux"];
perSystem = {
inputs',
config,
lib,
pkgs,
...
}: {
devShells = {
default = pkgs.mkShell {
shellHook = config.pre-commit.installationScript;
};
};
checks = {
system-checks = pkgs.recursiveLinkFarm "all-configs" {
nixos-configurations = lib.mapAttrs (_: config: config.config.system.build.toplevel) config.flake.nixosConfigurations;
home-manager-configurations = config.flake.homeModes;
};
};
pre-commit = {
pkgs = inputs'.nixos-unstable.legacyPackages;
check.enable = true;
settings = {
settings.ormolu.defaultExtensions = [
"TypeApplications"
"BangPatterns"
"ImportQualifiedPost"
"BlockArguments"
];
hooks = {
hlint.enable = true;
alejandra.enable = true;
nix-linter.enable = false; # Too many false positives for now
statix.enable = true;
fourmolu.enable = true;
shellcheck.enable = true;
cabal-fmt.enable = true;
dhall-format.enable = true;
};
};
};
};
}

View file

@ -59,62 +59,6 @@
};
};
outputs = inputs @ {
nixos-hardware,
self,
...
}:
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
inputs.pre-commit-hooks.flakeModule
./nixos/flake-parts.nix
./home-manager/flake-parts.nix
./packages/flake-parts.nix
./overlays/flake-parts.nix
];
systems = ["x86_64-linux"];
perSystem = {
self',
inputs',
config,
lib,
pkgs,
...
}: {
devShells = {
default = pkgs.mkShell {
shellHook = config.pre-commit.installationScript;
};
};
checks = {
system-checks = pkgs.recursiveLinkFarm "all-configs" {
nixos-configurations = lib.mapAttrs (_: config: config.config.system.build.toplevel) self.nixosConfigurations;
home-manager-configurations = self.homeModes;
};
};
pre-commit = {
pkgs = inputs'.nixos-unstable.legacyPackages;
check.enable = true;
settings = {
settings.ormolu.defaultExtensions = [
"TypeApplications"
"BangPatterns"
"ImportQualifiedPost"
"BlockArguments"
];
hooks = {
hlint.enable = true;
alejandra.enable = true;
nix-linter.enable = false; # Too many false positives for now
statix.enable = true;
fourmolu.enable = true;
shellcheck.enable = true;
cabal-fmt.enable = true;
dhall-format.enable = true;
};
};
};
};
};
outputs = inputs @ {nixos-hardware, ...}:
inputs.flake-parts.lib.mkFlake {inherit inputs;} (import ./flake-module.nix);
}

View file

@ -22,7 +22,7 @@
pathToOverlay = n: overlayPath + ("/" + n);
isNixFile = n: builtins.match ".*\\.nix" n != null;
isNixDir = n: builtins.pathExists (pathToOverlay n + "/default.nix");
notDefault = n: n != "flake-parts.nix";
notDefault = n: n != "flake-module.nix";
isOverlay = n: (isNixDir n || isNixFile n) && notDefault n;
overlays = builtins.filter isOverlay candidates;
importOverlay = n: import (pathToOverlay n);