From 31d11dd424daed7d7aec573ad98a164650ea11ef Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Thu, 28 Mar 2024 16:13:46 -0400 Subject: [PATCH] ported modules/ system/ and user/ to nixosModules with enable options --- flake.nix | 4 + hosts/lavaridge/default.nix | 55 +++++------ hosts/mauville/default.nix | 11 +-- hosts/petalburg/default.nix | 45 +++++---- hosts/rustboro/default.nix | 24 ++--- modules/desktop.nix | 56 ------------ modules/gnome/default.nix | 31 ------- modules/gnome/fingerprint.nix | 27 ------ modules/gnome/fractional_scaling.nix | 5 - modules/gnome/triplebuffering.nix | 18 ---- modules/homelab/binary_cache.nix | 9 -- modules/homelab/default.nix | 15 --- modules/homelab/nginx_proxy.nix | 85 ----------------- modules/homelab/nix_containers.nix | 23 ----- modules/homelab/oci_containers.nix | 49 ---------- modules/homelab/samba.nix | 36 -------- modules/homelab/virtualization.nix | 15 --- modules/hyprland.nix | 55 ----------- modules/kde.nix | 34 ------- modules/plymouth.nix | 9 -- modules/steam.nix | 12 --- modules/sway.nix | 16 ---- modules/zram_swap.nix | 6 -- nixosModules/default.nix | 6 ++ nixosModules/desktopConfig/default.nix | 43 +++++++++ nixosModules/desktopConfig/gnome/default.nix | 37 ++++++++ .../desktopConfig/gnome/fprintdFix.nix | 33 +++++++ .../desktopConfig/gnome/tripleBuffering.nix | 24 +++++ nixosModules/desktopConfig/plasma/default.nix | 36 ++++++++ .../windowManagers/hyprland/default.nix | 52 +++++++++++ nixosModules/homeLab/binaryCache/default.nix | 14 +++ nixosModules/homeLab/default.nix | 25 +++++ .../homeLab/nixContainers/default.nix | 29 ++++++ .../homeLab/ociContainers/default.nix | 55 +++++++++++ nixosModules/homeLab/reverseProxy/default.nix | 91 +++++++++++++++++++ nixosModules/homeLab/samba/default.nix | 41 +++++++++ .../homeLab/virtualization/default.nix | 21 +++++ nixosModules/programs/default.nix | 6 ++ .../programs/flatpakSupport/default.nix | 33 +++++++ nixosModules/programs/steamGames/default.nix | 17 ++++ .../systemConfig}/default.nix | 2 +- .../systemConfig}/network.nix | 0 .../systemConfig/plymouth/default.nix | 14 +++ .../systemConfig}/sound.nix | 0 .../systemConfig/zramSwap/default.nix | 13 +++ nixosModules/userConfig/aly/default.nix | 15 +++ nixosModules/userConfig/default.nix | 6 ++ nixosModules/userConfig/dustin/default.nix | 15 +++ users/aly.nix | 10 -- users/dustin.nix | 10 -- 50 files changed, 695 insertions(+), 593 deletions(-) delete mode 100644 modules/desktop.nix delete mode 100644 modules/gnome/default.nix delete mode 100644 modules/gnome/fingerprint.nix delete mode 100644 modules/gnome/fractional_scaling.nix delete mode 100644 modules/gnome/triplebuffering.nix delete mode 100644 modules/homelab/binary_cache.nix delete mode 100644 modules/homelab/default.nix delete mode 100644 modules/homelab/nginx_proxy.nix delete mode 100644 modules/homelab/nix_containers.nix delete mode 100644 modules/homelab/oci_containers.nix delete mode 100644 modules/homelab/samba.nix delete mode 100644 modules/homelab/virtualization.nix delete mode 100644 modules/hyprland.nix delete mode 100644 modules/kde.nix delete mode 100644 modules/plymouth.nix delete mode 100644 modules/steam.nix delete mode 100644 modules/sway.nix delete mode 100644 modules/zram_swap.nix create mode 100644 nixosModules/default.nix create mode 100644 nixosModules/desktopConfig/default.nix create mode 100644 nixosModules/desktopConfig/gnome/default.nix create mode 100644 nixosModules/desktopConfig/gnome/fprintdFix.nix create mode 100644 nixosModules/desktopConfig/gnome/tripleBuffering.nix create mode 100644 nixosModules/desktopConfig/plasma/default.nix create mode 100644 nixosModules/desktopConfig/windowManagers/hyprland/default.nix create mode 100644 nixosModules/homeLab/binaryCache/default.nix create mode 100644 nixosModules/homeLab/default.nix create mode 100644 nixosModules/homeLab/nixContainers/default.nix create mode 100644 nixosModules/homeLab/ociContainers/default.nix create mode 100644 nixosModules/homeLab/reverseProxy/default.nix create mode 100644 nixosModules/homeLab/samba/default.nix create mode 100644 nixosModules/homeLab/virtualization/default.nix create mode 100644 nixosModules/programs/default.nix create mode 100644 nixosModules/programs/flatpakSupport/default.nix create mode 100644 nixosModules/programs/steamGames/default.nix rename {system => nixosModules/systemConfig}/default.nix (97%) rename {system => nixosModules/systemConfig}/network.nix (100%) create mode 100644 nixosModules/systemConfig/plymouth/default.nix rename {system => nixosModules/systemConfig}/sound.nix (100%) create mode 100644 nixosModules/systemConfig/zramSwap/default.nix create mode 100644 nixosModules/userConfig/aly/default.nix create mode 100644 nixosModules/userConfig/default.nix create mode 100644 nixosModules/userConfig/dustin/default.nix delete mode 100644 users/aly.nix delete mode 100644 users/dustin.nix diff --git a/flake.nix b/flake.nix index 74e5de16..1e591c35 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,7 @@ nixos-hardware.nixosModules.framework-13-7040-amd home-manager-unstable.nixosModules.home-manager ./hosts/lavaridge + ./nixosModules ]; }; @@ -61,6 +62,7 @@ modules = [ home-manager-unstable.nixosModules.home-manager ./hosts/mauville + ./nixosModules ]; }; @@ -72,6 +74,7 @@ nixos-hardware.nixosModules.common-cpu-intel home-manager-unstable.nixosModules.home-manager ./hosts/petalburg + ./nixosModules ]; }; @@ -82,6 +85,7 @@ nixos-hardware.nixosModules.lenovo-thinkpad-t440p home-manager-unstable.nixosModules.home-manager ./hosts/rustboro + ./nixosModules ]; }; }; diff --git a/hosts/lavaridge/default.nix b/hosts/lavaridge/default.nix index edfaddde..56f902d7 100644 --- a/hosts/lavaridge/default.nix +++ b/hosts/lavaridge/default.nix @@ -4,53 +4,42 @@ { imports = [ - ../../modules/homelab/virtualization.nix - ../../modules/hyprland.nix - ../../modules/plymouth.nix - ../../modules/steam.nix - ../../modules/zram_swap.nix - ../../system - ../../users/aly.nix ./hardware-configuration.nix # Include the results of the hardware scan. - # ../../modules/gnome - # ../../modules/gnome/fingerprint.nix - # ../../modules/gnome/fractional_scaling.nix ]; - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; + boot = { + # Bootloader. + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; - # Pull latest Linux kernel. - boot.kernelPackages = pkgs.linuxPackages_latest; + # Use latest Linux kernel. + kernelPackages = pkgs.linuxPackages_latest; + }; networking.hostName = "lavaridge"; # Define your hostname. services.fwupd.enable = true; - # # we need fwupd 1.9.7 to downgrade the fingerprint sensor firmware - # services.fwupd.package = (import (builtins.fetchTarball { - # url = "https://github.com/NixOS/nixpkgs/archive/bb2009ca185d97813e75736c2b8d1d8bb81bde05.tar.gz"; - # sha256 = "sha256:003qcrsq5g5lggfrpq31gcvj82lb065xvr7bpfa8ddsw8x4dnysk"; - # }) { - # inherit (pkgs) system; - # }).fwupd; - - # nixpkgs.config.chromium.commandLineArgs = "--ozone-platform=wayland"; - # environment.sessionVariables.NIXOS_OZONE_WL = "1"; services.fprintd.package = pkgs.fprintd.overrideAttrs { mesonCheckFlags = [ "--no-suite" "fprintd:TestPamFprintd" ]; }; - # services.fprintd.enable = false; - home-manager.users.aly = import ../../home/aly-hyprland.nix; - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + desktopConfig = { + enable = true; + windowManagers.hyprland.enable = true; + }; + + programs = { + flatpakSupport.enable = true; + steamGames.enable = true; + }; + + homeLab.virtualization.enable = true; + + systemConfig.plymouth.enable = true; + systemConfig.zramSwap.enable = true; + system.stateVersion = "23.11"; # Did you read the comment? } diff --git a/hosts/mauville/default.nix b/hosts/mauville/default.nix index 4cd3a66f..af4759cb 100644 --- a/hosts/mauville/default.nix +++ b/hosts/mauville/default.nix @@ -4,13 +4,6 @@ { imports = [ - # ../../modules/gnome - # ../../modules/kde.nix - ../../modules/hyprland.nix - ../../modules/homelab - ../../modules/steam.nix - ../../system - ../../users/aly.nix ./hardware-configuration.nix ]; @@ -37,5 +30,9 @@ home-manager.users.aly = import ../../home/aly-hyprland.nix; + homeLab.enable = true; + programs.steamGames.enable = true; + desktopConfig.enable = true; + system.stateVersion = "23.11"; } diff --git a/hosts/petalburg/default.nix b/hosts/petalburg/default.nix index f2791819..235dc110 100644 --- a/hosts/petalburg/default.nix +++ b/hosts/petalburg/default.nix @@ -53,22 +53,17 @@ let in { imports = [ - # ../../modules/kde.nix - ../../modules/gnome - ../../modules/plymouth.nix - ../../modules/zram_swap.nix - ../../system - ../../users/aly.nix - ../../users/dustin.nix ./hardware-configuration.nix # Include the results of the hardware scan. ]; - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; + boot = { + # Bootloader. + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; - # Pull latest Linux kernel. - boot.kernelPackages = pkgs.linuxPackages_latest; + # Use latest Linux kernel. + kernelPackages = pkgs.linuxPackages_latest; + }; networking.hostName = "petalburg"; # Define your hostname. @@ -82,11 +77,23 @@ in { environment.systemPackages = [ cs-adjuster cs-adjuster-plasma pp-adjuster ]; - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.11"; # Did you read the comment? + userConfig.dustin.enable = true; + + desktopConfig = { + enable = true; + windowManagers.hyprland.enable = false; + gnome.enable = true; + }; + + programs = { + flatpakSupport.enable = true; + steamGames.enable = false; + }; + + homeLab.virtualization.enable = true; + + systemConfig.plymouth.enable = true; + systemConfig.zramSwap.enable = true; + + system.stateVersion = "23.11"; } diff --git a/hosts/rustboro/default.nix b/hosts/rustboro/default.nix index 1f7d50de..d4d8e330 100644 --- a/hosts/rustboro/default.nix +++ b/hosts/rustboro/default.nix @@ -5,12 +5,6 @@ { imports = [ ./hardware-configuration.nix # Include the results of the hardware scan. - ../../users/aly.nix - ../../system - ../../modules/plymouth.nix - # ../../modules/kde.nix - # ../../modules/sway.nix - ../../modules/hyprland.nix ]; # Bootloader. @@ -24,11 +18,17 @@ home-manager.users.aly = import ../../home/aly-hyprland.nix; - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It‘s perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + desktopConfig = { + enable = true; + windowManagers.hyprland.enable = true; + }; + + programs = { + flatpakSupport.enable = true; + }; + + systemConfig.plymouth.enable = true; + systemConfig.zramSwap.enable = true; + system.stateVersion = "23.11"; # Did you read the comment? } diff --git a/modules/desktop.nix b/modules/desktop.nix deleted file mode 100644 index 0efcdb3d..00000000 --- a/modules/desktop.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ config, pkgs, ... }: - -{ - ## Enable the X11 windowing system. - services.xserver = { - enable = true; - xkb.layout = "us"; - xkb.variant = ""; - excludePackages = with pkgs; [ xterm ]; - }; - - ## Needed for Flatpaks - xdg.portal.enable = true; - - services.flatpak.enable = true; - - environment.systemPackages = with pkgs; [ - firefox - fractal - github-desktop - gnome.gnome-software - google-chrome - obsidian - tauon - vscode - webcord - zoom-us - ]; - - fonts.packages = with pkgs; [ - (nerdfonts.override { fonts = [ "Hack" "DroidSansMono" "Noto" ]; }) - fira-code - fira-code-symbols - liberation_ttf - ]; - - fonts.fontDir.enable = true; - - system.fsPackages = [ pkgs.bindfs ]; - fileSystems = let - mkRoSymBind = path: { - device = path; - fsType = "fuse.bindfs"; - options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ]; - }; - aggregatedFonts = pkgs.buildEnv { - name = "system-fonts"; - paths = config.fonts.packages; - pathsToLink = [ "/share/fonts" ]; - }; - in { - # Create an FHS mount to support flatpak host icons/fonts - "/usr/share/icons" = mkRoSymBind (config.system.path + "/share/icons"); - "/usr/share/fonts" = mkRoSymBind (aggregatedFonts + "/share/fonts"); - }; -} diff --git a/modules/gnome/default.nix b/modules/gnome/default.nix deleted file mode 100644 index 533b90f1..00000000 --- a/modules/gnome/default.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ # Include X settings. - ../desktop.nix - ]; - - environment.systemPackages = with pkgs; [ - gnomeExtensions.appindicator - gnomeExtensions.blur-my-shell - gnomeExtensions.gsconnect - gnomeExtensions.light-shell - gnomeExtensions.night-theme-switcher - gnomeExtensions.noannoyance-fork - gnomeExtensions.tailscale-status - gnomeExtensions.tiling-assistant - ]; - - # Enable keyring support for KDE apps in GNOME. - security.pam.services.gdm.enableKwallet = true; - - # Enable GNOME and GDM. - services = { - gnome.tracker-miners.enable = true; - udev.packages = with pkgs; [ gnome.gnome-settings-daemon ]; - xserver = { - desktopManager.gnome.enable = true; - displayManager.gdm.enable = true; - }; - }; -} diff --git a/modules/gnome/fingerprint.nix b/modules/gnome/fingerprint.nix deleted file mode 100644 index de8f2a27..00000000 --- a/modules/gnome/fingerprint.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ config, pkgs, ... }: - -{ - # Need to change the order pam loads its modules - # to get proper fingerprint behavior on GDM and the lockscreen. - security.pam.services.login.fprintAuth = false; - security.pam.services.gdm-fingerprint = - lib.mkIf (config.services.fprintd.enable) { - text = '' - auth required pam_shells.so - auth requisite pam_nologin.so - auth requisite pam_faillock.so preauth - auth required ${pkgs.fprintd}/lib/security/pam_fprintd.so - auth optional pam_permit.so - auth required pam_env.so - auth [success=ok default=1] ${pkgs.gnome.gdm}/lib/security/pam_gdm.so - auth optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so - - account include login - - password required pam_deny.so - - session include login - session optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so auto_start - ''; - }; -} diff --git a/modules/gnome/fractional_scaling.nix b/modules/gnome/fractional_scaling.nix deleted file mode 100644 index 123ce81a..00000000 --- a/modules/gnome/fractional_scaling.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ config, pkgs, ... }: - -{ - environment.sessionVariables.NIXOS_OZONE_WL = "1"; -} diff --git a/modules/gnome/triplebuffering.nix b/modules/gnome/triplebuffering.nix deleted file mode 100644 index 2f122529..00000000 --- a/modules/gnome/triplebuffering.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ config, pkgs, ... }: - -{ - nixpkgs.overlays = [ - (final: prev: { - gnome = prev.gnome.overrideScope (gnomeFinal: gnomePrev: { - mutter = gnomePrev.mutter.overrideAttrs (old: { - src = pkgs.fetchgit { - url = "https://gitlab.gnome.org/vanvugt/mutter.git"; - # GNOME 45: triple-buffering-v4-45 - rev = "0b896518b2028d9c4d6ea44806d093fd33793689"; - sha256 = "sha256-mzNy5GPlB2qkI2KEAErJQzO//uo8yO0kPQUwvGDwR4w="; - }; - }); - }); - }) - ]; -} diff --git a/modules/homelab/binary_cache.nix b/modules/homelab/binary_cache.nix deleted file mode 100644 index 3f9abb11..00000000 --- a/modules/homelab/binary_cache.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, pkgs, ... }: - -{ - services.nix-serve = { - enable = true; - secretKeyFile = "/var/cache-priv-key.pem"; - }; -} - diff --git a/modules/homelab/default.nix b/modules/homelab/default.nix deleted file mode 100644 index 4b2c2b45..00000000 --- a/modules/homelab/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ - ./binary_cache.nix - ./nginx_proxy.nix - ./nix_containers.nix - ./oci_containers.nix - ./samba.nix - ./virtualization.nix - ]; - - # services.ddclient.enable = true; - # services.ddclient.configFile = "/etc/ddclient/ddclient.conf"; -} diff --git a/modules/homelab/nginx_proxy.nix b/modules/homelab/nginx_proxy.nix deleted file mode 100644 index 8c3148c4..00000000 --- a/modules/homelab/nginx_proxy.nix +++ /dev/null @@ -1,85 +0,0 @@ -{ config, pkgs, ... }: - -{ - # services.ddclient.enable = true; - # services.ddclient.configFile = "/etc/ddclient/ddclient.conf"; - - # Open TCP ports for audiobookshelf, plex-server, and transmission-server. - networking = { - firewall = { - allowedTCPPorts = [ 80 443 51413 9091 ]; - allowedUDPPorts = [ 51413 ]; - }; - # My router doesn't expose settings for NAT loopback - # So we have to use this workaround. - extraHosts = '' - 127.0.0.1 music.raffauflabs.com - 127.0.0.1 nixcache.raffauflabs.com - 127.0.0.1 plex.raffauflabs.com - 127.0.0.1 podcasts.raffauflabs.com - ''; - }; - - security.acme = { - acceptTerms = true; - defaults.email = "alyraffauf@gmail.com"; - }; - services.nginx = { - enable = true; - recommendedProxySettings = true; - recommendedTlsSettings = true; - recommendedGzipSettings = true; - - virtualHosts."music.raffauflabs.com" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:4533"; - proxyWebsockets = true; # needed if you need to use WebSocket - extraConfig = '' - proxy_buffering off; - ''; - }; - }; - - virtualHosts."nixcache.raffauflabs.com" = { - enableACME = true; - forceSSL = true; - locations."/".proxyPass = - "http://${config.services.nix-serve.bindAddress}:${ - toString config.services.nix-serve.port - }"; - }; - - virtualHosts."plex.raffauflabs.com" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:32400"; - proxyWebsockets = true; # needed if you need to use WebSocket - extraConfig = '' - proxy_buffering off; - ''; - }; - }; - - virtualHosts."podcasts.raffauflabs.com" = { - enableACME = true; - forceSSL = true; - locations."/" = { - proxyPass = "http://127.0.0.1:13378"; - # proxyWebsockets = true; # This breaks audiobookshelf. - extraConfig = '' - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Host $host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_redirect http:// https://; - proxy_buffering off; - client_max_body_size 500M; - ''; - }; - }; - }; -} diff --git a/modules/homelab/nix_containers.nix b/modules/homelab/nix_containers.nix deleted file mode 100644 index 6aafe227..00000000 --- a/modules/homelab/nix_containers.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ config, pkgs, ... }: - -{ - containers.navidrome = { - autoStart = true; - bindMounts."/Music".hostPath = "/mnt/Media/Music"; - config = { config, pkgs, lib, ... }: { - system.stateVersion = "24.05"; - services.navidrome = { - enable = true; - openFirewall = true; - settings = { - Address = "0.0.0.0"; - Port = 4533; - MusicFolder = "/Music"; - DefaultTheme = "Auto"; - SubsonicArtistParticipations = true; - UIWelcomeMessage = "Welcome to Navidrome @ raffauflabs.com."; - }; - }; - }; - }; -} diff --git a/modules/homelab/oci_containers.nix b/modules/homelab/oci_containers.nix deleted file mode 100644 index eb41db6e..00000000 --- a/modules/homelab/oci_containers.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ config, pkgs, ... }: - -{ - virtualisation.oci-containers.containers = { - audiobookshelf = { - ports = [ "0.0.0.0:13378:80" ]; - image = "ghcr.io/advplyr/audiobookshelf:latest"; - environment = { TZ = "America/New_York"; }; - volumes = - [ "abs_config:/config" "abs_metadata:/metadata" "/mnt/Media:/Media" ]; - }; - plex-server = { - ports = [ "0.0.0.0:32400:32400" ]; - image = "plexinc/pms-docker:public"; - environment = { TZ = "America/New_York"; }; - volumes = [ - "plex_config:/config" - "plex_transcode:/transcode" - "/mnt/Media:/Media" - "/mnt/Archive:/Archive" - ]; - }; - transmission-server = { - ports = [ "0.0.0.0:9091:9091" "0.0.0.0:51413:51413" ]; - image = "linuxserver/transmission:latest"; - environment = { - PGID = "1000"; - PUID = "1000"; - TZ = "America/New_York"; - }; - volumes = [ - "transmission_config:/config" - "/mnt/Media:/Media" - "/mnt/Archive:/Archive" - ]; - }; - jellyfin = { - ports = [ "0.0.0.0:8096:8096" ]; - image = "jellyfin/jellyfin"; - environment = { TZ = "America/New_York"; }; - volumes = [ - "jellyfin_config:/config" - "jellyfin_cache:/cache" - "/mnt/Media:/Media" - "/mnt/Archive:/Archive" - ]; - }; - }; -} diff --git a/modules/homelab/samba.nix b/modules/homelab/samba.nix deleted file mode 100644 index caf33a3c..00000000 --- a/modules/homelab/samba.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ config, pkgs, ... }: - -{ - services = { - samba = { - enable = true; - securityType = "user"; - openFirewall = true; - shares = { - Media = { - comment = "Media @Mauville"; - path = "/mnt/Media"; - browseable = "yes"; - "read only" = "no"; - "guest ok" = "yes"; - "create mask" = "0755"; - "directory mask" = "0755"; - }; - Archive = { - comment = "Archive @Mauville"; - path = "/mnt/Archive"; - browseable = "yes"; - "read only" = "no"; - "guest ok" = "yes"; - "create mask" = "0755"; - "directory mask" = "0755"; - }; - }; - }; - samba-wsdd = { - enable = true; - openFirewall = true; - }; - }; -} - diff --git a/modules/homelab/virtualization.nix b/modules/homelab/virtualization.nix deleted file mode 100644 index 2461eff8..00000000 --- a/modules/homelab/virtualization.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs, ... }: - -{ - programs.virt-manager.enable = true; - - virtualisation = { - libvirtd.enable = true; - 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; - }; - }; -} diff --git a/modules/hyprland.nix b/modules/hyprland.nix deleted file mode 100644 index 602e84bd..00000000 --- a/modules/hyprland.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ # Include X settings. - ./desktop.nix - ]; - - services.xserver.displayManager.lightdm = { - enable = true; - greeters.slick = { - enable = true; - theme.name = "Catppuccin-Frappe-Compact-Mauve-Dark"; - theme.package = pkgs.catppuccin-gtk.override { - accents = [ "mauve" ]; - size = "compact"; - variant = "frappe"; - tweaks = [ "normal" ]; - }; - iconTheme.name = "Papirus-Dark"; - iconTheme.package = pkgs.catppuccin-papirus-folders.override { - flavor = "frappe"; - accent = "mauve"; - }; - font.name = "NotoSans Nerd Font Regular"; - - cursorTheme.package = pkgs.catppuccin-cursors.frappeDark; - cursorTheme.name = "Catppuccin-Frappe-Dark-Cursors"; - cursorTheme.size = 32; - - extraConfig = '' - background=#ca9ee6 - enable-hidpi=on - ''; - }; - }; - programs.hyprland.enable = true; - services.power-profiles-daemon.enable = true; - services.upower.enable = true; - - services.dbus.packages = [ pkgs.gcr ]; - - services.gnome.gnome-keyring.enable = true; - security.pam.services.gdm.enableKwallet = true; - security.pam.services.gdm.enableGnomeKeyring = true; - - # programs.xfconf.enable = true; - # programs.thunar = { - # enable = true; - # plugins = with pkgs.xfce; [ thunar-archive-plugin thunar-volman ]; - # }; - services.gvfs.enable = true; # Mount, trash, and other functionalities - services.tumbler.enable = true; # Thumbnail support for images - - environment.sessionVariables.NIXOS_OZONE_WL = "1"; -} diff --git a/modules/kde.nix b/modules/kde.nix deleted file mode 100644 index 21681316..00000000 --- a/modules/kde.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ # Include X settings. - ./desktop.nix - ]; - - # Enable SDDM + Plasma Desktop. - services = { - desktopManager.plasma6.enable = true; - xserver = { - displayManager.sddm = { - enable = true; - wayland.enable = true; - }; - }; - }; - - environment.systemPackages = with pkgs; [ - kdePackages.kate - kdePackages.kimageformats - kdePackages.kio-gdrive - kdePackages.sddm-kcm - maliit-keyboard - ]; - - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - - programs.kdeconnect.enable = true; - # nixpkgs.config.firefox.enablePlasmaBrowserIntegration = true; - # nixpkgs.config.chromium.commandLineArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WaylandWindowDecorations --ozone-platform-hint=auto"; - services.gnome.gnome-keyring.enable = true; - security.pam.services.sddm.enableGnomeKeyring = true; -} diff --git a/modules/plymouth.nix b/modules/plymouth.nix deleted file mode 100644 index 89979213..00000000 --- a/modules/plymouth.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, pkgs, ... }: - -{ - boot = { - consoleLogLevel = 0; - initrd.verbose = false; - plymouth.enable = true; - }; -} diff --git a/modules/steam.nix b/modules/steam.nix deleted file mode 100644 index 1f67d2e8..00000000 --- a/modules/steam.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ config, pkgs, ... }: - -{ - hardware.steam-hardware.enable = true; - programs.steam = { - enable = true; - remotePlay.openFirewall = - true; # Open ports in the firewall for Steam Remote Play - dedicatedServer.openFirewall = - true; # Open ports in the firewall for Source Dedicated Server - }; -} diff --git a/modules/sway.nix b/modules/sway.nix deleted file mode 100644 index 38885d5b..00000000 --- a/modules/sway.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ # Include X settings. - ./desktop.nix - ]; - - services.xserver.displayManager = { sessionPackages = [ pkgs.sway ]; }; - - programs.light.enable = true; # Brightness and volume control. - programs.dconf.enable = true; - services.xserver.libinput.enable = true; - services.gnome.gnome-keyring.enable = true; - xdg.portal.wlr.enable = true; - xdg.portal.config.common.default = "*"; -} diff --git a/modules/zram_swap.nix b/modules/zram_swap.nix deleted file mode 100644 index ad495b3b..00000000 --- a/modules/zram_swap.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ config, pkgs, ... }: - -{ - zramSwap.enable = true; - zramSwap.memoryPercent = 25; -} diff --git a/nixosModules/default.nix b/nixosModules/default.nix new file mode 100644 index 00000000..1950af57 --- /dev/null +++ b/nixosModules/default.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: + +{ + imports = [ ./desktopConfig ./homeLab ./programs ./systemConfig ./userConfig ]; + +} \ No newline at end of file diff --git a/nixosModules/desktopConfig/default.nix b/nixosModules/desktopConfig/default.nix new file mode 100644 index 00000000..f3412550 --- /dev/null +++ b/nixosModules/desktopConfig/default.nix @@ -0,0 +1,43 @@ +{ pkgs, lib, config, ... }: { + + + imports = [ ./gnome ./plasma ./windowManagers/hyprland ]; + + options = { + desktopConfig.enable = + lib.mkEnableOption "Enables basic GUI X11 and Wayland environment."; + }; + + config = lib.mkIf config.desktopConfig.enable { + # Enable the X11 windowing system. + services.xserver = { + enable = true; + xkb.layout = "us"; + xkb.variant = ""; + excludePackages = with pkgs; [ xterm ]; + }; + + # Install pretty fonts. + fonts.packages = with pkgs; [ + (nerdfonts.override { fonts = [ "Hack" "DroidSansMono" "Noto" ]; }) + fira-code + fira-code-symbols + liberation_ttf + ]; + + # Enable basic assortment of GUI apps. + environment.systemPackages = with pkgs; [ + firefox + fractal + github-desktop + google-chrome + obsidian + tauon + vscode + webcord + zoom-us + ]; + + desktopConfig.windowManagers.hyprland.enable = lib.mkDefault true; + }; +} \ No newline at end of file diff --git a/nixosModules/desktopConfig/gnome/default.nix b/nixosModules/desktopConfig/gnome/default.nix new file mode 100644 index 00000000..8a336466 --- /dev/null +++ b/nixosModules/desktopConfig/gnome/default.nix @@ -0,0 +1,37 @@ +{ pkgs, lib, config, ... }: { + + imports = [ # Include X settings. + ./fprintdFix.nix ./tripleBuffering.nix + ]; + + options = { + desktopConfig.gnome.enable = + lib.mkEnableOption "Enables GNOME desktop session."; + }; + + config = lib.mkIf config.desktopConfig.gnome.enable { + environment.systemPackages = with pkgs; [ + gnomeExtensions.appindicator + gnomeExtensions.blur-my-shell + gnomeExtensions.gsconnect + gnomeExtensions.light-shell + gnomeExtensions.night-theme-switcher + gnomeExtensions.noannoyance-fork + gnomeExtensions.tailscale-status + gnomeExtensions.tiling-assistant + ]; + + # Enable keyring support for KDE apps in GNOME. + security.pam.services.gdm.enableKwallet = true; + + # Enable GNOME and GDM. + services = { + gnome.tracker-miners.enable = true; + udev.packages = with pkgs; [ gnome.gnome-settings-daemon ]; + xserver = { + desktopManager.gnome.enable = true; + displayManager.gdm.enable = true; + }; + }; + }; +} \ No newline at end of file diff --git a/nixosModules/desktopConfig/gnome/fprintdFix.nix b/nixosModules/desktopConfig/gnome/fprintdFix.nix new file mode 100644 index 00000000..dfc2fdf0 --- /dev/null +++ b/nixosModules/desktopConfig/gnome/fprintdFix.nix @@ -0,0 +1,33 @@ +{ pkgs, lib, config, ... }: { + + options = { + desktopConfig.gnome.fprintdFix.enable = + lib.mkEnableOption "Fixes fprintd and pam issues with GNOME Display Manager."; + }; + + config = lib.mkIf config.desktopConfig.gnome.fprintdFix.enable { + # Need to change the order pam loads its modules + # to get proper fingerprint behavior on GDM and the lockscreen. + security.pam.services.login.fprintAuth = false; + security.pam.services.gdm-fingerprint = + lib.mkIf (config.services.fprintd.enable) { + text = '' + auth required pam_shells.so + auth requisite pam_nologin.so + auth requisite pam_faillock.so preauth + auth required ${pkgs.fprintd}/lib/security/pam_fprintd.so + auth optional pam_permit.so + auth required pam_env.so + auth [success=ok default=1] ${pkgs.gnome.gdm}/lib/security/pam_gdm.so + auth optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so + + account include login + + password required pam_deny.so + + session include login + session optional ${pkgs.gnome.gnome-keyring}/lib/security/pam_gnome_keyring.so auto_start + ''; + }; + }; +} \ No newline at end of file diff --git a/nixosModules/desktopConfig/gnome/tripleBuffering.nix b/nixosModules/desktopConfig/gnome/tripleBuffering.nix new file mode 100644 index 00000000..03e029c4 --- /dev/null +++ b/nixosModules/desktopConfig/gnome/tripleBuffering.nix @@ -0,0 +1,24 @@ +{ pkgs, lib, config, ... }: { + + options = { + desktopConfig.gnome.tripleBuffering.enable = + lib.mkEnableOption "Enables dynamic triple buffering for GNOME."; + }; + + config = lib.mkIf config.desktopConfig.gnome.tripleBuffering.enable { + nixpkgs.overlays = [ + (final: prev: { + gnome = prev.gnome.overrideScope (gnomeFinal: gnomePrev: { + mutter = gnomePrev.mutter.overrideAttrs (old: { + src = pkgs.fetchgit { + url = "https://gitlab.gnome.org/vanvugt/mutter.git"; + # GNOME 45: triple-buffering-v4-45 + rev = "0b896518b2028d9c4d6ea44806d093fd33793689"; + sha256 = "sha256-mzNy5GPlB2qkI2KEAErJQzO//uo8yO0kPQUwvGDwR4w="; + }; + }); + }); + }) + ]; + }; +} \ No newline at end of file diff --git a/nixosModules/desktopConfig/plasma/default.nix b/nixosModules/desktopConfig/plasma/default.nix new file mode 100644 index 00000000..a59fbdb2 --- /dev/null +++ b/nixosModules/desktopConfig/plasma/default.nix @@ -0,0 +1,36 @@ +{ pkgs, lib, config, ... }: { + + options = { + desktopConfig.plasma.enable = + lib.mkEnableOption "Enables plasma desktop session."; + }; + + config = lib.mkIf config.desktopConfig.plasma.enable { + # Enable SDDM + Plasma Desktop. + services = { + desktopManager.plasma6.enable = true; + xserver = { + displayManager.sddm = { + enable = true; + wayland.enable = true; + }; + }; + }; + + environment.systemPackages = with pkgs; [ + kdePackages.kate + kdePackages.kimageformats + kdePackages.kio-gdrive + kdePackages.sddm-kcm + maliit-keyboard + ]; + + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + programs.kdeconnect.enable = true; + # nixpkgs.config.firefox.enablePlasmaBrowserIntegration = true; + # nixpkgs.config.chromium.commandLineArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WaylandWindowDecorations --ozone-platform-hint=auto"; + services.gnome.gnome-keyring.enable = true; + security.pam.services.sddm.enableGnomeKeyring = true; + }; +} \ No newline at end of file diff --git a/nixosModules/desktopConfig/windowManagers/hyprland/default.nix b/nixosModules/desktopConfig/windowManagers/hyprland/default.nix new file mode 100644 index 00000000..c4fc5be8 --- /dev/null +++ b/nixosModules/desktopConfig/windowManagers/hyprland/default.nix @@ -0,0 +1,52 @@ +{ pkgs, lib, config, ... }: { + + options = { + desktopConfig.windowManagers.hyprland.enable = + lib.mkEnableOption "Enables hyprland window manager session with lightdm."; + }; + + config = lib.mkIf config.desktopConfig.windowManagers.hyprland.enable { + services.xserver.displayManager.lightdm = { + enable = true; + greeters.slick = { + enable = true; + theme.name = "Catppuccin-Frappe-Compact-Mauve-Dark"; + theme.package = pkgs.catppuccin-gtk.override { + accents = [ "mauve" ]; + size = "compact"; + variant = "frappe"; + tweaks = [ "normal" ]; + }; + iconTheme.name = "Papirus-Dark"; + iconTheme.package = pkgs.catppuccin-papirus-folders.override { + flavor = "frappe"; + accent = "mauve"; + }; + font.name = "NotoSans Nerd Font Regular"; + + cursorTheme.package = pkgs.catppuccin-cursors.frappeDark; + cursorTheme.name = "Catppuccin-Frappe-Dark-Cursors"; + cursorTheme.size = 32; + + extraConfig = '' + background=#ca9ee6 + enable-hidpi=on + ''; + }; + }; + programs.hyprland.enable = true; + services.power-profiles-daemon.enable = true; + services.upower.enable = true; + + services.dbus.packages = [ pkgs.gcr ]; + + services.gnome.gnome-keyring.enable = true; + security.pam.services.gdm.enableKwallet = true; + security.pam.services.gdm.enableGnomeKeyring = true; + + services.gvfs.enable = true; # Mount, trash, and other functionalities + services.tumbler.enable = true; # Thumbnail support for images + + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + }; +} \ No newline at end of file diff --git a/nixosModules/homeLab/binaryCache/default.nix b/nixosModules/homeLab/binaryCache/default.nix new file mode 100644 index 00000000..d7c4f864 --- /dev/null +++ b/nixosModules/homeLab/binaryCache/default.nix @@ -0,0 +1,14 @@ +{ pkgs, lib, config, ... }: { + + options = { + homeLab.binaryCache.enable = + lib.mkEnableOption "Enables nixpkgs cache."; + }; + + config = lib.mkIf config.homeLab.binaryCache.enable { + services.nix-serve = { + enable = true; + secretKeyFile = "/var/cache-priv-key.pem"; + }; + }; +} \ No newline at end of file diff --git a/nixosModules/homeLab/default.nix b/nixosModules/homeLab/default.nix new file mode 100644 index 00000000..9ea6ec14 --- /dev/null +++ b/nixosModules/homeLab/default.nix @@ -0,0 +1,25 @@ +{ pkgs, lib, config, ... }: { + + imports = [ + ./binaryCache + ./reverseProxy + ./nixContainers + ./ociContainers + ./samba + ./virtualization + ]; + + options = { + homeLab.enable = + lib.mkEnableOption "Enables fully functional HomeLab."; + }; + + config = lib.mkIf config.homeLab.enable { + homeLab.binaryCache.enable = lib.mkDefault true; + homeLab.nixContainers.enable = lib.mkDefault true; + homeLab.ociContainers.enable = lib.mkDefault true; + homeLab.reverseProxy.enable = lib.mkDefault true; + homeLab.samba.enable = lib.mkDefault true; + homeLab.virtualization.enable = lib.mkDefault true; + }; +} \ No newline at end of file diff --git a/nixosModules/homeLab/nixContainers/default.nix b/nixosModules/homeLab/nixContainers/default.nix new file mode 100644 index 00000000..7dd7aa01 --- /dev/null +++ b/nixosModules/homeLab/nixContainers/default.nix @@ -0,0 +1,29 @@ +{ pkgs, lib, config, ... }: { + + options = { + homeLab.nixContainers.enable = + lib.mkEnableOption "Enables select nix containers."; + }; + + config = lib.mkIf config.homeLab.nixContainers.enable { + containers.navidrome = { + autoStart = true; + bindMounts."/Music".hostPath = "/mnt/Media/Music"; + config = { config, pkgs, lib, ... }: { + system.stateVersion = "24.05"; + services.navidrome = { + enable = true; + openFirewall = true; + settings = { + Address = "0.0.0.0"; + Port = 4533; + MusicFolder = "/Music"; + DefaultTheme = "Auto"; + SubsonicArtistParticipations = true; + UIWelcomeMessage = "Welcome to Navidrome @ raffauflabs.com."; + }; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/nixosModules/homeLab/ociContainers/default.nix b/nixosModules/homeLab/ociContainers/default.nix new file mode 100644 index 00000000..d8647de5 --- /dev/null +++ b/nixosModules/homeLab/ociContainers/default.nix @@ -0,0 +1,55 @@ +{ pkgs, lib, config, ... }: { + + options = { + homeLab.ociContainers.enable = + lib.mkEnableOption "Enables select OCI containers."; + }; + + config = lib.mkIf config.homeLab.ociContainers.enable { + virtualisation.oci-containers.containers = { + audiobookshelf = { + ports = [ "0.0.0.0:13378:80" ]; + image = "ghcr.io/advplyr/audiobookshelf:latest"; + environment = { TZ = "America/New_York"; }; + volumes = + [ "abs_config:/config" "abs_metadata:/metadata" "/mnt/Media:/Media" ]; + }; + plex-server = { + ports = [ "0.0.0.0:32400:32400" ]; + image = "plexinc/pms-docker:public"; + environment = { TZ = "America/New_York"; }; + volumes = [ + "plex_config:/config" + "plex_transcode:/transcode" + "/mnt/Media:/Media" + "/mnt/Archive:/Archive" + ]; + }; + transmission-server = { + ports = [ "0.0.0.0:9091:9091" "0.0.0.0:51413:51413" ]; + image = "linuxserver/transmission:latest"; + environment = { + PGID = "1000"; + PUID = "1000"; + TZ = "America/New_York"; + }; + volumes = [ + "transmission_config:/config" + "/mnt/Media:/Media" + "/mnt/Archive:/Archive" + ]; + }; + jellyfin = { + ports = [ "0.0.0.0:8096:8096" ]; + image = "jellyfin/jellyfin"; + environment = { TZ = "America/New_York"; }; + volumes = [ + "jellyfin_config:/config" + "jellyfin_cache:/cache" + "/mnt/Media:/Media" + "/mnt/Archive:/Archive" + ]; + }; + }; + }; +} \ No newline at end of file diff --git a/nixosModules/homeLab/reverseProxy/default.nix b/nixosModules/homeLab/reverseProxy/default.nix new file mode 100644 index 00000000..9df7f8c2 --- /dev/null +++ b/nixosModules/homeLab/reverseProxy/default.nix @@ -0,0 +1,91 @@ +{ pkgs, lib, config, ... }: { + + options = { + homeLab.reverseProxy.enable = + lib.mkEnableOption "Enables nginx reverse proxy."; + }; + + config = lib.mkIf config.homeLab.reverseProxy.enable { + # services.ddclient.enable = true; + # services.ddclient.configFile = "/etc/ddclient/ddclient.conf"; + + # Open TCP ports for audiobookshelf, plex-server, and transmission-server. + networking = { + firewall = { + allowedTCPPorts = [ 80 443 51413 9091 ]; + allowedUDPPorts = [ 51413 ]; + }; + # My router doesn't expose settings for NAT loopback + # So we have to use this workaround. + extraHosts = '' + 127.0.0.1 music.raffauflabs.com + 127.0.0.1 nixcache.raffauflabs.com + 127.0.0.1 plex.raffauflabs.com + 127.0.0.1 podcasts.raffauflabs.com + ''; + }; + + security.acme = { + acceptTerms = true; + defaults.email = "alyraffauf@gmail.com"; + }; + services.nginx = { + enable = true; + recommendedProxySettings = true; + recommendedTlsSettings = true; + recommendedGzipSettings = true; + + virtualHosts."music.raffauflabs.com" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:4533"; + proxyWebsockets = true; # needed if you need to use WebSocket + extraConfig = '' + proxy_buffering off; + ''; + }; + }; + + virtualHosts."nixcache.raffauflabs.com" = { + enableACME = true; + forceSSL = true; + locations."/".proxyPass = + "http://${config.services.nix-serve.bindAddress}:${ + toString config.services.nix-serve.port + }"; + }; + + virtualHosts."plex.raffauflabs.com" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:32400"; + proxyWebsockets = true; # needed if you need to use WebSocket + extraConfig = '' + proxy_buffering off; + ''; + }; + }; + + virtualHosts."podcasts.raffauflabs.com" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:13378"; + # proxyWebsockets = true; # This breaks audiobookshelf. + extraConfig = '' + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_redirect http:// https://; + proxy_buffering off; + client_max_body_size 500M; + ''; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/nixosModules/homeLab/samba/default.nix b/nixosModules/homeLab/samba/default.nix new file mode 100644 index 00000000..9424c543 --- /dev/null +++ b/nixosModules/homeLab/samba/default.nix @@ -0,0 +1,41 @@ +{ pkgs, lib, config, ... }: { + + options = { + homeLab.samba.enable = + lib.mkEnableOption "Enables /Archive and /Media samba shares."; + }; + + config = lib.mkIf config.homeLab.samba.enable { + services = { + samba = { + enable = true; + securityType = "user"; + openFirewall = true; + shares = { + Media = { + comment = "Media @Mauville"; + path = "/mnt/Media"; + browseable = "yes"; + "read only" = "no"; + "guest ok" = "yes"; + "create mask" = "0755"; + "directory mask" = "0755"; + }; + Archive = { + comment = "Archive @Mauville"; + path = "/mnt/Archive"; + browseable = "yes"; + "read only" = "no"; + "guest ok" = "yes"; + "create mask" = "0755"; + "directory mask" = "0755"; + }; + }; + }; + samba-wsdd = { + enable = true; + openFirewall = true; + }; + }; + }; +} \ No newline at end of file diff --git a/nixosModules/homeLab/virtualization/default.nix b/nixosModules/homeLab/virtualization/default.nix new file mode 100644 index 00000000..f8a2fd7d --- /dev/null +++ b/nixosModules/homeLab/virtualization/default.nix @@ -0,0 +1,21 @@ +{ pkgs, lib, config, ... }: { + + options = { + homeLab.virtualization.enable = + lib.mkEnableOption "Enables podman and virt-manager virtualization."; + }; + + config = lib.mkIf config.homeLab.virtualization.enable { + programs.virt-manager.enable = true; + + virtualisation = { + libvirtd.enable = true; + 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; + }; + }; + }; +} \ No newline at end of file diff --git a/nixosModules/programs/default.nix b/nixosModules/programs/default.nix new file mode 100644 index 00000000..65753e8a --- /dev/null +++ b/nixosModules/programs/default.nix @@ -0,0 +1,6 @@ +{ pkgs, lib, config, ... }: { + + + imports = [ ./flatpakSupport ./steamGames ]; + +} \ No newline at end of file diff --git a/nixosModules/programs/flatpakSupport/default.nix b/nixosModules/programs/flatpakSupport/default.nix new file mode 100644 index 00000000..d7a93ab7 --- /dev/null +++ b/nixosModules/programs/flatpakSupport/default.nix @@ -0,0 +1,33 @@ +{ pkgs, lib, config, ... }: { + + options = { + programs.flatpakSupport.enable = lib.mkEnableOption "Enables flatpak support with GUI."; + }; + + config = lib.mkIf config.programs.flatpakSupport.enable { + # Needed for Flatpaks + xdg.portal.enable = true; + services.flatpak.enable = true; + fonts.fontDir.enable = true; + + # Allow access to system fonts. + system.fsPackages = [ pkgs.bindfs ]; + fileSystems = let + mkRoSymBind = path: { + device = path; + fsType = "fuse.bindfs"; + options = [ "ro" "resolve-symlinks" "x-gvfs-hide" ]; + }; + aggregatedFonts = pkgs.buildEnv { + name = "system-fonts"; + paths = config.fonts.packages; + pathsToLink = [ "/share/fonts" ]; + }; + in { + # Create an FHS mount to support flatpak host icons/fonts + "/usr/share/icons" = mkRoSymBind (config.system.path + "/share/icons"); + "/usr/share/fonts" = mkRoSymBind (aggregatedFonts + "/share/fonts"); + }; + environment.systemPackages = with pkgs; [ gnome.gnome-software ]; + }; +} diff --git a/nixosModules/programs/steamGames/default.nix b/nixosModules/programs/steamGames/default.nix new file mode 100644 index 00000000..cf825b16 --- /dev/null +++ b/nixosModules/programs/steamGames/default.nix @@ -0,0 +1,17 @@ +{ pkgs, lib, config, ... }: { + + options = { + programs.steamGames.enable = lib.mkEnableOption "Enables Steam for video games."; + }; + + config = lib.mkIf config.programs.steamGames.enable { + hardware.steam-hardware.enable = true; + programs.steam = { + enable = true; + remotePlay.openFirewall = + true; # Open ports in the firewall for Steam Remote Play + dedicatedServer.openFirewall = + true; # Open ports in the firewall for Source Dedicated Server + }; + }; +} diff --git a/system/default.nix b/nixosModules/systemConfig/default.nix similarity index 97% rename from system/default.nix rename to nixosModules/systemConfig/default.nix index 39d9eafe..21453742 100644 --- a/system/default.nix +++ b/nixosModules/systemConfig/default.nix @@ -1,7 +1,7 @@ { config, pkgs, ... }: { - imports = [ ./network.nix ./sound.nix ]; + imports = [ ./network.nix ./sound.nix ./plymouth ./zramSwap ]; # Set your time zone. time.timeZone = "America/New_York"; diff --git a/system/network.nix b/nixosModules/systemConfig/network.nix similarity index 100% rename from system/network.nix rename to nixosModules/systemConfig/network.nix diff --git a/nixosModules/systemConfig/plymouth/default.nix b/nixosModules/systemConfig/plymouth/default.nix new file mode 100644 index 00000000..0e2c47c3 --- /dev/null +++ b/nixosModules/systemConfig/plymouth/default.nix @@ -0,0 +1,14 @@ +{ pkgs, lib, config, ... }: { + + options = { + systemConfig.plymouth.enable = lib.mkEnableOption "Enables plymouth boot screen with reduced text verbosity."; + }; + + config = lib.mkIf config.systemConfig.plymouth.enable { + boot = { + consoleLogLevel = 0; + initrd.verbose = false; + plymouth.enable = true; + }; + }; +} diff --git a/system/sound.nix b/nixosModules/systemConfig/sound.nix similarity index 100% rename from system/sound.nix rename to nixosModules/systemConfig/sound.nix diff --git a/nixosModules/systemConfig/zramSwap/default.nix b/nixosModules/systemConfig/zramSwap/default.nix new file mode 100644 index 00000000..1d920bec --- /dev/null +++ b/nixosModules/systemConfig/zramSwap/default.nix @@ -0,0 +1,13 @@ +{ pkgs, lib, config, ... }: { + + options = { + systemConfig.zramSwap.enable = lib.mkEnableOption "Enables zram swap."; + }; + + config = lib.mkIf config.systemConfig.zramSwap.enable { + zramSwap = { + enable = true; + memoryPercent = 25; + }; + }; +} diff --git a/nixosModules/userConfig/aly/default.nix b/nixosModules/userConfig/aly/default.nix new file mode 100644 index 00000000..b7ff3a0c --- /dev/null +++ b/nixosModules/userConfig/aly/default.nix @@ -0,0 +1,15 @@ +{ pkgs, lib, config, ... }: { + + options = { + userConfig.aly.enable = lib.mkEnableOption "Enables Aly's user."; + }; + + config = lib.mkIf config.userConfig.aly.enable { + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.aly = { + isNormalUser = true; + description = "Aly Raffauf"; + extraGroups = [ "networkmanager" "wheel" "docker" "libvirtd" "video" ]; + }; + }; +} diff --git a/nixosModules/userConfig/default.nix b/nixosModules/userConfig/default.nix new file mode 100644 index 00000000..9bf6103d --- /dev/null +++ b/nixosModules/userConfig/default.nix @@ -0,0 +1,6 @@ +{ pkgs, lib, config, ... }: { + + imports = [ ./aly ./dustin ]; + + userConfig.aly.enable = lib.mkDefault true; +} diff --git a/nixosModules/userConfig/dustin/default.nix b/nixosModules/userConfig/dustin/default.nix new file mode 100644 index 00000000..d48bc6d9 --- /dev/null +++ b/nixosModules/userConfig/dustin/default.nix @@ -0,0 +1,15 @@ +{ pkgs, lib, config, ... }: { + + options = { + userConfig.dustin.enable = lib.mkEnableOption "Enables Dustin's user."; + }; + + config = lib.mkIf config.userConfig.dustin.enable { + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.dustin = { + isNormalUser = true; + description = "Dustin Raffauf"; + extraGroups = [ "networkmanager" "wheel" "docker" "libvirtd" "video" ]; + }; + }; +} diff --git a/users/aly.nix b/users/aly.nix deleted file mode 100644 index d5b517c0..00000000 --- a/users/aly.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ config, pkgs, ... }: - -{ - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.aly = { - isNormalUser = true; - description = "Aly Raffauf"; - extraGroups = [ "networkmanager" "wheel" "docker" "libvirtd" "video" ]; - }; -} diff --git a/users/dustin.nix b/users/dustin.nix deleted file mode 100644 index 954f0235..00000000 --- a/users/dustin.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ config, pkgs, ... }: - -{ - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.dustin = { - isNormalUser = true; - description = "Dustin Raffauf"; - extraGroups = [ "networkmanager" "wheel" "docker" "libvirtd" "video" ]; - }; -}