2021-04-20 21:31:37 +00:00
|
|
|
{
|
|
|
|
|
2023-01-29 18:01:58 +00:00
|
|
|
# TODO make this usable again! Add sane defaults for inputs, and allow for
|
|
|
|
# injecting a bootstrap file.
|
|
|
|
|
2023-01-25 17:50:36 +00:00
|
|
|
pkgs,
|
|
|
|
garage,
|
|
|
|
selfRev,
|
|
|
|
hostSystem,
|
2021-04-20 21:31:37 +00:00
|
|
|
|
2023-01-25 17:50:36 +00:00
|
|
|
}: rec {
|
2022-10-20 20:30:30 +00:00
|
|
|
|
2023-01-25 17:50:36 +00:00
|
|
|
inherit garage;
|
2021-04-20 21:31:37 +00:00
|
|
|
|
|
|
|
version = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "cryptic-net-version";
|
|
|
|
|
2023-01-25 17:50:36 +00:00
|
|
|
inherit selfRev hostSystem;
|
|
|
|
src = ./version.txt;
|
2023-01-29 17:57:55 +00:00
|
|
|
|
2023-01-25 17:50:36 +00:00
|
|
|
garageVersion = garage.version;
|
2022-10-20 20:30:30 +00:00
|
|
|
|
2023-01-29 17:57:55 +00:00
|
|
|
# TODO it'd be nice to be able to call `go version`, but that doesn't work
|
|
|
|
# when crossSystem is being used for some unknown reason.
|
|
|
|
goVersion = pkgs.go.version;
|
2021-04-20 21:31:37 +00:00
|
|
|
|
|
|
|
builder = builtins.toFile "builder.sh" ''
|
|
|
|
source $stdenv/setup
|
|
|
|
|
|
|
|
versionFile=version
|
|
|
|
|
2023-01-25 17:50:36 +00:00
|
|
|
cat "$src" >> "$versionFile"
|
|
|
|
echo "" >> "$versionFile"
|
2022-10-20 20:30:30 +00:00
|
|
|
|
2023-01-25 17:50:36 +00:00
|
|
|
echo "System: $hostSystem" >> "$versionFile"
|
|
|
|
echo "Git Revision: $selfRev" >> "$versionFile"
|
2023-01-29 17:57:55 +00:00
|
|
|
echo "Go Version: $goVersion" >> "$versionFile"
|
2023-01-25 17:50:36 +00:00
|
|
|
echo "Garage Version: $garageVersion" >> "$versionFile"
|
2021-04-20 21:31:37 +00:00
|
|
|
|
|
|
|
mkdir -p "$out"/share
|
|
|
|
cp "$versionFile" "$out"/share
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-10-20 20:06:22 +00:00
|
|
|
entrypoint = pkgs.callPackage ./entrypoint {};
|
2021-04-20 21:31:37 +00:00
|
|
|
|
2022-10-26 20:18:16 +00:00
|
|
|
dnsmasq = (pkgs.callPackage ./nix/dnsmasq.nix {
|
2023-01-25 17:50:36 +00:00
|
|
|
stdenv = pkgs.pkgsStatic.stdenv;
|
2022-10-26 20:18:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
nebula = pkgs.callPackage ./nix/nebula.nix {};
|
2021-04-20 21:31:37 +00:00
|
|
|
|
|
|
|
appDir = pkgs.buildEnv {
|
|
|
|
name = "cryptic-net-AppDir";
|
|
|
|
paths = [
|
|
|
|
|
|
|
|
./AppDir
|
|
|
|
version
|
|
|
|
dnsmasq
|
2022-10-26 20:18:16 +00:00
|
|
|
nebula
|
2021-04-20 21:31:37 +00:00
|
|
|
garage
|
2022-10-20 20:06:22 +00:00
|
|
|
entrypoint
|
2021-04-20 21:31:37 +00:00
|
|
|
|
2023-01-25 17:50:36 +00:00
|
|
|
];
|
2021-04-20 21:31:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
appimagetool = pkgs.callPackage ./nix/appimagetool.nix {};
|
|
|
|
|
|
|
|
appImage = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "cryptic-net-AppImage";
|
|
|
|
src = appDir;
|
|
|
|
|
2023-01-28 21:57:06 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
appimagetool
|
|
|
|
];
|
2021-04-20 21:31:37 +00:00
|
|
|
|
|
|
|
ARCH = "x86_64";
|
|
|
|
|
|
|
|
builder = builtins.toFile "build.sh" ''
|
|
|
|
source $stdenv/setup
|
2023-01-28 21:57:06 +00:00
|
|
|
cp -rL "$src" cryptic-net.AppDir
|
|
|
|
chmod +w cryptic-net.AppDir -R
|
|
|
|
|
|
|
|
export VERSION=debug
|
|
|
|
|
|
|
|
# https://github.com/probonopd/go-appimage/issues/155
|
|
|
|
unset SOURCE_DATE_EPOCH
|
2023-01-29 14:31:11 +00:00
|
|
|
|
2023-01-28 21:57:06 +00:00
|
|
|
appimagetool ./cryptic-net.AppDir
|
2023-01-25 17:50:36 +00:00
|
|
|
|
2023-01-28 21:57:06 +00:00
|
|
|
mkdir -p "$out"/bin
|
|
|
|
chmod +w "$out" -R
|
|
|
|
mv Cryptic_Net-* "$out"/bin/cryptic-net
|
2021-04-20 21:31:37 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-11-16 16:43:41 +00:00
|
|
|
release = pkgs.stdenv.mkDerivation {
|
2023-01-25 17:50:36 +00:00
|
|
|
name = "cryptic-net-release";
|
|
|
|
inherit appImage;
|
2022-11-16 16:43:41 +00:00
|
|
|
|
2023-01-25 17:50:36 +00:00
|
|
|
nativeBuildInputs = [ pkgs.coreutils ];
|
2022-11-16 16:43:41 +00:00
|
|
|
|
|
|
|
builder = builtins.toFile "build.sh" ''
|
|
|
|
source $stdenv/setup
|
|
|
|
|
|
|
|
mkdir -p "$out"
|
2023-01-25 17:50:36 +00:00
|
|
|
cp "$appImage" "$out"/cryptic-net
|
2022-11-16 16:43:41 +00:00
|
|
|
(cd "$out" && sha256sum * > sha256.txt)
|
|
|
|
'';
|
|
|
|
};
|
2021-04-20 21:31:37 +00:00
|
|
|
}
|