flake: simplify

This commit is contained in:
Guanran Wang 2023-12-17 22:00:56 +08:00
parent 1ee4b0ca9a
commit dce2d0d156
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8

View file

@ -155,6 +155,18 @@
outputs = inputs: let outputs = inputs: let
inherit (inputs.flake-utils.lib) eachDefaultSystemMap; inherit (inputs.flake-utils.lib) eachDefaultSystemMap;
mkNixOS = system: modules:
inputs.nixpkgs.lib.nixosSystem {
inherit system modules;
specialArgs = {inherit inputs;};
};
mkDarwin = system: modules:
inputs.nixpkgs.lib.nixosSystem {
inherit system modules;
specialArgs = {inherit inputs;};
};
in { in {
formatter = eachDefaultSystemMap (system: inputs.nixpkgs.legacyPackages.${system}.alejandra); formatter = eachDefaultSystemMap (system: inputs.nixpkgs.legacyPackages.${system}.alejandra);
packages = eachDefaultSystemMap (system: import ./pkgs inputs.nixpkgs.legacyPackages.${system}); packages = eachDefaultSystemMap (system: import ./pkgs inputs.nixpkgs.legacyPackages.${system});
@ -162,10 +174,7 @@
### NixOS ### NixOS
nixosConfigurations = { nixosConfigurations = {
"Aristotle" = inputs.nixpkgs.lib.nixosSystem { "Aristotle" = mkNixOS "x86_64-linux" [
system = "x86_64-linux";
specialArgs = {inherit inputs;};
modules = [
# OS # OS
./nixos/profiles/core ./nixos/profiles/core
./nixos/profiles/device-type/laptop ./nixos/profiles/device-type/laptop
@ -194,14 +203,10 @@
} }
]; ];
}; };
};
### Darwin ### Darwin
darwinConfigurations = { darwinConfigurations = {
"Plato" = inputs.nix-darwin.lib.darwinSystem { "Plato" = mkDarwin "x86_64-darwin" [
system = "x86_64-darwin";
specialArgs = {inherit inputs;};
modules = [
./darwin/profiles/core ./darwin/profiles/core
./darwin/profiles/device-type/desktop ./darwin/profiles/device-type/desktop
@ -218,5 +223,4 @@
]; ];
}; };
}; };
};
} }