aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--flake.lock61
-rw-r--r--flake.nix51
3 files changed, 114 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index bcab3df..b04597a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,5 @@ project/edit-list/
project/Makefile.setup
project/Makefile.local
project/Makefile.user
+result
+result/
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..2d3322f
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,61 @@
+{
+ "nodes": {
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1731533236,
+ "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1782467914,
+ "narHash": "sha256-pGvFkM8N0xEkIIXDe5YYfbEAvHrk4IxBrjB/x8OomhE=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "e73de5be04e0eff4190a1432b946d469c794e7b4",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..ddaaef2
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,51 @@
+{
+ description = "Wiimms SZS Tools - command line tools for Mario Kart Wii files";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
+ };
+
+ outputs = { self, nixpkgs, flake-utils }:
+ flake-utils.lib.eachDefaultSystem (system:
+ let
+ pkgs = import nixpkgs { inherit system; };
+ version = "2.42a";
+ in {
+ packages = {
+ wiimms-szs-tools = pkgs.stdenv.mkDerivation {
+ pname = "wiimms-szs-tools";
+ inherit version;
+
+ src = ./.;
+
+ buildInputs = with pkgs; [ ncurses libpng zlib ];
+
+ postPatch = ''
+ # Fix shebangs: /usr/bin/env doesn't exist in Nix sandbox
+ sed -i '1s|#!/usr/bin/env bash|#!${pkgs.bash}/bin/bash|' \
+ project/gen-template.sh project/gen-text-file.sh
+ '';
+
+ buildPhase = ''
+ make -C project SHELL=bash NOWIIMM=1
+ '';
+
+ installPhase = ''
+ for tool in wszst wbmgt wctct wimgt wkclt wkmpt wlect wmdlt wpatt wstrt; do
+ install -Dm755 "project/$tool" "$out/bin/$tool"
+ done
+ '';
+
+ meta = with pkgs.lib; {
+ description = "Command-line tools to extract, modify and create Mario Kart Wii files";
+ homepage = "https://szs.wiimm.de/";
+ license = licenses.gpl2Plus;
+ maintainers = [ ];
+ platforms = platforms.linux;
+ };
+ };
+ default = self.packages.${system}.wiimms-szs-tools;
+ };
+ });
+}