Add release target in nix
This commit is contained in:
parent
03ab15902c
commit
0a6516b44e
30
default.nix
30
default.nix
@ -2,6 +2,7 @@
|
||||
|
||||
pkgsAttrs ? (import ./nix/pkgs.nix),
|
||||
bootstrap ? null,
|
||||
releaseName ? "debug",
|
||||
|
||||
}: let
|
||||
|
||||
@ -27,7 +28,7 @@ in rec {
|
||||
buildInputs = [ pkgs.git pkgs.go ];
|
||||
|
||||
src = ./.;
|
||||
inherit bootstrap;
|
||||
inherit bootstrap releaseName;
|
||||
nixPkgsVersion = pkgsAttrs.version;
|
||||
nixPkgsRev = pkgsAttrs.rev;
|
||||
builtByUser = builtins.getEnv "USER";
|
||||
@ -44,6 +45,7 @@ in rec {
|
||||
echo "Built for host: $hostName" >> "$versionFile"
|
||||
fi
|
||||
|
||||
echo "Release: $releaseName" >> "$versionFile"
|
||||
echo "Build date: $(date) ($(date +%s))" >> "$versionFile"
|
||||
echo "Built by: $builtByUser" >> "$versionFile"
|
||||
echo "Git rev: $(cd srcCp && git describe --always --long --dirty=' (dirty)')" >> "$versionFile"
|
||||
@ -95,24 +97,22 @@ in rec {
|
||||
source $stdenv/setup
|
||||
cp -rL "$src" cryptic-net
|
||||
chmod +w cryptic-net -R
|
||||
mkdir $out
|
||||
appimagetool cryptic-net "$out/cryptic-net"
|
||||
appimagetool cryptic-net "$out"
|
||||
'';
|
||||
};
|
||||
|
||||
service = pkgs.writeText "cryptic-service" ''
|
||||
[Unit]
|
||||
Description=cryptic nebula
|
||||
Requires=network.target
|
||||
After=network.target
|
||||
release = pkgs.stdenv.mkDerivation {
|
||||
name = "cryptic-net-AppImage";
|
||||
inherit appImage releaseName;
|
||||
|
||||
[Service]
|
||||
Restart=always
|
||||
RestartSec=1s
|
||||
User=root
|
||||
ExecStart=${appImage}/cryptic-net
|
||||
buildInputs = [ pkgs.coreutils ];
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
builder = builtins.toFile "build.sh" ''
|
||||
source $stdenv/setup
|
||||
|
||||
mkdir -p "$out"
|
||||
cp "$appImage" "$out"/cryptic-net-$releaseName-linux-amd64
|
||||
(cd "$out" && sha256sum * > sha256.txt)
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user