Update NixDesk

This commit is contained in:
Tibo De Peuter 2023-10-24 21:00:53 +02:00
parent 99231d0d04
commit 759ebb3558
12 changed files with 182 additions and 103 deletions

View file

@ -35,9 +35,10 @@
inherit self inputs; inherit self inputs;
channelsConfig.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [ channelsConfig.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [
"nvidia-x11"
"nvidia-settings"
"corefonts" "corefonts"
"nvidia-settings"
"nvidia-x11"
"Oracle_VM_VirtualBox_Extension_Pack"
"vista-fonts" "vista-fonts"
]; ];

View file

@ -1,64 +1,86 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
imports = imports = [
[ # Include the results of the hardware scan. ./hardware-configuration.nix
./hardware-configuration.nix ];
../../modules/hardware/nvidia.nix
../../modules/hardware/corsair
../../modules/apps/virtualbox sisyphus = {
../../modules/des/gnome hardware.nvidia = {
]; enable = true;
model = "RTX 2060";
};
# Bootloader. programs = {
boot.loader = { home-manager.enable = true;
systemd-boot.enable = true; sops.enable = true;
efi = { ssh.enable = true;
canTouchEfiVariables = true; };
efiSysMountPoint = "/boot/efi";
}; services = {
pipewire.enable = true;
printing.enable = true;
openrgb.enable = true;
};
users.tdpeuter.enable = true;
virtualisation.virtualbox.enable = true;
}; };
boot.loader = {
systemd-boot.enable = true;
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
};
environment.systemPackages = with pkgs; [
git
vim
w3m
wget
zenith-nvidia
];
programs.zsh.enable = true;
hardware.bluetooth.enable = true;
networking = { networking = {
hostName = "Tibo-NixDesk"; hostName = "Tibo-NixDesk";
networkmanager.enable = true; networkmanager.enable = true;
# wireless.enable = true; # Enables wireless support via wpa_supplicant. # wireless.enable = true; # Enables wireless support via wpa_supplicant.
}; };
# Set your time zone.
time.timeZone = "Europe/Brussels";
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
system.stateVersion = "23.05"; system.stateVersion = "23.05";
time.timeZone = "Europe/Brussels";
nix = {
# Allow Nix Flakes
# Keep derivations so shells don't break (direnv)
# If the disk has less than 100MiB, free up to 2GiB by garbage-collecting.
extraOptions = ''
experimental-features = nix-command flakes
keep-outputs = true
keep-derivations = true
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (2048 * 1024 * 1024)}
'';
# Scheduled garbage-collect
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
package = pkgs.nixFlakes;
};
i18n.defaultLocale = "en_GB.UTF-8";
console = {
# font = "Lat2-Terminus16";
useXkbConfig = true; # use xkbOptions in tty.
};
} }

View file

@ -3,24 +3,25 @@
{ {
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
../../modules-old
]; ];
sisyphus = { sisyphus = {
users.tdpeuter.enable = true; hardware.nvidia = {
enable = true;
hardware.nvidia.enable = true; model = "Quadro T2000";
hardware.nvidia.model = "Quadro T2000"; };
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;
sops.enable = true; sops.enable = true;
ssh.enable = true; ssh.enable = true;
}; };
services = { services = {
desktop.gnome.enable = true; pipewire.enable = true;
printing.enable = true;
}; };
users.tdpeuter.enable = true;
}; };
boot = { boot = {
@ -84,20 +85,29 @@
networkmanager.enable = true; networkmanager.enable = true;
}; };
# Enable sound with pipewire. nix = {
sound.enable = true; # Allow Nix Flakes
hardware.pulseaudio.enable = false; # Keep derivations so shells don't break (direnv)
security.rtkit.enable = true; # If the disk has less than 100MiB, free up to 2GiB by garbage-collecting.
services.pipewire = { extraOptions = ''
enable = true; experimental-features = nix-command flakes
alsa.enable = true; keep-outputs = true
alsa.support32Bit = true; keep-derivations = true
pulse.enable = true; min-free = ${toString (100 * 1024 * 1024)}
# If you want to use JACK applications, uncomment this max-free = ${toString (2048 * 1024 * 1024)}
#jack.enable = true; '';
# Scheduled garbage-collect
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
package = pkgs.nixFlakes;
};
# use the example session manager (no others are packaged yet so this is enabled by default, i18n.defaultLocale = "en_GB.UTF-8";
# no need to redefine it in your config for now) console = {
#media-session.enable = true; # font = "Lat2-Terminus16";
useXkbConfig = true; # use xkbOptions in tty.
}; };
} }

View file

@ -1,9 +0,0 @@
{ config, pkgs, ... }:
{
services.hardware.openrgb = {
enable = true;
package = pkgs.openrgb-with-all-plugins;
motherboard = "intel";
};
}

View file

