feat: Remote building
This commit is contained in:
parent
6f35a64e0e
commit
f2e730ceb5
7 changed files with 69 additions and 19 deletions
39
common/nixos/remoteBuild.nix
Normal file
39
common/nixos/remoteBuild.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
outputs,
|
||||
...
|
||||
}: {
|
||||
nix.buildMachines = [
|
||||
{
|
||||
hostName = "calculon";
|
||||
sshUser = "kdb424";
|
||||
systems = [
|
||||
"i686-linux"
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
protocol = "ssh-ng";
|
||||
supportedFeatures = ["kvm" "nixos-test" "big-parallel" "benchmark"];
|
||||
speedFactor = 4;
|
||||
maxJobs = 8;
|
||||
}
|
||||
{
|
||||
hostName = "planex";
|
||||
sshUser = "kdb424";
|
||||
systems = ["i686-linux" "x86_64-linux" "aarch64-linux"];
|
||||
protocol = "ssh-ng";
|
||||
supportedFeatures = ["kvm" "nixos-test" "big-parallel" "benchmark"];
|
||||
speedFactor = 3;
|
||||
maxJobs = 4;
|
||||
}
|
||||
];
|
||||
|
||||
nix.distributedBuilds = true;
|
||||
# optional, useful when the builder has a faster internet connection than yours
|
||||
nix.extraOptions = ''
|
||||
builders-use-substitutes = true
|
||||
'';
|
||||
}
|
|
@ -8,6 +8,7 @@
|
|||
../../common/gui/hyprland.nix
|
||||
../../common/style/stylix.nix
|
||||
../../common/hardware/laptop.nix
|
||||
../../common/nixos/remoteBuild.nix
|
||||
];
|
||||
|
||||
# Use the systemd-boot EFI boot loader.
|
||||
|
@ -23,4 +24,6 @@
|
|||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
|
||||
nix.distributedBuilds = true;
|
||||
}
|
||||
|
|
|
@ -1,24 +1,28 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}: {
|
||||
imports = [
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"];
|
||||
boot.initrd.kernelModules = [];
|
||||
boot.kernelModules = ["kvm-amd"];
|
||||
boot.extraModulePackages = [];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/abf4c24f-5999-44ed-b412-e40dc98a71ac";
|
||||
fsType = "ext4";
|
||||
};
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/abf4c24f-5999-44ed-b412-e40dc98a71ac";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
swapDevices = [];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
./hardware-configuration.nix
|
||||
../../common/nixos/baremetal.nix
|
||||
# ./zfs.nix
|
||||
../../common/nixos/remoteBuild.nix
|
||||
../../common/networking/zerotier.nix
|
||||
../../common/editors/emacs.nix
|
||||
../../common/nixos/docker.nix
|
||||
|
|
|
@ -27,4 +27,6 @@
|
|||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
|
||||
services.earlyoom.enable = true;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
../../common/networking/zerotier.nix
|
||||
../../common/editors/emacs.nix
|
||||
../../common/nixos/docker.nix
|
||||
../../common/nixos/remoteBuild.nix
|
||||
../../common/gui/games.nix
|
||||
../../common/gui/steamUltrawide.nix
|
||||
../../common/gui/hyprland.nix
|
||||
|
|
10
justfile
10
justfile
|
@ -58,16 +58,16 @@ trace target_host=hostname: (build target_host "--show-trace")
|
|||
switch target_host=hostname:
|
||||
sudo nixos-rebuild switch --flake .#{{target_host}} {{rebuild_flags}}
|
||||
|
||||
# Build the NixOS configuration remotely and switch to it.
|
||||
[linux]
|
||||
remote target_host=hostname:
|
||||
sudo nixos-rebuild switch --flake .#{{target_host}} {{rebuild_flags}} --max-jobs 1 --builders @/etc/nix/machines
|
||||
|
||||
# Build the NixOS configuration and switch to it on next boot.
|
||||
[linux]
|
||||
boot target_host=hostname:
|
||||
sudo nixos-rebuild boot --flake .#{{target_host}} {{rebuild_flags}}
|
||||
|
||||
# Update flake inputs to their latest revisions
|
||||
update:
|
||||
nix flake update --commit-lock-file
|
||||
|
||||
|
||||
# Garbage collect old OS generations and remove stale packages from the nix store
|
||||
gc generations="5d":
|
||||
sudo nix-env --delete-generations {{generations}}
|
||||
|
|
Loading…
Add table
Reference in a new issue