setup distributed builds

This commit is contained in:
Joakim Repomaa
2025-07-23 13:15:50 +03:00
parent 40598d20c7
commit e317f9b0e4
4 changed files with 33 additions and 11 deletions

View File

@@ -56,7 +56,10 @@
}@inputs: }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } ( flake-parts.lib.mkFlake { inherit inputs; } (
let let
ssh.publicKeys.yubikey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLIUkESu5NnBi1M0+ZjYrkp6/rIFuwc3aguspf98jmOydNce6l65cnS3GRzc9oWx4lu11ahi87ZuE+pYV+gaHm4="; ssh.publicKeys = {
yubikey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLIUkESu5NnBi1M0+ZjYrkp6/rIFuwc3aguspf98jmOydNce6l65cnS3GRzc9oWx4lu11ahi87ZuE+pYV+gaHm4=";
builder = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFuQaA6JKCOfsfUBI5tzoiYe3tdpLdPfVzeyByx/149C";
};
specialArgs = { inherit inputs ssh self; }; specialArgs = { inherit inputs ssh self; };
in in

View File

@@ -136,15 +136,26 @@ in
services.xserver.xkb.options = "eurosign:e,caps:escape"; services.xserver.xkb.options = "eurosign:e,caps:escape";
# Define a user account. Don't forget to set a password with passwd. # Define a user account. Don't forget to set a password with passwd.
users.users.jokke = { users.users = {
isNormalUser = true; jokke = {
extraGroups = [ "wheel" ]; # Enable sudo for the user. isNormalUser = true;
packages = [ pkgs.nh ]; extraGroups = [ "wheel" ]; # Enable sudo for the user.
openssh.authorizedKeys.keys = [ ssh.publicKeys.yubikey ]; packages = [ pkgs.nh ];
}; openssh.authorizedKeys.keys = [ ssh.publicKeys.yubikey ];
users.users.root.openssh.authorizedKeys.keys = [ ssh.publicKeys.yubikey ]; };
nix.settings.trusted-users = [ "jokke" ]; builder = {
isNormalUser = true;
openssh.authorizedKeys.keys = [ ssh.publicKeys.builder ];
};
root.openssh.authorizedKeys.keys = [ ssh.publicKeys.yubikey ];
};
nix.settings.trusted-users = [
"jokke"
"builder"
];
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget

View File

@@ -23,8 +23,6 @@
kernel.sysctl = { kernel.sysctl = {
"vm.max_map_count" = 262144; "vm.max_map_count" = 262144;
}; };
binfmt.emulatedSystems = [ "aarch64-linux" ];
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View File

@@ -1,6 +1,16 @@
{ ... }: { ... }:
{ {
nix = { nix = {
distributedBuilds = true;
buildMachines = [
{
hostName = "freun.dev";
maxJobs = 2;
protocol = "ssh";
sshUser = "builder";
system = "aarch64-linux";
}
];
settings = { settings = {
experimental-features = [ experimental-features = [
"nix-command" "nix-command"