config/modules/nix-config/default.nix

83 lines
2.1 KiB
Nix
Raw Normal View History

2022-09-25 14:45:50 +03:00
{ pkgs, lib, config, inputs, ... }:
2022-02-05 21:42:36 +02:00
let
builder = {
systems = [ "x86_64-linux" "i686-linux" ];
speedFactor = 4;
supportedFeatures = [ "benchmark" "nixos-test" ];
sshKey = config.age.secrets.nixBuilderKey.path;
2022-09-25 14:45:50 +03:00
protocol = "ssh-ng";
2022-02-05 21:42:36 +02:00
};
bigBuilder = builder // {
speedFactor = 16;
supportedFeatures = builder.supportedFeatures ++ [ "kvm" "big-parallel" ];
};
in {
age.secrets.nixBuilderKey = {
file = ../../secrets/builder_key.age;
mode = "0400";
};
nixpkgs.overlays = [
(self: super: {
nixSuper = inputs.nix-super.packages.x86_64-linux.default;
2022-02-05 21:42:36 +02:00
})
];
nix = {
package = pkgs.nixSuper;
settings = {
trusted-users = [ "root" "@wheel" ];
auto-optimise-store = true;
substituters = [
"https://cache.privatevoid.net"
"https://max.cachix.org?priority=90"
2022-12-19 01:01:11 +02:00
"https://reflex.privatevoid.net?priority=20"
2022-02-05 21:42:36 +02:00
];
trusted-public-keys = [
"cache.privatevoid.net:SErQ8bvNWANeAvtsOESUwVYr2VJynfuc9JRwlzTTkVg="
"max.cachix.org-1:oSMQ1zYLR8H4L17hfe6ETlI/d+VeiBykB8PbBdPtDJw="
];
};
extraOptions = ''
2022-08-08 22:46:09 +03:00
experimental-features = nix-command flakes repl-flake
2022-02-05 21:42:36 +02:00
warn-dirty = false
builders-use-substitutes = true
flake-registry = https://git.privatevoid.net/private-void/registry/-/raw/master/registry.json
2022-02-21 21:08:53 +02:00
max-free = ${toString (8 * 1024*1024*1024)}
min-free = ${toString (4 * 1024*1024*1024)}
2022-02-05 21:42:36 +02:00
'';
gc = {
automatic = true;
dates = "weekly";
2022-02-21 21:08:53 +02:00
options = "--delete-older-than 5d --max-freed 16G";
2022-02-05 21:42:36 +02:00
};
distributedBuilds = true;
buildMachines = [
(bigBuilder // {
2022-09-25 14:45:50 +03:00
sshUser = "nixbuilder";
2022-02-05 21:42:36 +02:00
hostName = "animus.com";
maxJobs = 4;
})
2022-05-16 20:56:47 +03:00
(builder // {
2022-09-25 14:45:50 +03:00
sshUser = "nix";
2022-05-16 20:56:47 +03:00
hostName = "prophet.node.privatevoid.net";
systems = [ "aarch64-linux" ];
})
2022-02-05 21:42:36 +02:00
] ++
(lib.optional (config.networking.hostName != "TITAN") (bigBuilder // {
2022-09-25 14:45:50 +03:00
sshUser = "nix";
2022-02-05 21:42:36 +02:00
hostName = "titan.hypr";
speedFactor = 12;
maxJobs = 12;
}));
};
environment.systemPackages = [ pkgs.cachix ];
}