diff --git a/_modules/system/boot.nix b/_modules/system/boot.nix deleted file mode 100644 index d0fa603..0000000 --- a/_modules/system/boot.nix +++ /dev/null @@ -1,48 +0,0 @@ -{ config, options, lib, pkgs, ... }: -let - inherit (lib) mkMerge mkIf mkEnableOption mkDefault mkForce; - - cfg = config.modules.boot; -in -{ - options.modules.boot = - { - silentBoot = mkEnableOption "Enable silent boot"; - animatedBoot = mkEnableOption "Enable boot animation"; - }; - - config = mkMerge [ - ({ - boot.loader = { - efi.canTouchEfiVariables = true; - - systemd-boot.enable = true; - - timeout = mkDefault 0; - }; - - time.timeZone = "Europe/Amsterdam"; - }) - - (mkIf (cfg.silentBoot == true) { - boot = { - consoleLogLevel = 0; - initrd.verbose = false; - kernelParams = [ "quiet" "splash" "boot.shell_on_fail" "udev.log_priority=3" "rd.systemd.show_status=auto" ]; - loader.timeout = mkDefault 0; - }; - }) - - (mkIf (cfg.animatedBoot == true) { - boot.plymouth = { - enable = true; - theme = mkForce "pixels"; - themePackages = with pkgs; [ - (adi1090x-plymouth-themes.override { - selected_themes = [ "pixels" ]; - }) - ]; - }; - }) - ]; -} \ No newline at end of file diff --git a/_modules/system/desktop/gaming.nix b/_modules/system/desktop/gaming.nix deleted file mode 100644 index 54efe3b..0000000 --- a/_modules/system/desktop/gaming.nix +++ /dev/null @@ -1,34 +0,0 @@ -{ inputs, lib, config, ... }: let - inherit (lib) mkEnableOption mkIf; - - cfg = config.modules.desktop.gaming; -in -{ - imports = [ inputs.jovian.nixosModules.default ]; - - options.modules.desktop.gaming = { - enable = mkEnableOption "enable steamdeck like desktop"; - }; - - config = mkIf cfg.enable { - services.desktopManager.plasma6.enable = true; - - jovian = { - # devices = { - # steamdeck = { - # enable = true; - # enableGyroDsuService = true; - # autoUpdate = true; - # }; - # }; - steam = { - enable = true; - autoStart = true; - user = "chris"; - updater.splash = "steamos"; - desktopSession = "plasma"; - }; - steamos.useSteamOSConfig = true; - }; - }; -} diff --git a/_modules/system/desktop/wine.nix b/_modules/system/desktop/wine.nix deleted file mode 100644 index 7444d77..0000000 --- a/_modules/system/desktop/wine.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ inputs, lib, pkgs, ... }: -{ - # imports = [ inputs.erosanix.nixosModules.someModule ]; - - config = { - - }; -} diff --git a/_modules/system/graphics.nix b/_modules/system/graphics.nix deleted file mode 100644 index a4d9775..0000000 --- a/_modules/system/graphics.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ ... }: -{ - services.xserver.videoDrivers = [ "nvidia" ]; - - hardware = { - graphics = { - enable = true; - enable32Bit = true; - }; - - nvidia = { - modesetting.enable = true; - open = false; - nvidiaSettings = true; - - powerManagement = { - enable = true; - finegrained = false; - }; - -# package = config.boot.kernelPackages.nvidiaPackages.vulkan_beta; - - # package = let - # rcu_patch = pkgs.fetchpatch { - # url = "https://github.com/gentoo/gentoo/raw/c64caf53/x11-drivers/nvidia-drivers/files/nvidia-drivers-470.223.02-gpl-pfn_valid.patch"; - # hash = "sha256-eZiQQp2S/asE7MfGvfe6dA/kdCvek9SYa/FFGp24dVg="; - # }; - # in config.boot.kernelPackages.nvidiaPackages.mkDriver { - # version = "550.40.07"; - # sha256_64bit = "sha256-KYk2xye37v7ZW7h+uNJM/u8fNf7KyGTZjiaU03dJpK0="; - # sha256_aarch64 = "sha256-AV7KgRXYaQGBFl7zuRcfnTGr8rS5n13nGUIe3mJTXb4="; - # openSha256 = "sha256-mRUTEWVsbjq+psVe+kAT6MjyZuLkG2yRDxCMvDJRL1I="; - # settingsSha256 = "sha256-c30AQa4g4a1EHmaEu1yc05oqY01y+IusbBuq+P6rMCs="; - # persistencedSha256 = "sha256-11tLSY8uUIl4X/roNnxf5yS2PQvHvoNjnd2CB67e870="; - - # patches = [ rcu_patch ]; - # }; - }; - }; -} diff --git a/_modules/system/networking/samba.nix b/_modules/system/networking/samba.nix deleted file mode 100644 index d7e0b7f..0000000 --- a/_modules/system/networking/samba.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ pkgs, config, lib, ... }: -let - inherit (builtins) getEnv; - inherit (lib.modules) mkIf mkMerge; -in -{ - options.modules.networking.samba = let - inherit (lib.options) mkEnableOption; - in { - sharing.enable = mkEnableOption "Samba: enable NixOs -> external file-transfer"; - receicing.enable = mkEnableOption "Samba: enable external -> NixOs file-transfer"; - }; - - config = mkMerge [ - (mkIf config.modules.networking.samba.sharing.enable { - users = { - groups.samba-guest = {}; - users.samba-guest = { - isSystemUser = true; - description = "Residence of our Samba guest users"; - group = "samba-guest"; - home = "/var/empty"; - createHome = false; - shell = pkgs.shadow; - }; - }; - user.extraGroups = [ "samba-guest" ]; - - networking.firewall = { - allowPing = true; - allowedTCPPorts = [ 5327 ]; - allowedUDPPorts = [ 3702 ]; - }; - - services.samba-wsdd.enable = true; - - services.samba = { - enable = true; - openFirewall = true; - extraConfig = '' - server string = ${config.networking.hostName} - netbios name = ${config.networking.hostName} - workgroup = WORKGROUP - security = user - - create mask 0664 - force create mode 0664 - directory mask 0775 - force directory mode 0775 - follow symlink = yes - - hosts allow = 192.168.1.0/24 localhost - hosts deny = 0.0.0.0/0 - guest account = nobody - map to guest = bad user - ''; - shares = { - Public = { - path = (getEnv "HOME") + "/Public"; - browseable = "yes"; - "read only" = "yes"; - "guest ok" = "yes"; - "forse user" = "${config.user.name}"; - "force group" = "samba-guest"; - "write list" = "${config.user.name}"; - }; - }; - }; - }) - ]; -} diff --git a/_modules/system/options.nix b/_modules/system/options.nix deleted file mode 100644 index abce819..0000000 --- a/_modules/system/options.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ config, lib, ... }: -let - inherit (lib.types) attrs; - inherit (lib.my) mkOpt; -in -{ - options = { - user = mkOpt attrs {}; - }; - - config = { - environment.variables = { - NIXPKGS_ALLOW_UNFREE = "1"; - }; - - nix.settings = let - inherit (lib) elem attrNames filterAttrs; - - users = (attrNames (filterAttrs (name: user: elem "wheel" (user.extraGroups or [])) config.users.users));# ++ [ "root" ]; - in - { - trusted-users = users; - allowed-users = users; - experimental-features = [ "nix-command" "flakes" ]; - }; - }; -} diff --git a/_modules/system/services/media.nix b/_modules/system/services/media.nix deleted file mode 100644 index 9ec8e5e..0000000 --- a/_modules/system/services/media.nix +++ /dev/null @@ -1,167 +0,0 @@ -{ config, lib, pkgs, ... }: -let - inherit (lib) mkIf; - - user = "media"; - group = "media"; - directory = "/var/media"; -in -{ - options.modules.services.media = let - inherit (lib.options) mkEnableOption; - in { - enable = mkEnableOption "Media tools"; - }; - - imports = let - extras = fetchTarball { - url = "https://github.com/onny/nixos-nextcloud-testumgebung/archive/fa6f062830b4bc3cedb9694c1dbf01d5fdf775ac.tar.gz"; - sha256 = "0gzd0276b8da3ykapgqks2zhsqdv4jjvbv97dsxg0hgrhb74z0fs"; - }; - in [ - "${extras}/nextcloud-extras.nix" - ]; - - config = mkIf config.modules.services.media.enable { - environment.systemPackages = with pkgs; [ - podman-tui - jellyfin - jellyfin-web - jellyfin-ffmpeg - jellyseerr - mediainfo - id3v2 - yt-dlp - ]; - - # need to permit these outdated packages until servarr finally upgrades at some point... - permittedInsecurePackages = [ - "dotnet-sdk-6.0.428" - "aspnetcore-runtime-6.0.36" - ]; - - users = { - users.${user} = { - isSystemUser = true; - group = group; - }; - groups.${group} = {}; - }; - - systemd.tmpfiles.rules = [ - "d '${directory}/series' 0700 ${user} ${group} - -" - "d '${directory}/movies' 0700 ${user} ${group} - -" - "d '${directory}/music' 0700 ${user} ${group} - -" - "d '${directory}/qbittorrent' 0700 ${user} ${group} - -" - "d '${directory}/sabnzbd' 0700 ${user} ${group} - -" - "d '${directory}/reiverr/config' 0700 ${user} ${group} - -" - "d '${directory}/downloads/incomplete' 0700 ${user} ${group} - -" - "d '${directory}/downloads/done' 0700 ${user} ${group} - -" - ]; - - services = let - serviceConf = { - enable = true; - openFirewall = true; - user = user; - group = group; - }; - in { - jellyfin = serviceConf; - radarr = serviceConf; - sonarr = serviceConf; - bazarr = serviceConf; - lidarr = serviceConf; - - lanraragi = { - enable = true; - port = 6969; - }; - - jellyseerr = { - enable = true; - openFirewall = true; - }; - - prowlarr = { - enable = true; - openFirewall = true; - }; - - qbittorrent = { - enable = true; - openFirewall = true; - dataDir = "${directory}/qbittorrent"; - port = 5000; - - user = user; - group = group; - }; - - sabnzbd = { - enable = true; - openFirewall = true; - configFile = "${directory}/sabnzbd/config.ini"; - - user = user; - group = group; - }; - - caddy = { - enable = true; - virtualHosts = { - "media.kruining.eu".extraConfig = '' - import auth - - reverse_proxy http://127.0.0.1:9494 - ''; - "jellyfin.kruining.eu".extraConfig = '' - reverse_proxy http://127.0.0.1:8096 - ''; - # "series.kruining.eu".extraConfig = '' - # reverse_proxy http://127.0.0.1:8989 - # ''; - # "movies.kruining.eu".extraConfig = '' - # reverse_proxy http://127.0.0.1:7878 - # ''; - # "indexer.kruining.eu".extraConfig = '' - # reverse_proxy http://127.0.0.1:9696 - # ''; - # "torrents.kruining.eu".extraConfig = '' - # reverse_proxy http://127.0.0.1:5000 - # ''; - # "usenet.kruining.eu".extraConfig = '' - # reverse_proxy http://127.0.0.1:8080 - # ''; - }; - }; - }; - - networking.firewall.allowedTCPPorts = [ 80 443 6969 ]; - - modules.virtualisation.podman.enable = true; - - virtualisation = { - oci-containers = { - backend = "podman"; - - containers = { - flaresolverr = { - image = "flaresolverr/flaresolverr"; - autoStart = true; - ports = [ "127.0.0.1:8191:8191" ]; - }; - - reiverr = { - image = "ghcr.io/aleksilassila/reiverr:v2.2.0"; - autoStart = true; - ports = [ "127.0.0.1:9494:9494" ]; - volumes = [ "${directory}/reiverr/config:/config" ]; - }; - }; - }; - }; - - systemd.services.jellyfin.serviceConfig.killSignal = lib.mkForce "SIGKILL"; - }; -} diff --git a/_modules/system/zsa_voyager.nix b/_modules/system/zsa_voyager.nix deleted file mode 100644 index c900954..0000000 --- a/_modules/system/zsa_voyager.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ config, pkgs, options, ... }: -{ - environment.systemPackages = with pkgs; [ - keymapp - ]; - - hardware.keyboard.zsa.enable = true; - - services.udev.extraRules = '' - # Rules for Oryx web flashing and live training - KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", MODE="0664", GROUP="plugdev" - KERNEL=="hidraw*", ATTRS{idVendor}=="3297", MODE="0664", GROUP="plugdev" - - # Legacy rules for live training over webusb (Not needed for firmware v21+) - # Rule for all ZSA keyboards - SUBSYSTEM=="usb", ATTR{idVendor}=="3297", GROUP="plugdev" - # Rule for the Moonlander - SUBSYSTEM=="usb", ATTR{idVendor}=="3297", ATTR{idProduct}=="1969", GROUP="plugdev" - # Rule for the Ergodox EZ - SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="1307", GROUP="plugdev" - # Rule for the Planck EZ - SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="6060", GROUP="plugdev" - - # Wally Flashing rules for the Ergodox EZ - ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1" - ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1" - SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666" - KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666" - - # Keymapp / Wally Flashing rules for the Moonlander and Planck EZ - SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666", SYMLINK+="stm32_dfu" - # Keymapp Flashing rules for the Voyager - SUBSYSTEMS=="usb", ATTRS{idVendor}=="3297", MODE:="0666", SYMLINK+="ignition_dfu" - ''; -} diff --git a/homes/x86_64-linux/chris@manwe/default.nix b/homes/x86_64-linux/chris@manwe/default.nix index 5acdd92..a5a09f3 100644 --- a/homes/x86_64-linux/chris@manwe/default.nix +++ b/homes/x86_64-linux/chris@manwe/default.nix @@ -1,11 +1,8 @@ -{ lib, ... }: -let - inherit (lib); -in +{ ... }: { - sneeuwvlok = { - series = { - media.enable = true; - }; + sneeuwvlok = { + series = { + media.enable = true; }; -} \ No newline at end of file + }; +} diff --git a/modules/home/desktop/plasma/default.nix b/modules/home/desktop/plasma/default.nix index 7a03fe9..12ffce3 100644 --- a/modules/home/desktop/plasma/default.nix +++ b/modules/home/desktop/plasma/default.nix @@ -1,5 +1,7 @@ { config, lib, namespace, osConfig ? {}, ... }: let + inherit (lib) mkIf; + cfg = config.${namespace}.desktop.plasma; osCfg = osConfig.${namespace}.desktop.plasma or { enable = false; }; in @@ -19,7 +21,7 @@ in general.askForConfirmationOnLogout = false; sessionRestore.restoreOpenApplicationsOnLogin = "onLastLogout"; }; - + workspace = { clickItemTo = "select"; colorScheme = "EverforestDark"; @@ -56,18 +58,18 @@ in kwalletrc = { Wallet.Enabled = false; }; - + plasmarc = { General = { RaiseMaximumVolume = true; VolumeStep = 2; }; }; - + kcminputrc = { Keyboard.NumLock.value = 0; }; }; }; }; -} \ No newline at end of file +} diff --git a/modules/home/desktop/plasma/panels.nix b/modules/home/desktop/plasma/panels.nix index fa4de70..a35b93c 100644 --- a/modules/home/desktop/plasma/panels.nix +++ b/modules/home/desktop/plasma/panels.nix @@ -1,5 +1,7 @@ { config, lib, namespace, osConfig ? {}, ... }: let + inherit (lib) mkIf; + cfg = config.${namespace}.desktop.plasma; osCfg = osConfig.${namespace}.desktop.plasma or { enable = false; }; in @@ -119,4 +121,4 @@ in } ]; }; -} \ No newline at end of file +} diff --git a/modules/home/desktop/plasma/power.nix b/modules/home/desktop/plasma/power.nix index 9d05dad..50e7cfe 100644 --- a/modules/home/desktop/plasma/power.nix +++ b/modules/home/desktop/plasma/power.nix @@ -1,5 +1,7 @@ { config, lib, namespace, osConfig ? {}, ... }: let + inherit (lib) mkIf; + cfg = config.${namespace}.desktop.plasma; osCfg = osConfig.${namespace}.desktop.plasma or { enable = false; }; in @@ -47,4 +49,4 @@ in }; }; }; -} \ No newline at end of file +} diff --git a/modules/nixos/boot/default.nix b/modules/nixos/boot/default.nix index 8037621..5c0c53c 100644 --- a/modules/nixos/boot/default.nix +++ b/modules/nixos/boot/default.nix @@ -1,12 +1,12 @@ -{ lib, namespace, config, ... }: +{ lib, namespace, config, pkgs, ... }: let - inherit (lib) mkIf mkMerge mkDefault mkEnableOption; - inherit (lib.types) enum; + inherit (lib) mkIf mkMerge mkDefault mkOption; + inherit (lib.types) enum bool; cfg = config.${namespace}.boot; in { - config.${namespace}.boot = { + options.${namespace}.boot = { type = mkOption { type = enum [ "bios" "uefi" ]; default = "uefi"; @@ -25,7 +25,16 @@ in config = mkMerge [ ({ - boot.loader.grub.enable = mkDefault true; + boot.loader = { + systemd-boot.enable = false; + grub.enable = true; + + grub2-theme = { + enable = true; + theme = "vimix"; + footer = true; + }; + }; }) (mkIf cfg.type == "bios" { @@ -52,7 +61,7 @@ in verbose = false; }; - kernelParams = [ + kernelParams = [ "quiet" "loglevel=3" "systemd.show_status=auto" @@ -68,7 +77,7 @@ in (mkIf cfg.animated { boot.plymouth = { enable = true; - + theme = mkDefault "pixels"; themePackages = with pkgs; [ (adi1090x-plymouth-themes.override { @@ -78,4 +87,4 @@ in }; }) ]; -} \ No newline at end of file +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 34c0298..6efb305 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -1,6 +1,6 @@ -{ config, lib, pkgs, ... }: +{ config, lib, namespace, ... }: let - inherit (lib) mkOption mkMerge attrNames filterAttrs; + inherit (lib) mkIf mkDefault mkOption mkMerge; inherit (lib.types) nullOr enum; cfg = config.${namespace}; @@ -17,7 +17,7 @@ in config = mkMerge [ (mkIf cfg.preset == "desktop" { - "${namespace}" = mkDefault { + ${namespace} = mkDefault { hardware.has = { audio = true; }; @@ -26,7 +26,7 @@ in quiet = true; animated = true; }; - + desktop.use = "kde"; }; }) @@ -39,4 +39,4 @@ in }; }) ]; -} \ No newline at end of file +} diff --git a/modules/nixos/desktop/default.nix b/modules/nixos/desktop/default.nix index 1c053c4..cca4c69 100644 --- a/modules/nixos/desktop/default.nix +++ b/modules/nixos/desktop/default.nix @@ -1,24 +1,19 @@ { lib, config, namespace, ... }:let - inherit (lib) mkOption mkMerge attrNames filterAttrs; - inherit (lib.types) nullOr enum bool; + inherit (lib) mkIf mkOption mkEnableOption mkMerge attrNames filterAttrs readDir; + inherit (lib.types) nullOr enum; cfg = config.${namespace}.desktop; in { options.${namespace}.desktop = { use = mkOption { - type = nullOr enum (attrNames (filterAttrs (n: type == "directory") (readDir ./.))); + type = nullOr enum (attrNames (filterAttrs (n: type: type == "directory") (readDir ./.))); default = null; example = "plasma"; description = "Which desktop to enable"; }; - autoLogin = mkOption { - type = bool; - default = false; - example = true; - description = "Enable plasma's auto login feature."; - }; + autoLogin = mkEnableOption "Enable plasma's auto login feature."; }; config = mkMerge [ @@ -27,7 +22,7 @@ in services.displayManager = { enable = true; - + autoLogin = mkIf cfg.autoLogin { enable = true; }; diff --git a/modules/nixos/desktop/gamescope/default.nix b/modules/nixos/desktop/gamescope/default.nix index 1d3d427..f125292 100644 --- a/modules/nixos/desktop/gamescope/default.nix +++ b/modules/nixos/desktop/gamescope/default.nix @@ -1,5 +1,5 @@ { lib, config, namespace, inputs, ... }:let - inherit (lib) mkEnableOption; + inherit (lib) mkIf mkEnableOption; cfg = config.${namespace}.desktop.gamescope; in diff --git a/modules/nixos/desktop/gnome/default.nix b/modules/nixos/desktop/gnome/default.nix index add3f2c..126d384 100644 --- a/modules/nixos/desktop/gnome/default.nix +++ b/modules/nixos/desktop/gnome/default.nix @@ -1,6 +1,5 @@ { lib, config, namespace, ... }:let - inherit (lib) mkEnableOption mkOption; - inherit (lib.types) bool; + inherit (lib) mkIf mkEnableOption; cfg = config.${namespace}.desktop.gnome; in diff --git a/modules/nixos/desktop/plasma/default.nix b/modules/nixos/desktop/plasma/default.nix index 3a30daf..8be91ec 100644 --- a/modules/nixos/desktop/plasma/default.nix +++ b/modules/nixos/desktop/plasma/default.nix @@ -1,6 +1,5 @@ -{ lib, config, namespace, ... }:let - inherit (lib) mkEnableOption mkOption; - inherit (lib.types) bool; +{ pkgs, lib, config, namespace, ... }:let + inherit (lib) mkIf mkEnableOption; cfg = config.${namespace}.desktop.plasma; in diff --git a/modules/nixos/hardware/audio/default.nix b/modules/nixos/hardware/audio/default.nix index bf9760f..d3f340f 100644 --- a/modules/nixos/hardware/audio/default.nix +++ b/modules/nixos/hardware/audio/default.nix @@ -5,7 +5,7 @@ let cfg = config.${namespace}.hardware.has.audio; in { - config.${namespace}.hardware.has.audio = mkEnableOption "Enable bluetooth"; + options.${namespace}.hardware.has.audio = mkEnableOption "Enable bluetooth"; config = mkIf cfg { environment.systemPackages = with pkgs; [ @@ -27,4 +27,4 @@ in }; }; }; -} \ No newline at end of file +} diff --git a/modules/nixos/hardware/bluetooth/default.nix b/modules/nixos/hardware/bluetooth/default.nix index 31dcdbc..1b99eef 100644 --- a/modules/nixos/hardware/bluetooth/default.nix +++ b/modules/nixos/hardware/bluetooth/default.nix @@ -5,7 +5,7 @@ let cfg = config.${namespace}.hardware.has.bluetooth; in { - config.${namespace}.hardware.has.bluetooth = mkEnableOption "Enable bluetooth"; + options.${namespace}.hardware.has.bluetooth = mkEnableOption "Enable bluetooth"; config = mkIf cfg { hardware.bluetooth = { @@ -22,4 +22,4 @@ in }; }; }; -} \ No newline at end of file +} diff --git a/modules/nixos/hardware/gpu/amd.nix b/modules/nixos/hardware/gpu/amd.nix index 9bd0961..c47191c 100644 --- a/modules/nixos/hardware/gpu/amd.nix +++ b/modules/nixos/hardware/gpu/amd.nix @@ -5,7 +5,7 @@ let cfg = config.${namespace}.hardware.has.gpu.amd; in { - config.${namespace}.hardware.has.gpu.amd = mkEnableOption "Enable AMD gpu configuration"; + options.${namespace}.hardware.has.gpu.amd = mkEnableOption "Enable AMD gpu configuration"; config = mkIf cfg { services.xserver.videoDrivers = [ "amd" ]; @@ -26,4 +26,4 @@ in }; }; }; -} \ No newline at end of file +} diff --git a/modules/nixos/hardware/gpu/nvidia.nix b/modules/nixos/hardware/gpu/nvidia.nix index 0e0ea4e..e8ac542 100644 --- a/modules/nixos/hardware/gpu/nvidia.nix +++ b/modules/nixos/hardware/gpu/nvidia.nix @@ -5,7 +5,7 @@ let cfg = config.${namespace}.hardware.has.gpu.nvidia; in { - config.${namespace}.hardware.has.gpu.nvidia = mkEnableOption "Enable NVidia gpu configuration"; + options.${namespace}.hardware.has.gpu.nvidia = mkEnableOption "Enable NVidia gpu configuration"; config = mkIf cfg { services.xserver.videoDrivers = [ "nvidia" ]; @@ -28,4 +28,4 @@ in }; }; }; -} \ No newline at end of file +} diff --git a/modules/nixos/hardware/keyboard/voyager.nix b/modules/nixos/hardware/keyboard/voyager.nix new file mode 100644 index 0000000..fd470f8 --- /dev/null +++ b/modules/nixos/hardware/keyboard/voyager.nix @@ -0,0 +1,46 @@ +{ lib, config, pkgs, namespace, ... }: +let + inherit (lib) mkIf mkEnableOption; + + cfg = config.${namespace}.hardware.keyboard.voyager; +in +{ + options.${namespace}.hardware.keyboard.voyager = { + enble = mkEnableOption "Enable tools for ZSA Voyager"; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + keymapp + ]; + + hardware.keyboard.zsa.enable = true; + + services.udev.extraRules = '' + # Rules for Oryx web flashing and live training + KERNEL=="hidraw*", ATTRS{idVendor}=="16c0", MODE="0664", GROUP="plugdev" + KERNEL=="hidraw*", ATTRS{idVendor}=="3297", MODE="0664", GROUP="plugdev" + + # Legacy rules for live training over webusb (Not needed for firmware v21+) + # Rule for all ZSA keyboards + SUBSYSTEM=="usb", ATTR{idVendor}=="3297", GROUP="plugdev" + # Rule for the Moonlander + SUBSYSTEM=="usb", ATTR{idVendor}=="3297", ATTR{idProduct}=="1969", GROUP="plugdev" + # Rule for the Ergodox EZ + SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="1307", GROUP="plugdev" + # Rule for the Planck EZ + SUBSYSTEM=="usb", ATTR{idVendor}=="feed", ATTR{idProduct}=="6060", GROUP="plugdev" + + # Wally Flashing rules for the Ergodox EZ + ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1" + ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1" + SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666" + KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666" + + # Keymapp / Wally Flashing rules for the Moonlander and Planck EZ + SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE:="0666", SYMLINK+="stm32_dfu" + # Keymapp Flashing rules for the Voyager + SUBSYSTEMS=="usb", ATTRS{idVendor}=="3297", MODE:="0666", SYMLINK+="ignition_dfu" + ''; + }; +} diff --git a/modules/nixos/nix/default.nix b/modules/nixos/nix/default.nix index 1177a14..05c001a 100644 --- a/modules/nixos/nix/default.nix +++ b/modules/nixos/nix/default.nix @@ -5,7 +5,7 @@ let cfg = config.${namespace}.nix; in { - config.${namespace}.nix = { + options.${namespace}.nix = { enable = mkEnableOption "Enable nix command"; }; @@ -39,4 +39,4 @@ in channel.enable = false; }; }; -} \ No newline at end of file +} diff --git a/_modules/system/services/auth/authelia.nix b/modules/nixos/services/authentication/authelia.nix similarity index 98% rename from _modules/system/services/auth/authelia.nix rename to modules/nixos/services/authentication/authelia.nix index c713279..e706439 100644 --- a/_modules/system/services/auth/authelia.nix +++ b/modules/nixos/services/authentication/authelia.nix @@ -1,12 +1,12 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, namespace, ... }: let inherit (lib) mkIf mkEnableOption; user = "authelia-testing"; - cfg = config.modules.services.auth.authelia; + cfg = config.${namespace}.services.authentication.authelia; in { - options.modules.services.auth.authelia = { + options.${namespace}.services.authentication.authelia = { enable = mkEnableOption "Authelia"; }; diff --git a/modules/nixos/services/authentication/default.nix b/modules/nixos/services/authentication/default.nix new file mode 100644 index 0000000..c157af7 --- /dev/null +++ b/modules/nixos/services/authentication/default.nix @@ -0,0 +1 @@ +{ ... }: {} diff --git a/_modules/system/authentication/himmelblau.nix b/modules/nixos/services/authentication/himmelblau.nix similarity index 68% rename from _modules/system/authentication/himmelblau.nix rename to modules/nixos/services/authentication/himmelblau.nix index 7817335..1228759 100644 --- a/_modules/system/authentication/himmelblau.nix +++ b/modules/nixos/services/authentication/himmelblau.nix @@ -1,12 +1,12 @@ -{ inputs, lib, config, ... }: let +{ inputs, lib, config, namespace, ... }: let inherit (lib) mkEnableOption mkIf; - cfg = config.modules.authentication.himmelblau; + cfg = config.${namespace}.services.authentication.himmelblau; in { imports = [ inputs.himmelblau.nixosModules.himmelblau ]; - options.modules.authentication.himmelblau = { + options.${namespace}.services.authentication.himmelblau = { enable = mkEnableOption "enable azure entra ID authentication"; }; diff --git a/_modules/system/services/auth/zitadel.nix b/modules/nixos/services/authentication/zitadel.nix similarity index 92% rename from _modules/system/services/auth/zitadel.nix rename to modules/nixos/services/authentication/zitadel.nix index 2814649..6142857 100644 --- a/_modules/system/services/auth/zitadel.nix +++ b/modules/nixos/services/authentication/zitadel.nix @@ -1,14 +1,14 @@ -{ config, options, lib, pkgs, ... }: +{ config, lib, pkgs, namespace, ... }: let inherit (lib) mkIf mkEnableOption; - cfg = config.modules.services.auth.zitadel; + cfg = config.${namespace}.services.authentication.zitadel; db_name = "zitadel"; db_user = "zitadel"; in { - options.modules.services.auth.zitadel = { + options.${namespace}.services.authentication.zitadel = { enable = mkEnableOption "Zitadel"; }; diff --git a/_modules/system/services/games/minecraft.nix b/modules/nixos/services/games/minecraft.nix similarity index 91% rename from _modules/system/services/games/minecraft.nix rename to modules/nixos/services/games/minecraft.nix index c414881..7f408ae 100644 --- a/_modules/system/services/games/minecraft.nix +++ b/modules/nixos/services/games/minecraft.nix @@ -1,22 +1,33 @@ -{ inputs, config, lib, pkgs, ... }: +{ inputs, config, lib, pkgs, namespace, ... }: let - inherit (lib.modules) mkIf; + inherit (lib) mkIf mkEnableOption mkOption; + inherit (lib.types) str; + + cfg = config.${namespace}.services.games.minecraft; in { imports = [ inputs.nix-minecraft.nixosModules.minecraft-servers ]; - options.modules.services.games.minecraft = let - inherit (lib.options) mkEnableOption; - in { + options.${namespace}.services.games.minecraft = { enable = mkEnableOption "Minecraft"; + + user = mkOption { + type = str; + default = "minecraft"; + }; + + group = mkOption { + type = str; + default = "minecraft"; + }; }; - config = mkIf config.modules.services.games.minecraft.enable { - user.users."minecraft" = { + config = mkIf cfg.enable { + user.users.${cfg.user} = { isSystemUser = true; - group = "minecraft"; + group = cfg.group; }; services = { @@ -25,7 +36,7 @@ in eula = true; openFirewall = true; - user = "minecraft"; + user = cfg.user; dataDir = "/var/lib/minecraft"; managementSystem = { @@ -151,7 +162,7 @@ in symlinks = let inherit (builtins) attrNames readDir map; - inherit (pkgs) linkFarm fetchzip; + inherit (pkgs) linkFarm; linkFarmFromDir = name: dir: linkFarm name (map (x: { name = x; path = "${src}/${dir}/${x}"; }) (attrNames (readDir "${src}/${dir}"))); in { diff --git a/_modules/system/services/games/palworld.nix b/modules/nixos/services/games/palworld.nix similarity index 64% rename from _modules/system/services/games/palworld.nix rename to modules/nixos/services/games/palworld.nix index 2f11597..dea16b3 100644 --- a/_modules/system/services/games/palworld.nix +++ b/modules/nixos/services/games/palworld.nix @@ -1,15 +1,15 @@ -{ config, options, lib, pkgs, ... }: +{ config, lib, namespace, ... }: let - inherit (lib.modules) mkIf; + inherit (lib) mkIf mkEnableOption; + + cfg = config.${namespace}.services.games.palworld; in { - options.modules.services.games.palworld = let - inherit (lib.options) mkEnableOption; - in { + options.${namespace}.services.games.palworld = { enable = mkEnableOption "Palworld"; }; - config = mkIf config.modules.services.games.palworld.enable { + config = mkIf cfg.enable { # kaas = (pkgs.mkSteamServer rec { # name = "Palworld"; # src = pkgs.fetchSteam { diff --git a/modules/nixos/services/media/default.nix b/modules/nixos/services/media/default.nix index 76c6309..4827114 100644 --- a/modules/nixos/services/media/default.nix +++ b/modules/nixos/services/media/default.nix @@ -1,12 +1,28 @@ -{ lib, namespace, config, ... }: +{ pkgs, lib, namespace, config, ... }: let - inherit (lib) mkIf mkEnableOption; + inherit (lib) mkIf mkEnableOption mkOption; + inherit (lib.types) str; cfg = config.${namespace}.services.media; in { - config.${namespace}.services.media = { + options.${namespace}.services.media = { enable = mkEnableOption "Enable media services"; + + user = mkOption { + type = str; + default = "media"; + }; + + group = mkOption { + type = str; + default = "media"; + }; + + path = mkOption { + type = str; + default = "/var/media"; + }; }; config = mkIf cfg.enable { @@ -23,7 +39,7 @@ in id3v2 yt-dlp ]; - + # need to permit these outdated packages until servarr finally upgrades at some point... permittedInsecurePackages = [ "dotnet-sdk-6.0.428" @@ -34,22 +50,22 @@ in # Prepare system #========================================================================= users = { - users.${user} = { + users.${cfg.user} = { isSystemUser = true; - group = group; + group = cfg.group; }; - groups.${group} = {}; + groups.${cfg.group} = {}; }; systemd.tmpfiles.rules = [ - "d '${directory}/series' 0700 ${user} ${group} - -" - "d '${directory}/movies' 0700 ${user} ${group} - -" - "d '${directory}/music' 0700 ${user} ${group} - -" - "d '${directory}/qbittorrent' 0700 ${user} ${group} - -" - "d '${directory}/sabnzbd' 0700 ${user} ${group} - -" - "d '${directory}/reiverr/config' 0700 ${user} ${group} - -" - "d '${directory}/downloads/incomplete' 0700 ${user} ${group} - -" - "d '${directory}/downloads/done' 0700 ${user} ${group} - -" + "d '${cfg.directory}/series' 0700 ${cfg.user} ${cfg.group} - -" + "d '${cfg.directory}/movies' 0700 ${cfg.user} ${cfg.group} - -" + "d '${cfg.directory}/music' 0700 ${cfg.user} ${cfg.group} - -" + "d '${cfg.directory}/qbittorrent' 0700 ${cfg.user} ${cfg.group} - -" + "d '${cfg.directory}/sabnzbd' 0700 ${cfg.user} ${cfg.group} - -" + "d '${cfg.directory}/reiverr/config' 0700 ${cfg.user} ${cfg.group} - -" + "d '${cfg.directory}/downloads/incomplete' 0700 ${cfg.user} ${cfg.group} - -" + "d '${cfg.directory}/downloads/done' 0700 ${cfg.user} ${cfg.group} - -" ]; #========================================================================= @@ -59,8 +75,8 @@ in serviceConf = { enable = true; openFirewall = true; - user = user; - group = group; + user = cfg.user; + group = cfg.group; }; in { jellyfin = serviceConf; @@ -69,11 +85,6 @@ in bazarr = serviceConf; lidarr = serviceConf; - lanraragi = { - enable = true; - port = 6969; - }; - jellyseerr = { enable = true; openFirewall = true; @@ -87,20 +98,34 @@ in qbittorrent = { enable = true; openFirewall = true; - dataDir = "${directory}/qbittorrent"; + dataDir = "${cfg.directory}/qbittorrent"; port = 5000; - user = user; - group = group; + user = cfg.user; + group = cfg.group; }; sabnzbd = { enable = true; openFirewall = true; - configFile = "${directory}/sabnzbd/config.ini"; + configFile = "${cfg.directory}/sabnzbd/config.ini"; - user = user; - group = group; + user = cfg.user; + group = cfg.group; + }; + + caddy = { + enable = true; + virtualHosts = { + "media.kruining.eu".extraConfig = '' + import auth + + reverse_proxy http://127.0.0.1:9494 + ''; + "jellyfin.kruining.eu".extraConfig = '' + reverse_proxy http://127.0.0.1:8096 + ''; + }; }; }; @@ -123,31 +148,12 @@ in image = "ghcr.io/aleksilassila/reiverr:v2.2.0"; autoStart = true; ports = [ "127.0.0.1:9494:9494" ]; - volumes = [ "${directory}/reiverr/config:/config" ]; + volumes = [ "${cfg.directory}/reiverr/config:/config" ]; }; }; }; }; - #========================================================================= - # Hosting - #========================================================================= - services = { - caddy = { - enable = true; - virtualHosts = { - "media.kruining.eu".extraConfig = '' - import auth - - reverse_proxy http://127.0.0.1:9494 - ''; - "jellyfin.kruining.eu".extraConfig = '' - reverse_proxy http://127.0.0.1:8096 - ''; - }; - }; - }; - networking.firewall.allowedTCPPorts = [ 80 443 6969 ]; }; -} \ No newline at end of file +} diff --git a/_modules/system/services/nextcloud.nix b/modules/nixos/services/media/nextcloud.nix similarity index 77% rename from _modules/system/services/nextcloud.nix rename to modules/nixos/services/media/nextcloud.nix index 4325d6c..658a5b4 100644 --- a/_modules/system/services/nextcloud.nix +++ b/modules/nixos/services/media/nextcloud.nix @@ -1,26 +1,35 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, namespace, ... }: let - inherit (lib.options) mkEnableOption; - inherit (lib.modules) mkIf; + inherit (lib) mkIf mkEnableOption mkOption; + inherit (lib.types) str; - user = "nextcloud"; - group = "nextcloud"; + cfg = config.${namespace}.services.media.nextcloud; in { options.modules.services.nextcloud = { enable = mkEnableOption "Nextcloud"; - }; - config = mkIf config.modules.services.nextcloud.enable { - users = { - users.${user} = { - isSystemUser = true; - group = group; - }; - groups.${group} = {}; + user = mkOption { + type = str; + default = "nextcloud"; }; - home-manager.users.${user}.home = { + group = mkOption { + type = str; + default = "nextcloud"; + }; + }; + + config = mkIf cfg.enable { + users = { + users.${cfg.user} = { + isSystemUser = true; + group = cfg.group; + }; + groups.${cfg.group} = {}; + }; + + home-manager.users.${cfg.user}.home = { stateVersion = config.system.stateVersion; file.".netrc".text = '' diff --git a/_modules/system/networking/nfs.nix b/modules/nixos/services/media/nfs.nix similarity index 74% rename from _modules/system/networking/nfs.nix rename to modules/nixos/services/media/nfs.nix index 7081e6c..7e47322 100644 --- a/_modules/system/networking/nfs.nix +++ b/modules/nixos/services/media/nfs.nix @@ -1,11 +1,11 @@ -{ config, lib, ... }: +{ config, lib, namespace, ... }: let inherit (lib) mkIf mkEnableOption; - cfg = config.modules.networking.nfs; + cfg = config.${namespace}.media.nfs; in { - options.modules.networking.nfs = { + options.${namespace}.media.nfs = { enable = mkEnableOption "Enable NFS"; }; diff --git a/_modules/system/networking/ssh.nix b/modules/nixos/services/networking/ssh.nix similarity index 78% rename from _modules/system/networking/ssh.nix rename to modules/nixos/services/networking/ssh.nix index 8d2b1c6..5ebdfd2 100644 --- a/_modules/system/networking/ssh.nix +++ b/modules/nixos/services/networking/ssh.nix @@ -1,12 +1,12 @@ -{ config, lib, ... }: +{ config, lib, namespace, ... }: let inherit (lib.modules) mkIf; inherit (lib.options) mkEnableOption; - cfg = config.modules.networking.ssh; + cfg = config.${namespace}.services.networking.ssh; in { - options.modules.networking.ssh = { + options.${namespace}.services.networking.ssh = { enable = mkEnableOption "enable ssh"; };