@ -1,5 +1,6 @@
{ {
imports = [ imports = [
./desktop
./hardware ./hardware
./programs ./programs
./services ./services

View file

@ -1,9 +1,9 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.sisyphus.services.desktop.gnome; cfg = config.sisyphus.desktop.gnome;
in { in {
options.sisyphus.services.desktop.gnome.enable = lib.mkEnableOption "GNOME"; options.sisyphus.desktop.gnome.enable = lib.mkEnableOption "GNOME";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
services.xserver = { services.xserver = {

View file

@ -3,6 +3,7 @@
let let
cfg = config.sisyphus.hardware.nvidia; cfg = config.sisyphus.hardware.nvidia;
do-offloading = builtins.elem cfg.model [ "Quadro T2000" ];
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" '' nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
export __NV_PRIME_RENDER_OFFLOAD=1 export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
@ -35,24 +36,33 @@ in {
open = true; open = true;
package = config.boot.kernelPackages.nvidiaPackages.stable; package = config.boot.kernelPackages.nvidiaPackages.stable;
modesetting.enable = true; modesetting.enable = true;
nvidiaSettings = config.sisyphus.hardware.nvidia.gui-settings; nvidiaSettings = cfg.gui-settings;
powerManagement = { powerManagement = {
enable = true; enable = do-offloading;
finegrained = true; finegrained = do-offloading;
}; };
prime = lib.mkIf (cfg.model == "Quadro T2000") { prime = lib.mkMerge [
offload = { (lib.mkIf do-offloading {
enable = true; offload = {
enableOffloadCmd = true; enable = true;
}; enableOffloadCmd = true;
intelBusId = "PCI::00:02:0"; };
nvidiaBusId = "PCI:01:00:0"; })
}; (lib.mkIf (cfg.model == "Quadro T2000") {
intelBusId = "PCI::00:02:0";
nvidiaBusId = "PCI:01:00:0";
})
(lib.mkIf (cfg.model == "RTX 2060") {
sync.enable = true;
intelBusId = "PCI::00:02:0";
nvidiaBusId = "PCI:01:00:0";
})
];
}; };
}; };
environment.systemPackages = lib.mkIf (cfg.model != "") [ environment.systemPackages = lib.mkIf do-offloading [
nvidia-offload nvidia-offload
]; ];
}; };

View file

@ -1,7 +1,8 @@
{ {
imports = [ imports = [
./desktop ./openrgb
./openssh ./openssh
./pipewire
./printing ./printing
]; ];
} }

View file

@ -0,0 +1,15 @@
{ config, lib, pkgs, ... }:
let
cfg = config.sisyphus.services.openrgb;
in {
options.sisyphus.services.openrgb.enable = lib.mkEnableOption "OpenRGB";
config = lib.mkIf cfg.enable {
services.hardware.openrgb = {
enable = true;
package = pkgs.openrgb-with-all-plugins;
motherboard = "intel";
};
};
}

View file

@ -0,0 +1,25 @@
{ config, lib, pkgs, ... }:
let
cfg = config.sisyphus.services.pipewire;
in {
options.sisyphus.services.pipewire.enable = lib.mkEnableOption "Pipewire";
config = lib.mkIf cfg.enable {
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
};
}

View file

@ -38,7 +38,10 @@ in {
vistafonts # Microsoft fonts vistafonts # Microsoft fonts
]; ];
sisyphus.programs.spotify-adblock.enable = true; sisyphus = {
desktop.gnome.enable = true;
programs.spotify-adblock.enable = true;
};
home-manager.users.tdpeuter = lib.mkIf config.sisyphus.programs.home-manager.enable { home-manager.users.tdpeuter = lib.mkIf config.sisyphus.programs.home-manager.enable {
programs.home-manager.enable = true; programs.home-manager.enable = true;
@ -86,7 +89,7 @@ in {
# GNOME ricing # GNOME ricing
# Browse available settings by running: # Browse available settings by running:
# gsettings list-schemas | xargs -I % sh -c 'echo %; gsettings list-keys %' | less # gsettings list-schemas | xargs -I % sh -c 'echo %; gsettings list-keys %' | less
dconf.settings = lib.mkIf config.sisyphus.services.desktop.gnome.enable { dconf.settings = lib.mkIf config.sisyphus.desktop.gnome.enable {
"org/gnome/desktop/background" = { "org/gnome/desktop/background" = {
picture-uri = "file:///home/tdpeuter/Nextcloud/Afbeeldingen/wallpapers/bg"; picture-uri = "file:///home/tdpeuter/Nextcloud/Afbeeldingen/wallpapers/bg";
picture-uri-dark = "file:///home/tdpeuter/Nextcloud/Afbeeldingen/wallpapers/bg-dark"; picture-uri-dark = "file:///home/tdpeuter/Nextcloud/Afbeeldingen/wallpapers/bg-dark";