Revert "分离 nix 配置"

This reverts commit 9ff5212fe7.
This commit is contained in:
2023-09-01 23:49:45 +08:00
parent 9ff5212fe7
commit 15ca93ada1
3 changed files with 38 additions and 61 deletions

View File

@@ -143,7 +143,7 @@
"broadwell"
];
gui.enable = true;
nix.keepOutputs = true;
keepOutputs = true;
};
virtualization =
{
@@ -276,11 +276,7 @@
network.enable = true;
sshd = { enable = true; hostKeys = [ "/nix/persistent/etc/ssh/initrd_ssh_host_ed25519_key" ]; };
};
system =
{
march = "sandybridge";
nix.substituters = [ "https://cache.nixos.org" "https://nix-store.chn.moe" ];
};
system.march = "sandybridge";
};})
];
"vps4" =

View File

@@ -1,15 +1,12 @@
inputs:
{
imports = inputs.localLib.mkModules
[
./nix.nix
];
options.nixos.system = let inherit (inputs.lib) mkOption types; in
{
hostname = mkOption { type = types.nonEmptyStr; };
march = mkOption { type = types.nullOr types.nonEmptyStr; default = null; };
extraMarch = mkOption { type = types.listOf types.nonEmptyStr; default = []; };
gui.enable = mkOption { type = types.bool; default = false; };
keepOutputs = mkOption { type = types.bool; default = false; };
};
config =
let
@@ -19,7 +16,33 @@ inputs:
in
mkMerge
[
# generic
{
nix =
{
settings =
{
system-features = [ "big-parallel" "nixos-test" "benchmark" ];
experimental-features = [ "nix-command" "flakes" ];
keep-outputs = inputs.config.nixos.system.keepOutputs;
keep-failed = true;
auto-optimise-store = true;
substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
trusted-public-keys = [ "chn:Cc+nowW1LIpe1kyXOZmNaznFDiH1glXmpb4A+WD/DTE=" ];
show-trace = true;
max-jobs = 2;
cores = 0;
keep-going = true;
};
daemonIOSchedClass = "idle";
daemonCPUSchedPolicy = "idle";
registry =
{
nixpkgs.flake = inputs.topInputs.nixpkgs;
nixos.flake = inputs.topInputs.self;
};
nixPath = [ "nixpkgs=${inputs.topInputs.nixpkgs}" ];
};
services =
{
udev.extraRules =
@@ -94,7 +117,15 @@ inputs:
DefaultLimitNOFILE=1048576:1048576
'';
user.extraConfig = "DefaultTimeoutStopSec=10s";
services.systemd-tmpfiles-setup = { environment = { SYSTEMD_TMPFILES_FORCE_SUBVOL = "0"; }; };
services =
{
nix-daemon =
{
serviceConfig = { CacheDirectory = "nix"; Slice = "-.slice"; Nice = "19"; };
environment = { TMPDIR = "/var/cache/nix"; };
};
systemd-tmpfiles-setup = { environment = { SYSTEMD_TMPFILES_FORCE_SUBVOL = "0"; }; };
};
timers.systemd-tmpfiles-clean.enable = false;
coredump.enable = false;
};

View File

@@ -1,50 +0,0 @@
inputs:
{
imports = inputs.localLib.mkModules
[
./nix.nix
];
options.nixos.system.nix = let inherit (inputs.lib) mkOption types; in
{
keepOutputs = mkOption { type = types.bool; default = false; };
# null: use default substituters; not null: use specified substituters, default one is ignored
substituters = mkOption { type = types.nullOr (types.listOf types.nonEmptyStr); default = null; };
};
config =
let
inherit (inputs.config.nixos) system;
in
{
nix =
{
settings =
{
system-features = [ "big-parallel" "nixos-test" "benchmark" ];
experimental-features = [ "nix-command" "flakes" ];
keep-outputs = system.nix.keepOutputs;
keep-failed = true;
auto-optimise-store = true;
substituters = if system.nix.substituters == null then [ "https://cache.nixos.org" ]
else system.nix.substituters;
trusted-public-keys = [ "chn:Cc+nowW1LIpe1kyXOZmNaznFDiH1glXmpb4A+WD/DTE=" ];
show-trace = true;
max-jobs = 2;
cores = 0;
keep-going = true;
};
daemonIOSchedClass = "idle";
daemonCPUSchedPolicy = "idle";
registry =
{
nixpkgs.flake = inputs.topInputs.nixpkgs;
nixos.flake = inputs.topInputs.self;
};
nixPath = [ "nixpkgs=${inputs.topInputs.nixpkgs}" ];
};
systemd.services.nix-daemon =
{
serviceConfig = { CacheDirectory = "nix"; Slice = "-.slice"; Nice = "19"; };
environment = { TMPDIR = "/var/cache/nix"; };
};
};
}