commit 4d2313c50933645040a0d12556016fc2916bfa65 Author: Wyatt J. Miller Date: Sun Jan 25 22:13:19 2026 -0500 initial commit diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..8392d15 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4a847d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/result diff --git a/README.md b/README.md new file mode 100644 index 0000000..d33ab09 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# Vintage Story + +Vintage Story as a Nix flake (with my own customizations) + +This will build the Vintage Story client and server software. + +To build the flake, run the following + +```bash +nix build +``` + +This will only ever build for x86_64 Linux. diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e0c4e00 --- /dev/null +++ b/flake.lock @@ -0,0 +1,40 @@ +{ + "nodes": { + "flake-schemas": { + "locked": { + "lastModified": 1761577921, + "narHash": "sha256-eK3/xbUOrxp9fFlei09XNjqcdiHXxndzrTXp7jFpOk8=", + "rev": "47849c7625e223d36766968cc6dc23ba0e135922", + "revCount": 107, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.2.0/019a4a84-544d-7c59-b26d-e334e320c932/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1769089682, + "narHash": "sha256-9yA/LIuAVQq0lXelrZPjLuLVuZdm03p8tfmHhnDIkms=", + "rev": "078d69f03934859a181e81ba987c2bb033eebfc5", + "revCount": 906333, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2511.906333%2Brev-078d69f03934859a181e81ba987c2bb033eebfc5/019bebf2-031c-7119-8fdc-ce9d29d005fa/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/%2A" + } + }, + "root": { + "inputs": { + "flake-schemas": "flake-schemas", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4b48d7d --- /dev/null +++ b/flake.nix @@ -0,0 +1,131 @@ +# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.26) +{ + description = "Vintage Story flake"; + + inputs = { + flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*"; + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*"; + }; + + outputs = { self, flake-schemas, nixpkgs }: + let + supportedSystems = [ "x86_64-linux" ]; + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in { + schemas = flake-schemas.schemas; + + devShells = forEachSupportedSystem ({ pkgs }: { + default = pkgs.mkShell { + packages = with pkgs; [ + curl + git + nixpkgs-fmt + ]; + }; + }); + + packages = forEachSupportedSystem ({ pkgs }: + let + x11Support = true; + waylandSupport = true; + in { + default = pkgs.stdenv.mkDerivation (finalAttrs: + let + inherit (pkgs) lib; + in { + pname = "vintagestory"; + version = "1.21.6"; + + src = pkgs.fetchurl { + url = "https://cdn.vintagestory.at/gamefiles/stable/vs_client_linux-x64_${finalAttrs.version}.tar.gz"; + hash = "sha256-LkiL/8W9MKpmJxtK+s5JvqhOza0BLap1SsaDvbLYR0c="; + }; + + nativeBuildInputs = with pkgs; [ + makeWrapper + copyDesktopItems + ]; + + runtimeLibs = with pkgs; [ + gtk2 + sqlite + openal + cairo + libGLU + SDL2 + freealut + libglvnd + pipewire + libpulseaudio + ] + ++ lib.optionals x11Support (with pkgs.xorg; [ + libX11 + libXi + libXcursor + ]) + ++ lib.optionals waylandSupport (with pkgs; [ + wayland + libxkbcommon + ]); + + desktopItems = [ + (pkgs.makeDesktopItem { + name = "vintagestory"; + desktopName = "Vintage Story"; + exec = "vintagestory"; + icon = "vintagestory"; + comment = "Innovate and explore in a sandbox world"; + categories = [ "Game" ]; + }) + + (pkgs.makeDesktopItem { + name = "vsmodinstall-handler"; + desktopName = "Vintage Story 1-click Mod Install Handler"; + comment = "Handler for vintagestorymodinstall:// URI scheme"; + exec = "vintagestory -i %u"; + mimeTypes = [ "x-scheme-handler/vintagestorymodinstall" ]; + noDisplay = true; + terminal = false; + }) + ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/share/vintagestory $out/bin $out/share/pixmaps $out/share/fonts/truetype + cp -r * $out/share/vintagestory + cp $out/share/vintagestory/assets/gameicon.xpm $out/share/pixmaps/vintagestory.xpm + cp $out/share/vintagestory/assets/game/fonts/*.ttf $out/share/fonts/truetype + + runHook postInstall + ''; + + preFixup = + let + runtimeLibs' = lib.strings.makeLibraryPath finalAttrs.runtimeLibs; + in + '' + makeWrapper ${lib.meta.getExe pkgs.dotnet-runtime_8} $out/bin/vintagestory \ + --prefix LD_LIBRARY_PATH : "${runtimeLibs'}" \ + --set-default mesa_glthread true \ + ${lib.strings.optionalString waylandSupport '' + --set-default OPENTK_4_USE_WAYLAND 1 \ + ''} \ + --add-flags $out/share/vintagestory/Vintagestory.dll + + makeWrapper ${lib.meta.getExe pkgs.dotnet-runtime_8} $out/bin/vintagestory-server \ + --prefix LD_LIBRARY_PATH : "${runtimeLibs'}" \ + --set-default mesa_glthread true \ + --add-flags $out/share/vintagestory/VintagestoryServer.dll + + find "$out/share/vintagestory/assets/" -not -path "*/fonts/*" -regex ".*/.*[A-Z].*" | while read -r file; do + local filename="$(basename -- "$file")" + ln -sf "$filename" "''${file%/*}"/"''${filename,,}" + done + ''; + }); + }); + }; +}