2024-12-20 11:49:01 +00:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
hostSystem,
|
|
|
|
releaseName,
|
2024-12-20 12:34:45 +00:00
|
|
|
buildNumber ? "1",
|
2024-12-20 11:49:01 +00:00
|
|
|
appDir,
|
|
|
|
}: let
|
|
|
|
|
|
|
|
debArch = builtins.getAttr hostSystem {
|
|
|
|
"x86_64-linux" = "amd64";
|
|
|
|
"aarch64-linux" = "arm64";
|
|
|
|
"armv6l-linux" = "armhf";
|
|
|
|
"i686-linux" = "i386";
|
|
|
|
};
|
|
|
|
|
|
|
|
control = pkgs.writeTextDir "DEBIAN/control" ''
|
|
|
|
Package: isle
|
2024-12-20 12:34:45 +00:00
|
|
|
Version: ${releaseName}-${buildNumber}
|
2024-12-20 11:49:01 +00:00
|
|
|
Section: net
|
|
|
|
Priority: optional
|
|
|
|
Architecture: ${debArch}
|
|
|
|
Maintainer: Brian Picciano <me@mediocregopher.com>
|
|
|
|
Description: The foundation for an autonomous community cloud infrastructure
|
|
|
|
Homepage: https://code.betamike.com/micropelago/isle
|
|
|
|
'';
|
|
|
|
|
|
|
|
postinst = pkgs.writeTextDir "DEBIAN/postinst" ''
|
|
|
|
#!/bin/sh
|
|
|
|
systemctl daemon-reload
|
|
|
|
systemd-sysusers /usr/lib/sysusers.d/isle.conf
|
|
|
|
'';
|
|
|
|
|
|
|
|
postrm = pkgs.writeTextDir "DEBIAN/postrm" ''
|
|
|
|
#!/bin/sh
|
|
|
|
systemctl daemon-reload
|
|
|
|
'';
|
|
|
|
|
|
|
|
linuxRoot = (import ../default.nix).buildRoot {
|
|
|
|
inherit pkgs appDir;
|
|
|
|
};
|
|
|
|
|
|
|
|
root = pkgs.buildEnv {
|
|
|
|
name = "isle-deb-pkg-root";
|
|
|
|
paths = [
|
|
|
|
linuxRoot
|
|
|
|
control
|
|
|
|
postinst
|
|
|
|
postrm
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
in pkgs.stdenv.mkDerivation {
|
2024-12-20 12:34:45 +00:00
|
|
|
name = "isle-deb-pkg";
|
2024-12-20 11:49:01 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkgs.zstd
|
|
|
|
pkgs.dpkg
|
|
|
|
];
|
|
|
|
src = root;
|
|
|
|
buildPhase = ''
|
|
|
|
cp -rL "$src" root
|
|
|
|
chmod +w -R root
|
|
|
|
chmod +x root/DEBIAN/post*
|
|
|
|
|
|
|
|
dpkg-deb \
|
|
|
|
--root-owner-group \
|
|
|
|
-Z zstd \
|
2024-12-20 12:34:45 +00:00
|
|
|
-b root isle_${releaseName}-${buildNumber}_${debArch}.deb
|
2024-12-20 11:49:01 +00:00
|
|
|
'';
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out"
|
|
|
|
cp *.deb "$out"
|
|
|
|
'';
|
|
|
|
}
|