From 1bf77e4eb62b1d9182c2921776b3b5f818676862 Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Tue, 27 Oct 2026 13:47:25 -0400 Subject: [PATCH] add: krile configuration --- flake.lock | 141 ++++++++++++------ flake.nix | 24 +++ modules/games/homestead/README.md | 105 +++++++++++++ modules/games/homestead/default.nix | 81 ++++++++++ modules/games/homestead/package.nix | 48 ++++++ modules/games/homestead/required-mods.json | 42 ++++++ modules/machine/krile/configuration.nix | 88 +++++++++++ modules/machine/krile/default.nix | 6 + .../machine/krile/hardware-configuration.nix | 32 ++++ 9 files changed, 524 insertions(+), 43 deletions(-) create mode 100644 modules/games/homestead/README.md create mode 100644 modules/games/homestead/default.nix create mode 100644 modules/games/homestead/package.nix create mode 100644 modules/games/homestead/required-mods.json create mode 100644 modules/machine/krile/configuration.nix create mode 100644 modules/machine/krile/default.nix create mode 100644 modules/machine/krile/hardware-configuration.nix diff --git a/flake.lock b/flake.lock index ff4198b..ef5e6eb 100644 --- a/flake.lock +++ b/flake.lock @@ -32,11 +32,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1791702392, - "narHash": "sha256-8uWZP3UiJBtYzBzazI18WvlshKYHxPb+8aqm02OxL5M=", + "lastModified": 1792911802, + "narHash": "sha256-GdMiAfj8hRDCqrE2AvQJ3atf0y2XVGFx9/Ptr6qiju0=", "ref": "refs/heads/master", - "rev": "ee2a27ad749d6d774e26c2be5de5f3a5ecd4a93f", - "revCount": 28, + "rev": "a355f99a17b9dc38fc626b80340646a94ae7f1c9", + "revCount": 30, "type": "git", "url": "https://scm.wyattjmiller.com/wymiller/caitsith.git" }, @@ -74,11 +74,11 @@ ] }, "locked": { - "lastModified": 1786845137, - "narHash": "sha256-oQFip+v0luP8NIxJzmiW4Wu8bILsbFWom5l0zonl8hQ=", + "lastModified": 1792737899, + "narHash": "sha256-P0/GhewcEQmAbzq3QunNWY2jLJaYH9F6c/5dEM/jQ4M=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "4cff07de74b50e64bdd68cd4e722ab5b6b35ee48", + "rev": "bb0b90dbd54e207100de72b5dcbe3188c98a4b69", "type": "github" }, "original": { @@ -136,6 +136,22 @@ } }, "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_5": { "flake": false, "locked": { "lastModified": 1777699697, @@ -290,11 +306,11 @@ ] }, "locked": { - "lastModified": 1792166485, - "narHash": "sha256-TL2RJ56FbBQNi6vsCXAn7QhZECh5DPbvzfiX6v+4r1A=", + "lastModified": 1792644631, + "narHash": "sha256-3aILZu5bQ+6khPvGCdIbC7wBFZOgPbpP0TBSL9tf89E=", "owner": "purpleclay", "repo": "go-overlay", - "rev": "5971ffb6c5de960d37f3b85c53cb5a30387cd05a", + "rev": "ff2b494b477eb4349dd40f0564cedab552f9804d", "type": "github" }, "original": { @@ -313,11 +329,11 @@ "rust-overlay": "rust-overlay_3" }, "locked": { - "lastModified": 1791702441, - "narHash": "sha256-qHf8tVIYu6OE1PKcthmpBgblg27u3bU7v4TVqy0B3jg=", + "lastModified": 1792911744, + "narHash": "sha256-iXH6FL8HYaZg0+p9lUv5bEc4k1YpvwKFYtMYbY1phTA=", "ref": "refs/heads/master", - "rev": "2c2e99f6347e9be744a72f7df6043015989d6cd7", - "revCount": 17, + "rev": "01ff244467f011033d98286e8f4171a890e9060a", + "revCount": 19, "type": "git", "url": "https://scm.wyattjmiller.com/wymiller/hildibrand.git" }, @@ -355,11 +371,11 @@ ] }, "locked": { - "lastModified": 1792098797, - "narHash": "sha256-u4DIIZgznEGzByxXrxWCXK19VcMtTBmi/M9gZ7Jk9bM=", + "lastModified": 1792896866, + "narHash": "sha256-/0tELNnhdSnP+bHSdWiEe6KpfSwi6WrTnT9cm/jNkjA=", "owner": "nix-community", "repo": "home-manager", - "rev": "640725978b99076e18e069f6e7d2959124584f8f", + "rev": "c216bf5a1f173b0481bd5c8c489ebe5595ecc68c", "type": "github" }, "original": { @@ -399,6 +415,29 @@ "type": "github" } }, + "nix-minecraft": { + "inputs": { + "flake-compat": "flake-compat_4", + "nixpkgs": [ + "nur", + "nixpkgs" + ], + "systems": "systems_3" + }, + "locked": { + "lastModified": 1792988509, + "narHash": "sha256-1Li/v57ePpV9t6E57w/XTu760H6hYHztwm1RSd6RA8k=", + "owner": "Infinidoge", + "repo": "nix-minecraft", + "rev": "931d87d3811cabc0277be27b94392d19291bd344", + "type": "github" + }, + "original": { + "owner": "Infinidoge", + "repo": "nix-minecraft", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1789286504, @@ -417,11 +456,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1792615934, - "narHash": "sha256-MlvRfa1O5Cqc2/a+gG+l9TSuowEoCKCmrJ1d9oAVm0I=", + "lastModified": 1792898606, + "narHash": "sha256-Mg3rRjsbMqhSMxop5PYMXos8SwAjejrxSgVThTvP9eg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "da6dc0e7b26060f2f71ce3ef7088fb56ee44fa36", + "rev": "1f607aa79b6356ed45d3cd3c8079c196e79efa2c", "type": "github" }, "original": { @@ -433,11 +472,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1792030654, - "narHash": "sha256-OaQwAtPMTjQiY2sT/2/62UbSPhzP/0aDnWzMm/NCiUw=", + "lastModified": 1792615934, + "narHash": "sha256-MlvRfa1O5Cqc2/a+gG+l9TSuowEoCKCmrJ1d9oAVm0I=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "26f4107e47e3ad0ffd0db220469ba83b6f6d96e8", + "rev": "da6dc0e7b26060f2f71ce3ef7088fb56ee44fa36", "type": "github" }, "original": { @@ -483,15 +522,16 @@ "go-overlay": "go-overlay_2", "hildibrand": "hildibrand", "home-manager": "home-manager_2", + "nix-minecraft": "nix-minecraft", "nixpkgs": "nixpkgs_3", "rust-overlay": "rust-overlay_4" }, "locked": { - "lastModified": 1792639431, - "narHash": "sha256-ZFh9vzagl6LegBH4gjIvEWIvNuZGEqOQX0LiAwt9DA8=", + "lastModified": 1793051642, + "narHash": "sha256-b+CbWZU8sYR9TNBg6KJur680E+5+Zm4S4IVzkzFnJEc=", "ref": "refs/heads/master", - "rev": "ce646a959820bed061d173e7631cd13d39edd532", - "revCount": 118, + "rev": "8ec05b20cea4865f9fd5dd797c6e090f41863db1", + "revCount": 121, "type": "git", "url": "https://scm.wyattjmiller.com/wymiller/nur.git" }, @@ -502,16 +542,16 @@ }, "nvf": { "inputs": { - "flake-compat": "flake-compat_4", + "flake-compat": "flake-compat_5", "mnw": "mnw", "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1792889789, - "narHash": "sha256-xpH3z+T5NELixXRjxGJ3mx30kz63Xt2B0ZfPWl7hcUg=", + "lastModified": 1793047357, + "narHash": "sha256-eY8aBTGSgtx+25254i22jyjbj+JQkEIfb+JyQ2Exnuk=", "owner": "notashelf", "repo": "nvf", - "rev": "557d2eb05a76e5939e6a75351343cae5731a71f8", + "rev": "60b4593979c39e9a1227c9913bd835bb1a59054b", "type": "github" }, "original": { @@ -563,11 +603,11 @@ ] }, "locked": { - "lastModified": 1791620365, - "narHash": "sha256-CVZXIDNw7HEwyD8X6q9Ln370Sc0ZqRlTzDRwOZ1hJMY=", + "lastModified": 1792825530, + "narHash": "sha256-aphXA2IFNd3q48++TKmfuuvDDjkrgGdJDnDIhij9684=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "e90fafa71b440fabcd52dd7fb017ab2da81c781a", + "rev": "5b9f1198b59bcb31c5c3250b332e7d77590e6306", "type": "github" }, "original": { @@ -585,11 +625,11 @@ ] }, "locked": { - "lastModified": 1791620365, - "narHash": "sha256-CVZXIDNw7HEwyD8X6q9Ln370Sc0ZqRlTzDRwOZ1hJMY=", + "lastModified": 1792825530, + "narHash": "sha256-aphXA2IFNd3q48++TKmfuuvDDjkrgGdJDnDIhij9684=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "e90fafa71b440fabcd52dd7fb017ab2da81c781a", + "rev": "5b9f1198b59bcb31c5c3250b332e7d77590e6306", "type": "github" }, "original": { @@ -606,11 +646,11 @@ ] }, "locked": { - "lastModified": 1792219666, - "narHash": "sha256-RMO08tKD+hFIL5ryWi85VY4aHE5oIpdV1h4kVFctOkw=", + "lastModified": 1792825530, + "narHash": "sha256-aphXA2IFNd3q48++TKmfuuvDDjkrgGdJDnDIhij9684=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "a110337465cfb76e3806b81b9db3094c3e6e770a", + "rev": "5b9f1198b59bcb31c5c3250b332e7d77590e6306", "type": "github" }, "original": { @@ -624,11 +664,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1792825530, - "narHash": "sha256-aphXA2IFNd3q48++TKmfuuvDDjkrgGdJDnDIhij9684=", + "lastModified": 1793000331, + "narHash": "sha256-6sLQgHX/V/yF8VrhmsJroujeRua1GY3nDTEpnY7tHF4=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "5b9f1198b59bcb31c5c3250b332e7d77590e6306", + "rev": "0d0575988e4bb9ebc4cf1afb1cec1ceac0b5914e", "type": "github" }, "original": { @@ -666,6 +706,21 @@ "repo": "default", "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" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 501fd6d..f896546 100644 --- a/flake.nix +++ b/flake.nix @@ -271,6 +271,30 @@ ]; }; + # Homestead 2.0 Minecraft server + nixosConfigurations."krile" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit userName userEmail nur; + hostname = "krile"; + role = "server"; + }; + modules = [ + myOverlays + ./modules/common + ./modules/machine/krile + + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.extraSpecialArgs = extraSpecialArgs // { isNixOS = true; role = "server"; }; + home-manager.backupFileExtension = "bak"; + home-manager.users.${userName}.imports = [./home]; + } + ]; + }; + # generic non-NixOS Linux machine homeConfigurations."generic" = let hostname = builtins.getEnv "HOSTNAME"; diff --git a/modules/games/homestead/README.md b/modules/games/homestead/README.md new file mode 100644 index 0000000..831fd98 --- /dev/null +++ b/modules/games/homestead/README.md @@ -0,0 +1,105 @@ +# Homestead 2.0 on krile + +This module uses the Minecraft NixOS module and Fabric overlay re-exported by +the existing `nur` flake input. It pins Minecraft 1.20.1, Fabric 0.19.5, Java 17, +and the [official Homestead 2.0 server pack](https://cozystudios.org/homestead/server-pack/). +The archive and all eight additional mods listed in its `startserver.sh` are +downloaded with fixed SHA-256 hashes during the Nix build. The upstream startup +script is not run. + +`modules/machine/krile/configuration.nix` enables the server, accepts the Minecraft +EULA, and opens TCP 25565 and UDP 24454 (Simple Voice Chat). Forward those ports +to krile on your router if players connect from outside your network. Players +need the Homestead 2.0 client pack. + +The default heap is 6 GiB initially and 10 GiB maximum. Give the VM additional +RAM for the OS, native libraries, and filesystem cache; 16 GiB total is a +reasonable starting point. + +## Deploy + +On krile, from the repository root: + +```bash +nix eval --raw path:.#nixosConfigurations.krile.config.system.build.toplevel.drvPath +sudo nixos-rebuild switch --flake path:.#krile +``` + +The `path:.` form includes new files before they have been added to Git. Once the +new module and krile files are tracked, `--flake .#krile` works as usual. + +The service starts on boot and restarts after an unexpected exit. Check it with: + +```bash +systemctl status minecraft-server-homestead +journalctl -u minecraft-server-homestead -f +``` + +The console uses nix-minecraft's systemd FIFO. For example, run a command with: + +```bash +sudo sh -c 'echo list > /run/minecraft/homestead.stdin' +``` + +Stop the service with `sudo systemctl stop minecraft-server-homestead` so it can +save the world cleanly. + +## Configuration and state + +Worlds, player progress, and other runtime state live in +`/srv/minecraft/homestead`. Back up that directory, particularly `world/`, before +changing pack versions. The module does not provide automatic backups. + +The `mods` directory and server icon are store symlinks. `config`, `defaultconfigs`, +`kubejs`, `scripts`, and `patchouli_books` are writable copies of the pinned pack, +recreated on each start and removed on stop by nix-minecraft. Edits to those +copies do not persist across restarts. World data is not part of those managed +directories. + +Change memory in the host configuration: + +```nix +services.homestead.jvmOpts = "-Xms6G -Xmx12G -XX:+UseG1GC"; +``` + +Other server settings use the underlying nix-minecraft options: + +```nix +services.minecraft-servers.servers.homestead = { + serverProperties = { + server-port = 25566; + max-players = 10; + white-list = true; + }; + # Add real player UUIDs here, or manage the whitelist through the console. + whitelist = { }; +}; +``` + +Changing `server-port` also changes the opened TCP port. Voice chat remains on +UDP 24454, matching the pack's `config/voicechat/voicechat-server.properties`. + +To use this module on another NixOS host, pass `nur` in `specialArgs`, import +`modules/games/homestead`, set `services.homestead.enable = true`, and set +`services.minecraft-servers.eula = true` after accepting the EULA. The host must +allow unfree packages, as the common modules already do for krile. + +## Pack updates + +For a new release, inspect the official archive and startup script, update the +archive URL/hash in `package.nix`, update `required-mods.json` with any separate +downloads and their hashes, and match the Minecraft/Fabric versions in +`default.nix`. Evaluate and build before switching, then check the startup log. +The pack is kept fixed at 2.0 until these declarations change. + +## Validation + +The krile system derivation evaluates, and the pack, Fabric launcher, and +nix-minecraft setup/cleanup scripts build successfully. A temporary local server +reached `Done`, started Simple Voice Chat, and exited with status 0 after `stop`, +saving every dimension. Setup/cleanup was also checked to preserve world data +and reset managed configs. Multiplayer gameplay was not tested. + +The upstream 2.0 pack emits some nonfatal mixin/recipe warnings and an optional +Falling Trees/Jade integration error during startup; these did not prevent the +startup and shutdown check from passing. diff --git a/modules/games/homestead/default.nix b/modules/games/homestead/default.nix new file mode 100644 index 0000000..2004c6a --- /dev/null +++ b/modules/games/homestead/default.nix @@ -0,0 +1,81 @@ +{ + config, + lib, + nur, + pkgs, + ... +}: +let + cfg = config.services.homestead; + modpack = pkgs.callPackage ./package.nix { }; +in +{ + imports = [ nur.nixosModules.minecraft-servers ]; + + options.services.homestead = { + enable = lib.mkEnableOption "the Homestead 2.0 Minecraft server"; + + openFirewall = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Open the Minecraft TCP port and Simple Voice Chat UDP port (24454)."; + }; + + jvmOpts = lib.mkOption { + type = lib.types.str; + default = "-Xms6G -Xmx10G -XX:+UseG1GC"; + description = "JVM options for Homestead. Leave additional RAM for the OS and native allocations."; + }; + }; + + config = lib.mkIf cfg.enable { + nixpkgs.overlays = [ nur.overlays.minecraft ]; + + services.minecraft-servers = { + enable = true; + servers.homestead = { + enable = true; + inherit (cfg) openFirewall jvmOpts; + + package = pkgs.fabricServers.fabric-1_20_1.override { + loaderVersion = "0.19.5"; + jre_headless = pkgs.jdk17_headless; + }; + + managementSystem = { + tmux.enable = false; + systemd-socket.enable = true; + }; + + # Match the properties generated by the pack's startserver.sh. + serverProperties = lib.mapAttrs (_: lib.mkDefault) { + motd = "Homestead 2.0"; + allow-flight = true; + max-tick-time = 180000; + simulation-distance = 6; + view-distance = 10; + server-port = 25565; + online-mode = true; + # keep-inventory = true; + }; + + symlinks = { + mods = "${modpack}/mods"; + "server-icon.png" = "${modpack}/server-icon.png"; + }; + + # Mods may rewrite their configs or generate files here. nix-minecraft + # supplies writable copies on each start and cleans them on stop. + files = lib.genAttrs [ + "config" + "defaultconfigs" + "kubejs" + "scripts" + "patchouli_books" + ] (dir: "${modpack}/${dir}"); + }; + }; + + networking.firewall.allowedUDPPorts = lib.mkIf cfg.openFirewall [ 24454 ]; + }; +} diff --git a/modules/games/homestead/package.nix b/modules/games/homestead/package.nix new file mode 100644 index 0000000..8327434 --- /dev/null +++ b/modules/games/homestead/package.nix @@ -0,0 +1,48 @@ +{ + lib, + stdenvNoCC, + fetchurl, + unzip, +}: +let + # These eight downloads come from startserver.sh in the official 2.0 pack. + requiredMods = map fetchurl (lib.importJSON ./required-mods.json); +in +stdenvNoCC.mkDerivation { + pname = "homestead-server-pack"; + version = "2.0"; + + src = fetchurl { + name = "Homestead-2.0-Server.zip"; + url = "https://drive.usercontent.google.com/download?id=1SpJBa80o_Jx_yqLjQ49pz7HP1FY2PCJj&export=download&confirm=t"; + hash = "sha256-QVenE6dz+lZPHkC1hwL7Yy4lw6vg/Cr/8pnmK3iaK4o="; + }; + + nativeBuildInputs = [ unzip ]; + dontUnpack = true; + dontConfigure = true; + dontBuild = true; + + installPhase = '' + runHook preInstall + + mkdir -p "$out" + unzip -q "$src" \ + 'mods/*' 'config/*' 'defaultconfigs/*' 'kubejs/*' \ + 'scripts/*' 'patchouli_books/*' 'server-icon.png' -d "$out" + + ${lib.concatMapStringsSep "\n" (mod: '' + install -m644 ${mod} "$out/mods/${mod.name}" + '') requiredMods} + + runHook postInstall + ''; + + meta = { + description = "Homestead 2.0 server assets, including the eight separately downloaded mods"; + homepage = "https://cozystudios.org/homestead/server-pack/"; + # The pack contains mods with different licenses; do not redistribute it. + license = lib.licenses.unfree; + platforms = lib.platforms.linux; + }; +} diff --git a/modules/games/homestead/required-mods.json b/modules/games/homestead/required-mods.json new file mode 100644 index 0000000..210f971 --- /dev/null +++ b/modules/games/homestead/required-mods.json @@ -0,0 +1,42 @@ +[ + { + "name": "balm-fabric-1.20.1-7.3.44.jar", + "url": "https://edge.forgecdn.net/files/8969/704/balm-fabric-1.20.1-7.3.44.jar", + "hash": "sha256-hMoKTCjV9cxwjuEqKQ+U4ixMntDxXZNM0MDCMPClpMY=" + }, + { + "name": "CraftTweaker-fabric-1.20.1-14.0.60.jar", + "url": "https://edge.forgecdn.net/files/7772/872/CraftTweaker-fabric-1.20.1-14.0.60.jar", + "hash": "sha256-y4Kl3wHCNr6oY8SxxZtgaS/ARGHWVIK/eW1EZizqiQA=" + }, + { + "name": "libraryferret-fabric-1.20.1-4.0.0.jar", + "url": "https://edge.forgecdn.net/files/4601/231/libraryferret-fabric-1.20.1-4.0.0.jar", + "hash": "sha256-d/UX69gN5R+fh62cTZIrNMQNfF+2iu1tl0zu0NthuG0=" + }, + { + "name": "sophisticatedbackpacks-1.20.1-3.23.4.5.110.jar", + "url": "https://edge.forgecdn.net/files/7147/929/sophisticatedbackpacks-1.20.1-3.23.4.5.110.jar", + "hash": "sha256-Fewy1BGnA4R0OldwrmoitxqEGK9/juu/+se/yKGDbA8=" + }, + { + "name": "sophisticatedcore-1.20.1-1.2.7.15.166.jar", + "url": "https://edge.forgecdn.net/files/7341/57/sophisticatedcore-1.20.1-1.2.7.15.166.jar", + "hash": "sha256-Fzmsti4i+ZQk8yQkuZYr2S0p4HUvVJWqEW35p8Hdgxo=" + }, + { + "name": "sophisticatedstorage-1.20.1-1.3.5.11.142.jar", + "url": "https://edge.forgecdn.net/files/8032/765/sophisticatedstorage-1.20.1-1.3.5.11.142.jar", + "hash": "sha256-VgjSIGpr0TJlhLUrTFp7Mpvpw/izOqOiQGAHiu0Lz4k=" + }, + { + "name": "trashslot-fabric-1.20.1-15.1.5.jar", + "url": "https://edge.forgecdn.net/files/8019/425/trashslot-fabric-1.20.1-15.1.5.jar", + "hash": "sha256-u876a68TrhF8ShNtf/ZrYlx1QLncwNQHe08jcIXuRAg=" + }, + { + "name": "wirelessredstone-fabric-1.20.1-1.1.2.jar", + "url": "https://edge.forgecdn.net/files/5175/782/wirelessredstone-fabric-1.20.1-1.1.2.jar", + "hash": "sha256-Kw8xy4ngmAgD9kEvwAjTS6KatJEnA6UPkI1X3xnWf48=" + } +] diff --git a/modules/machine/krile/configuration.nix b/modules/machine/krile/configuration.nix new file mode 100644 index 0000000..8050595 --- /dev/null +++ b/modules/machine/krile/configuration.nix @@ -0,0 +1,88 @@ +{ + pkgs, + userName, + nur, + ... +}: { + imports = [ + ../../pwrMgmt + ../../networking/core.nix + ../../virtualization/podman.nix + ../../games/homestead + ]; + + # Enable flakes for NixOS + nix.settings.experimental-features = ["nix-command" "flakes"]; + + # Custom kernel/boot stuff + boot.kernelPackages = pkgs.linuxPackages_latest; + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Set your timezone + time.timeZone = "America/Detroit"; + + # Enable OpenSSH + services.openssh.enable = true; + + # Enable keyring + services.gnome.gnome-keyring.enable = true; + + # Enable GnuPG + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + # Enable SUID wrappers (some programs need them) + programs.mtr.enable = true; + + # Enable Polkit + security.polkit.enable = true; + + # Power management (see ../../pwrMgmt/default.nix) + pwrMgmt = { + enable = true; + cpuFreqGovernor = "performance"; + powertop.enable = false; + }; + + network = { + firewall = { + enable = true; + }; + networkManager.enable = true; + }; + + # Add username to groups "wheel" and "video" - more may be added here later + users = { + users = { + ${userName} = { + extraGroups = [ "wheel" "network" ]; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFV9eSc9L+aJLoKoexq2f/jb5rpyZnhuGiyhS8YQAbaS wyatt@wyattjmiller.com" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4WKvKnnYpTbzZHFEslOKyfiiMqWxhW3AfX6E7ACmYU wyatt@wyattjmiller.com" + ]; + }; + }; + }; + + services.fail2ban = { + enable = true; + package = pkgs.fail2ban; + maxretry = 5; + bantime = "3h"; + bantime-increment = { + enable = true; + rndtime = "10m"; + }; + }; + + services.homestead = { + enable = true; + openFirewall = true; + }; + services.minecraft-servers.eula = true; + + system.stateVersion = "26.05"; +} diff --git a/modules/machine/krile/default.nix b/modules/machine/krile/default.nix new file mode 100644 index 0000000..3c4d411 --- /dev/null +++ b/modules/machine/krile/default.nix @@ -0,0 +1,6 @@ +{ ... }: { + imports = [ + ./configuration.nix + ./hardware-configuration.nix + ]; +} diff --git a/modules/machine/krile/hardware-configuration.nix b/modules/machine/krile/hardware-configuration.nix new file mode 100644 index 0000000..9dc7cc7 --- /dev/null +++ b/modules/machine/krile/hardware-configuration.nix @@ -0,0 +1,32 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "virtio_scsi" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/ec4c43ec-efcc-40ea-a4c8-411e60ee7c4e"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/140E-FE19"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/547bbd78-85be-4d17-a519-c4a2a923bdab"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +}