1
0
Fork 0

Merge branch 'main' of ssh://code.8bitbuddhism.com/aires/nix-configuration

This commit is contained in:
Aires 2024-10-05 13:30:47 -04:00
commit 97df6d213d
7 changed files with 17 additions and 67 deletions

View file

@ -68,20 +68,7 @@ Nix can create builds for or on remote systems, and transfer them via SSH.
##### Generating a build on a remote system
You can run a build on a remote server, then pull it down to the local system. This is called a `distributedBuild`.
> [!NOTE]
> For distributed builds, the root user on the local system needs SSH access to the build target. This is done automatically.
To enable root builds on a host, add this to its config:
```nix
nix.distributedBuilds = true;
```
For hosts where `nix.distributedBuilds` is true, this repo automatically gives the local root user SSH access to an unprivileged user on the build systems. This is configured in `modules/secrets.nix`, but the build systems are defined in [`modules/system/nix.nix`](https://code.8bitbuddhism.com/aires/nix-configuration/src/commit/433821ef0c46f08855a041c3aa97143a954564f5/modules/system/nix.nix#L57).
If you want to ensure a build happens on a remote system, you can use:
You can run a build on a remote server by using `--build-host`:
```sh
nixos-rebuild build --flake . --build-host [remote hostname]

View file

@ -315,11 +315,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1727802920,
"narHash": "sha256-HP89HZOT0ReIbI7IJZJQoJgxvB2Tn28V6XS3MNKnfLs=",
"lastModified": 1728018373,
"narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "27e30d177e57d912d614c88c622dcfdb2e6e6515",
"rev": "bc947f541ae55e999ffdb4013441347d83b00feb",
"type": "github"
},
"original": {
@ -331,11 +331,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1727907660,
"narHash": "sha256-QftbyPoieM5M50WKUMzQmWtBWib/ZJbHo7mhj5riQec=",
"lastModified": 1728067476,
"narHash": "sha256-/uJcVXuBt+VFCPQIX+4YnYrHaubJSx4HoNsJVNRgANM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "5966581aa04be7eff830b9e1457d56dc70a0b798",
"rev": "6e6b3dd395c3b1eb9be9f2d096383a8d05add030",
"type": "github"
},
"original": {

View file

@ -88,7 +88,4 @@ in
services.syncthing.enable = true;
};
};
# Build remotely
nix.distributedBuilds = true;
}

View file

@ -38,6 +38,4 @@ in
};
users.aires.enable = true;
};
nix.distributedBuilds = true;
}

View file

@ -1,4 +1,6 @@
# Enables Intel GPU support.
# https://wiki.nixos.org/wiki/Intel_Graphics
# https://nixos.org/manual/nixos/stable/#sec-x11--graphics-cards-intel
{
pkgs,
config,
@ -14,32 +16,17 @@ in
};
config = lib.mkIf cfg.enable {
# Configuration options from NixOS-Hardware: https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/intel/default.nix
boot.initrd.kernelModules = [ "i915" ];
services.xserver.videoDrivers = [ "intel" ];
environment.variables.VDPAU_DRIVER = "va_gl";
hardware.opengl = {
extraPackages = with pkgs; [
(
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then
vaapiIntel
else
intel-vaapi-driver
)
libvdpau-va-gl
intel-media-driver
hardware.graphics = {
enable = true;
extraPackages = [
pkgs.intel-media-driver
pkgs.unstable.vpl-gpu-rt
];
extraPackages32 = with pkgs.driversi686Linux; [
(
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then
vaapiIntel
else
intel-vaapi-driver
)
libvdpau-va-gl
intel-media-driver
pkgs.unstable.vpl-gpu-rt
];
};
};

View file

@ -70,25 +70,6 @@ in
registry.nixpkgs.flake = inputs.nixpkgs;
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
# Configure remote build machines
# To enable a system to use remote build machines, add `nix.distributedBuilds = true;` to its config
buildMachines = [
{
hostName = "hevana";
systems = [
"x86_64-linux"
"aarch64-linux"
];
protocol = "ssh-ng";
supportedFeatures = [
"nixos-test"
"kvm"
"benchmark"
"big-parallel"
];
}
];
# When using a builder, use its package store
extraOptions = ''
builders-use-substitutes = true

View file

@ -4,7 +4,7 @@
home-manager.users.root = {
home.stateVersion = "24.05";
programs = {
ssh = lib.mkIf config.nix.distributedBuilds {
ssh = {
enable = true;
matchBlocks = config.secrets.users.root.sshConfig;
};