idiosyn/nixos/module/nix.nix
Mikael Voss 3f5371bb99
Some checks are pending
nix flake check / check (aarch64-linux) (push) Waiting to run
nix flake check / check (x86_64-linux) (push) Waiting to run
nixos/nix: Specify extra substituters
2024-11-07 21:59:05 +01:00

75 lines
1.8 KiB
Nix

{ self, ... }: { lib, pkgs, ... }:
let
inherit (pkgs.stdenv) hostPlatform;
in {
imports = with self.nixosModules; [
powersupply
];
nix = {
package = pkgs.lix.override { enableGC = true; };
channel.enable = false;
daemonCPUSchedPolicy = "batch";
daemonIOSchedClass = "best-effort";
daemonIOSchedPriority = 7;
gc = {
automatic = true;
dates = "weekly";
randomizedDelaySec = "24h";
options = "--delete-older-than 10d";
};
settings = {
experimental-features = [
"cgroups"
"flakes"
"nix-command"
"repl-flake"
"pipe-operator"
];
allowed-users = [ "@users" ];
trusted-users = [ "@wheel" ];
builders-use-substitutes = true;
download-attempts = 8;
http-connections = 128;
max-substitution-jobs = 128;
preallocate-contents = true;
use-cgroups = true;
use-xdg-base-directories = true;
substituters = [
"https://cache.kyouma.net"
"https://colmena.cachix.org"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"cache.kyouma.net:Frjwu4q1rnwE/MnSTmX9yx86GNA/z3p/oElGvucLiZg="
"colmena.cachix.org-1:7BzpDnjjH8ki2CT3f6GdOk7QAzPOl+1t3LvTLXqYcSg="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
registry = {
nixpkgs.to = {
type = "path";
path = pkgs.path;
narHash = lib.trim (builtins.readFile
(pkgs.runCommandLocal "get-nixpkgs-hash"
{ nativeBuildInputs = [ pkgs.nix ]; }
"nix-hash --type sha256 --sri ${pkgs.path} > $out"));
};
};
};
systemd = {
services.nix-daemon.serviceConfig.Slice = "nix-build.slice";
slices.nix-build = { };
timers.nix-gc.bindsTo = [ "power-external.target" ];
};
}