{ pkgs, hostSystem, releaseName, buildNumber ? "1", 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 Version: ${releaseName}-${buildNumber} Section: net Priority: optional Architecture: ${debArch} Maintainer: Brian Picciano 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 { name = "isle-deb-pkg"; 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 \ -b root isle_${releaseName}-${buildNumber}_${debArch}.deb ''; installPhase = '' mkdir -p "$out" cp *.deb "$out" ''; }