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,61 +174,53 @@
### NixOS ### NixOS
nixosConfigurations = { nixosConfigurations = {
"Aristotle" = inputs.nixpkgs.lib.nixosSystem { "Aristotle" = mkNixOS "x86_64-linux" [
system = "x86_64-linux"; # OS
specialArgs = {inherit inputs;}; ./nixos/profiles/core
modules = [ ./nixos/profiles/device-type/laptop
# OS ./nixos/profiles/opt-in/zram-generator.nix
./nixos/profiles/core ./nixos/profiles/opt-in/gaming.nix
./nixos/profiles/device-type/laptop ./nixos/profiles/opt-in/wayland.nix
./nixos/profiles/opt-in/zram-generator.nix ./nixos/profiles/opt-in/virt-manager.nix
./nixos/profiles/opt-in/gaming.nix
./nixos/profiles/opt-in/wayland.nix
./nixos/profiles/opt-in/virt-manager.nix
# User # User
./users/guanranwang/nixos/profiles/core ./users/guanranwang/nixos/profiles/core
./users/guanranwang/nixos/profiles/device-type/laptop ./users/guanranwang/nixos/profiles/device-type/laptop
./users/guanranwang/nixos/profiles/opt-in/clash-meta-client.nix ./users/guanranwang/nixos/profiles/opt-in/clash-meta-client.nix
./users/guanranwang/nixos/profiles/opt-in/gaming ./users/guanranwang/nixos/profiles/opt-in/gaming
./users/guanranwang/nixos/profiles/opt-in/torrenting ./users/guanranwang/nixos/profiles/opt-in/torrenting
# Hardware # Hardware
./nixos/hosts/Aristotle ./nixos/hosts/Aristotle
./nixos/profiles/opt-in/lanzaboote.nix ./nixos/profiles/opt-in/lanzaboote.nix
./nixos/profiles/opt-in/impermanence.nix ./nixos/profiles/opt-in/impermanence.nix
./nixos/profiles/opt-in/disko.nix ./nixos/profiles/opt-in/disko.nix
{ {
networking.hostName = "Aristotle"; networking.hostName = "Aristotle";
time.timeZone = "Asia/Shanghai"; time.timeZone = "Asia/Shanghai";
_module.args.disks = ["/dev/nvme0n1"]; # Disko _module.args.disks = ["/dev/nvme0n1"]; # Disko
} }
]; ];
};
}; };
### Darwin ### Darwin
darwinConfigurations = { darwinConfigurations = {
"Plato" = inputs.nix-darwin.lib.darwinSystem { "Plato" = mkDarwin "x86_64-darwin" [
system = "x86_64-darwin"; ./darwin/profiles/core
specialArgs = {inherit inputs;}; ./darwin/profiles/device-type/desktop
modules = [
./darwin/profiles/core
./darwin/profiles/device-type/desktop
./users/guanranwang/darwin/profiles/core ./users/guanranwang/darwin/profiles/core
./users/guanranwang/darwin/profiles/device-type/desktop ./users/guanranwang/darwin/profiles/device-type/desktop
./users/guanranwang/darwin/profiles/opt-in/clash-meta-client.nix ./users/guanranwang/darwin/profiles/opt-in/clash-meta-client.nix
./darwin/hardware/apple/imac/18-3 ./darwin/hardware/apple/imac/18-3
{ {
networking.hostName = "Plato"; networking.hostName = "Plato";
time.timeZone = "Asia/Shanghai"; time.timeZone = "Asia/Shanghai";
} }
]; ];
};
}; };
}; };
} }