make builds in nix flakes
Signed-off-by: Xe <me@christine.website>
This commit is contained in:
parent
acd4500adf
commit
a61bcfbccd
27
flake.nix
27
flake.nix
|
@ -25,6 +25,33 @@
|
|||
};
|
||||
version = builtins.substring 0 8 self.lastModifiedDate;
|
||||
in {
|
||||
packages = rec {
|
||||
imagebuilder = pkgs.buildGoModule {
|
||||
pname = "taildeck-imagebuilder";
|
||||
inherit version;
|
||||
src = ./.;
|
||||
|
||||
vendorSha256 =
|
||||
"sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo=";
|
||||
};
|
||||
|
||||
tsTarball = builtins.fetchurl {
|
||||
url = "https://pkgs.tailscale.com/stable/tailscale_1.24.2_amd64.tgz";
|
||||
sha256 = "1b697g694vigzmv5q48l1d3pjc9l5gwzazggnfi7z9prb9cvlnx2";
|
||||
};
|
||||
|
||||
image = pkgs.stdenv.mkDerivation {
|
||||
pname = "tailscale-image";
|
||||
version = "1.24.2";
|
||||
buildInputs = with pkgs; [ squashfsTools imagebuilder ];
|
||||
phases = "installPhase";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
taildeck --out $out --tarball ${tsTarball}
|
||||
'';
|
||||
};
|
||||
};
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [ go gopls gotools go-tools squashfsTools ];
|
||||
};
|
||||
|
|
6
main.go
6
main.go
|
@ -15,8 +15,8 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
out = flag.String("out-dir", ".", "where to save squashfs images to")
|
||||
tsTarballPath = flag.String("tailscale-tarball", "./var/tailscale_1.24.2_amd64.tgz", "path to tailscale tarball on disk")
|
||||
out = flag.String("out", ".", "where to save squashfs images to")
|
||||
tsTarballPath = flag.String("tarball", "./var/tailscale_1.24.2_amd64.tgz", "path to tailscale tarball on disk")
|
||||
distro = flag.String("distro", "arch", "distro to stamp into system extension")
|
||||
)
|
||||
|
||||
|
@ -105,7 +105,7 @@ func main() {
|
|||
}
|
||||
|
||||
sp := strings.Split(filepath.Base(*tsTarballPath), "_")
|
||||
cmd := exec.Command(binPath, tmpDir, fmt.Sprintf("tailscale_sysext_%s.raw", sp[1]), "-quiet", "-noappend", "-all-root", "-root-mode", "755", "-b", "1M", "-comp", "xz", "-Xdict-size", "100%")
|
||||
cmd := exec.Command(binPath, tmpDir, fmt.Sprintf("%s/tailscale_sysext_%s.raw", *out, sp[1]), "-quiet", "-noappend", "-all-root", "-root-mode", "755", "-b", "1M", "-comp", "xz", "-Xdict-size", "100%")
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdout = os.Stdout
|
||||
if err := cmd.Run(); err != nil {
|
||||
|
|
Loading…
Reference in New Issue