From 06d85688fdcddf2f3ea1b5a68cf5c2c8d617a172 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Tue, 8 Mar 2022 17:07:08 +0000 Subject: [PATCH] set version based on git rev --- flake.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 75cf973b..89e77eb6 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,9 @@ }; outputs = { self, nixpkgs, flake-utils, ... }: + let + headscaleVersion = if (self ? shortRev) then self.shortRev else "dev"; + in { overlay = final: prev: let @@ -52,7 +55,7 @@ headscale = pkgs.buildGo117Module rec { pname = "headscale"; - version = "dev"; + version = headscaleVersion; src = pkgs.lib.cleanSource self; # When updating go.mod or go.sum, a new sha will need to be calculated, @@ -94,7 +97,7 @@ # docker load < result headscale-docker = pkgs.dockerTools.buildLayeredImage { name = "headscale"; - tag = "latest"; + tag = headscaleVersion; contents = [ pkgs.headscale ]; config.Entrypoint = [ (pkgs.headscale + "/bin/headscale") ]; };