diff --git a/flake.nix b/flake.nix index fcd3571..ecc0cde 100644 --- a/flake.nix +++ b/flake.nix @@ -33,37 +33,22 @@ pkgsM = makePkgs master; pkgsJ = makePkgs jellyfin; overlays = [ (import ./overlay.nix { inherit pkgs pkgsU pkgsM pkgsJ; }) ]; + createConfig = name: { + inherit system; + specialArgs = { inherit inputs outputs; }; + modules = [ + ./hosts/${name}/configuration.nix + sops-nix.nixosModules.sops + ({ ... }: { nixpkgs.overlays = overlays; }) + ]; + }; in { inherit lib pkgs; formatter = pkgs.alejandra; nixosConfigurations = { - workstation = lib.nixosSystem { - inherit system; - specialArgs = { inherit inputs outputs; }; - modules = [ - ./hosts/workstation/configuration.nix - sops-nix.nixosModules.sops - ({ ... }: { nixpkgs.overlays = overlays; }) - ]; - }; - miniserver = lib.nixosSystem { - inherit system; - specialArgs = { inherit inputs outputs; }; - modules = [ - ./hosts/miniserver/configuration.nix - sops-nix.nixosModules.sops - ({ ... }: { nixpkgs.overlays = overlays; }) - ]; - }; - server = lib.nixosSystem { - inherit system; - specialArgs = { inherit inputs outputs; }; - modules = [ - ./hosts/server/configuration.nix - sops-nix.nixosModules.sops - ({ ... }: { nixpkgs.overlays = overlays; }) - ]; - }; + workstation = lib.nixosSystem (createConfig "workstation"); + miniserver = lib.nixosSystem (createConfig "miniserver"); + server = lib.nixosSystem (createConfig "server"); }; }; } diff --git a/hosts/workstation/configuration.nix b/hosts/workstation/configuration.nix index a23dec3..bb29db2 100644 --- a/hosts/workstation/configuration.nix +++ b/hosts/workstation/configuration.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: { +{ pkgs, ... }: { imports = [ ./hardware-configuration.nix ../../base.nix @@ -78,11 +78,11 @@ users = { groups.nixremote.gid = 555; users = { - jawz.packages = (with pkgs; [ + jawz.packages = with pkgs; [ gocryptfs # encrypted filesystem! shhh!!! torrenttools # create torrent files from the terminal! vcsi # video thumbnails for torrents, can I replace it with ^? - ]); + ]; nixremote = { isNormalUser = true; createHome = true; diff --git a/hosts/workstation/hardware-configuration.nix b/hosts/workstation/hardware-configuration.nix index f1dbe1f..910b6b4 100644 --- a/hosts/workstation/hardware-configuration.nix +++ b/hosts/workstation/hardware-configuration.nix @@ -51,11 +51,11 @@ [ "xhci_pci" "ahci" "usbhid" "nvme" "usb_storage" "sd_mod" ]; }; fileSystems = let - nfsMount = (server: nfsDisk: { + nfsMount = server: nfsDisk: { device = "${server}:/${nfsDisk}"; fsType = "nfs"; options = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=600" ]; - }); + }; btrfsMount = subvol: { device = "/dev/mapper/nvme"; fsType = "btrfs"; diff --git a/modules/scripts/base.nix b/modules/scripts/base.nix index ea44f4b..3cc82b9 100644 --- a/modules/scripts/base.nix +++ b/modules/scripts/base.nix @@ -37,7 +37,7 @@ lib.nameValuePair "${script.name}" (lib.mkIf (script.enable && script.service) { restartIfChanged = true; - description = script.description; + inherit (script) description; wantedBy = [ "default.target" ]; path = [ pkgs.nix script.package ]; serviceConfig = { @@ -51,7 +51,7 @@ lib.nameValuePair "${script.name}" (lib.mkIf (script.enable && script.service) { enable = true; - description = script.description; + inherit (script) description; wantedBy = [ "timers.target" ]; timerConfig = { OnCalendar = script.timer; }; })) config.my.scripts; diff --git a/modules/servers/jellyfin.nix b/modules/servers/jellyfin.nix index 0eaf6a9..0fbda18 100644 --- a/modules/servers/jellyfin.nix +++ b/modules/servers/jellyfin.nix @@ -1,6 +1,6 @@ { lib, config, pkgs, serviceBase, ... }: let - localhost = config.my.localhost; + inherit (config.my) localhost; port = 8096; in { options.my.servers.jellyfin = { diff --git a/modules/servers/nextcloud.nix b/modules/servers/nextcloud.nix index 7f1a5d9..bdac35c 100644 --- a/modules/servers/nextcloud.nix +++ b/modules/servers/nextcloud.nix @@ -1,6 +1,6 @@ { lib, config, pkgs, ... }: let - localhost = config.my.localhost; + inherit (config.my) localhost; collaboraPort = 9980; url = "cloud.${config.my.domain}"; collaboraProxy = "http://${localhost}:${toString collaboraPort}"; @@ -36,7 +36,7 @@ in { users.users.nextcloud = { isSystemUser = true; extraGroups = [ "render" ]; - packages = (with pkgs; [ + packages = with pkgs; [ mediainfo nodejs (python3.withPackages (ps: with ps; [ tensorflow ])) @@ -49,7 +49,7 @@ in { hash = "sha256-TLJSJEXMPj870TkExq6uraX8Wl4kmNerrSlX3LQsr/4="; }; }) - ]); + ]; }; programs.msmtp = { enable = true; diff --git a/modules/servers/postgres.nix b/modules/servers/postgres.nix index 3d012dc..4f3e060 100644 --- a/modules/servers/postgres.nix +++ b/modules/servers/postgres.nix @@ -35,7 +35,7 @@ in { ensureDatabases = dbNames; package = pkgs.postgresql_16; ensureUsers = map (name: { - name = name; + inherit name; ensureDBOwnership = true; }) dbNames; authentication = pkgs.lib.mkOverride 10 '' diff --git a/overlay.nix b/overlay.nix index 76a3367..6354d29 100644 --- a/overlay.nix +++ b/overlay.nix @@ -21,12 +21,12 @@ _self: super: { nerdfonts = super.nerdfonts.override { fonts = [ "CascadiaCode" "ComicShannsMono" "Iosevka" ]; }; - jellyfin = pkgsJ.jellyfin; - planify = pkgsU.planify; - gdtoolkit = pkgsU.gdtoolkit; - gallery-dl = pkgsM.gallery-dl; - yt-dlp = pkgsM.yt-dlp; - ns-usbloader = pkgsU.ns-usbloader; + inherit (pkgsJ) jellyfin; + inherit (pkgsU) planify; + inherit (pkgsU) gdtoolkit; + inherit (pkgsM) gallery-dl; + inherit (pkgsM) yt-dlp; + inherit (pkgsU) ns-usbloader; handbrake = super.handbrake.override { useGtk = true; }; discord = super.discord.override { withOpenASAR = true; }; ripgrep = super.ripgrep.override { withPCRE2 = true; }; diff --git a/pkgs/citra/generic.nix b/pkgs/citra/generic.nix index e10b63c..6dccda7 100644 --- a/pkgs/citra/generic.nix +++ b/pkgs/citra/generic.nix @@ -45,8 +45,8 @@ stdenv.mkDerivation rec { ++ lib.optional enableFdk "-DENABLE_FDK=ON"; postPatch = let - branchCaptialized = - (lib.toUpper (lib.substring 0 1 branch) + lib.substring 1 (-1) branch); + branchCaptialized = lib.toUpper (lib.substring 0 1 branch) + + lib.substring 1 (-1) branch; in '' # Fix file not found when looking in var/empty instead of opt mkdir externals/dynarmic/src/dynarmic/ir/var diff --git a/pkgs/polymc/default.nix b/pkgs/polymc/default.nix index 9cd1e86..251b3dc 100644 --- a/pkgs/polymc/default.nix +++ b/pkgs/polymc/default.nix @@ -8,22 +8,21 @@ let polymc = let binpath = lib.makeBinPath [ xorg.xrandr glxinfo pciutils ]; - libpath = with xorg; - lib.makeLibraryPath [ - libX11 - libXext - libXcursor - libXrandr - libXxf86vm - libpulseaudio - libGL - vulkan-loader - glfw - openal - udev - flite - stdenv.cc.cc.lib - ]; + libpath = lib.makeLibraryPath [ + xorg.libX11 + xorg.libXext + xorg.libXcursor + xorg.libXrandr + xorg.libXxf86vm + libpulseaudio + libGL + vulkan-loader + glfw + openal + udev + flite + stdenv.cc.cc.lib + ]; gameLibraryPath = libpath + ":${addOpenGLRunpath.driverLink}/lib"; @@ -84,7 +83,7 @@ let , withWaylandGLFW ? false, withMangohud ? true, withGamemode ? true }: stdenv.mkDerivation rec { pname = "${polymc.pname}-wrapped"; - version = polymc.version; + inherit (polymc) version; libsPath = (lib.makeLibraryPath (extraLibs ++ lib.optional withGamemode gamemode.lib)) + lib.optionalString withMangohud "${mangohud + "/lib/mangohud"}"; @@ -119,7 +118,7 @@ let ''; preferLocalBuild = true; - meta = polymc.meta; + inherit (polymc) meta; }; };