#!/bin/env fish
begin
    set -l dir (status dirname)
    source "$dir/../../../lib/software.fish"

    function configureSW -V dir
        # According to: https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks
        begin
            printf %s\n \
                "options nvidia NVreg_PreserveVideoMemoryAllocations=1" \
                "options nvidia NVreg_TemporaryFilePath=/var/tmp"
        end | sudo tee /etc/modprobe.d/nvidia-power-management.conf >/dev/null

        sudo systemctl enable \
            nvidia-suspend.service \
            nvidia-hibernate.service \
            nvidia-resume.service
    end

    runInstaller $argv
end