From 0cc72e047b4b537d3ad62700d3acf88cb1df562c Mon Sep 17 00:00:00 2001 From: Sky Hearn Date: Tue, 5 Mar 2024 22:41:50 -0800 Subject: [PATCH] minecraft docker container should work? --- configuration.nix | 9 ++- flake.lock | 142 ++++++++++++++++++++++++++++++++++++++-- flake.nix | 11 +++- users/arion-compose.nix | 7 +- 4 files changed, 155 insertions(+), 14 deletions(-) diff --git a/configuration.nix b/configuration.nix index ff47366..d8f8fd1 100644 --- a/configuration.nix +++ b/configuration.nix @@ -96,17 +96,16 @@ environment.systemPackages = [ pkgs.wget pkgs.vim - + pkgs.arion - - # Do install the docker CLI to talk to podman. - # Not needed when virtualisation.docker.enable = true; + # Do install the docker CLI to talk to podman. + # Not needed when virtualisation.docker.enable = true; pkgs.docker-client ]; # List services that you want to enable: - networking.firewall.allowedTCPPorts = [ 80 443 22]; + networking.firewall.allowedTCPPorts = [ 80 443 22 ]; services.nginx = { enable = true; diff --git a/flake.lock b/flake.lock index 12a6fda..d3a4fbc 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,105 @@ { "nodes": { + "arion": { + "inputs": { + "flake-parts": "flake-parts", + "haskell-flake": "haskell-flake", + "hercules-ci-effects": "hercules-ci-effects", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1709606645, + "narHash": "sha256-yObjAl8deNvx1uIfQn7/vkB9Rnr0kqTo1HVrsk46l30=", + "owner": "hercules-ci", + "repo": "arion", + "rev": "d2d48c9ec304ac80c84ede138b8c6f298d07d995", + "type": "github" + }, + "original": { + "id": "arion", + "type": "indirect" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "arion", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "arion", + "hercules-ci-effects", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701473968, + "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "haskell-flake": { + "locked": { + "lastModified": 1675296942, + "narHash": "sha256-u1X1sblozi5qYEcLp1hxcyo8FfDHnRUVX3dJ/tW19jY=", + "owner": "srid", + "repo": "haskell-flake", + "rev": "c2cafce9d57bfca41794dc3b99c593155006c71e", + "type": "github" + }, + "original": { + "owner": "srid", + "ref": "0.1.0", + "repo": "haskell-flake", + "type": "github" + } + }, + "hercules-ci-effects": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": [ + "arion", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708547820, + "narHash": "sha256-xU/KC1PWqq5zL9dQ9wYhcdgxAwdeF/dJCLPH3PNZEBg=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "0ca27bd58e4d5be3135a4bef66b582e57abe8f4a", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -24,18 +124,34 @@ "locked": { "lastModified": 1709479366, "narHash": "sha256-n6F0n8UV6lnTZbYPl1A9q1BS0p4hduAv1mGAP17CVd0=", - "owner": "nixos", + "owner": "NixOS", "repo": "nixpkgs", "rev": "b8697e57f10292a6165a20f03d2f42920dfaf973", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, + "nixpkgs-23-11": { + "locked": { + "lastModified": 1709569716, + "narHash": "sha256-iOR44RU4jQ+YPGrn+uQeYAp7Xo7Z/+gT+wXJoGxxLTY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "617579a787259b9a6419492eaac670a5f7663917", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1709428628, @@ -53,6 +169,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1709479366, + "narHash": "sha256-n6F0n8UV6lnTZbYPl1A9q1BS0p4hduAv1mGAP17CVd0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "b8697e57f10292a6165a20f03d2f42920dfaf973", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1709356872, "narHash": "sha256-mvxCirJbtkP0cZ6ABdwcgTk0u3bgLoIoEFIoYBvD6+4=", @@ -70,14 +202,16 @@ }, "root": { "inputs": { + "arion": "arion", "home-manager": "home-manager", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", + "nixpkgs-23-11": "nixpkgs-23-11", "sops-nix": "sops-nix" } }, "sops-nix": { "inputs": { - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "nixpkgs-stable": "nixpkgs-stable" }, "locked": { diff --git a/flake.nix b/flake.nix index 9c7ddba..0ab0555 100644 --- a/flake.nix +++ b/flake.nix @@ -2,20 +2,27 @@ description = "NixOS configuration"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; sops-nix.url = "github:Mic92/sops-nix"; + nixpkgs-23-11.url = "github:nixos/nixpkgs/nixos-23.11"; }; - outputs = inputs@{ nixpkgs, home-manager, sops-nix, ... }: { + outputs = inputs@{ nixpkgs, nixpkgs-23-11, home-manager, sops-nix, arion, ... }: { nixosConfigurations = { rackserver = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ ./configuration.nix sops-nix.nixosModules.sops + + # https://github.com/hercules-ci/arion/issues/230 + ({pkgs, ...}: + { + nixpkgs.overlays = [ (final: prev: { arion = nixpkgs-23-11.legacyPackages.x86_64-linux.arion; }) ]; + }) + home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; diff --git a/users/arion-compose.nix b/users/arion-compose.nix index daca6bf..d1de8fd 100644 --- a/users/arion-compose.nix +++ b/users/arion-compose.nix @@ -3,13 +3,14 @@ project.name = "minecraft"; services = { mc = { - service.image = "itzg/minecraft-server"; + service.image = "itzg/minecraft-server:latest"; service.volumes = [ "${toString ./.}/data:/data" ]; - service.ports = [ "25564:25565" ]; + service.ports = [ "25565:25565" ]; service.environment = { EULA = "true"; MOD_PLATFORM = "AUTO_CURSEFORGE"; - CF_API_KEY = "$2a$10$BiefeMHCHbPFjXkIwpHk/.LvfbKaohRF7HcB3PF8oJtVAI/PfMpwe"; # free API key <3 + # https://stackoverflow.com/questions/49897503/ + CF_API_KEY = "$$2a$$10$$BiefeMHCHbPFjXkIwpHk/.LvfbKaohRF7HcB3PF8oJtVAI/PfMpwe"; # free API key <3 CF_FORCE_SYNCHRONIZE = "true"; CF_PAGE_URL = "https://www.curseforge.com/minecraft/modpacks/valhelsia-6/files/5135030"; MEMORY = "16G";