2023-09-02 14:04:03 +08:00
|
|
|
inputs:
|
|
|
|
{
|
|
|
|
options.nixos.system.nix = let inherit (inputs.lib) mkOption types; in
|
|
|
|
{
|
2023-09-02 14:21:27 +08:00
|
|
|
# marches allowed to be compiled on this machine
|
2023-09-02 14:04:03 +08:00
|
|
|
marches = mkOption { type = types.nullOr (types.listOf types.nonEmptyStr); default = null; };
|
|
|
|
keepOutputs = mkOption { type = types.bool; default = false; };
|
|
|
|
substituters = mkOption { type = types.nullOr (types.listOf types.nonEmptyStr); default = null; };
|
2023-11-06 13:48:29 +08:00
|
|
|
autoOptimiseStore = mkOption { type = types.bool; default = false; };
|
2023-09-02 14:04:03 +08:00
|
|
|
};
|
|
|
|
config =
|
|
|
|
let
|
|
|
|
inherit (inputs.config.nixos.system) nix;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
nix =
|
|
|
|
{
|
|
|
|
settings =
|
|
|
|
{
|
2023-10-30 12:07:09 +08:00
|
|
|
system-features = [ "big-parallel" "nixos-test" "benchmark" ] ++ (map
|
2023-09-02 14:04:03 +08:00
|
|
|
(march: "gccarch-${march}")
|
|
|
|
(
|
|
|
|
if nix.marches == null then
|
2023-09-02 21:21:29 +08:00
|
|
|
(with inputs.config.nixos.system.nixpkgs; if march == null then [] else [ march ])
|
2023-09-02 14:04:03 +08:00
|
|
|
else nix.marches
|
|
|
|
));
|
|
|
|
experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
keep-outputs = nix.keepOutputs;
|
|
|
|
keep-failed = true;
|
2023-11-06 13:48:29 +08:00
|
|
|
auto-optimise-store = nix.autoOptimiseStore;
|
2023-09-02 14:04:03 +08:00
|
|
|
substituters = if nix.substituters == null then [ "https://cache.nixos.org/" ] else 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;
|
2023-10-25 14:01:30 +08:00
|
|
|
nixpkgs-unstable.flake = inputs.topInputs.nixpkgs-unstable;
|
2023-09-02 14:04:03 +08:00
|
|
|
nixos.flake = inputs.topInputs.self;
|
|
|
|
};
|
|
|
|
nixPath = [ "nixpkgs=${inputs.topInputs.nixpkgs}" ];
|
|
|
|
};
|
2023-11-16 15:51:47 +08:00
|
|
|
system = { stateVersion = "22.11"; configurationRevision = inputs.topInputs.self.rev or "dirty"; };
|
2023-09-02 14:04:03 +08:00
|
|
|
systemd.services.nix-daemon =
|
|
|
|
{
|
|
|
|
serviceConfig = { CacheDirectory = "nix"; Slice = "-.slice"; Nice = "19"; };
|
|
|
|
environment = { TMPDIR = "/var/cache/nix"; };
|
|
|
|
};
|
|
|
|
environment.etc =
|
|
|
|
{
|
|
|
|
"channels/nixpkgs".source = inputs.topInputs.nixpkgs.outPath;
|
2023-10-25 14:01:30 +08:00
|
|
|
"channels/nixpkgs-unstable".source = inputs.topInputs.nixpkgs-unstable.outPath;
|
2023-09-02 14:04:03 +08:00
|
|
|
"nixos".source = inputs.topInputs.self.outPath;
|
|
|
|
};
|
|
|
|
# environment.pathsToLink = [ "/include" ];
|
|
|
|
# environment.variables.CPATH = "/run/current-system/sw/include";
|
|
|
|
# environment.variables.LIBRARY_PATH = "/run/current-system/sw/lib";
|
|
|
|
# gui.enable
|
|
|
|
};
|
|
|
|
}
|