Split flake into multiple files

This commit is contained in:
Pim Kunis 2024-11-11 21:40:36 +01:00
parent 47c2a10ee7
commit d70a737bc2
9 changed files with 159 additions and 108 deletions

114
flake.nix
View file

@ -8,6 +8,7 @@
stylix.url = "github:pizzapim/stylix/release-24.05";
treefmt-nix.url = "github:numtide/treefmt-nix";
nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
flake-utils.url = "github:numtide/flake-utils";
git-hooks = {
url = "github:cachix/git-hooks.nix";
@ -51,110 +52,13 @@
};
};
outputs = {
self,
nixpkgs,
...
} @ inputs: let
supportedSystems = [
"x86_64-linux"
"i686-linux"
"aarch64-linux"
outputs = inputs @ {flake-utils, ...}:
flake-utils.lib.meld inputs [
./packages.nix
./formatter.nix
./nixos-configurations.nix
./checks.nix
./dev-shells.nix
./colmena.nix
];
forAllSystems' = nixpkgs.lib.genAttrs;
forAllSystems = forAllSystems' supportedSystems;
pkgsForSystem = system:
import nixpkgs {
inherit system;
};
treefmtEval = forAllSystems (
system: inputs.treefmt-nix.lib.evalModule (pkgsForSystem system) ./treefmt.nix
);
in {
formatter = forAllSystems (system: (treefmtEval.${system}.config.build.wrapper));
nixosConfigurations = nixpkgs.lib.mapAttrs (
name: nixosModule:
nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
specialArgs = {
inherit inputs system self;
};
modules = [
nixosModule
./nixos
];
}
) (import ./machines);
checks = forAllSystems (system: {
pre-commit-check = inputs.git-hooks.lib.${system}.run {
src = ./.;
hooks = {
treefmt = {
enable = true;
package = treefmtEval.${system}.config.build.wrapper;
};
};
};
});
devShells = forAllSystems (system: {
default = nixpkgs.legacyPackages.${system}.mkShell {
inherit (self.checks.${system}.pre-commit-check) shellHook;
buildInputs = self.checks.${system}.pre-commit-check.enabledPackages;
};
});
colmena = {
meta = {
nixpkgs = import nixpkgs {
system = "x86_64-linux";
};
specialArgs = {
inherit inputs self;
};
nodeSpecialArgs = {
sue = {};
};
};
sue = {
name,
nodes,
...
}: {
deployment = {
allowLocalDeployment = true;
targetHost = null;
};
imports = [
(import ./machines).sue
./nixos
];
};
gamepc = {
name,
nodes,
...
}: {
deployment = {
targetHost = "gamepc";
targetUser = "root";
};
imports = [
(import ./machines).gamepc
./nixos
];
};
};
};
}