diff --git a/nixos/flake.nix b/nixos/flake.nix index 34e699a..8607295 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -35,9 +35,10 @@ inherit self inputs; channelsConfig.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [ - "nvidia-x11" - "nvidia-settings" "corefonts" + "nvidia-settings" + "nvidia-x11" + "Oracle_VM_VirtualBox_Extension_Pack" "vista-fonts" ]; diff --git a/nixos/hosts/Tibo-NixDesk/default.nix b/nixos/hosts/Tibo-NixDesk/default.nix index afb4b3b..b114570 100644 --- a/nixos/hosts/Tibo-NixDesk/default.nix +++ b/nixos/hosts/Tibo-NixDesk/default.nix @@ -1,64 +1,86 @@ { config, pkgs, ... }: { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ../../modules/hardware/nvidia.nix - ../../modules/hardware/corsair + imports = [ + ./hardware-configuration.nix + ]; - ../../modules/apps/virtualbox - ../../modules/des/gnome - ]; + sisyphus = { + hardware.nvidia = { + enable = true; + model = "RTX 2060"; + }; - # Bootloader. - boot.loader = { - systemd-boot.enable = true; - efi = { - canTouchEfiVariables = true; - efiSysMountPoint = "/boot/efi"; - }; + programs = { + home-manager.enable = true; + sops.enable = true; + ssh.enable = true; + }; + + 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 = { - hostName = "Tibo-NixDesk"; - networkmanager.enable = true; - # wireless.enable = true; # Enables wireless support via wpa_supplicant. + hostName = "Tibo-NixDesk"; + networkmanager.enable = true; + # 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"; + + 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. + }; } diff --git a/nixos/hosts/Tibo-NixFat/default.nix b/nixos/hosts/Tibo-NixFat/default.nix index e88cf35..d8970a4 100644 --- a/nixos/hosts/Tibo-NixFat/default.nix +++ b/nixos/hosts/Tibo-NixFat/default.nix @@ -3,24 +3,25 @@ { imports = [ ./hardware-configuration.nix - ../../modules-old ]; sisyphus = { - users.tdpeuter.enable = true; - - hardware.nvidia.enable = true; - hardware.nvidia.model = "Quadro T2000"; + hardware.nvidia = { + enable = true; + model = "Quadro T2000"; + }; programs = { home-manager.enable = true; sops.enable = true; ssh.enable = true; }; + services = { - desktop.gnome.enable = true; - printing.enable = true; + pipewire.enable = true; }; + + users.tdpeuter.enable = true; }; boot = { @@ -83,21 +84,30 @@ networking = { networkmanager.enable = true; }; - - # 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; + + 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. }; } diff --git a/nixos/modules-old/hardware/corsair/default.nix b/nixos/modules-old/hardware/corsair/default.nix deleted file mode 100644 index c67bd77..0000000 --- a/nixos/modules-old/hardware/corsair/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, pkgs, ... }: - -{ - services.hardware.openrgb = { - enable = true; - package = pkgs.openrgb-with-all-plugins; - motherboard = "intel"; - }; -} diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix index 5f5812b..7c3c16f 100644 --- a/nixos/modules/default.nix +++ b/nixos/modules/default.nix @@ -1,5 +1,6 @@ { imports = [ + ./desktop ./hardware ./programs ./services diff --git a/nixos/modules/services/desktop/default.nix b/nixos/modules/desktop/default.nix similarity index 100% rename from nixos/modules/services/desktop/default.nix rename to nixos/modules/desktop/default.nix diff --git a/nixos/modules/services/desktop/gnome/default.nix b/nixos/modules/desktop/gnome/default.nix similarity index 91% rename from nixos/modules/services/desktop/gnome/default.nix rename to nixos/modules/desktop/gnome/default.nix index 186155e..dfe804e 100644 --- a/nixos/modules/services/desktop/gnome/default.nix +++ b/nixos/modules/desktop/gnome/default.nix @@ -1,9 +1,9 @@ { config, lib, pkgs, ... }: let - cfg = config.sisyphus.services.desktop.gnome; + cfg = config.sisyphus.desktop.gnome; in { - options.sisyphus.services.desktop.gnome.enable = lib.mkEnableOption "GNOME"; + options.sisyphus.desktop.gnome.enable = lib.mkEnableOption "GNOME"; config = lib.mkIf cfg.enable { services.xserver = { diff --git a/nixos/modules/hardware/nvidia/default.nix b/nixos/modules/hardware/nvidia/default.nix index 701fcac..077520d 100644 --- a/nixos/modules/hardware/nvidia/default.nix +++ b/nixos/modules/hardware/nvidia/default.nix @@ -3,6 +3,7 @@ let cfg = config.sisyphus.hardware.nvidia; + do-offloading = builtins.elem cfg.model [ "Quadro T2000" ]; nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" '' export __NV_PRIME_RENDER_OFFLOAD=1 export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 @@ -35,24 +36,33 @@ in { open = true; package = config.boot.kernelPackages.nvidiaPackages.stable; modesetting.enable = true; - nvidiaSettings = config.sisyphus.hardware.nvidia.gui-settings; + nvidiaSettings = cfg.gui-settings; powerManagement = { - enable = true; - finegrained = true; + enable = do-offloading; + finegrained = do-offloading; }; - prime = lib.mkIf (cfg.model == "Quadro T2000") { - offload = { - enable = true; - enableOffloadCmd = true; - }; - intelBusId = "PCI::00:02:0"; - nvidiaBusId = "PCI:01:00:0"; - }; + prime = lib.mkMerge [ + (lib.mkIf do-offloading { + offload = { + enable = true; + enableOffloadCmd = true; + }; + }) + (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 ]; }; diff --git a/nixos/modules/services/default.nix b/nixos/modules/services/default.nix index 9fc4c37..8094bfa 100644 --- a/nixos/modules/services/default.nix +++ b/nixos/modules/services/default.nix @@ -1,7 +1,8 @@ { imports = [ - ./desktop + ./openrgb ./openssh + ./pipewire ./printing ]; } diff --git a/nixos/modules/services/openrgb/default.nix b/nixos/modules/services/openrgb/default.nix new file mode 100644 index 0000000..1898a0f --- /dev/null +++ b/nixos/modules/services/openrgb/default.nix @@ -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"; + }; + }; +} diff --git a/nixos/modules/services/pipewire/default.nix b/nixos/modules/services/pipewire/default.nix new file mode 100644 index 0000000..09393f0 --- /dev/null +++ b/nixos/modules/services/pipewire/default.nix @@ -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; + }; + }; +} diff --git a/nixos/users/tdpeuter/default.nix b/nixos/users/tdpeuter/default.nix index 20db00d..64fe307 100644 --- a/nixos/users/tdpeuter/default.nix +++ b/nixos/users/tdpeuter/default.nix @@ -38,7 +38,10 @@ in { 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 { programs.home-manager.enable = true; @@ -85,7 +88,7 @@ in { # GNOME ricing # Browse available settings by running: # 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" = { picture-uri = "file:///home/tdpeuter/Nextcloud/Afbeeldingen/wallpapers/bg"; picture-uri-dark = "file:///home/tdpeuter/Nextcloud/Afbeeldingen/wallpapers/bg-dark";