os/shared/core/nix.nix

51 lines
1.1 KiB
Nix
Raw Permalink Normal View History

2023-05-21 21:15:04 +02:00
{ pkgs, lib, config, nixpkgs, pwnix, ... }:
let cfg = config.custom.nix;
in with lib; {
2023-06-19 18:40:58 +02:00
options.custom.nix = {
distributedBuilds.enable =
(mkEnableOption "distributed builds on strawberry") // { default = true; };
2023-06-19 18:40:58 +02:00
};
2023-05-21 21:15:04 +02:00
2023-06-17 23:46:16 +02:00
# TODO: Add strawberry as a build machine here
config = mkMerge [
{
nixpkgs.config.allowUnfree = true;
nix = {
extraOptions = ''
experimental-features = nix-command flakes
'';
registry.nixpkgs.flake = nixpkgs;
registry.pwnix.flake = pwnix;
settings.trusted-users = [
"@wheel"
"root"
];
};
}
(mkIf cfg.distributedBuilds.enable {
nix.distributedBuilds = true;
nix.buildMachines = [{
2023-06-19 18:40:58 +02:00
hostName = "strawberry";
sshUser = "nix-build";
sshKey = "/etc/ssh/ssh_host_ed25519_key";
systems = [
"x86_64-linux"
"aarch64-linux"
];
supportedFeatures = [
"nixos-test"
"benchmark"
"big-parallel"
"kvm"
];
}];
})
];
2023-05-21 21:15:04 +02:00
}