diff --git a/.gitignore b/.gitignore index b2be92b..a6554cf 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ result +example/ diff --git a/build-and-upload.sh b/build-and-upload.sh new file mode 100755 index 0000000..3bb9563 --- /dev/null +++ b/build-and-upload.sh @@ -0,0 +1,11 @@ +#!/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 c30c5f9..bee95e3 100644 --- a/flake.nix +++ b/flake.nix @@ -22,28 +22,13 @@ 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 = '' @@ -70,29 +55,26 @@ 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.buildImage { - name = "vintage-server"; + default = pkgs.dockerTools.buildLayeredImage { + name = "docker-vintagestory-server"; + tag = "1.18.15"; architecture = "amd64"; - copyToRoot = - [ - (pkgs.buildEnv - { - name = "image-root"; - paths = [ - pkgs.hello - pkgs.coreutils - pkgs.strace - pkgs.bash - pkgs.dotnet-sdk_7 - server - ]; - pathsToLink = ["/bin"]; - }) - ] + contents = + [home server pkgs.bash pkgs.coreutils] ++ (with pkgs.dockerTools; [ usrBinEnv binSh @@ -100,14 +82,9 @@ fakeNss ]); - runAsRoot = '' - mkdir -p /home/dotnet - mkdir -p /game - ''; - config = { - Env = ["HOME=/home/dotnet" "VS_DATA_PATH=/game"]; - Cmd = ["/bin/bash"]; + Env = ["HOME=/home/dotnet"]; + Cmd = ["vintagestory-server" "--dataPath" "/game"]; }; }; };