Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit9bcd2512e7715ed5e552a978deed7ef44bd9b161 (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-12-21 18:03:10 +0200
Committer
 Syndamia <kamen@syndamia.com>
2025-12-21 18:03:10 +0200
Files289f63b6fd535b70d1580b10ad3764b0e816e390
nix-9bcd2512e7715ed5e552a978deed7ef44bd9b161.tar
nix-9bcd2512e7715ed5e552a978deed7ef44bd9b161.tar.gz
nix-9bcd2512e7715ed5e552a978deed7ef44bd9b161.zip
Parent7d208459d48f98e6cfc2b309ebb540e95a9ffef4 (diff)
feat(packages): Add inferno64 package
1 files changed, 91 insertions, 0 deletions
-rw-r--r--packages/inferno64/default.nix91
diff --git a/packages/inferno64/default.nix b/packages/inferno64/default.nix
new file mode 100644
index 0000000..7e2502a
--- /dev/null
+++ b/packages/inferno64/default.nix
@@ -0,0 +1,91 @@
+{
+ lib,
+ stdenv,
+ fetchFromGitHub,
+ xorg,
+ ...
+}:
+# TODO: non-Linux OS setup
+# TODO: insert meta
+stdenv.mkDerivation rec {
+ pname = "inferno64";
+ version = "2025-12-21";
+
+ src = fetchFromGitHub {
+ owner = "caerwynj";
+ repo = pname;
+ rev = "ba4ba275cf9da4d2a6daec2a40ca7ac96fa480db";
+ hash = "sha256-BvtQz/H/jhjqgyrJsw/hujfBZx7F5lEFC0VqvE4TdAE=";
+ };
+
+ buildInputs = [
+ xorg.libX11
+ xorg.libXext
+ ];
+
+ postPatch = ''
+ sed -i '/types.h/a #include <sys/stat.h>' ./lib9/create.c
+ sed -i '19a\
+ -fpermissive\\' ./mkfiles/mkfile-Linux-amd64
+ '';
+
+ configurePhase = ''
+ runHook preConfigure
+
+ export ROOT="$PWD"
+ export objtype='amd64'
+ export PATH="$PATH:$PWD/Linux/$objtype/bin"
+
+ ./makemk.sh
+ mk mkdirs
+
+ runHook postConfigure
+ '';
+
+ buildPhase = ''
+ runHook preBuild
+
+ mk install
+
+ runHook postBuild
+ '';
+
+ installPhase = lib.warn ''
+ All Inferno files are stored under a directory on your filesystem.
+ Nix outputs (under /nix/store) are read-only.
+ To initialize a directory for the Inferno FS, run the "inferno_init" script.
+ '' ''
+ runHook preInstall
+
+ mkdir -p "$out/usr/inferno"
+ cp -r . "$out/usr/inferno"
+ ln -s "$out/usr/inferno/Linux/amd64/bin" "$out/bin"
+
+ cat <<SH >"$out/bin/inferno_init"
+ #!${stdenv.builder}
+
+ [ -z "\$1" ] && set '/usr/inferno'
+ [ ! -d "\$1" ] && echo "'\$1' doesn't exist or not a directory!" && exit 1
+
+ cp -sr "$out/usr/inferno"/* "\$1" || exit $?
+ find "\$1" -type d -not -path "\$1" -exec chmod +w {} +
+
+ echo "'\$1' initialised for Inferno!"
+
+ echo "You're probably planning on using the emulator, just issue:"
+ if [ "\$1" != '/usr/inferno' ]
+ then
+ echo "emu -r '\$1'"
+ else
+ echo 'emu'
+ fi
+ SH
+ chmod +x "$out/bin/inferno_init"
+
+ runHook postInstall
+ '';
+
+ # All (most?) resultant scripts are ran with /dis/sh,
+ # not with /nix/store/...-bash-...
+ dontFixup = true;
+}