Compare commits

..

2 Commits

3 changed files with 33 additions and 31 deletions

View File

@ -180,7 +180,7 @@
},
"locked": {
"lastModified": 1,
"narHash": "sha256-KP+2qdZlhmRkrafuuEofg7YnNdVmGV95ipvpuqmJneI=",
"narHash": "sha256-GgIXbuHvwReBHZUyfSKS6DET3CfD6EEKABj6ndpcqHQ=",
"path": "./../../out-of-tree/nixGL",
"type": "path"
},

View File

@ -77,37 +77,10 @@ let
fetchurl { inherit url sha256; };
useGLVND = true;
});
in
{
inherit nvidiaDrivers;
nvidiaLibsOnly = nvidiaDrivers.override {
libsOnly = true;
kernel = null;
};
nixGLNvidiaBumblebee = writeExecutable {
name = "nixGLNvidiaBumblebee-${version}";
text = ''
#!${runtimeShell}
export LD_LIBRARY_PATH=${
lib.makeLibraryPath [ nvidiaDrivers ]
}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
${
bumblebee.override {
nvidia_x11 = nvidiaDrivers;
nvidia_x11_i686 = nvidiaDrivers.lib32;
}
}/bin/optirun --ldpath ${
lib.makeLibraryPath ([ libglvnd nvidiaDrivers ]
++ lib.optionals enable32bits [
nvidiaDrivers.lib32
pkgsi686Linux.libglvnd
])
} "$@"
'';
};
# TODO: 32bit version? Not tested.
nixNvidiaWrapper = api:
writeExecutable {
name = "nix${api}Nvidia-${version}";
@ -142,6 +115,34 @@ let
exec "$@"
'';
};
in
{
inherit nvidiaDrivers nvidiaLibsOnly;
nixGLNvidiaBumblebee = writeExecutable {
name = "nixGLNvidiaBumblebee-${version}";
text = ''
#!${runtimeShell}
export LD_LIBRARY_PATH=${
lib.makeLibraryPath [ nvidiaDrivers ]
}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
${
bumblebee.override {
nvidia_x11 = nvidiaDrivers;
nvidia_x11_i686 = nvidiaDrivers.lib32;
}
}/bin/optirun --ldpath ${
lib.makeLibraryPath ([ libglvnd nvidiaDrivers ]
++ lib.optionals enable32bits [
nvidiaDrivers.lib32
pkgsi686Linux.libglvnd
])
} "$@"
'';
};
# TODO: 32bit version? Not tested.
inherit nixNvidiaWrapper;
# TODO: 32bit version? Not tested.
nixGLNvidia = nixNvidiaWrapper "GL";

View File

@ -8,16 +8,17 @@ echo "SCRIPT_DIR: ${SCRIPT_DIR}"
HOME_MANAGER_DIR="${SCRIPT_DIR}/../nix-conf/home-manager"
# Mason is bad: it puts binaries onto xdg.data
# let's make mason starts fresh, just in case we introduce RPATH hacks
# that injects binary for Mason to use.
rm -rf ~/.local/share/nvim/mason
# test if we have home-manager, if not, attempt to use nix to put home-manager to
# our environment
if [ $(home-manager >/dev/null 2>&1) ]; then
# highly likely we don't even have nix support to start with, so let's fix that
sudo mv /etc/
nix-shell -p home-manager --run "home-manager switch --flake $HOME_MANAGER_DIR"
nix-shell -p home-manager --run "home-manager switch --flake $HOME_MANAGER_DIR $@"
else
home-manager switch -b backup --flake "$HOME_MANAGER_DIR"
home-manager switch -b backup --flake "$HOME_MANAGER_DIR" $@
fi