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