Files
home-manager/modules/targets/generic-linux/gpu/setup/default.nix
Jure Varlec a3ac4bb1f8 generic-linux-gpu: put systemd unit in lib/systemd
This is where unit files are expected to be, making GPU setup compatible
with things like selinux. Fixes #8438. The `resources/` directory was
kept because it is expected to be used in the future.
2026-01-08 13:15:31 -05:00

32 lines
818 B
Nix

{
lib,
stdenv,
nixStateDirectory,
nonNixosGpuEnv,
}:
stdenv.mkDerivation {
name = "non-nixos-gpu";
meta = {
description = "GPU driver setup for Nix on non-NixOS Linux systems";
homepage = "https://github.com/exzombie/non-nixos-gpu";
license = lib.licenses.mit;
mainProgram = "non-nixos-gpu-setup";
};
src = ./.;
patchPhase = ''
substituteInPlace non-nixos-gpu* \
--replace-quiet '@@resources@@' "$out/resources" \
--replace-quiet '@@statedir@@' '${nixStateDirectory}' \
--replace-quiet '@@systemddir@@' "$out/lib/systemd/system" \
--replace-quiet '@@env@@' "${nonNixosGpuEnv}"
'';
installPhase = ''
mkdir -p $out/{bin,resources,lib/systemd/system}
cp non-nixos-gpu-setup $out/bin
cp non-nixos-gpu.service $out/lib/systemd/system
'';
}