Compare commits

..

4 Commits

Author SHA1 Message Date
Peder Bergebakken Sundt d1d06e192f remove mkFlakeView
shitty abstractions bad
2024-10-04 03:10:38 +02:00
Peder Bergebakken Sundt c78862ef0e remote nixos-hardware-2311 2024-10-04 03:00:03 +02:00
Peder Bergebakken Sundt f175fb76f7 clean 2024-10-03 17:31:06 +02:00
Peder Bergebakken Sundt 1321b9a7d3 move domene-shop-updater 2024-10-03 17:31:06 +02:00
13 changed files with 23 additions and 317 deletions

View File

@ -155,22 +155,6 @@
"type": "github"
}
},
"nixos-hardware-2311": {
"locked": {
"lastModified": 1718349360,
"narHash": "sha256-SuPne4BMqh9/IkKIAG47Cu5qfmntAaqlHdX1yuFoDO0=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "ae5c8dcc4d0182d07d75df2dc97112de822cb9d6",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "ae5c8dcc4d0182d07d75df2dc97112de822cb9d6",
"type": "github"
}
},
"nixos-nspawn": {
"flake": false,
"locked": {
@ -389,7 +373,6 @@
"nix-index-database": "nix-index-database",
"nixos-generators-2311": "nixos-generators-2311",
"nixos-hardware": "nixos-hardware",
"nixos-hardware-2311": "nixos-hardware-2311",
"nixos-nspawn": "nixos-nspawn",
"nixpkgs-1909": "nixpkgs-1909",
"nixpkgs-2003": "nixpkgs-2003",

View File

@ -33,7 +33,6 @@
# https://github.com/NixOS/nixos-hardware
nixos-hardware.url = "github:NixOS/nixos-hardware";
nixos-hardware-2311.url = "github:NixOS/nixos-hardware/ae5c8dcc4d0182d07d75df2dc97112de822cb9d6"; # pre https://github.com/NixOS/nixos-hardware/pull/977
# https://github.com/tfc/nspawn-nixos
nixos-nspawn.url = "github:tfc/nspawn-nixos";
@ -102,7 +101,6 @@
outputs = {
self,
nixos-hardware,
nixos-hardware-2311,
nixos-nspawn,
nixos-generators-2311,
...
@ -141,24 +139,11 @@
inputs-1909 = inputs-2305 // { nixpkgs = inputs'.nixpkgs-1909; };
inputs-test = inputs-edge // { nixpkgs = inputs'.nixpkgs-test; unstable = inputs'.nixpkgs-test; };
mkFlakeView = inputs: system: inputs.nixpkgs.lib.mapAttrs (name: flake: flake // {
# TODO filter non-flake inputs
nixos = flake.nixosModules
or null;
pkgs = flake.packages.${system}
or flake.legacyPackages.${system}
or null;
lib = flake.lib.${system}
or flake.lib
or null;
}) inputs;
forSystems = systems: f: inputs-edge.nixpkgs.lib.genAttrs systems (system: f rec {
inherit system;
inputs = inputs-edge;
pkgs = inputs.nixpkgs.legacyPackages.${system};
lib = inputs.nixpkgs.legacyPackages.${system}.lib;
flakes = mkFlakeView inputs system;
});
forAllSystems = forSystems [
"x86_64-linux"
@ -187,7 +172,6 @@
home-manager.useGlobalPkgs = true; # go brrr, reuse overrides
home-manager.extraSpecialArgs = {
inherit inputs;
flakes = mkFlakeView inputs system;
};
home-manager.sharedModules = [
inputs.sops-nix.homeManagerModules.sops
@ -217,7 +201,6 @@
inherit system;
specialArgs = {
inherit inputs;
flakes = mkFlakeView inputs system;
};
modules = [ (mkModule extra-modules domain system inputs stateVersion modules hostname) ];
};
@ -261,7 +244,6 @@
mkHosts = mk: let
ls = imports: { inherit imports; };
hw = nixos-hardware.nixosModules;
hw_ = nixos-hardware-2311.nixosModules;
#vf = nixos-vf2.nixosModules;
amd = ls [ hw.common-pc hw.common-pc-ssd hw.common-cpu-amd ];
intel = ls [ hw.common-pc hw.common-pc-ssd hw.common-cpu-intel ./hardware/gpu/intel.nix ];
@ -269,7 +251,6 @@
cuda = ls [ ./hardware/gpu/cuda.nix hw.common-gpu-nvidia-nonprime ];
cuda-prime = ls [ ./hardware/gpu/cuda.nix hw.common-gpu-nvidia ];
rocm = ls [ ./hardware/gpu/rocm.nix hw.common-gpu-amd ];
rocm_ = ls [ ./hardware/gpu/rocm.nix hw_.common-gpu-amd ];
nspawn = ls [ "${nixos-nspawn}/nspawn-image.nix" { boot.isContainer = true; } ];
hidpi = hw.common-hidpi;
p1005 = ./hardware/printer/hp-laserjet-p1005.nix;
@ -301,24 +282,24 @@
inputs = inputs';
lib = {
inherit mkFlakeView forSystems;
# pass
} // forAllSystems ({ system, ... }: {
inherit mkFlakeView forSystems;
flakes = mkFlakeView inputs-edge system;
flakes-2311 = mkFlakeView inputs-2311 system;
flakes-2305 = mkFlakeView inputs-2305 system;
# pass
});
nixosModules = mkHosts (mkModule []);
nixosConfigurations = mkHosts (mkConfig []);
nixosReports = mkHosts (mkReport []);
packages = forAllSystems ({ inputs, pkgs, lib, flakes, ... }: let
# TODO: overlays
packages = forAllSystems ({ inputs, pkgs, lib, ... }: let
# TODO: by-name
mk-nspawn-setup = hostname: # TODO: nspawn-tarball.nix populates /etc/nixos with junk
(pkgs.callPackage ./pkgs/mk-nspawn-setup {})
(mkHosts (mkConfig [ "${nixos-nspawn}/nspawn-tarball.nix" ])).${hostname};
in {
# TODO: get faketty to work ${expect}/bin/unbuffer is bad
# TODO: get faketty to work, ${expect}/bin/unbuffer is bad
nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" ''
if test -t 1 && test -z "''${NIX_NO_NOM-}"; then
exec ${lib.getExe pkgs.nixos-rebuild} -L "$@" |& ${lib.getExe pkgs.nix-output-monitor}
@ -334,7 +315,7 @@
nspawn-setup-brumlebasse = mk-nspawn-setup "brumlebasse";
image-brumlebasse-openstack = nixos-generators-2311.nixosGenerate {
system = "x86_64-linux";
specialArgs = { inherit inputs flakes; };
specialArgs = { inherit inputs; };
modules = [ (mkHosts (mkModule [])).brumlebasse ];
format = "openstack";
};
@ -356,7 +337,6 @@
}];
extraSpecialArgs = {
inherit inputs;
flakes = mkFlakeView inputs system;
};
};
in {
@ -371,10 +351,10 @@
pbsds-gnome-2305 = mkHome "pbsds" "/home/pbsds" inputs-2305 [ ./users/pbsds/home/gnome.nix ];
});
devShells = forAllSystems ({ pkgs, flakes, ... }: let
devShells = forAllSystems ({ pkgs, system, ... }: let
mkShell = packages: pkgs.mkShellNoCC { inherit packages; };
envrc-pkgs = [
flakes.self.pkgs.nixos-rebuild-nom
self.packages.${system}.nixos-rebuild-nom
pkgs.home-manager
pkgs.nix-output-monitor
pkgs.cachix
@ -388,12 +368,12 @@
in {
envrc-local = mkShell envrc-pkgs;
envrc-remote = mkShell (envrc-pkgs ++ [
(pkgs.remote-exec or flakes.unstable.pkgs.remote-exec)
pkgs.remote-exec
pkgs.yq
pkgs.rsync
]);
remoteenv = mkShell [
flakes.self.pkgs.nixos-rebuild-nom
self.packages.${system}.nixos-rebuild-nom
pkgs.age
pkgs.ssh-to-age
pkgs.just

View File

@ -17,7 +17,7 @@
../../profiles/shell.nix
../../profiles/domeneshop-dyndns
../../profiles/domeneshop-dyndns.nix
../../profiles/remote-builders.nix
#../../profiles/autossh-reverse-tunnels
];

View File

@ -18,7 +18,7 @@
../../profiles/shell.nix
#../../profiles/domeneshop-dyndns
#../../profiles/domeneshop-dyndns.nix
../../profiles/remote-builders.nix
];
#services.domeneshop-updater.targets = [ config.networking.fqdn ];

View File

@ -18,7 +18,7 @@
../../profiles/shell.nix
../../profiles/domeneshop-dyndns
../../profiles/domeneshop-dyndns.nix
../../profiles/remote-builders.nix
#../../profiles/autossh-reverse-tunnels
];

View File

@ -41,7 +41,7 @@
##../../profiles/desktop/sound/pulseaudio.nix
#../../profiles/desktop/sound/pipewire.nix
../../profiles/domeneshop-dyndns
../../profiles/domeneshop-dyndns.nix
../../profiles/remote-builders.nix
];
services.domeneshop-updater.targets = [ config.networking.fqdn ];

View File

@ -42,7 +42,7 @@
../../profiles/remote-builders.nix
#../../profiles/autossh-reverse-tunnels
#../../profiles/domeneshop-dyndns # handled by noximilien
#../../profiles/domeneshop-dyndns.nix # handled by noximilien
];
nix.settings.max-jobs = 1; # this host do be stinky

