setup remote building for both laptops

This commit is contained in:
Gerg-L 2023-04-27 15:31:34 -04:00
parent 76fe743021
commit e1a7947411
6 changed files with 86 additions and 21 deletions

42
flake.lock generated
View file

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1681977899, "lastModified": 1682299489,
"narHash": "sha256-G5/DB7t1t1uhGEwPk6HY2JSVOPp3k9qZC5sOl2vrn7E=", "narHash": "sha256-bqHo0/82KB+IyBMyjBd6QdyZWJl/YZeGggjBsAgRFlY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "a433c7995448989e697c9f913405df1a98122885", "rev": "8ab9e5609929379ab15f03fd3bdc1f85419e5a3a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -141,11 +141,11 @@
}, },
"master": { "master": {
"locked": { "locked": {
"lastModified": 1682012766, "lastModified": 1682616090,
"narHash": "sha256-qcQvCO3vBENFBnE7btDf2mi7PeLqnZmnktYKDWHEUu4=", "narHash": "sha256-29fV+jLRbo7WtLx0rQ7nxYkjTdU7KDWbtC9hOLWk3S4=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1c74273033e2d375122d4d301c8bff44d657872b", "rev": "938afbb96edba3dd28065f5f2d42a86e9714bab3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -226,11 +226,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1681464810, "lastModified": 1682332772,
"narHash": "sha256-G7AD9qMvD7lU+5K7tTZpUMXvQa0kFR5KKY9y/okcX+w=", "narHash": "sha256-GMoWhChQdeNM2FFqVbEZgBABSdi/+JgSP6v+jUz5b24=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixos-generators", "repo": "nixos-generators",
"rev": "5ad9f98194cfe7aa990929fb8cae28c500da7620", "rev": "d774aeedc0685e5871be1e1ee0511900deeb21c2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -273,11 +273,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1681613598, "lastModified": 1682173319,
"narHash": "sha256-Ogkoma0ytYcDoMR2N7CZFABPo+i0NNo26dPngru9tPc=", "narHash": "sha256-tPhOpJJ+wrWIusvGgIB2+x6ILfDkEgQMX0BTtM5vd/4=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1040ce5f652b586da95dfd80d48a745e107b9eac", "rev": "ee7ec1c71adc47d2e3c2d5eb0d6b8fbbd42a8d1c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -333,11 +333,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1681821695, "lastModified": 1682539132,
"narHash": "sha256-uwyBGo/9IALi97AfMuzkJroQQhV6hkybaZVdw6pRNG4=", "narHash": "sha256-djX/Vp1snR1XHyk400HKCfwWVoLBE8uiQalTXMH7Kj0=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "5698b06b0731a2c15ff8c2351644427f8ad33993", "rev": "4a330ead6a990365c9bb48f30523ac048fb6d8ae",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -386,11 +386,11 @@
}, },
"stable": { "stable": {
"locked": { "locked": {
"lastModified": 1681932375, "lastModified": 1682538316,
"narHash": "sha256-tSXbYmpnKSSWpzOrs27ie8X3I0yqKA6AuCzCYNtwbCU=", "narHash": "sha256-YuHgVsR7S9zxJWHo7lo2ugd+uDC4ESWg1hA4bEZQv3Y=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3d302c67ab8647327dba84fbdb443cdbf0e82744", "rev": "15b75800dce80225b44f067c9012b09de37dfad2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -452,11 +452,11 @@
}, },
"unstable": { "unstable": {
"locked": { "locked": {
"lastModified": 1681828457, "lastModified": 1682526928,
"narHash": "sha256-o4Zvs309HOhrNeVloPKqangcKHobsggVt6GFbnEPZlQ=", "narHash": "sha256-2cKh4O6t1rQ8Ok+v16URynmb0rV7oZPEbXkU0owNLQs=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "555daa9d339b3df75e58ee558a4fec98ea92521e", "rev": "d6b863fd9b7bb962e6f9fdf292419a775e772891",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -10,7 +10,9 @@ _: {
logo = self + /misc/nixos.png; logo = self + /misc/nixos.png;
}; };
loader = { loader = {
grub.configurationLimit = 10;
systemd-boot = { systemd-boot = {
configurationLimit = 10;
enable = lib.mkDefault true; enable = lib.mkDefault true;
consoleMode = "max"; consoleMode = "max";
editor = false; editor = false;

59
modules/builders.nix Normal file
View file

@ -0,0 +1,59 @@
_: {
config,
lib,
options,
...
}: {
options.localModules.remoteBuild = {
enable = lib.mkEnableOption "";
isBuilder = lib.mkEnableOption "";
};
config = lib.mkMerge [
(
lib.mkIf config.localModules.remoteBuild.enable {
nix = {
settings = {
builders-use-substitutes = true;
max-jobs = 0;
};
distributedBuilds = true;
buildMachines = [
{
hostName = "gerg-desktop";
protocol = "ssh-ng";
maxJobs = 32;
systems = ["x86_64-linux"];
supportedFeatures = ["big-parallel" "nixos-test" "kvm" "benchmark"];
sshUser = "builder";
sshKey = "/etc/ssh/ssh_host_ed25519_key";
publicHostKey = "BQxvBOWsTw1gdNDR0KzrSRmbVhDrJdG05vYXkVmw8yA";
}
];
};
programs.ssh.knownHosts = {
gerg-desktop = {
extraHostNames = ["gerg-desktop.lan"];
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIeHsGcmOdIMzV+SNe4WFcA3CPHCNb1aqxThkXtm7G/1";
};
};
}
)
(lib.mkIf config.localModules.remoteBuild.isBuilder {
users = {
groups.builder = {};
users.builder = {
createHome = false;
isSystemUser = true;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIq9YTf4jlVCKBKn44m4yJvj94C7pTOyaa4VjZFohNqD root@mom-laptop"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJUKHZasYQUAmRBiqtx1drDxfq18/N4rKydCtPHx461I root@game-laptop"
];
useDefaultShell = true;
group = "builder";
};
};
nix.settings.trusted-users = ["builder"];
})
];
}

View file

@ -4,6 +4,7 @@ _: {
... ...
}: { }: {
localModules = { localModules = {
remoteBuild.enable = true;
DE.gnome.enable = true; DE.gnome.enable = true;
DM = { DM = {
lightdm.enable = true; lightdm.enable = true;

View file

@ -4,6 +4,7 @@ inputs: {
... ...
}: { }: {
localModules = { localModules = {
remoteBuild.isBuilder = true;
X11Programs = { X11Programs = {
sxhkd.enable = true; sxhkd.enable = true;
}; };
@ -38,6 +39,7 @@ inputs: {
nixpkgs.overlays = [ nixpkgs.overlays = [
inputs.nvim-flake.overlays.default inputs.nvim-flake.overlays.default
]; ];
nix.settings.system-features = ["kvm" "big-parallel" "nixos-test" "benchmark"];
environment.systemPackages = [ environment.systemPackages = [
pkgs.bitwarden #store stuff pkgs.bitwarden #store stuff

View file

@ -4,6 +4,7 @@ _: {
... ...
}: { }: {
localModules = { localModules = {
remoteBuild.enable = true;
DM = { DM = {
lightdm.enable = true; lightdm.enable = true;
autoLogin = true; autoLogin = true;