This commit is contained in:
Brian Picciano 2024-06-16 23:25:23 +02:00
parent c645a8c767
commit 87fa440498
3 changed files with 96 additions and 7 deletions

View File

@ -157,10 +157,7 @@ in rec {
unset SOURCE_DATE_EPOCH unset SOURCE_DATE_EPOCH
appimagetool ./isle.AppDir appimagetool ./isle.AppDir
mv Isle-* "$out"
mkdir -p "$out"/bin
chmod +w "$out" -R
mv Isle-* "$out"/bin/isle
''; '';
}; };

86
dist/linux/arch/default.nix vendored Normal file
View File

@ -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 <<EOF
u isle - "isle Daemon"
EOF
cp $pkgbuild PKGBUILD
tar -cf src.tar.zst --zstd --mode=a+rX,u+w -C root .
cp "$src" isle
PKGEXT=".pkg.tar.zst" makepkg \
--nodeps \
--config ${pkgs.pacman}/etc/makepkg.conf
'';
installPhase = ''
mkdir -p $out
cp *.pkg.tar.zst $out/
'';
checkPhase = ''
namcap *.pkg.tar.zst
'';
# NOTE if https://github.com/NixOS/nixpkgs/issues/241911 is ever addressed
# it'd be nice to add an automatic check here.
}

View File

@ -16,15 +16,21 @@
inherit buildSystem hostSystem releaseName revision; inherit buildSystem hostSystem releaseName revision;
}).appImage; }).appImage;
archPkg = ((import ./dist/linux/arch) {
inherit pkgs buildSystem releaseName appImage;
});
in pkgs.stdenv.mkDerivation { in pkgs.stdenv.mkDerivation {
name = "isle-release-${hostSystem}"; name = "isle-release-${hostSystem}";
inherit releaseName appImage hostSystem; inherit releaseName hostSystem;
inherit appImage archPkg;
builder = builtins.toFile "build.sh" '' builder = builtins.toFile "build.sh" ''
source $stdenv/setup source $stdenv/setup
mkdir -p "$out"/ mkdir -p "$out"/
cp "$appImage"/bin/isle "$out"/isle-$releaseName-$hostSystem cp "$appImage" "$out"/isle-$releaseName-$hostSystem.AppImage
cp "$archPkg"/*.tar.zst "$out"/isle-$releaseName-$hostSystem.pkg.tar.zst
''; '';
}; };
@ -43,7 +49,7 @@ in
mkdir -p "$out" mkdir -p "$out"
for p in $releases; do for p in $releases; do
cp "$p"/isle-* "$out"/ cp "$p"/* "$out"/
done done
(cd "$out" && sha256sum * > sha256.txt) (cd "$out" && sha256sum * > sha256.txt)