View File

@ -89,7 +89,7 @@
#../../profiles/http/services/trivial-gradios
#../../profiles/code-remote # TODO: move into web? services?
../../profiles/domeneshop-dyndns
../../profiles/domeneshop-dyndns.nix
../../profiles/remote-builders.nix
../../profiles/autossh-reverse-tunnels
#../../profiles/xrdp

View File

@ -51,7 +51,7 @@
../../profiles/remote-builders.nix
#../../profiles/autossh-reverse-tunnels
#../../profiles/domeneshop-dyndns # handled by noximilien
#../../profiles/domeneshop-dyndns.nix # handled by noximilien
];
networking.firewall.allowedTCPPorts = [ 57621 ]; # spotify local discovery

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, mkDomain, flakes, ... }:
{ config, pkgs, lib, mkDomain, ... }:
let
cfg = config.services.docs-to-host;
@ -48,7 +48,7 @@ in
services.docs-to-host.enable = mkEnableOption (lib.mdDoc "docs-to-host");
services.docs-to-host.pagefind = {
enable = mkEnableOption (lib.mdDoc "pagefind default on index of docs");
package = mkPackageOptionMD flakes.unstable.pkgs "pagefind" { };
package = mkPackageOptionMD pkgs.unstable "pagefind" { };
};
services.docs-to-host.docs = mkOption {
type = types.listOf (types.submodule {

View File

@ -1,7 +1,7 @@
{ config, lib, mkDomain, flakes, ... }:
{ config, lib, mkDomain, inputs, ... }:
let
myStickerPicker = flakes.maunium-stickerpicker-nix.createStickerPicker {
myStickerPicker = inputs.maunium-stickerpicker-nix.createStickerPicker {
#homeserver = "https://matrix.pvv.ntnu.no";
#userId = "@stickerbot:my.matrix.server";
## You should probably encrypt this with either agenix, sops-nix or whatever else

View File

@ -1,257 +0,0 @@
{ config, pkgs, lib, ... }:
let
# supportedFeatures:
# - "kvm" - has hypervisor
# - "nixos-test" - the same as ^? nixos?
# - "benchmark" - has "equal" performance
# - "big-parallel" - is beefy, for stuff like llvm
# find 'publicKey' with `ssh-keyscan`
proxyjump-ntnu = {
proxy.user = "pederbs";
proxy.host = "isvegg.pvv.ntnu.no";
proxy.publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGurF7rdnrDP/VgIK2Tx38of+bX/QGCGL+alrWnZ1Ca5llGneMulUt1RB9xZzNLHiaWIE+HOP0i4spEaeZhilfU="; # isvegg
#proxy.host = "hildring.pvv.ntnu.no";
#proxy.publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGurF7rdnrDP/VgIK2Tx38of+bX/QGCGL+alrWnZ1Ca5llGneMulUt1RB9xZzNLHiaWIE+HOP0i4spEaeZhilfU="; # hildring
#proxy.host = "microbel.pvv.ntnu.no";
#proxy.publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEq0yasKP0mH6PI6ypmuzPzMnbHELo9k+YB5yW534aKudKZS65YsHJKQ9vapOtmegrn5MQbCCgrshf+/XwZcjbM="; # microbel
#proxy.host = "snotra-login1.idi.ntnu.no";
#proxy.publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKvf//xeGEuGkPqTMyCZJlyjufpChPkwnB+W19yIQquF"; # snotra
};
sops.secrets.nix-community-builders-ssh-key = {};
remotes =
let
mkClab = hostname: pubkey: {
systems = [ "x86_64-linux" ];
hostName = hostname;
sshUser = "pederbs";
maxJobs = 1; # 24 thread 64gb ram
speedFactor = 2;
supportedFeatures = [ "kvm" "big-parallel" "nixos-test" ];
#mandatoryFeatures = [ ];
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOkcZ3cUAKk8uUvZPsX7PDBInkb3Eps3Xh+xVrhPY+sx";
inherit (proxyjump-ntnu) proxy;
};
in [
/** /
{
systems = [ "aarch64-darwin" "x86_64-darwin" ];
hostName = "darwin-build-box.winter.cafe";
maxJobs = 4;
sshUser = "pbsds";
sshKey = "/run/secrets/nix-community-builders-ssh-key";
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB0io9E0eXiDIEHvsibXOxOPveSjUPIr1RnNKbUkw3fD";
}
/** /
{
systems = [ "aarch64-linux" ];
supportedFeatures = [ "big-parallel" ];
hostName = "aarch64.nixos.community";
maxJobs = 64;
sshUser = "pbsds";
sshKey = "/run/secrets/nix-community-builders-ssh-key";
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMUTz5i9u5H2FHNAmZJyoJfIGyUm/HfGhfwnc142L3ds";
}
/**/
{
systems = [ "x86_64-linux" ]; #"wasm32-wasi" "wasm64-wasi" "x86_64-windows" "aarch64-linux" "riscv64-linux" ];
hostName = "bolle.pbsds.net";
sshUser = "pbsds";
maxJobs = 4; # 12 cores
#maxJobs = 1; # at least for big-parallel
speedFactor = 3;
supportedFeatures = [ "kvm" "big-parallel" "nixos-test" ];
#mandatoryFeatures = [ ];
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILeOB/57N1fQPVorIUlkkJZaQduBo+4+km2Qbj4ebd/k";
inherit (proxyjump-ntnu) proxy;
}
/**/
{
systems = [ "x86_64-linux" ]; #"wasm32-wasi" "wasm64-wasi" "x86_64-windows" "aarch64-linux" "riscv64-linux" ];
hostName = "eple.pbsds.net";
sshUser = "pbsds";
maxJobs = 4; # 12 cores
#maxJobs = 1; # at least for big-parallel
speedFactor = 3;
supportedFeatures = [ "kvm" "big-parallel" "nixos-test" ];
#mandatoryFeatures = [ ];
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH03MEINNnjBvtmvN2QsCDCLkvF9ow5FQJp9uiyQ1Iwi";
inherit (proxyjump-ntnu) proxy;
}
/**/
{
systems = [ "x86_64-linux" ]; #"wasm32-wasi" "wasm64-wasi" "x86_64-windows" "aarch64-linux" "riscv64-linux" ];
hostName = "garp.pbsds.net"; # TODO: port 23
sshUser = "pbsds";
maxJobs = 3; # 8 cores
#maxJobs = 1; # at least for big-parallel
speedFactor = 2;
supportedFeatures = [ "kvm" "big-parallel" "nixos-test" ];
#mandatoryFeatures = [ ];
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOkcZ3cUAKk8uUvZPsX7PDBInkb3Eps3Xh+xVrhPY+sx";
inherit (proxyjump-ntnu) proxy;
}
/** /
{
systems = [ "x86_64-linux" ]; #"wasm32-wasi" "wasm64-wasi" "x86_64-windows" "aarch64-linux" "riscv64-linux" ];
hostName = "noximilien.pbsds.net"; # TODO: port 23
sshUser = "pbsds";
maxJobs = 3; # 8 cores
#maxJobs = 1; # at least for big-parallel
speedFactor = 3;
supportedFeatures = [ "kvm" "big-parallel" ]; # TODO: "nixos-test"
#mandatoryFeatures = [ ];
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ3QhTGS03Sqm6OeCEz5AIGqJnBttKaBqMgNXp3Md7t4";
}
/** /
{
systems = ["x86_64-linux"];
hostName = "rocm.pbsds.net";
sshUser = "pbsds";
maxJobs = 6; # 16 cores
#maxJobs = 4;
#maxJobs = 1; # at least for big-parallel
speedFactor = 2;
supportedFeatures = [ "kvm" "big-parallel" ];
#mandatoryFeatures = [ ];
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGDuWdqEQ5mmVjuKi6f/Q2PFxuqB3URpgTHid06Vw7we";
inherit (proxyjump-ntnu) proxy;
}
/** /
{
systems = [ "x86_64-linux" ]; #"wasm32-wasi" "wasm64-wasi" "x86_64-windows" "aarch64-linux" "riscv64-linux" ];
hostName = "sopp.pbsds.net";
sshPort = 26;
sshUser = "pbsds";
maxJobs = 4; # 8 cores
#maxJobs = 1; # at least for big-parallel
speedFactor = 1;
supportedFeatures = [ "kvm" "big-parallel" "nixos-test" ];
#mandatoryFeatures = [ ];
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDYB9H1pHB1vTBiGhO/GCQjn70BtVdQuJyXx38zN2CDj";
}
/**/
{
systems = [ "x86_64-linux" ]; #"wasm32-wasi" "wasm64-wasi" "x86_64-windows" "aarch64-linux" "riscv64-linux" ];
hostName = "nord.pbsds.net";
sshPort = 24;
sshUser = "pbsds";
maxJobs = 1; # 4 cores
#maxJobs = 1; # at least for big-parallel
speedFactor = 1;
supportedFeatures = [ "kvm" "big-parallel" "nixos-test" ];
#mandatoryFeatures = [ ];
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBSdIUtUfAxnVbPDmDDFdP2S3Wd3+CC8IfZAANJ76oh";
}
/** /
{
systems = ["x86_64-linux"];
hostName = "isvegg.pvv.ntnu.no";
sshUser = "pederbs";
maxJobs = 1; # 4 cores
speedFactor = 0;
publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGurF7rdnrDP/VgIK2Tx38of+bX/QGCGL+alrWnZ1Ca5llGneMulUt1RB9xZzNLHiaWIE+HOP0i4spEaeZhilfU=";
}
/** /
{
systems = ["x86_64-linux"];
hostName = "eirin.pvv.ntnu.no";
sshUser = "pederbs";
maxJobs = 1; # 8 cores
speedFactor = 0;
publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBILGULKEzYe5kPorM0rWATv10qq6debfCuYUYqw3HWZm4Y5Pi7mVKcf8lKFNPc1DxT/dStfxxtHj/2fbezaxElk=";
inherit (proxyjump-ntnu) proxy;
}
{
systems = ["x86_64-linux"];
hostName = "demiurgen.pvv.ntnu.no";
sshUser = "pederbs";
maxJobs = 1; # 8 cores
speedFactor = 0;
publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKw92q3eB5HZbKJN3p+80MtirqcXPu01USE9LnoGYJuDvko1udjIy4UR0wAwELqgs+r7mJyuQPeXmOZKwjHP6tM=";
inherit (proxyjump-ntnu) proxy;
}
/**/
/** /
(mkClab "clab01.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJfJV5Ov3D0qErVnbQZ3oxhA3i0zuAmjmVUf3JV08aSg")
(mkClab "clab02.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHNhQPotOGWZdFeW4B3eDYGcaF/2xB56hNL+x3QEURa6")
(mkClab "clab03.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH5srnYPuULchLvlCOlWOwrhQEBznQn61kj0Oawnp44Y")
(mkClab "clab04.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICgMxLYYiYb/6IAH6nyc9eGXASgDPTE2JcRZ9ODjhQt5")
(mkClab "clab05.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHw4h4dH689bLYWjrhhsvfljyWfUEClPa1Kb0cYxLRaD")
(mkClab "clab06.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDVZ394P3124lSxkzVodFqbindIvCB3kcn4YcgbaPrAs")
(mkClab "clab07.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILKQfcOmWC73bmE2mlWEcXFHiDUhsYWA7Xy9Dtq8kKmn")
(mkClab "clab08.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKlyZq3uTBCgkvPgs6nWRzsdhHmXHph14dmYWgt1vuBx")
(mkClab "clab09.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAj4eXT/k7iiUYx+CXq5ShLWm1N6SNO23EIs4xYEaQaW")
(mkClab "clab10.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG5xEUkiwXWaUCA+QfMDq2vHfXKzcpXlrHpJMNQ8EU+K")
(mkClab "clab11.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFlKZhdQBrjafzzwdRR3arem3TXnnPucQskd7RWW9L5V")
(mkClab "clab12.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDEr2zGzev8JffE67Hkb3Qli7K0kzVdu8VXxJW47PK7m")
(mkClab "clab13.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIZgIhgpMCdegJaW6Huad7Dj4YfyR8Zhi1UmDsgcJYK2")
(mkClab "clab14.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIL3pAYx5rtbaUCf4xsiy+7/qKqnGMnSa9KCp42j+XmEh")
(mkClab "clab15.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP7XwwhLJGwK+a7zShr2Ok9f2GlvPkP+FxKdbGYsNHtd")
(mkClab "clab16.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJKAaMXBAYsDd2QQOAQhXAAJCejbylQNLI9KsN3/EsY+")
(mkClab "clab20.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEGBbcKU5uDTgaQoREjaNuzQkCKNm5wlnhln6ZNiL3o2")
(mkClab "clab22.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMHlaYq184VDBoEOtaIIu2jnuBihhWiGPlyku0SMKORG")
(mkClab "clab23.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAsIRgqoFF900olTCy6DSrFMpZyRmtK6aVP2oYQhNi8g")
(mkClab "clab24.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICqh/Sp13OcUnZ8gVgiylcLsqAgIw+twQG92GyZK3FBZ")
(mkClab "clab25.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOdL5coXj0geu9O1cMLdYuUE0TWlIkKLNj71/XF0e8eg")
(mkClab "clab26.idi.ntnu.no" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINqqxg0hVT/gPBM1xqrR9QtMRHVBZDYWZ3pzbJv9MHUG")
/**/
];
mkRemoteConfig = {
publicKey,# fetch it with `ssh-keyscan`
proxy ? null, # schema: { user, host, publicKey }
sshPort ? 22,
... # the rest follows nix.buildMachines.<NAME> schema
}@args:
let
buildMachine = lib.filterAttrs (key: _: !builtins.elem key ["publicKey" "proxy" "sshPort"]) args; # this should have syntactic sugar: ...@buildMachine
filter = lib.mkIf (buildMachine.hostName != config.networking.fqdn);
in filter {
nix.buildMachines = [ buildMachine ];
#nix.buildMachines = [ (buildMachine // { protocol = "ssh-ng"; } ) ];
#TODO: users.users.root.openssh.authorizedKeys.keys
programs.ssh.knownHosts.${buildMachine.hostName}.publicKey = publicKey;
# the timeout is great to have when a remote is unresponsive, as nix currently does not give a shit
programs.ssh.extraConfig = ''
Host ${buildMachine.hostName}
ConnectTimeout 3
Port ${builtins.toString sshPort}
${lib.optionalString (proxy != null) ''
ProxyJump ${proxy.user}@${proxy.host}
''}
'';
programs.ssh.knownHosts.${proxy.host or "IGNORE"} = lib.mkIf (proxy != null) { publicKey = proxy.publicKey; };
};
remoteMap = lib.listToAttrs (lib.forEach remotes (remote: {
name = remote.hostName;
value = remote;
}));
in {
nix.distributedBuilds = true;
# TODO: Allow setting speedFactor for local builds, as local is currently fixed to 0
# https://github.com/NixOS/nix/issues/2457
# useful when the builder has a faster internet connection than i do
nix.settings.builders-use-substitutes = true;
/** /
nix.buildMachines = let cfg = remoteMap.${config.networking.fqdn}; in [{
hostName = "localhost"; # https://github.com/NixOS/nix/pull/4938
systems = [ config.nixpkgs.system "builtin" ] ++ config.boot.binfmt.emulatedSystems;
supportedFeatures = ["builtin" "local" "kvm" "nixos-test" "big-parallel" "benchmark"];
inherit (cfg) maxJobs speedFactor;
}];
/**/
# TIL: this can be a list of configurations and lambdas, not just file paths
imports = builtins.map mkRemoteConfig remotes;
}