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