diff options
| author | Mathias Magnusson <mathias@magnusson.space> | 2026-01-06 14:44:17 +0100 |
|---|---|---|
| committer | Mathias Magnusson <mathias@magnusson.space> | 2026-01-06 15:11:34 +0100 |
| commit | 529714f1a8a2c7241436ed6de71a7b0b88117137 (patch) | |
| tree | 274d445829ef63ded590dd47212bb8d34016e462 | |
| parent | 4fb956b33d8a2255b3acc8a00fa89a1747804bd6 (diff) | |
| download | oden-529714f1a8a2c7241436ed6de71a7b0b88117137.tar.gz | |
add minecraft
| -rw-r--r-- | configuration.nix | 1 | ||||
| -rw-r--r-- | flake.nix | 26 | ||||
| -rw-r--r-- | impermanence.nix | 4 | ||||
| -rw-r--r-- | minecraft.nix | 16 |
4 files changed, 29 insertions, 18 deletions
diff --git a/configuration.nix b/configuration.nix index 4c20513..57bb404 100644 --- a/configuration.nix +++ b/configuration.nix @@ -12,6 +12,7 @@ ./router.nix ./immich.nix ./postgresql.nix + ./minecraft.nix ]; powerManagement.powertop.enable = true; @@ -23,28 +23,22 @@ ... }: let + pkgsFor = system: import nixpkgs { + inherit system; + config.allowUnfree = true; + overlays = [ + agenix.overlays.default + ]; + }; forAllSystems = f: nixpkgs.lib.genAttrs - [ - "x86_64-linux" - "aarch64-linux" - ] - ( - system: - f ( - import nixpkgs { - inherit system; - config.allowUnfree = true; - overlays = [ - agenix.overlays.default - ]; - } - ) - ); + [ "x86_64-linux" "aarch64-linux" ] + (system: f (pkgsFor system)); in { nixosConfigurations.oden = nixpkgs.lib.nixosSystem { + pkgs = pkgsFor "x86_64-linux"; modules = [ ./configuration.nix disko.nixosModules.disko diff --git a/impermanence.nix b/impermanence.nix index 3fe347a..ae62f3c 100644 --- a/impermanence.nix +++ b/impermanence.nix @@ -1,7 +1,7 @@ # sudo mount --ro /dev/nvme0n1p2 ./mnt --mkdir # ls mnt/old_roots -{ lib, config, ... }: +{ lib, config, options, ... }: let cfg = config.oden.persist; in @@ -11,7 +11,7 @@ in with types; { directories = mkOption { - type = listOf str; + type = listOf (types.oneOf [ str (types.attrsOf types.anything) ]); default = [ ]; description = "Directories that should be persisted"; }; diff --git a/minecraft.nix b/minecraft.nix new file mode 100644 index 0000000..f900726 --- /dev/null +++ b/minecraft.nix @@ -0,0 +1,16 @@ +{ config, ... }: +{ + services.minecraft-server = { + enable = true; + openFirewall = true; + eula = true; + jvmOpts = "-Xms4G -Xmx4G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1"; + }; + + oden.persist.directories = [ { + directory = config.services.minecraft-server.dataDir; + user = "minecraft"; + group = "minecraft"; + mode = "u=rwx,g=rx,o="; + } ]; +} |
