Skip to content

Instantly share code, notes, and snippets.

@tilpner

tilpner/bar.nix Secret

Created November 1, 2017 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tilpner/85adb5e0b3aac194f1e74953f45f8fd9 to your computer and use it in GitHub Desktop.
Save tilpner/85adb5e0b3aac194f1e74953f45f8fd9 to your computer and use it in GitHub Desktop.
with import <nixpkgs> {};
let
runForText = name: attrs: cmd:
lib.removeSuffix "\n" (builtins.readFile (runCommand name attrs cmd));
in stdenv.mkDerivation rec {
name = "foo-${version}";
version =
runForText "version" { buildInputs = [ git ]; } ''
cd ${src} && git describe --always > $out
'';
src = ...;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment