From 87fa440498bb75d554cfc2773d2f64b59b875910 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sun, 16 Jun 2024 23:25:23 +0200 Subject: [PATCH] WIP --- default.nix | 5 +-- dist/linux/arch/default.nix | 86 +++++++++++++++++++++++++++++++++++++ release.nix | 12 ++++-- 3 files changed, 96 insertions(+), 7 deletions(-) create mode 100644 dist/linux/arch/default.nix diff --git a/default.nix b/default.nix index c595ae9..80afece 100644 --- a/default.nix +++ b/default.nix @@ -157,10 +157,7 @@ in rec { unset SOURCE_DATE_EPOCH appimagetool ./isle.AppDir - - mkdir -p "$out"/bin - chmod +w "$out" -R - mv Isle-* "$out"/bin/isle + mv Isle-* "$out" ''; }; diff --git a/dist/linux/arch/default.nix b/dist/linux/arch/default.nix new file mode 100644 index 0000000..99d41d2 --- /dev/null +++ b/dist/linux/arch/default.nix @@ -0,0 +1,86 @@ +{ + pkgs, + buildSystem, + releaseName, + appImage, +}: let + + cpuArch = (pkgs.lib.systems.parse.mkSystemFromString buildSystem).cpu.name; + + pkgbuild = pkgs.writeText "isle-arch-PKGBUILD-${releaseName}-${cpuArch}" '' + pkgname=isle + pkgver=${releaseName} + pkgrel=0 + pkgdesc="The foundation for an autonomous community cloud infrastructure." + arch=('${cpuArch}') + url="https://code.betamike.com/micropelago/isle" + license=('AGPL-3.0-or-later') + + depends=( + 'fuse2' + ) + + # The appImage is deliberately kept separate from the src.tar.zst. For some + # reason including the appImage within the archive results in a large part + # of the binary being stripped away and some weird skeleton appImage comes + # out the other end. + source=('isle' 'src.tar.zst') + md5sums=('SKIP' 'SKIP') + noextract=('isle') + + package() { + cp -r etc "$pkgdir"/etc + cp -r usr "$pkgdir"/usr + + mkdir -p "$pkgdir"/usr/bin/ + cp isle "$pkgdir"/usr/bin/ + } + ''; + +in + pkgs.stdenv.mkDerivation { + name = "isle-arch-pkg-${releaseName}-${cpuArch}"; + + nativeBuildInputs = [ + pkgs.zstd + pkgs.pacman + pkgs.fakeroot + pkgs.libarchive + ]; + + inherit pkgbuild; + src = appImage; + appDir = ../../../AppDir; + dontUnpack = true; + + buildPhase = '' + mkdir -p root/etc/isle/ + cp "$appDir"/etc/daemon.yml root/etc/isle/daemon.yml + + mkdir -p root/usr/lib/sysusers.d/ + cat >root/usr/lib/sysusers.d/isle.conf < sha256.txt)