17fb9bbd77
I spent some time trying to get compilation on non-x86_64 systems possibly working, but we're currently limited by AppImage, which doesn't want to work properly.
97 lines
1.9 KiB
Nix
97 lines
1.9 KiB
Nix
{
|
|
|
|
pkgs,
|
|
garage,
|
|
selfRev,
|
|
hostSystem,
|
|
#buildSystem,
|
|
|
|
}: rec {
|
|
|
|
inherit garage;
|
|
|
|
version = pkgs.stdenv.mkDerivation {
|
|
name = "cryptic-net-version";
|
|
|
|
inherit selfRev hostSystem;
|
|
src = ./version.txt;
|
|
garageVersion = garage.version;
|
|
|
|
nativeBuildInputs = [ pkgs.go ];
|
|
|
|
builder = builtins.toFile "builder.sh" ''
|
|
source $stdenv/setup
|
|
|
|
versionFile=version
|
|
|
|
cat "$src" >> "$versionFile"
|
|
echo "" >> "$versionFile"
|
|
|
|
echo "System: $hostSystem" >> "$versionFile"
|
|
echo "Git Revision: $selfRev" >> "$versionFile"
|
|
echo "Go Version: $(go version)" >> "$versionFile"
|
|
echo "Garage Version: $garageVersion" >> "$versionFile"
|
|
|
|
mkdir -p "$out"/share
|
|
cp "$versionFile" "$out"/share
|
|
'';
|
|
};
|
|
|
|
entrypoint = pkgs.callPackage ./entrypoint {};
|
|
|
|
dnsmasq = (pkgs.callPackage ./nix/dnsmasq.nix {
|
|
stdenv = pkgs.pkgsStatic.stdenv;
|
|
});
|
|
|
|
nebula = pkgs.callPackage ./nix/nebula.nix {};
|
|
|
|
appDir = pkgs.buildEnv {
|
|
name = "cryptic-net-AppDir";
|
|
paths = [
|
|
|
|
./AppDir
|
|
version
|
|
dnsmasq
|
|
nebula
|
|
garage
|
|
entrypoint
|
|
|
|
];
|
|
};
|
|
|
|
appimagetool = pkgs.callPackage ./nix/appimagetool.nix {};
|
|
|
|
appImage = pkgs.stdenv.mkDerivation {
|
|
name = "cryptic-net-AppImage";
|
|
src = appDir;
|
|
|
|
nativeBuildInputs = [ appimagetool ];
|
|
|
|
ARCH = "x86_64";
|
|
|
|
builder = builtins.toFile "build.sh" ''
|
|
source $stdenv/setup
|
|
cp -rL "$src" cryptic-net
|
|
chmod +w cryptic-net -R
|
|
|
|
mkdir -p "$out/bin"
|
|
appimagetool cryptic-net "$out/bin/cryptic-net"
|
|
'';
|
|
};
|
|
|
|
release = pkgs.stdenv.mkDerivation {
|
|
name = "cryptic-net-release";
|
|
inherit appImage;
|
|
|
|
nativeBuildInputs = [ pkgs.coreutils ];
|
|
|
|
builder = builtins.toFile "build.sh" ''
|
|
source $stdenv/setup
|
|
|
|
mkdir -p "$out"
|
|
cp "$appImage" "$out"/cryptic-net
|
|
(cd "$out" && sha256sum * > sha256.txt)
|
|
'';
|
|
};
|
|
}
|