-
Notifications
You must be signed in to change notification settings - Fork 47
/
default.nix
32 lines (25 loc) · 873 Bytes
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{ stdenv, buildGoPackage, fetchgit, pkgs ? import <nixpkgs> {} }:
with pkgs;
buildGoPackage rec {
# load version from file
versionPath = toString ./VERSION;
versionData = builtins.readFile versionPath;
versionLen = lib.stringLength versionData;
# trim trailing newline
version = lib.substring 0 (versionLen - 1) versionData;
# set the version dynamically at build time
buildFlagsArray = ''
-ldflags=-X main.version=${version}
'';
# create link so the tool can also be executed as `ec`
postInstall = ''
ln -s $bin/bin/editorconfig-checker $bin/bin/ec
'';
name = "editorconfig-checker-${version}";
goPackagePath = "github.com/editorconfig-checker/editorconfig-checker/v2";
src = lib.cleanSourceWith {
filter = name: type: builtins.match ".*tests.*" name == null;
src = (lib.cleanSource ./.);
};
goDeps = ./deps.nix;
}