From e73026fe5746590140f38bb8c2c6164816d78255 Mon Sep 17 00:00:00 2001 From: William Date: Sat, 22 Mar 2025 17:13:25 -0300 Subject: [PATCH] new mkHost function, and dome other changes --- flake.lock | 101 +----------- flake.nix | 214 +++++++++++++++---------- hosts/modules/alexandria/default.nix | 1 - hosts/modules/alexandria/minecraft.nix | 73 --------- hosts/modules/networking.nix | 8 - hosts/modules/programs.nix | 3 +- hosts/rotterdam.nix | 14 +- 7 files changed, 141 insertions(+), 273 deletions(-) delete mode 100644 hosts/modules/alexandria/minecraft.nix diff --git a/flake.lock b/flake.lock index 955c5cc..c98e87e 100644 --- a/flake.lock +++ b/flake.lock @@ -5,7 +5,7 @@ "darwin": "darwin", "home-manager": "home-manager", "nixpkgs": [ - "nixpkgs" + "nixpkgs-stable" ], "systems": "systems" }, @@ -49,7 +49,7 @@ "inputs": { "flake-compat": "flake-compat", "nixpkgs": [ - "nixpkgs" + "nixpkgs-stable" ], "utils": "utils" }, @@ -83,40 +83,6 @@ "type": "github" } }, - "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1733328505, - "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": "systems_3" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -180,22 +146,6 @@ "type": "github" } }, - "homepage": { - "flake": false, - "locked": { - "lastModified": 1727121984, - "narHash": "sha256-sbpLXaFeyIBrGbuw58jwxDcMupFqlqmPGO5/QUgI9eg=", - "owner": "AlexW00", - "repo": "StartTreeV2", - "rev": "cfb8b97b14b23b094878867bef94e3c17a144f3f", - "type": "github" - }, - "original": { - "owner": "AlexW00", - "repo": "StartTreeV2", - "type": "github" - } - }, "impermanence": { "locked": { "lastModified": 1737831083, @@ -213,42 +163,20 @@ }, "nix-flatpak": { "locked": { - "lastModified": 1711997201, - "narHash": "sha256-J71xzQlVYsjagA4AsVwRazhBh2rZrPpKvxTgs6UzL7c=", + "lastModified": 1739444422, + "narHash": "sha256-iAVVHi7X3kWORftY+LVbRiStRnQEob2TULWyjMS6dWg=", "owner": "gmodena", "repo": "nix-flatpak", - "rev": "b76fa31346db7fc958a9898f3c594696ca71c4fd", + "rev": "5e54c3ca05a7c7d968ae1ddeabe01d2a9bc1e177", "type": "github" }, "original": { "owner": "gmodena", - "ref": "v0.4.1", + "ref": "latest", "repo": "nix-flatpak", "type": "github" } }, - "nix-minecraft": { - "inputs": { - "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1741830767, - "narHash": "sha256-/VjgJuccz8jDkQbMplhZuJTHf7u3SroXkJUIjOGFlAM=", - "owner": "Infinidoge", - "repo": "nix-minecraft", - "rev": "d5544ae6ceb4e13a3bec77ed99754684a58302b7", - "type": "github" - }, - "original": { - "owner": "Infinidoge", - "repo": "nix-minecraft", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1741851582, @@ -287,10 +215,8 @@ "deploy-rs": "deploy-rs", "home-manager": "home-manager_2", "home-manager-stable": "home-manager-stable", - "homepage": "homepage", "impermanence": "impermanence", "nix-flatpak": "nix-flatpak", - "nix-minecraft": "nix-minecraft", "nixpkgs": "nixpkgs", "nixpkgs-stable": "nixpkgs-stable" } @@ -325,21 +251,6 @@ "type": "github" } }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "utils": { "inputs": { "systems": "systems_2" diff --git a/flake.nix b/flake.nix index bad6ff3..ec68373 100644 --- a/flake.nix +++ b/flake.nix @@ -16,27 +16,17 @@ agenix = { url = "github:ryantm/agenix"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs.follows = "nixpkgs-stable"; }; deploy-rs = { url = "github:serokell/deploy-rs"; - inputs.nixpkgs.follows = "nixpkgs"; + inputs.nixpkgs.follows = "nixpkgs-stable"; }; - homepage = { - url = "github:AlexW00/StartTreeV2"; - flake = false; - }; + nix-flatpak.url = "github:gmodena/nix-flatpak/latest"; impermanence.url = "github:nix-community/impermanence"; - - nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1"; - - nix-minecraft = { - url = "github:Infinidoge/nix-minecraft"; - inputs.nixpkgs.follows = "nixpkgs"; - }; }; outputs = @@ -48,86 +38,146 @@ home-manager-stable, agenix, deploy-rs, - homepage, impermanence, nix-flatpak, - nix-minecraft, ... }: { - nixosConfigurations = { - rotterdam = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { - inherit inputs; - hostType = { - isServer = false; - isWorkstation = true; - }; - }; - modules = [ - ./hosts/rotterdam.nix - agenix.nixosModules.default - home-manager.nixosModules.default - impermanence.nixosModules.impermanence - nix-flatpak.nixosModules.nix-flatpak + nixosConfigurations = + let + mkHost = { - nixpkgs.overlays = [ - agenix.overlays.default - self.overlays.custom + hostname, + type, # workstation|server + system ? "x86_64-linux", + extraModules ? [ ], + }: + let + pkgs = if type == "server" then nixpkgs-stable else nixpkgs; + hm = if type == "server" then home-manager-stable else home-manager; + hostTypeFlags = { + isServer = type == "server"; + isWorkstation = type == "workstation"; + }; + defaultModules = [ + ./hosts/${hostname}.nix + agenix.nixosModules.default + hm.nixosModules.default + impermanence.nixosModules.impermanence + nix-flatpak.nixosModules.nix-flatpak + { + nixpkgs.overlays = [ + agenix.overlays.default + ]; + } ]; - } - ]; - }; - - io = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { - inherit inputs; - hostType = { - isServer = false; - isWorkstation = true; + workstationModules = [ + { + nixpkgs.overlays = [ + self.overlays.custom + ]; + } + ]; + serverModules = [ + self.nixosModules.qbittorrent + ]; + typeModules = if type == "server" then serverModules else workstationModules; + allModules = defaultModules ++ typeModules ++ extraModules; + in + pkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs; + hostType = hostTypeFlags; + }; + modules = allModules; }; + in + { + rotterdam = mkHost { + hostname = "rotterdam"; + type = "workstation"; }; - modules = [ - ./hosts/io.nix - agenix.nixosModules.default - home-manager.nixosModules.default - impermanence.nixosModules.impermanence - nix-flatpak.nixosModules.nix-flatpak - { - nixpkgs.overlays = [ - agenix.overlays.default - self.overlays.custom - ]; - } - ]; - }; + io = mkHost { + hostname = "io"; + type = "workstation"; + }; + alexandria = mkHost { + hostname = "alexandria"; + type = "server"; + }; + # rotterdam = nixpkgs.lib.nixosSystem { + # system = "x86_64-linux"; + # specialArgs = { + # inherit inputs; + # hostType = { + # isServer = false; + # isWorkstation = true; + # }; + # }; + # modules = [ + # ./hosts/rotterdam.nix + # agenix.nixosModules.default + # home-manager.nixosModules.default + # impermanence.nixosModules.impermanence + # nix-flatpak.nixosModules.nix-flatpak + # { + # nixpkgs.overlays = [ + # agenix.overlays.default + # self.overlays.custom + # ]; + # } + # ]; + # }; - alexandria = nixpkgs-stable.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = { - inherit inputs; - hostType = { - isServer = true; - isWorkstation = false; - }; - }; - modules = [ - ./hosts/alexandria.nix - agenix.nixosModules.default - home-manager-stable.nixosModules.default - self.nixosModules.qbittorrent - ({ - nixpkgs.overlays = [ - agenix.overlays.default - nix-minecraft.overlay - ]; - imports = [ nix-minecraft.nixosModules.minecraft-servers ]; - }) - ]; + # io = nixpkgs.lib.nixosSystem { + # system = "x86_64-linux"; + # specialArgs = { + # inherit inputs; + # hostType = { + # isServer = false; + # isWorkstation = true; + # }; + # }; + # modules = [ + # ./hosts/io.nix + # agenix.nixosModules.default + # home-manager.nixosModules.default + # impermanence.nixosModules.impermanence + # nix-flatpak.nixosModules.nix-flatpak + # { + # nixpkgs.overlays = [ + # agenix.overlays.default + # self.overlays.custom + # ]; + # } + # ]; + # }; + + # alexandria = nixpkgs-stable.lib.nixosSystem { + # system = "x86_64-linux"; + # specialArgs = { + # inherit inputs; + # hostType = { + # isServer = true; + # isWorkstation = false; + # }; + # }; + # modules = [ + # ./hosts/alexandria.nix + # agenix.nixosModules.default + # home-manager-stable.nixosModules.default + # self.nixosModules.qbittorrent + # ({ + # nixpkgs.overlays = [ + # agenix.overlays.default + # nix-minecraft.overlay + # ]; + # imports = [ nix-minecraft.nixosModules.minecraft-servers ]; + # }) + # ]; + # }; }; - }; overlays = { custom = final: prev: { diff --git a/hosts/modules/alexandria/default.nix b/hosts/modules/alexandria/default.nix index bb81971..d33bd6d 100644 --- a/hosts/modules/alexandria/default.nix +++ b/hosts/modules/alexandria/default.nix @@ -19,7 +19,6 @@ in ./jellyfin.nix ./librespeed.nix ./memos.nix - ./minecraft.nix ./nextcloud.nix ./nginx.nix ./searx.nix diff --git a/hosts/modules/alexandria/minecraft.nix b/hosts/modules/alexandria/minecraft.nix deleted file mode 100644 index 2ce951f..0000000 --- a/hosts/modules/alexandria/minecraft.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ pkgs, ... }: - -{ - services.minecraft-servers = { - enable = true; - eula = true; - dataDir = "/data/minecraft"; - servers."kingdomcums" = { - enable = true; - package = pkgs.fabricServers.fabric-1_20_1; - openFirewall = true; - serverProperties = { - difficulty = "normal"; - gamemode = "survival"; - motd = "Kingdom Cums"; - online-mode = false; - spawn-protection = false; - }; - symlinks."mods" = pkgs.linkFarmFromDrvs "mods" ( - builtins.attrValues { - villagerNames = pkgs.fetchurl { - url = "https://cdn.modrinth.com/data/gqRXDo8B/versions/rzXhJ2pH/villagernames-1.20.1-8.1.jar"; - sha256 = "0hcbbp3zi3nnr12kian9l645f22jr7495bcrlbng46nxp9h08pg5"; - }; - lithium = pkgs.fetchurl { - url = "https://cdn.modrinth.com/data/gvQqBUqZ/versions/ZSNsJrPI/lithium-fabric-mc1.20.1-0.11.2.jar"; - sha256 = "1ycdvrs46bbdxsa6i38sfx70v47nvzzbmblfpy3hq3k8blsrbid0"; - }; - lootr = pkgs.fetchurl { - url = "https://cdn.modrinth.com/data/EltpO5cN/versions/fqmzdpE2/lootr-fabric-1.20-0.7.33.81.jar"; - sha256 = "0db0472rb07nbc9i925qp3n7s7nmrq6q3alhprflgc9gqg0j0f14"; - }; - malilib = pkgs.fetchurl { - url = "https://cdn.modrinth.com/data/GcWjdA9I/versions/V7yLDtJV/malilib-fabric-1.20.1-0.16.3.jar"; - sha256 = "129m1jnk58p0wid5fmagqx13wp6pw4gja01yx14aljdxgzr8kqas"; - }; - immersivePaintings = pkgs.fetchurl { - url = "https://cdn.modrinth.com/data/6txNkua3/versions/UjL11A4h/immersive_paintings-0.6.7%2B1.20.1-fabric.jar"; - sha256 = "1di9a67q372z6lplnsa1kmh86armya83mimn61c8ai7izjlsfnid"; - }; - entityCulling = pkgs.fetchurl { - url = "https://cdn.modrinth.com/data/NNAgCjsB/versions/mahLIqpj/entityculling-fabric-1.6.7-mc1.20.1.jar"; - sha256 = "01iz8rgljgzl0d8gcwpmr6wcvv3b0cf1siggp3dn8q5hv9przk9k"; - }; - fabricAPI = pkgs.fetchurl { - url = "https://cdn.modrinth.com/data/P7dR8mSH/versions/P7uGFii0/fabric-api-0.92.2%2B1.20.1.jar"; - sha256 = "1z3hcxng2p9ymph1c0k729vxxaasi34n6fcdsqwx0wsmqi2gh025"; - }; - fallingTree = pkgs.fetchurl { - url = "https://cdn.modrinth.com/data/Fb4jn8m6/versions/NrtzFkZE/FallingTree-1.20.1-4.3.4.jar"; - sha256 = "0sfv2laxzgmkhmr0kizi7g09r6fkccjhj9p5j0viqywnwx02r7fs"; - }; - carryOn = pkgs.fetchurl { - url = "https://cdn.modrinth.com/data/joEfVgkn/versions/Mkla4B3q/carryon-fabric-1.20.1-2.1.2.7.jar"; - sha256 = "1pgbqrjrxw7bgwn6phpywgpjfmf5h341ba93j76ibk649wbgn9cd"; - }; - collective = pkgs.fetchurl { - url = "https://cdn.modrinth.com/data/e0M1UDsY/versions/jo7YkyNS/collective-1.20.1-7.84.jar"; - sha256 = "01qvaqmd5kmxq7sins6703xq5ckc47qs5kd62gnjyfq1dbjp2y2b"; - }; - dynamicLights = pkgs.fetchurl { - url = "https://cdn.modrinth.com/data/7YjclEGc/versions/eU6PA0pr/dynamiclights-v1.8.3-mc1.17x-1.21x-mod.jar"; - sha256 = "0vdv525gis1vj514iqh4rbl6byp7k0ls3lsyj0c3db8g58d784gm"; - }; - appleSkin = pkgs.fetchurl { - url = "https://cdn.modrinth.com/data/EsAfCjCV/versions/xcauwnEB/appleskin-fabric-mc1.20.1-2.5.1.jar"; - sha256 = "1d9qmzjlk763ycmizqpmhcq0hhqw9j8hij6xk8p8l11ljr13mql5"; - }; - } - ); - }; - }; -} diff --git a/hosts/modules/networking.nix b/hosts/modules/networking.nix index f567d9b..63459d0 100644 --- a/hosts/modules/networking.nix +++ b/hosts/modules/networking.nix @@ -1,6 +1,5 @@ { hostType, - inputs, lib, ... }: @@ -33,13 +32,6 @@ # Workstation specific configuration (lib.mkIf hostType.isWorkstation { - services = { - tailscale.useRoutingFeatures = "client"; - nginx = { - enable = true; - virtualHosts."localhost".root = inputs.homepage; - }; - }; }) ]; } diff --git a/hosts/modules/programs.nix b/hosts/modules/programs.nix index 7ea6b77..046354f 100644 --- a/hosts/modules/programs.nix +++ b/hosts/modules/programs.nix @@ -153,7 +153,8 @@ fontDir.enable = true; packages = with pkgs; [ corefonts - material-icons + inter + nerd-fonts.hack noto-fonts-cjk-sans roboto ]; diff --git a/hosts/rotterdam.nix b/hosts/rotterdam.nix index ea2de1d..ad95919 100644 --- a/hosts/rotterdam.nix +++ b/hosts/rotterdam.nix @@ -5,19 +5,7 @@ imports = [ ./modules/rotterdam - ./modules/boot.nix - ./modules/console.nix - ./modules/desktop.nix - ./modules/flatpak.nix - ./modules/impermanence.nix - ./modules/locale.nix - ./modules/networking.nix - ./modules/nix.nix - ./modules/programs.nix - ./modules/security.nix - ./modules/services.nix - ./modules/users.nix - ./modules/virtualisation.nix + ./modules ]; nix.nixPath = [ "nixos-config=${./rotterdam.nix}" ];