Skip to content

Commit 49ba18d

Browse files
committed
feat: nix builds have the right version and commit
1 parent b58ff07 commit 49ba18d

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

default.nix

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1-
{pkgs ? import <nixpkgs> {}, ...}:
2-
pkgs.buildGoModule {
1+
{
2+
self,
3+
pkgs ? import <nixpkgs> {},
4+
...
5+
}:
6+
pkgs.buildGoModule rec {
7+
env.CGO_ENABLED = 0;
38
pname = "ess";
49
version = pkgs.lib.strings.removeSuffix "\n" (builtins.readFile ./version.txt);
510
src = ./.;
611
vendorHash = null;
12+
ldflags = [
13+
"-X 'main.version=${version}-nix'"
14+
"-X 'main.commit=${self.rev or "dev"}'"
15+
];
716

817
meta = {
918
description = "ess (env-sample-sync): automatically and safely synchronize env.sample files with .env";
19+
homepage = "https://github.com/acaloiaro/ess";
1020
license = pkgs.lib.licenses.bsd2;
1121
};
1222
}

flake.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
};
77

88
outputs = {
9+
self,
910
nixpkgs,
1011
flake-utils,
1112
...
@@ -17,7 +18,7 @@
1718
};
1819
in {
1920
packages = rec {
20-
ess = pkgs.callPackage ./. {inherit pkgs;};
21+
ess = pkgs.callPackage ./. {inherit pkgs self;};
2122
default = ess;
2223
};
2324

0 commit comments

Comments
 (0)