From 698bd499fdd559301c183e4ff4ec940d4d244600 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 5 Sep 2023 16:41:49 +0200 Subject: add Nix package --- README.md | 11 +++++++++++ anissue.nix | 46 ++++++++++++++++++++++++++++++++++++++++++++++ default.nix | 2 ++ 3 files changed, 59 insertions(+) create mode 100644 README.md create mode 100644 anissue.nix create mode 100644 default.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..b5c8079 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +## installation + +```console +nix-env -f. -i + + +## usage + +```console +anissue . +``` diff --git a/anissue.nix b/anissue.nix new file mode 100644 index 0000000..8df12a3 --- /dev/null +++ b/anissue.nix @@ -0,0 +1,46 @@ +{ coreutils +, fetchFromGitHub +, findutils +, gawk +, git +, gnused +, jq +, lib +, makeWrapper +, ncurses +, nix-gitignore +, stdenv +}: +let + # TODO package tree-grepper in Nixpkgs so that it can reuse + tree-grepper = (import (fetchFromGitHub { + owner = "BrianHicks"; + repo = "tree-grepper"; + rev = "refs/tags/2.4.1"; + hash = "sha256-wHqVhx2JFBm+lc3/rruBBlpF2Ylv3/oOFM5CgX5WtKs="; + })).default; +in +stdenv.mkDerivation { + name = "anissue"; + src = nix-gitignore.gitignoreSource [ ] ./.; + nativeBuildInputs = [ makeWrapper ]; + buildPhase = ":"; + installPhase = '' + mkdir -p $out/{bin,share} + for bin in src/*.sh; do + cp $bin $out/share/$(basename $bin) + wrapProgram $out/share/$(basename $bin) \ + --set PATH ${lib.makeBinPath [ + coreutils + findutils + gawk + git + gnused + jq + ncurses + tree-grepper + ]} + done + ln -s $out/share/extract.sh $out/bin/anissue + ''; +} diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..f453cd5 --- /dev/null +++ b/default.nix @@ -0,0 +1,2 @@ +{ pkgs ? import { } }: +pkgs.callPackage ./anissue.nix { } -- cgit v1.2.3