From 5edd8b1e01c8bf67c8d8b9685dc6645f99a0a66a Mon Sep 17 00:00:00 2001 From: xeovalyte Date: Mon, 23 Dec 2024 17:03:36 +0100 Subject: [PATCH] Migrated from import based to config based --- hosts/laptop/default.nix | 50 +++++++++++-------- modules/system/applications/common.nix | 34 +++++++++++++ modules/system/applications/steam.nix | 31 ++++++++++++ modules/system/applications/thunar.nix | 30 +++++++++++ modules/system/cli/common.nix | 19 ------- modules/system/cli/docker.nix | 22 -------- modules/system/cli/podman.nix | 19 ------- modules/system/default.nix | 26 ++++++++++ .../system/desktop-environments/cosmic.nix | 24 +++++++++ .../system/desktop-environments/hyprland.nix | 44 ++++++++++++++++ .../display-managers/cosmic-greeter.nix | 11 ++++ modules/system/display-managers/default.nix | 21 ++++++++ .../{gui => display-managers}/sddm-theme.nix | 0 modules/system/display-managers/sddm.nix | 20 ++++++++ modules/system/gui/cosmic-greeter.nix | 5 -- modules/system/gui/cosmic.nix | 9 ---- modules/system/gui/hyprland.nix | 29 ----------- modules/system/gui/noisetorch.nix | 5 -- modules/system/gui/plasma.nix | 18 ------- modules/system/gui/sddm.nix | 14 ------ modules/system/gui/steam.nix | 16 ------ modules/system/gui/sunshine.nix | 11 ---- modules/system/gui/thunar.nix | 15 ------ modules/system/hardware/amd.nix | 16 ------ modules/system/hardware/bluetooth.nix | 35 +++++++++---- modules/system/hardware/firewall.nix | 27 +++++++--- modules/system/hardware/fprint.nix | 25 ++++++++-- .../system/hardware/garbage-collection.nix | 11 ---- modules/system/hardware/laptop.nix | 24 --------- modules/system/hardware/locale.nix | 47 +++++++++++------ modules/system/hardware/printing.nix | 25 ++++++++-- modules/system/hardware/virt.nix | 12 ----- modules/system/services/docker.nix | 37 ++++++++++++++ .../system/services/garbage-collection.nix | 26 ++++++++++ modules/system/services/quickemu.nix | 27 ++++++++++ modules/system/services/sunshine.nix | 26 ++++++++++ 36 files changed, 503 insertions(+), 308 deletions(-) create mode 100644 modules/system/applications/common.nix create mode 100644 modules/system/applications/steam.nix create mode 100644 modules/system/applications/thunar.nix delete mode 100644 modules/system/cli/common.nix delete mode 100644 modules/system/cli/docker.nix delete mode 100644 modules/system/cli/podman.nix create mode 100644 modules/system/default.nix create mode 100644 modules/system/desktop-environments/cosmic.nix create mode 100644 modules/system/desktop-environments/hyprland.nix create mode 100644 modules/system/display-managers/cosmic-greeter.nix create mode 100644 modules/system/display-managers/default.nix rename modules/system/{gui => display-managers}/sddm-theme.nix (100%) create mode 100644 modules/system/display-managers/sddm.nix delete mode 100644 modules/system/gui/cosmic-greeter.nix delete mode 100644 modules/system/gui/cosmic.nix delete mode 100644 modules/system/gui/hyprland.nix delete mode 100644 modules/system/gui/noisetorch.nix delete mode 100644 modules/system/gui/plasma.nix delete mode 100644 modules/system/gui/sddm.nix delete mode 100644 modules/system/gui/steam.nix delete mode 100644 modules/system/gui/sunshine.nix delete mode 100644 modules/system/gui/thunar.nix delete mode 100644 modules/system/hardware/amd.nix delete mode 100644 modules/system/hardware/garbage-collection.nix delete mode 100644 modules/system/hardware/laptop.nix delete mode 100644 modules/system/hardware/virt.nix create mode 100644 modules/system/services/docker.nix create mode 100644 modules/system/services/garbage-collection.nix create mode 100644 modules/system/services/quickemu.nix create mode 100644 modules/system/services/sunshine.nix diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix index 949452a..e880ee4 100644 --- a/hosts/laptop/default.nix +++ b/hosts/laptop/default.nix @@ -2,31 +2,39 @@ { imports = [ + # Import hardware configuration ./hardware-configuration.nix - # GUI - ../../modules/system/gui/hyprland.nix - ../../modules/system/gui/cosmic.nix - ../../modules/system/gui/cosmic-greeter.nix - ../../modules/system/gui/steam.nix - ../../modules/system/gui/thunar.nix - - # CLI - ../../modules/system/cli/common.nix - ../../modules/system/cli/docker.nix - - # Hardware - # ../../modules/system/hardware/amd.nix - ../../modules/system/hardware/bluetooth.nix - ../../modules/system/hardware/firewall.nix - ../../modules/system/hardware/garbage-collection.nix - ../../modules/system/hardware/laptop.nix - ../../modules/system/hardware/locale.nix - ../../modules/system/hardware/printing.nix - ../../modules/system/hardware/fprint.nix - ../../modules/system/hardware/virt.nix + # Import modules + ../../modules/system/default.nix ]; + settings = { + display-manager = "cosmic-greeter"; + desktop-environments = { + cosmic.enable = true; + hyprland.enable = true; + }; + applications = { + common.enable = true; + steam.enable = true; + thunar.enable = true; + }; + services = { + docker.enable = true; + quickemu.enable = true; + sunshine.enable = false; + garbage-collection.enable = true; + }; + hardware = { + fprint.enable = true; + printing.enable = true; + bluetooth.enable = true; + firewall.enable = true; + locale.enable = true; + }; + }; + nix.settings = { experimental-features = [ "nix-command" "flakes" ]; diff --git a/modules/system/applications/common.nix b/modules/system/applications/common.nix new file mode 100644 index 0000000..512e7eb --- /dev/null +++ b/modules/system/applications/common.nix @@ -0,0 +1,34 @@ +{ pkgs, config, lib, ... }: + +with lib; + +let + cfg = config.settings.applications.common; +in { + options = { + settings.applications.common.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable common applications + ''; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + usbutils + tree + fastfetch + btop + git + yazi + + just + ]; + + environment.pathsToLink = [ "/share/zsh" ]; + + programs.zsh.enable = true; + users.defaultUserShell = pkgs.zsh; + }; +} diff --git a/modules/system/applications/steam.nix b/modules/system/applications/steam.nix new file mode 100644 index 0000000..fe059e6 --- /dev/null +++ b/modules/system/applications/steam.nix @@ -0,0 +1,31 @@ +{ config, lib, ... }: + +with lib; + +let + cfg = config.settings.applications.steam; +in { + options = { + settings.applications.steam.enable = lib.mkOption { + type = with lib.types; bool; + description = '' + Enable steam + ''; + }; + }; + + config = mkIf cfg.enable { + nixpkgs.config.allowUnfree = true; + nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "steam" + "steam-original" + "steam-run" + ]; + + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + }; + }; +} diff --git a/modules/system/applications/thunar.nix b/modules/system/applications/thunar.nix new file mode 100644 index 0000000..6fa980c --- /dev/null +++ b/modules/system/applications/thunar.nix @@ -0,0 +1,30 @@ +{ pkgs, config, lib, ... }: + +with lib; + +let + cfg = config.settings.applications.thunar; +in { + options = { + settings.applications.thunar.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable thunar file manager + ''; + }; + }; + + config = mkIf cfg.enable { + programs.thunar = { + enable = true; + plugins = with pkgs.xfce; [ + thunar-archive-plugin + thunar-volman + ]; + }; + + services.gvfs.enable = true; + services.tumbler.enable = true; + programs.file-roller.enable = true; + }; +} diff --git a/modules/system/cli/common.nix b/modules/system/cli/common.nix deleted file mode 100644 index fd66f19..0000000 --- a/modules/system/cli/common.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - usbutils - tree - fastfetch - btop - git - yazi - - just - ]; - - environment.pathsToLink = [ "/share/zsh" ]; - - programs.zsh.enable = true; - users.defaultUserShell = pkgs.zsh; -} diff --git a/modules/system/cli/docker.nix b/modules/system/cli/docker.nix deleted file mode 100644 index 6f9a138..0000000 --- a/modules/system/cli/docker.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ pkgs, ... }: - -{ - virtualisation.docker = { - enable = true; - rootless = { - enable = true; - setSocketVariable = true; - }; - }; - - users.users.xeovalyte.extraGroups = [ "docker" ]; - - security.wrappers = { - docker-rootlesskit = { - owner = "root"; - group = "root"; - capabilities = "cap_net_bind_service+ep"; - source = "${pkgs.rootlesskit}/bin/rootlesskit"; - }; - }; -} diff --git a/modules/system/cli/podman.nix b/modules/system/cli/podman.nix deleted file mode 100644 index 3d1718c..0000000 --- a/modules/system/cli/podman.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ pkgs, ... }: - -{ - virtualisation.containers.enable = true; - - virtualisation.podman = { - enable = true; - dockerCompat = true; - defaultNetwork.settings.dns_enabled = true; - }; - - virtualisation.oci-containers.backend = "podman"; - - environment.systemPackages = with pkgs; [ - dive - podman-tui - podman-compose - ]; -} diff --git a/modules/system/default.nix b/modules/system/default.nix new file mode 100644 index 0000000..8d7899e --- /dev/null +++ b/modules/system/default.nix @@ -0,0 +1,26 @@ +{ ... }: + +{ + imports = [ + ./applications/common.nix + ./applications/steam.nix + ./applications/thunar.nix + + ./services/docker.nix + ./services/quickemu.nix + ./services/sunshine.nix + ./services/garbage-collection.nix + + ./hardware/bluetooth.nix + ./hardware/fprint.nix + ./hardware/locale.nix + # ./hardware/nvidia.nix + ./hardware/firewall.nix + ./hardware/printing.nix + + ./desktop-environments/cosmic.nix + ./desktop-environments/hyprland.nix + + ./display-managers/default.nix + ]; +} diff --git a/modules/system/desktop-environments/cosmic.nix b/modules/system/desktop-environments/cosmic.nix new file mode 100644 index 0000000..4ccd6ee --- /dev/null +++ b/modules/system/desktop-environments/cosmic.nix @@ -0,0 +1,24 @@ +{ lib, config, ... }: + +with lib; + +let + cfg = config.settings.desktop-environments.cosmic; +in { + options = { + settings.desktop-environments.cosmic.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable cosmic desktop environment + ''; + }; + }; + + config = mkIf cfg.enable { + services.desktopManager.cosmic.enable = true; + + environment.sessionVariables = { + COSMIC_DISABLE_DIRECT_SCANOUT = "true"; + }; + }; +} diff --git a/modules/system/desktop-environments/hyprland.nix b/modules/system/desktop-environments/hyprland.nix new file mode 100644 index 0000000..1178883 --- /dev/null +++ b/modules/system/desktop-environments/hyprland.nix @@ -0,0 +1,44 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.settings.desktop-environments.hyprland; +in { + options = { + settings.desktop-environments.hyprland.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable hyprland window manager + ''; + }; + }; + + config = mkIf cfg.enable { + programs.hyprland = { + enable = true; + package = pkgs.unstable.hyprland; + xwayland.enable = true; + }; + + # Sound configuration + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Keyring configuration + security.polkit.enable = true; + services.gnome.gnome-keyring.enable = true; + security.pam.services.greetd.enableGnomeKeyring = true; + programs.ssh.startAgent = true; + + # Configure networking + networking.networkmanager.enable = true; + networking.wireless.iwd.enable = true; + }; +} diff --git a/modules/system/display-managers/cosmic-greeter.nix b/modules/system/display-managers/cosmic-greeter.nix new file mode 100644 index 0000000..31541ed --- /dev/null +++ b/modules/system/display-managers/cosmic-greeter.nix @@ -0,0 +1,11 @@ +{ lib, config, ... }: + +with lib; + +let + cfg = config.settings.display-manager; +in { + config = mkIf (cfg == "cosmic-greeter") { + services.displayManager.cosmic-greeter.enable = true; + }; +} diff --git a/modules/system/display-managers/default.nix b/modules/system/display-managers/default.nix new file mode 100644 index 0000000..8679f3f --- /dev/null +++ b/modules/system/display-managers/default.nix @@ -0,0 +1,21 @@ +{ lib, ... }: + +with lib; + +let + cfg = config.settings.display-manager; +in { + options = { + settings.display-manager = lib.mkOption { + type = lib.types.enum ["sddm" "cosmic-greeter"]; + description = '' + Specify which display manager to use + ''; + }; + }; + + imports = [ + ./sddm.nix + ./cosmic-greeter.nix + ]; +} diff --git a/modules/system/gui/sddm-theme.nix b/modules/system/display-managers/sddm-theme.nix similarity index 100% rename from modules/system/gui/sddm-theme.nix rename to modules/system/display-managers/sddm-theme.nix diff --git a/modules/system/display-managers/sddm.nix b/modules/system/display-managers/sddm.nix new file mode 100644 index 0000000..f9e72d9 --- /dev/null +++ b/modules/system/display-managers/sddm.nix @@ -0,0 +1,20 @@ +{ pkgs, lib, config, ... }: + +with lib; + +let + cfg = config.settings.display-manager; +in { + config = mkIf (cfg == "sddm") { + environment.systemPackages = with pkgs; [ + libsForQt5.qt5.qtquickcontrols2 + libsForQt5.qt5.qtgraphicaleffects + ]; + + services.displayManager.sddm = { + enable = true; + wayland.enable = true; + theme = "${import ./sddm-theme.nix { inherit pkgs; }}"; + }; + }; +} diff --git a/modules/system/gui/cosmic-greeter.nix b/modules/system/gui/cosmic-greeter.nix deleted file mode 100644 index 36f33d2..0000000 --- a/modules/system/gui/cosmic-greeter.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - services.displayManager.cosmic-greeter.enable = true; -} diff --git a/modules/system/gui/cosmic.nix b/modules/system/gui/cosmic.nix deleted file mode 100644 index b936e94..0000000 --- a/modules/system/gui/cosmic.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ ... }: - -{ - services.desktopManager.cosmic.enable = true; - - environment.sessionVariables = { - COSMIC_DISABLE_DIRECT_SCANOUT = "true"; - }; -} diff --git a/modules/system/gui/hyprland.nix b/modules/system/gui/hyprland.nix deleted file mode 100644 index ca6dd78..0000000 --- a/modules/system/gui/hyprland.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ config, pkgs, ... }: - -{ - programs.hyprland = { - enable = true; - package = pkgs.unstable.hyprland; - xwayland.enable = true; - }; - - # Sound configuration - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - - # Keyring configuration - security.polkit.enable = true; - services.gnome.gnome-keyring.enable = true; - security.pam.services.greetd.enableGnomeKeyring = true; - programs.ssh.startAgent = true; - - # Configure networking - networking.networkmanager.enable = true; - networking.wireless.iwd.enable = true; -} diff --git a/modules/system/gui/noisetorch.nix b/modules/system/gui/noisetorch.nix deleted file mode 100644 index 41434d6..0000000 --- a/modules/system/gui/noisetorch.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: - -{ - programs.noisetorch.enable = true; -} diff --git a/modules/system/gui/plasma.nix b/modules/system/gui/plasma.nix deleted file mode 100644 index 7dfc6d7..0000000 --- a/modules/system/gui/plasma.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ pkgs, ... }: - -{ - services.displayManager.sddm.enable = true; - services.displayManager.sddm.wayland.enable = true; - - services.desktopManager.plasma6.enable = true; - - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; -} diff --git a/modules/system/gui/sddm.nix b/modules/system/gui/sddm.nix deleted file mode 100644 index a6f9521..0000000 --- a/modules/system/gui/sddm.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = with pkgs; [ - libsForQt5.qt5.qtquickcontrols2 - libsForQt5.qt5.qtgraphicaleffects - ]; - - services.displayManager.sddm = { - enable = true; - wayland.enable = true; - theme = "${import ./sddm-theme.nix { inherit pkgs; }}"; - }; -} diff --git a/modules/system/gui/steam.nix b/modules/system/gui/steam.nix deleted file mode 100644 index fa52670..0000000 --- a/modules/system/gui/steam.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, lib, nixpkgs, ... }: - -{ - nixpkgs.config.allowUnfree = true; - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - "steam" - "steam-original" - "steam-run" - ]; - - programs.steam = { - enable = true; - remotePlay.openFirewall = true; - dedicatedServer.openFirewall = true; - }; -} diff --git a/modules/system/gui/sunshine.nix b/modules/system/gui/sunshine.nix deleted file mode 100644 index a9ec115..0000000 --- a/modules/system/gui/sunshine.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: - -{ - services.sunshine = { - enable = true; - package = pkgs.unstable.sunshine.override { cudaSupport = true; }; - autoStart = true; - capSysAdmin = true; - openFirewall = true; - }; -} diff --git a/modules/system/gui/thunar.nix b/modules/system/gui/thunar.nix deleted file mode 100644 index ed54653..0000000 --- a/modules/system/gui/thunar.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs, ... }: - -{ - programs.thunar = { - enable = true; - plugins = with pkgs.xfce; [ - thunar-archive-plugin - thunar-volman - ]; - }; - - services.gvfs.enable = true; - services.tumbler.enable = true; - programs.file-roller.enable = true; -} diff --git a/modules/system/hardware/amd.nix b/modules/system/hardware/amd.nix deleted file mode 100644 index e85f44a..0000000 --- a/modules/system/hardware/amd.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ pkgs, ... }: - -{ - hardware.graphics = { - enable = true; - enable32Bit = true; - }; - - hardware.graphics.extraPackages = with pkgs; [ - amdvlk - ]; - - hardware.graphics.extraPackages32 = with pkgs; [ - driversi686Linux.amdvlk - ]; -} diff --git a/modules/system/hardware/bluetooth.nix b/modules/system/hardware/bluetooth.nix index 0921b77..36905a5 100644 --- a/modules/system/hardware/bluetooth.nix +++ b/modules/system/hardware/bluetooth.nix @@ -1,15 +1,30 @@ -{ pkgs, ... }: +{ config, lib, ... }: -{ - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - settings = { - General = { - Enable = "Source,Sink,Media,Socket"; - }; +with lib; + +let + cfg = config.settings.hardware.bluetooth; +in { + options = { + settings.hardware.bluetooth.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable bluetooth + ''; }; }; - services.blueman.enable = true; + config = mkIf cfg.enable { + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + settings = { + General = { + Enable = "Source,Sink,Media,Socket"; + }; + }; + }; + + services.blueman.enable = true; + }; } diff --git a/modules/system/hardware/firewall.nix b/modules/system/hardware/firewall.nix index 7b9bb93..83c1d32 100644 --- a/modules/system/hardware/firewall.nix +++ b/modules/system/hardware/firewall.nix @@ -1,9 +1,24 @@ -{ ... }: +{ config, lib, ... }: -{ - networking.firewall = { - enable = true; - allowedTCPPorts = [ ]; - allowedUDPPorts = [ ]; +with lib; + +let + cfg = config.settings.hardware.firewall; +in { + options = { + settings.hardware.firewall.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable firewall + ''; + }; + }; + + config = mkIf cfg.enable { + networking.firewall = { + enable = true; + allowedTCPPorts = [ ]; + allowedUDPPorts = [ ]; + }; }; } diff --git a/modules/system/hardware/fprint.nix b/modules/system/hardware/fprint.nix index 2b2593c..04cbcbe 100644 --- a/modules/system/hardware/fprint.nix +++ b/modules/system/hardware/fprint.nix @@ -1,8 +1,23 @@ -{ lib, pkgs, ... }: +{ config, lib, ... }: -{ - services.fprintd.enable = true; +with lib; - security.pam.services.login.fprintAuth = false; - security.pam.services.cosmic-greeter.fprintAuth = false; +let + cfg = config.settings.hardware.fprint; +in { + options = { + settings.hardware.fprint.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable fingerprint + ''; + }; + }; + + config = mkIf cfg.enable { + services.fprintd.enable = true; + + security.pam.services.login.fprintAuth = false; + security.pam.services.cosmic-greeter.fprintAuth = false; + }; } diff --git a/modules/system/hardware/garbage-collection.nix b/modules/system/hardware/garbage-collection.nix deleted file mode 100644 index dcf217e..0000000 --- a/modules/system/hardware/garbage-collection.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ ... }: - -{ - nix.gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 1w"; - }; - - nix.settings.auto-optimise-store = true; -} diff --git a/modules/system/hardware/laptop.nix b/modules/system/hardware/laptop.nix deleted file mode 100644 index 48dbd88..0000000 --- a/modules/system/hardware/laptop.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ ... }: - -{ - # services.auto-cpufreq.enable = true; - # services.auto-cpufreq.settings = { - # battery = { - # governor = "powersave"; - # turbo = "never"; - # }; - # charger = { - # governor = "performance"; - # turbo = "auto"; - # }; - # }; - - services.power-profiles-daemon.enable = true; - - boot.extraModprobeConfig = '' - options snd_hda_intel power_save=0 - ''; - - # powerManagement.powertop.enable = true; -} - diff --git a/modules/system/hardware/locale.nix b/modules/system/hardware/locale.nix index f12783d..69b5eb9 100644 --- a/modules/system/hardware/locale.nix +++ b/modules/system/hardware/locale.nix @@ -1,21 +1,36 @@ -{ ... }: +{ config, lib, ... }: -{ - # Set your time zone. - time.timeZone = "Europe/Amsterdam"; +with lib; - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; +let + cfg = config.settings.hardware.locale; +in { + options = { + settings.hardware.locale.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable locale configuration + ''; + }; + }; - i18n.extraLocaleSettings = { - LC_ADDRESS = "nl_NL.UTF-8"; - LC_IDENTIFICATION = "nl_NL.UTF-8"; - LC_MEASUREMENT = "nl_NL.UTF-8"; - LC_MONETARY = "nl_NL.UTF-8"; - LC_NAME = "nl_NL.UTF-8"; - LC_NUMERIC = "nl_NL.UTF-8"; - LC_PAPER = "nl_NL.UTF-8"; - LC_TELEPHONE = "nl_NL.UTF-8"; - LC_TIME = "nl_NL.UTF-8"; + config = mkIf cfg.enable { + # Set your time zone. + time.timeZone = "Europe/Amsterdam"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "nl_NL.UTF-8"; + LC_IDENTIFICATION = "nl_NL.UTF-8"; + LC_MEASUREMENT = "nl_NL.UTF-8"; + LC_MONETARY = "nl_NL.UTF-8"; + LC_NAME = "nl_NL.UTF-8"; + LC_NUMERIC = "nl_NL.UTF-8"; + LC_PAPER = "nl_NL.UTF-8"; + LC_TELEPHONE = "nl_NL.UTF-8"; + LC_TIME = "nl_NL.UTF-8"; + }; }; } diff --git a/modules/system/hardware/printing.nix b/modules/system/hardware/printing.nix index 91f6389..1f4f43d 100644 --- a/modules/system/hardware/printing.nix +++ b/modules/system/hardware/printing.nix @@ -1,8 +1,23 @@ -{ pkgs, ... }: +{ config, lib, pkgs, ... }: -{ - services.printing = { - enable = true; - drivers = [ pkgs.hplip ]; +with lib; + +let + cfg = config.settings.hardware.printing; +in { + options = { + settings.hardware.printing.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable printer configuration + ''; + }; + }; + + config = mkIf cfg.enable { + services.printing = { + enable = true; + drivers = [ pkgs.hplip ]; + }; }; } diff --git a/modules/system/hardware/virt.nix b/modules/system/hardware/virt.nix deleted file mode 100644 index a08d6f9..0000000 --- a/modules/system/hardware/virt.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ pkgs, ... }: - -{ - virtualisation.libvirtd.enable = true; - programs.virt-manager.enable = true; - - users.users.xeovalyte.extraGroups = [ "libvirtd" ]; - - environment.systemPackages = with pkgs; [ - quickemu - ]; -} diff --git a/modules/system/services/docker.nix b/modules/system/services/docker.nix new file mode 100644 index 0000000..4bf70c9 --- /dev/null +++ b/modules/system/services/docker.nix @@ -0,0 +1,37 @@ +{ pkgs, lib, config, ... }: + +with lib; + +let + cfg = config.settings.services.docker; +in { + options = { + settings.services.docker.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable docker configuration + ''; + }; + }; + + config = mkIf cfg.enable { + virtualisation.docker = { + enable = true; + rootless = { + enable = true; + setSocketVariable = true; + }; + }; + + users.users.xeovalyte.extraGroups = [ "docker" ]; + + security.wrappers = { + docker-rootlesskit = { + owner = "root"; + group = "root"; + capabilities = "cap_net_bind_service+ep"; + source = "${pkgs.rootlesskit}/bin/rootlesskit"; + }; + }; + }; +} diff --git a/modules/system/services/garbage-collection.nix b/modules/system/services/garbage-collection.nix new file mode 100644 index 0000000..945b02b --- /dev/null +++ b/modules/system/services/garbage-collection.nix @@ -0,0 +1,26 @@ +{ config, lib, ... }: + +with lib; + +let + cfg = config.settings.services.garbage-collection; +in { + options = { + settings.services.garbage-collection.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable garbage collection of nix store + ''; + }; + }; + + config = mkIf cfg.enable { + nix.gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 1w"; + }; + + nix.settings.auto-optimise-store = true; + }; +} diff --git a/modules/system/services/quickemu.nix b/modules/system/services/quickemu.nix new file mode 100644 index 0000000..7b87145 --- /dev/null +++ b/modules/system/services/quickemu.nix @@ -0,0 +1,27 @@ +{ pkgs, config, lib, ... }: + +with lib; + +let + cfg = config.settings.services.quickemu; +in { + options = { + settings.services.quickemu.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable quickemu virtualisation + ''; + }; + }; + + config = mkIf cfg.enable { + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + + users.users.xeovalyte.extraGroups = [ "libvirtd" ]; + + environment.systemPackages = with pkgs; [ + quickemu + ]; + }; +} diff --git a/modules/system/services/sunshine.nix b/modules/system/services/sunshine.nix new file mode 100644 index 0000000..622c4ab --- /dev/null +++ b/modules/system/services/sunshine.nix @@ -0,0 +1,26 @@ +{ pkgs, config, lib, ... }: + +with lib; + +let + cfg = config.settings.services.sunshine; +in { + options = { + settings.services.sunshine.enable = lib.mkOption { + type = lib.types.bool; + description = '' + Enable sunshine service + ''; + }; + }; + + config = mkIf cfg.enable { + services.sunshine = { + enable = true; + package = pkgs.unstable.sunshine.override { cudaSupport = true; }; + autoStart = true; + capSysAdmin = true; + openFirewall = true; + }; + }; +}