diff --git a/.gitignore b/.gitignore index a6554cf..b2be92b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ result -example/ diff --git a/build-and-upload.sh b/build-and-upload.sh deleted file mode 100755 index 3bb9563..0000000 --- a/build-and-upload.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set euo pipefail - - -nix build .#images.default -podman load -i ./result - -podman push localhost/docker-vintagestory-server:1.18.15 forgejo.obyoxion.at/nionidh/docker-vintagestory-server:1.18.15 - -# podman image rm localhost/docker-vintagestory-server:latest diff --git a/flake.nix b/flake.nix index bee95e3..c30c5f9 100644 --- a/flake.nix +++ b/flake.nix @@ -22,13 +22,28 @@ hash = "sha256-nWzx44EVkEqWZw42Yi4NLa0b9lJ4HVIIqEvqEcjW+Q4="; stripRoot = false; }; + #src = fetchurl { + # url = "https://cdn.vintagestory.at/gamefiles/stable/vs_server_linux-x64_${version}.tar.gz"; + # hash = "sha256-gPe5ZQn7MrK07R1nT6UK1D9YMUbVTUltzkOycvJFZ3o="; + # stripRoot = false; + #}; nativeBuildInputs = [pkgs.makeWrapper]; buildInputs = [pkgs.dotnet-runtime_7]; runtimeLibs = pkgs.lib.makeLibraryPath (with pkgs; [ + gtk2 sqlite + openal + cairo + libGLU + SDL2 + freealut + libglvnd + pipewire + libpulseaudio + dotnet-runtime_7 ]); installPhase = '' @@ -55,26 +70,29 @@ done ''; }; - - home = pkgs.stdenv.mkDerivation { - name = "vintagestory-server-home-directories"; - dontUnpack = true; - installPhase = '' - mkdir -p $out/home/dotnet - mkdir -p $out/game - mkdir -p $out/tmp - ''; - }; in { packages.x86_64-linux.default = server; images = { - default = pkgs.dockerTools.buildLayeredImage { - name = "docker-vintagestory-server"; - tag = "1.18.15"; + default = pkgs.dockerTools.buildImage { + name = "vintage-server"; architecture = "amd64"; - contents = - [home server pkgs.bash pkgs.coreutils] + copyToRoot = + [ + (pkgs.buildEnv + { + name = "image-root"; + paths = [ + pkgs.hello + pkgs.coreutils + pkgs.strace + pkgs.bash + pkgs.dotnet-sdk_7 + server + ]; + pathsToLink = ["/bin"]; + }) + ] ++ (with pkgs.dockerTools; [ usrBinEnv binSh @@ -82,9 +100,14 @@ fakeNss ]); + runAsRoot = '' + mkdir -p /home/dotnet + mkdir -p /game + ''; + config = { - Env = ["HOME=/home/dotnet"]; - Cmd = ["vintagestory-server" "--dataPath" "/game"]; + Env = ["HOME=/home/dotnet" "VS_DATA_PATH=/game"]; + Cmd = ["/bin/bash"]; }; }; };