Merge branch 'main' of ssh://code.8bitbuddhism.com/aires/nix-configuration
This commit is contained in:
commit
97df6d213d
15
README.md
15
README.md
|
@ -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
|
##### 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`.
|
You can run a build on a remote server by using `--build-host`:
|
||||||
|
|
||||||
> [!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:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
nixos-rebuild build --flake . --build-host [remote hostname]
|
nixos-rebuild build --flake . --build-host [remote hostname]
|
||||||
|
|
12
flake.lock
12
flake.lock
|
@ -315,11 +315,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs-unstable": {
|
"nixpkgs-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1727802920,
|
"lastModified": 1728018373,
|
||||||
"narHash": "sha256-HP89HZOT0ReIbI7IJZJQoJgxvB2Tn28V6XS3MNKnfLs=",
|
"narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "27e30d177e57d912d614c88c622dcfdb2e6e6515",
|
"rev": "bc947f541ae55e999ffdb4013441347d83b00feb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -331,11 +331,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1727907660,
|
"lastModified": 1728067476,
|
||||||
"narHash": "sha256-QftbyPoieM5M50WKUMzQmWtBWib/ZJbHo7mhj5riQec=",
|
"narHash": "sha256-/uJcVXuBt+VFCPQIX+4YnYrHaubJSx4HoNsJVNRgANM=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5966581aa04be7eff830b9e1457d56dc70a0b798",
|
"rev": "6e6b3dd395c3b1eb9be9f2d096383a8d05add030",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -88,7 +88,4 @@ in
|
||||||
services.syncthing.enable = true;
|
services.syncthing.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Build remotely
|
|
||||||
nix.distributedBuilds = true;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,4 @@ in
|
||||||
};
|
};
|
||||||
users.aires.enable = true;
|
users.aires.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
nix.distributedBuilds = true;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
# Enables Intel GPU support.
|
# Enables Intel GPU support.
|
||||||
|
# https://wiki.nixos.org/wiki/Intel_Graphics
|
||||||
|
# https://nixos.org/manual/nixos/stable/#sec-x11--graphics-cards-intel
|
||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
|
@ -14,32 +16,17 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
# Configuration options from NixOS-Hardware: https://github.com/NixOS/nixos-hardware/blob/master/common/gpu/intel/default.nix
|
services.xserver.videoDrivers = [ "intel" ];
|
||||||
boot.initrd.kernelModules = [ "i915" ];
|
|
||||||
|
|
||||||
environment.variables.VDPAU_DRIVER = "va_gl";
|
hardware.graphics = {
|
||||||
|
enable = true;
|
||||||
hardware.opengl = {
|
extraPackages = [
|
||||||
extraPackages = with pkgs; [
|
pkgs.intel-media-driver
|
||||||
(
|
pkgs.unstable.vpl-gpu-rt
|
||||||
if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then
|
|
||||||
vaapiIntel
|
|
||||||
else
|
|
||||||
intel-vaapi-driver
|
|
||||||
)
|
|
||||||
libvdpau-va-gl
|
|
||||||
intel-media-driver
|
|
||||||
];
|
];
|
||||||
|
|
||||||
extraPackages32 = with pkgs.driversi686Linux; [
|
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
|
intel-media-driver
|
||||||
|
pkgs.unstable.vpl-gpu-rt
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,25 +70,6 @@ in
|
||||||
registry.nixpkgs.flake = inputs.nixpkgs;
|
registry.nixpkgs.flake = inputs.nixpkgs;
|
||||||
nixPath = [ "nixpkgs=${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
|
# When using a builder, use its package store
|
||||||
extraOptions = ''
|
extraOptions = ''
|
||||||
builders-use-substitutes = true
|
builders-use-substitutes = true
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
home-manager.users.root = {
|
home-manager.users.root = {
|
||||||
home.stateVersion = "24.05";
|
home.stateVersion = "24.05";
|
||||||
programs = {
|
programs = {
|
||||||
ssh = lib.mkIf config.nix.distributedBuilds {
|
ssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
matchBlocks = config.secrets.users.root.sshConfig;
|
matchBlocks = config.secrets.users.root.sshConfig;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue