isle/release.nix

57 lines
1.2 KiB
Nix

{
releaseName ? "dev",
buildNumber ? "1",
buildSystem ? builtins.currentSystem,
pkgsNix ? (import ./nix/pkgs.nix),
supportedSystems ? pkgsNix.supportedSystems,
}: let
pkgs = pkgsNix.default { inherit buildSystem; };
mkRelease = hostSystem: let
build = ((import ./default.nix) {
inherit buildSystem hostSystem releaseName buildNumber;
}).build;
in pkgs.stdenv.mkDerivation {
name = "isle-release-${hostSystem}";
inherit releaseName buildNumber hostSystem;
appImage = build.appImage;
archPkg = build.archPkg;
debPkg = build.debPkg;
builder = builtins.toFile "build.sh" ''
source $stdenv/setup
mkdir -p "$out"/
cp "$appImage"/bin/isle "$out"/isle-$releaseName-$buildNumber-$hostSystem.AppImage
cp "$archPkg"/* "$out"/
cp "$debPkg"/* "$out"/
'';
};
releases = builtins.map mkRelease supportedSystems;
in
pkgs.stdenv.mkDerivation {
name = "isle-release-${releaseName}";
inherit releases;
nativeBuildInputs = [ pkgs.coreutils ];
builder = builtins.toFile "build.sh" ''
source $stdenv/setup
mkdir -p "$out"
for p in $releases; do
cp "$p"/* "$out"/
done
(cd "$out" && sha256sum * > sha256.txt)
'';
}