isle/dist/linux/arch/default.nix

65 lines
1.4 KiB
Nix
Raw Normal View History

{
pkgs,
2024-07-14 13:26:34 +00:00
hostSystem,
releaseName,
buildNumber ? "1",
appDir,
}: let
2024-07-14 13:26:34 +00:00
cpuArch = (pkgs.lib.systems.parse.mkSystemFromString hostSystem).cpu.name;
pkgbuild = pkgs.writeText "isle-arch-PKGBUILD-${releaseName}-${cpuArch}" ''
pkgname=isle
2024-07-14 11:56:43 +00:00
pkgver=${builtins.replaceStrings ["-"] ["_"] releaseName}
pkgrel=${buildNumber}
2024-12-20 11:49:01 +00:00
pkgdesc="The foundation for an autonomous community cloud infrastructure"
arch=('${cpuArch}')
url="https://code.betamike.com/micropelago/isle"
license=('AGPL-3.0-or-later')
source=('src.tar.zst')
md5sums=('SKIP')
package() {
cp -r etc "$pkgdir"/etc
cp -r usr "$pkgdir"/usr
}
'';
2024-12-20 11:49:01 +00:00
linuxRoot = (import ../default.nix).buildRoot {
inherit pkgs appDir;
};
in
pkgs.stdenv.mkDerivation {
name = "isle-arch-pkg-${releaseName}-${cpuArch}";
nativeBuildInputs = [
pkgs.zstd
pkgs.pacman
pkgs.fakeroot
pkgs.libarchive
];
inherit pkgbuild;
2024-12-20 11:49:01 +00:00
src = linuxRoot;
dontUnpack = true;
buildPhase = ''
2024-12-20 11:49:01 +00:00
tar -cf src.tar.zst --zstd --mode=a+rX,u+w -C "$src" .
cp $pkgbuild PKGBUILD
2024-07-14 13:26:34 +00:00
PKGEXT=".pkg.tar.zst" CARCH="${cpuArch}" makepkg \
--nodeps \
--config ${pkgs.pacman}/etc/makepkg.conf
'';
installPhase = ''
mkdir -p $out
cp *.pkg.tar.zst $out/
'';
# NOTE if https://github.com/NixOS/nixpkgs/issues/241911 is ever addressed
# it'd be nice to add an automatic check using namcap here.
}