feat: read system at evaluation time

This commit is contained in:
514fpv 2025-07-08 13:28:38 +08:00
parent 7a2c2c1c38
commit 24dce91965
Signed by: koishi
SSH key fingerprint: SHA256:axz0uIzzY+5W19i7QOUuiw5LSqhKfCBKPf3L4xFRxLw
22 changed files with 52 additions and 69 deletions

View file

@ -3,6 +3,7 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
flake-utils.url = "github:numtide/flake-utils";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
@ -23,23 +24,20 @@
};
outputs =
inputs@{
self,
flake-parts,
treefmt-nix,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
];
inputs:
let
inherit (inputs.nixpkgs) lib;
in
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = lib.systems.flakeExposed;
perSystem.treefmt = {
programs.nixfmt.enable = true;
};
imports = [
./spec
treefmt-nix.flakeModule
inputs.treefmt-nix.flakeModule
];
};
}

1
spec/chireiden/system Normal file
View file

@ -0,0 +1 @@
x86_64-linux

View file

@ -8,29 +8,38 @@ with nixpkgs.lib;
spec
// {
${name} = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
system = trim (builtins.readFile ./${name}/system);
specialArgs = inputs // {
inherit inputs;
};
modules = [
../global
../home/profile.nix
../home/user.nix
../package
./constant.nix
./channel.nix
impermanence.nixosModules.impermanence
home-manager.nixosModules.home-manager
catppuccin.nixosModules.catppuccin
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
lanzaboote.nixosModules.lanzaboote
modules =
[
../global
../home/profile.nix
../home/user.nix
../package
./constant.nix
./channel.nix
impermanence.nixosModules.impermanence
home-manager.nixosModules.home-manager
catppuccin.nixosModules.catppuccin
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
lanzaboote.nixosModules.lanzaboote
./${name}
{ networking.hostName = name; }
];
{ networking.hostName = name; }
]
++ (pipe ./${name} [
builtins.readDir
(filterAttrs (
n: ty:
(ty == "regular" && hasSuffix ".nix" n)
|| (ty == "directory" && builtins.pathExists ./${name}/${n}/default.nix)
))
(mapAttrsToList (n: _: ./${name}/${n}))
]);
};
}
) { })

View file

@ -33,12 +33,6 @@
'';
boot.kernelParams = [ "zfs.zfs_arc_max=17179869184" ];
imports = lib.pipe ./. [
builtins.readDir
(lib.filterAttrs (n: ty: ty == "regular" && n != "default.nix"))
(lib.mapAttrsToList (n: _: ./${n}))
];
hardware.enableRedistributableFirmware = true;
boot.initrd.availableKernelModules = [
"xhci_pci"

1
spec/eientei/system Normal file
View file

@ -0,0 +1 @@
x86_64-linux

View file

@ -36,12 +36,6 @@
noProxy = "10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,127.0.0.1,localhost,.localdomain";
};
imports = lib.pipe ./. [
builtins.readDir
(lib.filterAttrs (n: ty: ty == "regular" && n != "default.nix"))
(lib.mapAttrsToList (n: _: ./${n}))
];
hardware.enableRedistributableFirmware = true;
boot.initrd.availableKernelModules = [
"xhci_pci"

1
spec/focus/system Normal file
View file

@ -0,0 +1 @@
x86_64-linux

1
spec/hakugyokurou/system Normal file
View file

@ -0,0 +1 @@
x86_64-linux

View file

@ -13,13 +13,7 @@
oci.enable = true;
};
imports =
lib.pipe ./. [
builtins.readDir
(lib.filterAttrs (n: ty: ty == "regular" && n != "default.nix"))
(lib.mapAttrsToList (n: _: ./${n}))
]
++ [ (modulesPath + "/profiles/qemu-guest.nix") ];
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [
"ahci"

1
spec/incinerator/system Normal file
View file

@ -0,0 +1 @@
x86_64-linux

View file

@ -82,8 +82,5 @@
boot.extraModulePackages = [ ];
hardware.cpu.intel.updateMicrocode = true;
imports = [
jovian.nixosModules.jovian
./jovian.nix
];
imports = [ jovian.nixosModules.jovian ];
}

1
spec/koumakyou/system Normal file
View file

@ -0,0 +1 @@
x86_64-linux

View file

@ -43,6 +43,4 @@
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
hardware.cpu.intel.updateMicrocode = true;
imports = [ ./ac71 ];
}

1
spec/reimaden/system Normal file
View file

@ -0,0 +1 @@
x86_64-linux

1
spec/shatter/system Normal file
View file

@ -0,0 +1 @@
x86_64-linux

1
spec/shinkirou/system Normal file
View file

@ -0,0 +1 @@
x86_64-linux

View file

@ -17,10 +17,4 @@
home = {
util.minimal = true;
};
imports = lib.pipe ./. [
builtins.readDir
(lib.filterAttrs (n: ty: ty == "regular" && n != "default.nix"))
(lib.mapAttrsToList (n: _: ./${n}))
];
}

View file

@ -27,7 +27,7 @@
};
"514fpv.one" = {
root = pkgs.callPackage ./site { };
root = pkgs.callPackage ./site/package.nix { };
forceSSL = true;
enableACME = true;
};

1
spec/web/system Normal file
View file

@ -0,0 +1 @@
x86_64-linux

View file

@ -27,13 +27,7 @@
steam.enable = true;
};
imports =
lib.pipe ./. [
builtins.readDir
(lib.filterAttrs (n: ty: ty == "regular" && n != "default.nix"))
(lib.mapAttrsToList (n: _: ./${n}))
]
++ [ (modulesPath + "/profiles/qemu-guest.nix") ];
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.initrd.availableKernelModules = [
"ahci"

1
spec/yume/system Normal file
View file

@ -0,0 +1 @@
x86_64-linux