From d5121dedaded2cd96e2b361621725d7a0ecedb19 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Tue, 11 Oct 2022 14:48:24 +0900 Subject: [PATCH] nix: use pname and add generated version --- darwin.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/darwin.nix b/darwin.nix index 8d0b7f8..9b1f283 100644 --- a/darwin.nix +++ b/darwin.nix @@ -1,8 +1,15 @@ { pkgs ? import {} }: -pkgs.stdenv.mkDerivation rec { - name = "bemenu"; - src = ./.; +let + src = pkgs.copyPathToStore ./.; + semver = builtins.readFile "${src}/VERSION"; + revision = builtins.readFile (pkgs.runCommand "get-rev" { + nativeBuildInputs = with pkgs; [ git ]; + } "GIT_DIR=${src}/.git git rev-parse --short HEAD | tr -d '\n' > $out"); +in pkgs.stdenv.mkDerivation rec { + inherit src; + pname = "bemenu"; + version = "${semver}${revision}"; nativeBuildInputs = with pkgs; [ pkg-config scdoc ]; buildInputs = with pkgs; [ ncurses ];