diff --git a/flake.nix b/flake.nix index b1793461..cb9057a0 100644 --- a/flake.nix +++ b/flake.nix @@ -186,7 +186,23 @@ hw-framework-13-intel-11th = import ./hwModules/framework/13/intel-11th; hw-thinkpad-t440p = import ./hwModules/thinkpad/t440p; - nixos = import ./nixosModules self; + nixos-desktop-gnome = import ./nixosModules/desktop/gnome.nix; + nixos-desktop-gui = import ./nixosModules/desktop/gui.nix; + nixos-desktop-hyprland = import ./nixosModules/desktop/hyprland.nix; + nixos-desktop-kde = import ./nixosModules/desktop/kde.nix; + + nixos-profiles-desktop = import ./nixosModules/profiles/desktop.nix; + + nixos-programs-firefox = import ./nixosModules/programs/firefox.nix; + nixos-programs-nicotine-plus = import ./nixosModules/programs/nicotine-plus.nix; + nixos-programs-podman = import ./nixosModules/programs/podman.nix; + nixos-programs-steam = import ./nixosModules/programs/steam.nix; + nixos-programs-virt-manager = import ./nixosModules/programs/virt-manager.nix; + + nixos-services-flatpak = import ./nixosModules/services/flatpak.nix; + nixos-services-greetd = import ./nixosModules/services/greetd.nix; + nixos-services-sddm = import ./nixosModules/services/sddm.nix; + users = import ./userModules self; }; @@ -203,7 +219,6 @@ self.inputs.home-manager.nixosModules.home-manager self.inputs.lanzaboote.nixosModules.lanzaboote self.inputs.stylix.nixosModules.stylix - self.nixosModules.nixos self.nixosModules.users { home-manager = { diff --git a/homeManagerModules/options.nix b/homeManagerModules/options.nix index eb92e102..ec38757e 100644 --- a/homeManagerModules/options.nix +++ b/homeManagerModules/options.nix @@ -1,7 +1,6 @@ { config, lib, - osConfig, pkgs, ... }: let @@ -100,18 +99,10 @@ in { type = lib.types.bool; }; - gnome.enable = lib.mkOption { - description = "GNOME with sane defaults."; - default = osConfig.ar.desktop.gnome.enable or false; - type = lib.types.bool; - }; + gnome.enable = lib.mkEnableOption "GNOME with sane defaults."; hyprland = { - enable = lib.mkOption { - description = "Hyprland with full desktop session components."; - default = osConfig.ar.desktop.hyprland.enable or false; - type = lib.types.bool; - }; + enable = lib.mkEnableOption "Hyprland with full desktop session components."; laptopMonitors = lib.mkOption { description = "List of internal laptop monitors."; @@ -136,11 +127,7 @@ in { }; }; - kde.enable = lib.mkOption { - description = "KDE Plasma with sane defaults."; - default = osConfig.ar.desktop.kde.enable or false; - type = lib.types.bool; - }; + kde.enable = lib.mkEnableOption "KDE Plasma with sane defaults."; windowManagerBinds = lib.mkOption { description = "Default binds for window management."; @@ -160,11 +147,7 @@ in { }; }; - laptopMode = lib.mkOption { - description = "Enable laptop configuration."; - default = osConfig.ar.laptopMode or false; - type = lib.types.bool; - }; + laptopMode = lib.mkEnableOption "Enable laptop configuration."; services = { easyeffects = { diff --git a/hosts/fallarbor/default.nix b/hosts/fallarbor/default.nix index a46d8852..ad0ca1da 100644 --- a/hosts/fallarbor/default.nix +++ b/hosts/fallarbor/default.nix @@ -16,43 +16,32 @@ self.nixosModules.common-systemd-boot self.nixosModules.common-wifi-profiles self.nixosModules.hw-framework-13-intel-11th + self.nixosModules.nixos-desktop-kde + self.nixosModules.nixos-profiles-desktop + self.nixosModules.nixos-programs-firefox + self.nixosModules.nixos-programs-steam + self.nixosModules.nixos-services-sddm ]; environment.variables.GDK_SCALE = "1.5"; networking.hostName = "fallarbor"; system.stateVersion = "24.05"; - ar = { - apps = { - firefox.enable = true; - steam.enable = true; - }; - - desktop = { - desktopOptimizations.enable = true; - kde.enable = true; - sddm.enable = true; - }; - - laptopMode = true; - services.flatpak.enable = true; + ar.users = { + aly = { + enable = true; + password = "$y$j9T$0p6rc4p5sn0LJ/6XyAGP7.$.wmTafwMMscdW1o8kqqoHJP7U8kF.4WBmzzcPYielR3"; - users = { - aly = { + syncthing = { enable = true; - password = "$y$j9T$0p6rc4p5sn0LJ/6XyAGP7.$.wmTafwMMscdW1o8kqqoHJP7U8kF.4WBmzzcPYielR3"; - - syncthing = { - enable = true; - certFile = config.age.secrets.syncthingCert.path; - keyFile = config.age.secrets.syncthingKey.path; - }; + certFile = config.age.secrets.syncthingCert.path; + keyFile = config.age.secrets.syncthingKey.path; }; + }; - dustin = { - enable = true; - password = "$y$j9T$OXQYhj4IWjRJWWYsSwcqf.$lCcdq9S7m0EAdej9KMHWj9flH8K2pUb2gitNhLTlLG/"; - }; + dustin = { + enable = true; + password = "$y$j9T$OXQYhj4IWjRJWWYsSwcqf.$lCcdq9S7m0EAdej9KMHWj9flH8K2pUb2gitNhLTlLG/"; }; }; } diff --git a/hosts/fallarbor/home.nix b/hosts/fallarbor/home.nix index 2dba0c03..77b67e03 100644 --- a/hosts/fallarbor/home.nix +++ b/hosts/fallarbor/home.nix @@ -4,6 +4,7 @@ { ar.home = { desktop.hyprland.laptopMonitors = ["desc:BOE 0x095F,preferred,auto,1.566667"]; + laptopMode = true; services = { easyeffects = { diff --git a/hosts/lavaridge/default.nix b/hosts/lavaridge/default.nix index 571cac2d..84e25c74 100644 --- a/hosts/lavaridge/default.nix +++ b/hosts/lavaridge/default.nix @@ -20,8 +20,12 @@ self.nixosModules.common-pkgs self.nixosModules.common-tailscale self.nixosModules.common-wifi-profiles - # self.nixosModules.hw-common-gaming self.nixosModules.hw-framework-13-amd-7000 + self.nixosModules.nixos-desktop-gnome + self.nixosModules.nixos-profiles-desktop + self.nixosModules.nixos-programs-firefox + self.nixosModules.nixos-programs-podman + self.nixosModules.nixos-programs-steam ]; environment.variables.GDK_SCALE = "2"; @@ -53,31 +57,16 @@ system.stateVersion = "24.05"; - ar = { - apps = { - firefox.enable = true; - podman.enable = true; - steam.enable = true; - }; - - desktop = { - desktopOptimizations.enable = true; - gnome.enable = true; - }; + ar.users.aly = { + enable = true; + password = "$y$j9T$NSS7QcEtN4yiigPyofwlI/$nxdgz0lpySa0heDMjGlHe1gX3BWf48jK6Tkfg4xMEs6"; - laptopMode = true; - - users.aly = { + syncthing = { enable = true; - password = "$y$j9T$NSS7QcEtN4yiigPyofwlI/$nxdgz0lpySa0heDMjGlHe1gX3BWf48jK6Tkfg4xMEs6"; - - syncthing = { - enable = true; - certFile = config.age.secrets.syncthingCert.path; - keyFile = config.age.secrets.syncthingKey.path; - syncMusic = true; - syncROMs = true; - }; + certFile = config.age.secrets.syncthingCert.path; + keyFile = config.age.secrets.syncthingKey.path; + syncMusic = true; + syncROMs = true; }; }; } diff --git a/hosts/lavaridge/home.nix b/hosts/lavaridge/home.nix index 3b51444b..2c801a6b 100644 --- a/hosts/lavaridge/home.nix +++ b/hosts/lavaridge/home.nix @@ -4,6 +4,7 @@ { ar.home = { desktop.hyprland.laptopMonitors = ["desc:BOE NE135A1M-NY1,2880x1920@60, 0x0, 2, vrr, 0"]; + laptopMode = true; services = { easyeffects = { diff --git a/hosts/mauville/default.nix b/hosts/mauville/default.nix index 8160b237..59486e87 100644 --- a/hosts/mauville/default.nix +++ b/hosts/mauville/default.nix @@ -27,11 +27,20 @@ in { self.nixosModules.hw-common-amd-gpu self.nixosModules.hw-common-bluetooth self.nixosModules.hw-common-ssd + self.nixosModules.nixos-desktop-kde + self.nixosModules.nixos-profiles-desktop + self.nixosModules.nixos-programs-firefox + self.nixosModules.nixos-programs-nicotine-plus + self.nixosModules.nixos-programs-podman + self.nixosModules.nixos-programs-steam + self.nixosModules.nixos-services-sddm ]; boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" "r8169"]; networking.hostName = "mauville"; + sddm.autologin = "aly"; + services = { samba = { enable = true; @@ -88,43 +97,24 @@ in { system.stateVersion = "24.05"; - ar = { - apps = { - firefox.enable = true; - nicotine-plus.enable = true; - podman.enable = true; - steam.enable = true; - }; - - desktop = { - desktopOptimizations.enable = true; - kde.enable = true; + ar.users = { + aly = { + enable = true; + password = "$y$j9T$SHPShqI2IpRE101Ey2ry/0$0mhW1f9LbVY02ifhJlP9XVImge9HOpf23s9i1JFLIt9"; - sddm = { + syncthing = { enable = true; - autologin = "aly"; + certFile = config.age.secrets.syncthingCert.path; + keyFile = config.age.secrets.syncthingKey.path; + musicPath = "${mediaDirectory}/Music"; + syncMusic = true; + syncROMs = true; }; }; - users = { - aly = { - enable = true; - password = "$y$j9T$SHPShqI2IpRE101Ey2ry/0$0mhW1f9LbVY02ifhJlP9XVImge9HOpf23s9i1JFLIt9"; - - syncthing = { - enable = true; - certFile = config.age.secrets.syncthingCert.path; - keyFile = config.age.secrets.syncthingKey.path; - musicPath = "${mediaDirectory}/Music"; - syncMusic = true; - syncROMs = true; - }; - }; - - dustin = { - enable = false; - password = "$y$j9T$3mMCBnUQ.xjuPIbSof7w0.$fPtRGblPRSwRLj7TFqk1nzuNQk2oVlgvb/bE47sghl."; - }; + dustin = { + enable = false; + password = "$y$j9T$3mMCBnUQ.xjuPIbSof7w0.$fPtRGblPRSwRLj7TFqk1nzuNQk2oVlgvb/bE47sghl."; }; }; } diff --git a/hosts/rustboro/default.nix b/hosts/rustboro/default.nix index a340c018..f22ba7cb 100644 --- a/hosts/rustboro/default.nix +++ b/hosts/rustboro/default.nix @@ -20,38 +20,30 @@ self.nixosModules.common-tailscale self.nixosModules.common-wifi-profiles self.nixosModules.hw-thinkpad-t440p + self.nixosModules.nixos-desktop-hyprland + self.nixosModules.nixos-profiles-desktop + self.nixosModules.nixos-programs-firefox + self.nixosModules.nixos-services-greetd ]; environment.variables.GDK_SCALE = "1.25"; - networking.hostName = "rustboro"; - system.stateVersion = "24.05"; - - ar = { - apps.firefox.enable = true; - - desktop = { - desktopOptimizations.enable = true; - - greetd = { - enable = true; - autologin = "aly"; - session = lib.getExe config.programs.hyprland.package; - }; - hyprland.enable = true; - }; + greetd = { + autologin = "aly"; + session = lib.getExe config.programs.hyprland.package; + }; - laptopMode = true; + networking.hostName = "rustboro"; + system.stateVersion = "24.05"; - users.aly = { + ar.users.aly = { + enable = true; + password = "$y$j9T$VMCXwk0X5m6xW6FGLc39F/$r9gmyeB70RCq3k4oLPHFZyy7wng6WyX2xYMKLO/A.rB"; + syncthing = { enable = true; - password = "$y$j9T$VMCXwk0X5m6xW6FGLc39F/$r9gmyeB70RCq3k4oLPHFZyy7wng6WyX2xYMKLO/A.rB"; - syncthing = { - enable = true; - certFile = config.age.secrets.syncthingCert.path; - keyFile = config.age.secrets.syncthingKey.path; - syncMusic = true; - }; + certFile = config.age.secrets.syncthingCert.path; + keyFile = config.age.secrets.syncthingKey.path; + syncMusic = true; }; }; } diff --git a/hosts/rustboro/home.nix b/hosts/rustboro/home.nix index c49066c2..3cda5278 100644 --- a/hosts/rustboro/home.nix +++ b/hosts/rustboro/home.nix @@ -5,6 +5,8 @@ ar.home = { desktop.hyprland.laptopMonitors = ["desc:LG Display 0x0569,preferred,auto,1.25"]; + laptopMode = true; + services = { easyeffects = { enable = true; diff --git a/hosts/slateport/default.nix b/hosts/slateport/default.nix index 66dc3eaa..e045c5a4 100644 --- a/hosts/slateport/default.nix +++ b/hosts/slateport/default.nix @@ -21,6 +21,7 @@ self.nixosModules.hw-common-intel-cpu self.nixosModules.hw-common-intel-gpu self.nixosModules.hw-common-ssd + self.nixosModules.nixos-programs-podman ]; boot = { @@ -46,18 +47,14 @@ system.stateVersion = "24.05"; - ar = { - apps.podman.enable = true; + ar.users.aly = { + enable = true; + password = "$y$j9T$Lit66g43.Zn60mwGig7cx1$L.aLzGvy0q.b1E40/XSIkhj2tkJbigpXFrxR/D/FVB4"; - users.aly = { + syncthing = { enable = true; - password = "$y$j9T$Lit66g43.Zn60mwGig7cx1$L.aLzGvy0q.b1E40/XSIkhj2tkJbigpXFrxR/D/FVB4"; - - syncthing = { - enable = true; - certFile = config.age.secrets.syncthingCert.path; - keyFile = config.age.secrets.syncthingKey.path; - }; + certFile = config.age.secrets.syncthingCert.path; + keyFile = config.age.secrets.syncthingKey.path; }; }; } diff --git a/nixosModules/apps/default.nix b/nixosModules/apps/default.nix deleted file mode 100644 index e0267d5c..00000000 --- a/nixosModules/apps/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - imports = [ - ./firefox - ./nicotine-plus - ./steam - ./podman - ./virt-manager - ]; -} diff --git a/nixosModules/apps/firefox/default.nix b/nixosModules/apps/firefox/default.nix deleted file mode 100644 index dc790fde..00000000 --- a/nixosModules/apps/firefox/default.nix +++ /dev/null @@ -1,104 +0,0 @@ -{ - config, - lib, - ... -}: { - config = lib.mkIf config.ar.apps.firefox.enable { - programs.firefox = { - enable = true; - policies = { - Cookies.Behavior = "reject-foreign"; - DisableAppUpdate = true; - DisableFirefoxStudies = true; - DisableMasterPasswordCreation = true; - DisablePocket = true; - DisableProfileImport = true; - DisableSetDesktopBackground = true; - DisableTelemetry = true; - DisplayBookmarksToolbar = "newtab"; - - DNSOverHTTPS = { - Enabled = true; - Fallback = true; - }; - - DontCheckDefaultBrowser = true; - - EnableTrackingProtection = { - Cryptomining = true; - Fingerprinting = true; - EmailTracking = true; - Locked = false; - Value = true; - }; - - EncryptedMediaExtensions = { - Enabled = true; - Locked = false; - }; - - FirefoxHome = { - Highlights = false; - Locked = false; - Pocket = false; - Search = true; - Snippets = false; - SponsoredPocket = false; - SponsoredTopSites = false; - TopSites = false; - }; - - FirefoxSuggest = { - ImproveSuggest = false; - Locked = false; - SponsoredSuggestions = false; - WebSuggestions = false; - }; - - HardwareAcceleration = true; - - Homepage = { - Locked = false; - StartPage = "previous-session"; - }; - - NewTabPage = false; - NoDefaultBookmarks = false; # Enabling this prevents declaratively setting bookmarks. - OfferToSaveLoginsDefault = false; - OverrideFirstRunPage = ""; - OverridePostUpdatePage = ""; - - PDFjs = { - Enabled = true; - EnablePermissions = false; - }; - - Preferences = { - "browser.aboutConfig.showWarning" = false; - "browser.bookmarks.addedImportButton" = false; - - "browser.tabs.inTitlebar" = - if config.ar.desktop.gnome.enable - then 1 - else 0; - - "datareporting.policy.dataSubmissionPolicyAccepted" = true; - "dom.security.https_only_mode" = true; - "extensions.autoDisableScopes" = 0; - "media.ffmpeg.vaapi.enabled" = true; - "media.navigator.mediadatadecoder_vpx_enabled" = true; - "media.rdd-ffmpeg.enabled" = true; - }; - - UserMessaging = { - ExtensionRecommendations = false; - FeatureRecommendations = false; - MoreFromMozilla = false; - SkipOnboarding = true; - }; - - UseSystemPrintDialog = true; - }; - }; - }; -} diff --git a/nixosModules/apps/nicotine-plus/default.nix b/nixosModules/apps/nicotine-plus/default.nix deleted file mode 100644 index 88434f26..00000000 --- a/nixosModules/apps/nicotine-plus/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - config = lib.mkIf config.ar.apps.nicotine-plus.enable { - environment.systemPackages = [pkgs.nicotine-plus]; - networking = { - firewall.allowedTCPPortRanges = [ - # Soulseek - { - from = 2234; - to = 2239; - } - ]; - firewall.allowedUDPPortRanges = [ - # Soulseek - { - from = 2234; - to = 2239; - } - ]; - }; - }; -} diff --git a/nixosModules/apps/podman/default.nix b/nixosModules/apps/podman/default.nix deleted file mode 100644 index 4528ccba..00000000 --- a/nixosModules/apps/podman/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - lib, - config, - ... -}: { - config = lib.mkIf config.ar.apps.podman.enable { - virtualisation = { - oci-containers = {backend = "podman";}; - podman = { - # Required for containers under podman-compose to be able to talk to each other. - defaultNetwork.settings.dns_enabled = true; - enable = true; - autoPrune.enable = true; - }; - }; - }; -} diff --git a/nixosModules/apps/steam/default.nix b/nixosModules/apps/steam/default.nix deleted file mode 100644 index c83d19b5..00000000 --- a/nixosModules/apps/steam/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - config = - lib.mkIf ( - config.ar.apps.steam.enable - || config.ar.desktop.steam.enable - ) { - hardware.steam-hardware.enable = true; - - programs = { - gamescope.enable = config.ar.desktop.steam.enable; - - steam = { - enable = true; - dedicatedServer.openFirewall = true; - extest.enable = true; - extraCompatPackages = with pkgs; [proton-ge-bin]; - gamescopeSession.enable = config.ar.desktop.steam.enable; - localNetworkGameTransfers.openFirewall = true; - remotePlay.openFirewall = true; - }; - }; - }; -} diff --git a/nixosModules/apps/virt-manager/default.nix b/nixosModules/apps/virt-manager/default.nix deleted file mode 100644 index d908e138..00000000 --- a/nixosModules/apps/virt-manager/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - config, - lib, - ... -}: { - config = lib.mkIf config.ar.apps.virt-manager.enable { - programs.virt-manager.enable = true; - virtualisation.libvirtd.enable = true; - }; -} diff --git a/nixosModules/default.nix b/nixosModules/default.nix deleted file mode 100644 index 837331f1..00000000 --- a/nixosModules/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -self: { - imports = [ - ./apps - ./desktop - ./options.nix - ./services - ]; -} diff --git a/nixosModules/desktop/default.nix b/nixosModules/desktop/default.nix deleted file mode 100644 index bc14b1b0..00000000 --- a/nixosModules/desktop/default.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - imports = [ - ./desktopOptimizations.nix - ./gnome - ./greetd - ./hyprland - ./kde - ./sddm - ./waylandComp.nix - ]; - - config = - lib.mkIf ( - config.ar.desktop.gnome.enable - || config.ar.desktop.hyprland.enable - || config.ar.desktop.kde.enable - || config.ar.desktop.steam.enable - ) { - boot = { - consoleLogLevel = 0; - initrd.verbose = false; - plymouth.enable = true; - }; - - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - - hardware.logitech.wireless = { - enable = true; - enableGraphical = true; - }; - - programs.system-config-printer.enable = true; - - services = { - gnome.gnome-keyring.enable = true; - gvfs.enable = true; # Mount, trash, etc. - libinput.enable = true; - - pipewire = { - enable = true; - - alsa = { - enable = true; - support32Bit = true; - }; - - pulse.enable = true; - }; - - printing.enable = true; - system-config-printer.enable = true; - - xserver = { - enable = true; - excludePackages = with pkgs; [xterm]; - }; - }; - }; -} diff --git a/nixosModules/desktop/desktopOptimizations.nix b/nixosModules/desktop/desktopOptimizations.nix deleted file mode 100644 index 7e9924f8..00000000 --- a/nixosModules/desktop/desktopOptimizations.nix +++ /dev/null @@ -1,183 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - config = lib.mkIf (config.ar.desktop.desktopOptimizations.enable) { - assertions = [ - { - assertion = !(config.programs.gamemode.enable && config.services.ananicy.enable); - message = "Ananicy and GameMode cannot be enabled at the same time."; - } - ]; - - boot = { - kernel.sysctl = { - # Improved file monitoring - "fs.file-max" = lib.mkDefault 2097152; # Set size of file handles and inode cache - "fs.inotify.max_user_instances" = lib.mkOverride 100 8192; # Re-use the default from Bazzite even though the default NixOS value is higher. - "fs.inotify.max_user_watches" = lib.mkOverride 100 524288; - - "kernel.nmi_watchdog" = lib.mkOverride 100 0; # Disable watchdogs for maximum performance at the cost of resiliency - "kernel.sched_cfs_bandwidth_slice_u" = lib.mkDefault 3000; - "kernel.sched_latency_ns" = lib.mkDefault 3000000; - "kernel.sched_migration_cost_ns" = lib.mkDefault 50000; - "kernel.sched_min_granularity_ns" = lib.mkDefault 300000; - "kernel.sched_nr_migrate" = lib.mkDefault 128; - "kernel.sched_wakeup_granularity_ns" = lib.mkDefault 500000; - "kernel.soft_watchdog" = lib.mkDefault 0; - "kernel.split_lock_mitigate" = lib.mkDefault 0; - "kernel.unprivileged_userns_clone" = lib.mkDefault 1; - "kernel.watchdog" = lib.mkDefault 0; - - # Network optimizations - "net.core.default_qdisc" = lib.mkDefault "fq"; - "net.core.netdev_max_backlog" = lib.mkDefault 16384; # Increase netdev receive queue - "net.ipv4.tcp_congestion_control" = lib.mkDefault "bbr"; - "net.ipv4.tcp_ecn" = lib.mkDefault 1; - "net.ipv4.tcp_fastopen" = lib.mkDefault 3; - "net.ipv4.tcp_fin_timeout" = lib.mkDefault 5; - "net.ipv4.tcp_mtu_probing" = lib.mkForce 1; - "net.ipv4.tcp_rfc1337" = lib.mkDefault 1; # Protect against tcp time-wait assassination hazards, drop RST packets for sockets in the time-wait state. Not widely supported outside of Linux, but conforms to RFC. - "net.ipv4.tcp_slow_start_after_idle" = 0; # Disable TCP slow start after idle - "net.ipv4.tcp_timestamps" = lib.mkDefault 0; # https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_for_real_time/7/html/tuning_guide/reduce_tcp_performance_spikes - - # Memory management - "vm.dirty_background_bytes" = lib.mkDefault 134217728; - "vm.dirty_bytes" = lib.mkDefault 268435456; - "vm.dirty_writeback_centisecs" = lib.mkDefault 1500; - "vm.max_map_count" = lib.mkOverride 100 2147483642; - "vm.page-cluster" = lib.mkDefault 0; - "vm.swappiness" = lib.mkDefault 150; - "vm.vfs_cache_pressure" = lib.mkDefault 50; - "vm.watermark_boost_factor" = lib.mkDefault 0; - "vm.watermark_scale_factor" = lib.mkDefault 125; - }; - - kernelModules = ["ntsync"]; - kernelPackages = pkgs.linuxPackages_cachyos; - }; - - environment.systemPackages = with pkgs; [joystickwake]; - - services = { - ananicy = { - enable = true; # Incompatible/not recommended with gamemode. - - extraRules = [ - { - name = ".easyeffects-wr"; - type = "LowLatency_RT"; - } - ]; - - package = pkgs.ananicy-cpp; - rulesProvider = pkgs.ananicy-rules-cachyos; - }; - - bpftune.enable = true; - - pipewire = let - rate = 48000; - quantum = 64; - qr = "${toString quantum}/${toString rate}"; - in { - # Make sure PipeWire is enabled. - enable = true; - - # Write extra config. - extraConfig.pipewire = { - "99-lowlatency" = { - context = { - properties.default.clock.min-quantum = quantum; - modules = [ - { - name = "libpipewire-module-rtkit"; - flags = ["ifexists" "nofail"]; - args = { - nice.level = -15; - rt = { - prio = 88; - time.soft = 200000; - time.hard = 200000; - }; - }; - } - { - name = "libpipewire-module-protocol-pulse"; - args = { - server.address = ["unix:native"]; - pulse.min = { - req = qr; - quantum = qr; - frag = qr; - }; - }; - } - ]; - - stream.properties = { - node.latency = qr; - resample.quality = 1; - }; - }; - }; - }; - - # Ensure WirePlumber is enabled explicitly (defaults to true while PW is enabled) - # + write extra config to ship low latency rules for alsa. - wireplumber = { - enable = true; - - configPackages = let - # Generate "matches" section of the rules - matches = lib.generators.toLua { - multiline = false; # Looks better while inline - indent = false; - } [[["node.name" "matches" "alsa_output.*"]]]; # Nested lists are to produce `{{{ }}}` in the output. - - # Generate "apply_properties" section of the rules. - apply_properties = lib.generators.toLua {} { - "audio.format" = "S32LE"; - "audio.rate" = rate * 2; - "api.alsa.period-size" = 2; - }; - in [ - (pkgs.writeTextDir "share/lowlatency.lua.d/99-alsa-lowlatency.lua" '' - -- Generated by nix-gaming - alsa_monitor.rules = { - { - matches = ${matches}; - apply_properties = ${apply_properties}; - } - } - '') - ]; - }; - }; - - udev.extraRules = '' - ACTION=="add|change", KERNEL=="mmcblk[0-9]p[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq" # SD cards use BFQ scheduler. - ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="kyber" # NVMe use kyber scheduler. - ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="kyber" # SSD use kyber scheduler. - ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq" # HHDs use BFW scheduler. - DEVPATH=="/devices/virtual/misc/cpu_dma_latency", OWNER="root", GROUP="audio", MODE="0660" # cpu_dma_latency writeable by audio group - KERNEL=="ntsync", MODE="0644" # /dev/ntsync user writeable - ''; - }; - - systemd.oomd = { - enable = true; - enableRootSlice = true; - enableSystemSlice = true; - enableUserSlices = true; - }; - - zramSwap = { - enable = lib.mkDefault true; - algorithm = lib.mkDefault "lz4"; - priority = lib.mkDefault 100; - }; - }; -} diff --git a/nixosModules/desktop/gnome.nix b/nixosModules/desktop/gnome.nix new file mode 100644 index 00000000..5ab2cce8 --- /dev/null +++ b/nixosModules/desktop/gnome.nix @@ -0,0 +1,27 @@ +{ + config, + lib, + ... +}: { + imports = [./gui.nix]; + + home-manager.sharedModules = [ + { + ar.home.desktop.gnome.enable = lib.mkDefault true; + } + ]; + + programs.firefox.policies.Preferences."browser.tabs.inTitlebar" = lib.mkIf (config.programs.firefox.enable) 1; + + security.pam.services.gdm = { + enableGnomeKeyring = true; + gnupg.enable = true; + kwallet.enable = true; + }; + + # Enable GNOME and GDM. + services.xserver = { + desktopManager.gnome.enable = true; + displayManager.gdm.enable = true; + }; +} diff --git a/nixosModules/desktop/gnome/default.nix b/nixosModules/desktop/gnome/default.nix deleted file mode 100644 index b7632b5d..00000000 --- a/nixosModules/desktop/gnome/default.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - config, - lib, - ... -}: { - config = lib.mkIf config.ar.desktop.gnome.enable { - security.pam.services.gdm = { - enableGnomeKeyring = true; - gnupg.enable = true; - kwallet.enable = true; - }; - - # Enable GNOME and GDM. - services.xserver = { - desktopManager.gnome.enable = true; - displayManager.gdm.enable = true; - }; - }; -} diff --git a/nixosModules/desktop/gui.nix b/nixosModules/desktop/gui.nix new file mode 100644 index 00000000..a96da081 --- /dev/null +++ b/nixosModules/desktop/gui.nix @@ -0,0 +1,41 @@ +{pkgs, ...}: { + boot = { + consoleLogLevel = 0; + initrd.verbose = false; + plymouth.enable = true; + }; + + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + hardware.logitech.wireless = { + enable = true; + enableGraphical = true; + }; + + programs.system-config-printer.enable = true; + + services = { + gnome.gnome-keyring.enable = true; + gvfs.enable = true; # Mount, trash, etc. + libinput.enable = true; + + pipewire = { + enable = true; + + alsa = { + enable = true; + support32Bit = true; + }; + + pulse.enable = true; + }; + + printing.enable = true; + system-config-printer.enable = true; + + xserver = { + enable = true; + excludePackages = with pkgs; [xterm]; + }; + }; +} diff --git a/nixosModules/desktop/hyprland.nix b/nixosModules/desktop/hyprland.nix new file mode 100644 index 00000000..6fa04135 --- /dev/null +++ b/nixosModules/desktop/hyprland.nix @@ -0,0 +1,24 @@ +{ + lib, + pkgs, + ... +}: { + imports = [./gui.nix]; + + home-manager.sharedModules = [ + { + ar.home.desktop.hyprland.enable = lib.mkDefault true; + } + ]; + + programs = { + gnupg.agent.pinentryPackage = pkgs.pinentry-gnome3; + hyprland.enable = true; + hyprlock.enable = true; + }; + + services = { + dbus.packages = [pkgs.gcr]; + udev.packages = [pkgs.swayosd]; + }; +} diff --git a/nixosModules/desktop/hyprland/default.nix b/nixosModules/desktop/hyprland/default.nix deleted file mode 100644 index 4f84b72b..00000000 --- a/nixosModules/desktop/hyprland/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - config, - lib, - ... -}: { - config = lib.mkIf config.ar.desktop.hyprland.enable { - programs = { - hyprland.enable = true; - hyprlock.enable = true; - }; - }; -} diff --git a/nixosModules/desktop/kde.nix b/nixosModules/desktop/kde.nix new file mode 100644 index 00000000..3867d79e --- /dev/null +++ b/nixosModules/desktop/kde.nix @@ -0,0 +1,28 @@ +{ + lib, + pkgs, + ... +}: { + imports = [./gui.nix]; + + # environment.plasma6.excludePackages = lib.attrsets.attrValues { + # inherit + # (pkgs.kdePackages) + # elisa + # gwenview + # krdp + # okular + # oxygen + # ; + # }; + + environment.systemPackages = [pkgs.kdePackages.sddm-kcm]; + + home-manager.sharedModules = [ + { + ar.home.desktop.kde.enable = lib.mkDefault true; + } + ]; + + services.desktopManager.plasma6.enable = true; +} diff --git a/nixosModules/desktop/kde/default.nix b/nixosModules/desktop/kde/default.nix deleted file mode 100644 index 6290ff19..00000000 --- a/nixosModules/desktop/kde/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - config = lib.mkIf config.ar.desktop.kde.enable { - # environment.plasma6.excludePackages = lib.attrsets.attrValues { - # inherit - # (pkgs.kdePackages) - # elisa - # gwenview - # krdp - # okular - # oxygen - # ; - # }; - - environment.systemPackages = [pkgs.kdePackages.sddm-kcm]; - services.desktopManager.plasma6.enable = true; - }; -} diff --git a/nixosModules/desktop/waylandComp.nix b/nixosModules/desktop/waylandComp.nix deleted file mode 100644 index 3d00dcc8..00000000 --- a/nixosModules/desktop/waylandComp.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: { - config = lib.mkIf (config.ar.desktop.hyprland.enable) { - programs = { - gnupg.agent.pinentryPackage = lib.mkForce pkgs.pinentry-gnome3; - }; - - services = { - dbus.packages = [pkgs.gcr]; - gnome.gnome-keyring.enable = lib.mkDefault true; - udev.packages = [pkgs.swayosd]; - }; - }; -} diff --git a/nixosModules/options.nix b/nixosModules/options.nix deleted file mode 100644 index d4dbdc3c..00000000 --- a/nixosModules/options.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ - config, - lib, - ... -}: { - options.ar = { - apps = { - firefox.enable = lib.mkEnableOption "Firefox Web Browser."; - nicotine-plus.enable = lib.mkEnableOption "Nicotine+ Soulseek client."; - podman.enable = lib.mkEnableOption "Podman for OCI container support."; - steam.enable = lib.mkEnableOption "Valve's Steam for video games."; - virt-manager.enable = lib.mkEnableOption "Virtual machine client."; - }; - - desktop = { - desktopOptimizations.enable = lib.mkEnableOption "Optimizations for desktop, gaming, and multimedia workloads."; - - greetd = { - enable = lib.mkEnableOption "Greetd display manager."; - - autologin = lib.mkOption { - description = "User to autologin."; - default = null; - type = lib.types.nullOr lib.types.str; - }; - - session = lib.mkOption { - description = "Default command to execute on login."; - default = lib.getExe config.programs.hyprland.package; - type = lib.types.str; - }; - }; - - gnome.enable = lib.mkEnableOption "GNOME desktop session."; - hyprland.enable = lib.mkEnableOption "Hyprland wayland session."; - kde.enable = lib.mkEnableOption "KDE desktop session."; - - sddm = { - enable = lib.mkEnableOption "SDDM display manager."; - - autologin = lib.mkOption { - description = "User to autologin."; - default = null; - type = lib.types.nullOr lib.types.str; - }; - }; - - steam.enable = lib.mkEnableOption "Steam + Gamescope session."; - }; - - laptopMode = lib.mkEnableOption "Enable laptop configuration."; - - services.flatpak.enable = lib.mkEnableOption "Flatpak support with GUI."; - }; -} diff --git a/nixosModules/profiles/desktop.nix b/nixosModules/profiles/desktop.nix new file mode 100644 index 00000000..f8156c0a --- /dev/null +++ b/nixosModules/profiles/desktop.nix @@ -0,0 +1,181 @@ +{ + config, + lib, + pkgs, + ... +}: { + assertions = [ + { + assertion = !(config.programs.gamemode.enable && config.services.ananicy.enable); + message = "Ananicy and GameMode cannot be enabled at the same time."; + } + ]; + + boot = { + kernel.sysctl = { + # Improved file monitoring + "fs.file-max" = lib.mkDefault 2097152; # Set size of file handles and inode cache + "fs.inotify.max_user_instances" = lib.mkOverride 100 8192; # Re-use the default from Bazzite even though the default NixOS value is higher. + "fs.inotify.max_user_watches" = lib.mkOverride 100 524288; + + "kernel.nmi_watchdog" = lib.mkOverride 100 0; # Disable watchdogs for maximum performance at the cost of resiliency + "kernel.sched_cfs_bandwidth_slice_u" = lib.mkDefault 3000; + "kernel.sched_latency_ns" = lib.mkDefault 3000000; + "kernel.sched_migration_cost_ns" = lib.mkDefault 50000; + "kernel.sched_min_granularity_ns" = lib.mkDefault 300000; + "kernel.sched_nr_migrate" = lib.mkDefault 128; + "kernel.sched_wakeup_granularity_ns" = lib.mkDefault 500000; + "kernel.soft_watchdog" = lib.mkDefault 0; + "kernel.split_lock_mitigate" = lib.mkDefault 0; + "kernel.unprivileged_userns_clone" = lib.mkDefault 1; + "kernel.watchdog" = lib.mkDefault 0; + + # Network optimizations + "net.core.default_qdisc" = lib.mkDefault "fq"; + "net.core.netdev_max_backlog" = lib.mkDefault 16384; # Increase netdev receive queue + "net.ipv4.tcp_congestion_control" = lib.mkDefault "bbr"; + "net.ipv4.tcp_ecn" = lib.mkDefault 1; + "net.ipv4.tcp_fastopen" = lib.mkDefault 3; + "net.ipv4.tcp_fin_timeout" = lib.mkDefault 5; + "net.ipv4.tcp_mtu_probing" = lib.mkForce 1; + "net.ipv4.tcp_rfc1337" = lib.mkDefault 1; # Protect against tcp time-wait assassination hazards, drop RST packets for sockets in the time-wait state. Not widely supported outside of Linux, but conforms to RFC. + "net.ipv4.tcp_slow_start_after_idle" = 0; # Disable TCP slow start after idle + "net.ipv4.tcp_timestamps" = lib.mkDefault 0; # https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux_for_real_time/7/html/tuning_guide/reduce_tcp_performance_spikes + + # Memory management + "vm.dirty_background_bytes" = lib.mkDefault 134217728; + "vm.dirty_bytes" = lib.mkDefault 268435456; + "vm.dirty_writeback_centisecs" = lib.mkDefault 1500; + "vm.max_map_count" = lib.mkOverride 100 2147483642; + "vm.page-cluster" = lib.mkDefault 0; + "vm.swappiness" = lib.mkDefault 150; + "vm.vfs_cache_pressure" = lib.mkDefault 50; + "vm.watermark_boost_factor" = lib.mkDefault 0; + "vm.watermark_scale_factor" = lib.mkDefault 125; + }; + + kernelModules = ["ntsync"]; + kernelPackages = pkgs.linuxPackages_cachyos; + }; + + environment.systemPackages = with pkgs; [joystickwake]; + + services = { + ananicy = { + enable = true; # Incompatible/not recommended with gamemode. + + extraRules = [ + { + name = ".easyeffects-wr"; + type = "LowLatency_RT"; + } + ]; + + package = pkgs.ananicy-cpp; + rulesProvider = pkgs.ananicy-rules-cachyos; + }; + + bpftune.enable = true; + + pipewire = let + rate = 48000; + quantum = 64; + qr = "${toString quantum}/${toString rate}"; + in { + # Make sure PipeWire is enabled. + enable = true; + + # Write extra config. + extraConfig.pipewire = { + "99-lowlatency" = { + context = { + properties.default.clock.min-quantum = quantum; + modules = [ + { + name = "libpipewire-module-rtkit"; + flags = ["ifexists" "nofail"]; + args = { + nice.level = -15; + rt = { + prio = 88; + time.soft = 200000; + time.hard = 200000; + }; + }; + } + { + name = "libpipewire-module-protocol-pulse"; + args = { + server.address = ["unix:native"]; + pulse.min = { + req = qr; + quantum = qr; + frag = qr; + }; + }; + } + ]; + + stream.properties = { + node.latency = qr; + resample.quality = 1; + }; + }; + }; + }; + + # Ensure WirePlumber is enabled explicitly (defaults to true while PW is enabled) + # + write extra config to ship low latency rules for alsa. + wireplumber = { + enable = true; + + configPackages = let + # Generate "matches" section of the rules + matches = lib.generators.toLua { + multiline = false; # Looks better while inline + indent = false; + } [[["node.name" "matches" "alsa_output.*"]]]; # Nested lists are to produce `{{{ }}}` in the output. + + # Generate "apply_properties" section of the rules. + apply_properties = lib.generators.toLua {} { + "audio.format" = "S32LE"; + "audio.rate" = rate * 2; + "api.alsa.period-size" = 2; + }; + in [ + (pkgs.writeTextDir "share/lowlatency.lua.d/99-alsa-lowlatency.lua" '' + -- Generated by nix-gaming + alsa_monitor.rules = { + { + matches = ${matches}; + apply_properties = ${apply_properties}; + } + } + '') + ]; + }; + }; + + udev.extraRules = '' + ACTION=="add|change", KERNEL=="mmcblk[0-9]p[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq" # SD cards use BFQ scheduler. + ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="kyber" # NVMe use kyber scheduler. + ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="kyber" # SSD use kyber scheduler. + ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq" # HHDs use BFW scheduler. + DEVPATH=="/devices/virtual/misc/cpu_dma_latency", OWNER="root", GROUP="audio", MODE="0660" # cpu_dma_latency writeable by audio group + KERNEL=="ntsync", MODE="0644" # /dev/ntsync user writeable + ''; + }; + + systemd.oomd = { + enable = true; + enableRootSlice = true; + enableSystemSlice = true; + enableUserSlices = true; + }; + + zramSwap = { + enable = lib.mkDefault true; + algorithm = lib.mkDefault "lz4"; + priority = lib.mkDefault 100; + }; +} diff --git a/nixosModules/programs/firefox.nix b/nixosModules/programs/firefox.nix new file mode 100644 index 00000000..e85077f2 --- /dev/null +++ b/nixosModules/programs/firefox.nix @@ -0,0 +1,92 @@ +{...}: { + programs.firefox = { + enable = true; + policies = { + Cookies.Behavior = "reject-foreign"; + DisableAppUpdate = true; + DisableFirefoxStudies = true; + DisableMasterPasswordCreation = true; + DisablePocket = true; + DisableProfileImport = true; + DisableSetDesktopBackground = true; + DisableTelemetry = true; + DisplayBookmarksToolbar = "newtab"; + + DNSOverHTTPS = { + Enabled = true; + Fallback = true; + }; + + DontCheckDefaultBrowser = true; + + EnableTrackingProtection = { + Cryptomining = true; + Fingerprinting = true; + EmailTracking = true; + Locked = false; + Value = true; + }; + + EncryptedMediaExtensions = { + Enabled = true; + Locked = false; + }; + + FirefoxHome = { + Highlights = false; + Locked = false; + Pocket = false; + Search = true; + Snippets = false; + SponsoredPocket = false; + SponsoredTopSites = false; + TopSites = false; + }; + + FirefoxSuggest = { + ImproveSuggest = false; + Locked = false; + SponsoredSuggestions = false; + WebSuggestions = false; + }; + + HardwareAcceleration = true; + + Homepage = { + Locked = false; + StartPage = "previous-session"; + }; + + NewTabPage = false; + NoDefaultBookmarks = false; # Enabling this prevents declaratively setting bookmarks. + OfferToSaveLoginsDefault = false; + OverrideFirstRunPage = ""; + OverridePostUpdatePage = ""; + + PDFjs = { + Enabled = true; + EnablePermissions = false; + }; + + Preferences = { + "browser.aboutConfig.showWarning" = false; + "browser.bookmarks.addedImportButton" = false; + "datareporting.policy.dataSubmissionPolicyAccepted" = true; + "dom.security.https_only_mode" = true; + "extensions.autoDisableScopes" = 0; + "media.ffmpeg.vaapi.enabled" = true; + "media.navigator.mediadatadecoder_vpx_enabled" = true; + "media.rdd-ffmpeg.enabled" = true; + }; + + UserMessaging = { + ExtensionRecommendations = false; + FeatureRecommendations = false; + MoreFromMozilla = false; + SkipOnboarding = true; + }; + + UseSystemPrintDialog = true; + }; + }; +} diff --git a/nixosModules/programs/nicotine-plus.nix b/nixosModules/programs/nicotine-plus.nix new file mode 100644 index 00000000..d5c16138 --- /dev/null +++ b/nixosModules/programs/nicotine-plus.nix @@ -0,0 +1,19 @@ +{pkgs, ...}: { + environment.systemPackages = [pkgs.nicotine-plus]; + networking = { + firewall.allowedTCPPortRanges = [ + # Soulseek + { + from = 2234; + to = 2239; + } + ]; + firewall.allowedUDPPortRanges = [ + # Soulseek + { + from = 2234; + to = 2239; + } + ]; + }; +} diff --git a/nixosModules/programs/podman.nix b/nixosModules/programs/podman.nix new file mode 100644 index 00000000..e2d3cf8a --- /dev/null +++ b/nixosModules/programs/podman.nix @@ -0,0 +1,11 @@ +{...}: { + virtualisation = { + oci-containers = {backend = "podman";}; + + podman = { + enable = true; + autoPrune.enable = true; + defaultNetwork.settings.dns_enabled = true; # Required for containers under podman-compose to be able to talk to each other. + }; + }; +} diff --git a/nixosModules/programs/steam.nix b/nixosModules/programs/steam.nix new file mode 100644 index 00000000..dc73c158 --- /dev/null +++ b/nixosModules/programs/steam.nix @@ -0,0 +1,17 @@ +{pkgs, ...}: { + hardware.steam-hardware.enable = true; + + programs = { + gamescope.enable = true; + + steam = { + enable = true; + dedicatedServer.openFirewall = true; + extest.enable = true; + extraCompatPackages = with pkgs; [proton-ge-bin]; + gamescopeSession.enable = true; + localNetworkGameTransfers.openFirewall = true; + remotePlay.openFirewall = true; + }; + }; +} diff --git a/nixosModules/programs/virt-manager.nix b/nixosModules/programs/virt-manager.nix new file mode 100644 index 00000000..2cb59118 --- /dev/null +++ b/nixosModules/programs/virt-manager.nix @@ -0,0 +1,4 @@ +{...}: { + programs.virt-manager.enable = true; + virtualisation.libvirtd.enable = true; +} diff --git a/nixosModules/services/default.nix b/nixosModules/services/default.nix deleted file mode 100644 index 6f52f3b0..00000000 --- a/nixosModules/services/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - imports = [ - ./flatpak - ]; -} diff --git a/nixosModules/services/flatpak.nix b/nixosModules/services/flatpak.nix new file mode 100644 index 00000000..91149505 --- /dev/null +++ b/nixosModules/services/flatpak.nix @@ -0,0 +1,56 @@ +{ + config, + lib, + pkgs, + ... +}: { + environment.systemPackages = with pkgs; [gnome-software]; + + fileSystems = let + mkRoSymBind = path: { + device = path; + fsType = "fuse.bindfs"; + options = ["ro" "resolve-symlinks" "x-gvfs-hide"]; + }; + + aggregatedIcons = pkgs.buildEnv { + name = "system-icons"; + paths = + (with pkgs; [ + adwaita-icon-theme + gnome-themes-extra + ]) + ++ lib.optional (config.stylix.enable) config.stylix.cursor.package; + + pathsToLink = ["/share/icons"]; + }; + + aggregatedFonts = pkgs.buildEnv { + name = "system-fonts"; + paths = config.fonts.packages; + pathsToLink = ["/share/fonts"]; + }; + in { + "/usr/share/icons" = mkRoSymBind "${aggregatedIcons}/share/icons"; + "/usr/local/share/fonts" = mkRoSymBind "${aggregatedFonts}/share/fonts"; + }; + + fonts = { + fontDir.enable = true; + packages = + (with pkgs; [ + noto-fonts + noto-fonts-cjk-sans + noto-fonts-emoji + ]) + ++ lib.optionals (config.stylix.enable) [ + config.stylix.fonts.sansSerif.package + config.stylix.fonts.monospace.package + config.stylix.fonts.serif.package + ]; + }; + + services.flatpak.enable = true; + system.fsPackages = [pkgs.bindfs]; + xdg.portal.enable = true; +} diff --git a/nixosModules/services/flatpak/default.nix b/nixosModules/services/flatpak/default.nix deleted file mode 100644 index 8f8b5d32..00000000 --- a/nixosModules/services/flatpak/default.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - config = lib.mkIf config.ar.services.flatpak.enable { - environment.systemPackages = with pkgs; [gnome-software]; - - fileSystems = let - mkRoSymBind = path: { - device = path; - fsType = "fuse.bindfs"; - options = ["ro" "resolve-symlinks" "x-gvfs-hide"]; - }; - - aggregatedIcons = pkgs.buildEnv { - name = "system-icons"; - paths = - (with pkgs; [ - adwaita-icon-theme - gnome-themes-extra - ]) - ++ lib.optional (config.stylix.enable) config.stylix.cursor.package; - - pathsToLink = ["/share/icons"]; - }; - - aggregatedFonts = pkgs.buildEnv { - name = "system-fonts"; - paths = config.fonts.packages; - pathsToLink = ["/share/fonts"]; - }; - in { - "/usr/share/icons" = mkRoSymBind "${aggregatedIcons}/share/icons"; - "/usr/local/share/fonts" = mkRoSymBind "${aggregatedFonts}/share/fonts"; - }; - - fonts = { - fontDir.enable = true; - packages = - (with pkgs; [ - noto-fonts - noto-fonts-cjk-sans - noto-fonts-emoji - ]) - ++ lib.optionals (config.stylix.enable) [ - config.stylix.fonts.sansSerif.package - config.stylix.fonts.monospace.package - config.stylix.fonts.serif.package - ]; - }; - - services.flatpak.enable = true; - system.fsPackages = [pkgs.bindfs]; - xdg.portal.enable = true; - }; -} diff --git a/nixosModules/desktop/greetd/default.nix b/nixosModules/services/greetd.nix similarity index 51% rename from nixosModules/desktop/greetd/default.nix rename to nixosModules/services/greetd.nix index 4d0a456c..d6280906 100644 --- a/nixosModules/desktop/greetd/default.nix +++ b/nixosModules/services/greetd.nix @@ -4,7 +4,21 @@ pkgs, ... }: { - config = lib.mkIf config.ar.desktop.greetd.enable { + options.greetd = { + autologin = lib.mkOption { + description = "User to autologin."; + default = null; + type = lib.types.nullOr lib.types.str; + }; + + session = lib.mkOption { + description = "Default command to execute on login."; + default = lib.getExe config.programs.hyprland.package; + type = lib.types.str; + }; + }; + + config = { security.pam.services.greetd = { enableGnomeKeyring = true; gnupg.enable = true; @@ -15,19 +29,19 @@ enable = true; settings = - if config.ar.desktop.greetd.autologin != null + if config.greetd.autologin != null then { default_session = { - command = lib.mkDefault "${lib.getExe pkgs.greetd.tuigreet} --asterisks --user-menu -g 'Welcome to NixOS ${config.system.nixos.release}' --time --remember --cmd ${config.ar.desktop.greetd.session}"; + command = lib.mkDefault "${lib.getExe pkgs.greetd.tuigreet} --asterisks --user-menu -g 'Welcome to NixOS ${config.system.nixos.release}' --time --remember --cmd ${config.greetd.session}"; }; initial_session = { - command = config.ar.desktop.greetd.session; - user = config.ar.desktop.greetd.autologin; + command = config.greetd.session; + user = config.greetd.autologin; }; } else { default_session = { - command = lib.mkDefault "${lib.getExe pkgs.greetd.tuigreet} --asterisks --user-menu -g 'Welcome to NixOS ${config.system.nixos.release}' --time --remember --cmd ${config.ar.desktop.greetd.session}"; + command = lib.mkDefault "${lib.getExe pkgs.greetd.tuigreet} --asterisks --user-menu -g 'Welcome to NixOS ${config.system.nixos.release}' --time --remember --cmd ${config.greetd.session}"; }; }; }; diff --git a/nixosModules/desktop/sddm/default.nix b/nixosModules/services/sddm.nix similarity index 58% rename from nixosModules/desktop/sddm/default.nix rename to nixosModules/services/sddm.nix index 96589c14..d7dfd0e7 100644 --- a/nixosModules/desktop/sddm/default.nix +++ b/nixosModules/services/sddm.nix @@ -3,7 +3,13 @@ lib, ... }: { - config = lib.mkIf config.ar.desktop.sddm.enable { + options.sddm.autologin = lib.mkOption { + description = "User to autologin."; + default = null; + type = lib.types.nullOr lib.types.str; + }; + + config = { security.pam.services.sddm = { enableGnomeKeyring = true; gnupg.enable = true; @@ -11,9 +17,9 @@ }; services.displayManager = { - autoLogin = lib.mkIf (config.ar.desktop.sddm.autologin != null) { + autoLogin = lib.mkIf (config.sddm.autologin != null) { enable = true; - user = config.ar.desktop.sddm.autologin; + user = config.sddm.autologin; }; sddm = {