From 31bea2379f97a12017e27629234aa23febc613eb Mon Sep 17 00:00:00 2001 From: Gus <58223632+thegu5@users.noreply.github.com> Date: Sun, 28 Dec 2025 02:21:24 -0500 Subject: [PATCH] witr: init at 0.1.0 --- pkgs/by-name/wi/witr/package.nix | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 pkgs/by-name/wi/witr/package.nix diff --git a/pkgs/by-name/wi/witr/package.nix b/pkgs/by-name/wi/witr/package.nix new file mode 100644 index 000000000000..d418d3fd4144 --- /dev/null +++ b/pkgs/by-name/wi/witr/package.nix @@ -0,0 +1,56 @@ +{ + fetchFromGitHub, + buildGoModule, + installShellFiles, + lib, +}: +buildGoModule (finalAttrs: { + pname = "witr"; + version = "0.1.0"; + + src = fetchFromGitHub { + owner = "pranshuparmar"; + repo = "witr"; + tag = "v${finalAttrs.version}"; + hash = "sha256-RA3dTTprYL6kmSiADqm2uR2QbFebpKPoOE3oyfGiNuI="; + # populate values that require us to use git. By doing this in postFetch we + # can delete .git afterwards and maintain better reproducibility of the src. + leaveDotGit = true; + postFetch = '' + cd "$out" + git rev-parse HEAD > $out/COMMIT + date -u -d "@$(git log -1 --pretty=%ct)" "+%Y-%m-%dT%H:%M:%SZ" > $out/SOURCE_DATE_EPOCH + find "$out" -name .git -print0 | xargs -0 rm -rf + ''; + }; + + vendorHash = null; + + # temporary, until go 1.25.5 is merged from staging-next to master + postPatch = '' + substituteInPlace go.mod --replace-fail 'go 1.25.5' 'go 1.25.4' + ''; + + ldflags = [ + "-X main.version=v${finalAttrs.version}" + ]; + + preBuild = '' + ldflags+=" -X=main.commit=$(cat COMMIT)" + ldflags+=" -X=main.buildDate=$(cat SOURCE_DATE_EPOCH)" + ''; + + nativeBuildInputs = [ installShellFiles ]; + + postInstall = '' + installManPage docs/witr.1 + ''; + + meta = { + description = "Command-line tool to find out why processes are running"; + homepage = "https://github.com/pranshuparmar/witr"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ thegu5 ]; + mainProgram = "witr"; + }; +})