generate tarball.nix with a script
Signed-off-by: Xe <me@christine.website>
This commit is contained in:
parent
dd50643eaf
commit
e1f9bbb8f2
12
flake.nix
12
flake.nix
|
@ -25,25 +25,21 @@
|
||||||
};
|
};
|
||||||
version = builtins.substring 0 8 self.lastModifiedDate;
|
version = builtins.substring 0 8 self.lastModifiedDate;
|
||||||
in {
|
in {
|
||||||
packages = rec {
|
packages = let tsmeta = import ./tarball.nix; in rec {
|
||||||
imagebuilder = pkgs.buildGoModule {
|
imagebuilder = pkgs.buildGoModule {
|
||||||
pname = "taildeck-imagebuilder";
|
pname = "taildeck-imagebuilder";
|
||||||
inherit version;
|
inherit (tsmeta) version;
|
||||||
src = ./.;
|
src = ./.;
|
||||||
|
|
||||||
vendorSha256 =
|
vendorSha256 =
|
||||||
"sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo=";
|
"sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo=";
|
||||||
};
|
};
|
||||||
|
|
||||||
tsTarball = builtins.fetchurl {
|
tsTarball = tsmeta.tarball;
|
||||||
url =
|
|
||||||
"https://pkgs.tailscale.com/stable/tailscale_1.24.2_amd64.tgz";
|
|
||||||
sha256 = "1b697g694vigzmv5q48l1d3pjc9l5gwzazggnfi7z9prb9cvlnx2";
|
|
||||||
};
|
|
||||||
|
|
||||||
image = pkgs.stdenv.mkDerivation {
|
image = pkgs.stdenv.mkDerivation {
|
||||||
pname = "tailscale-image";
|
pname = "tailscale-image";
|
||||||
version = "1.24.2";
|
inherit (tsmeta) version;
|
||||||
buildInputs = with pkgs; [ squashfsTools imagebuilder ];
|
buildInputs = with pkgs; [ squashfsTools imagebuilder ];
|
||||||
phases = "installPhase";
|
phases = "installPhase";
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#! nix-shell -p curl -p jq -p nix -i bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
version="$(curl https://pkgs.tailscale.com/stable/?mode=json | jq .Tarballs.amd64 -r)"
|
||||||
|
url="https://pkgs.tailscale.com/stable/${version}"
|
||||||
|
shasum="$(nix-prefetch-url "${url}")"
|
||||||
|
|
||||||
|
rm -f tarball.nix
|
||||||
|
echo "{
|
||||||
|
version = \"$(echo ${version} | cut -d_ -f2)\";
|
||||||
|
tarball = builtins.fetchurl {
|
||||||
|
url = \"${url}\";
|
||||||
|
sha256 = \"${shasum}\";
|
||||||
|
};
|
||||||
|
}" >> tarball.nix
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
version = "1.24.2";
|
||||||
|
tarball = builtins.fetchurl {
|
||||||
|
url = "https://pkgs.tailscale.com/stable/tailscale_1.24.2_amd64.tgz";
|
||||||
|
sha256 = "1b697g694vigzmv5q48l1d3pjc9l5gwzazggnfi7z9prb9cvlnx2";
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue