From cbef421081f1e65b1dcd81c9a6434e69cbc50f8e Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Fri, 12 Feb 2021 14:05:56 +0100 Subject: pkgs/profpatsch/nman: initial rewrite in rust This is a complete and user interface compatible rewrite of nman.go in Rust which aleviates a few flaws of the previous implementation: * Garbage collector roots for both the derivation and the build outputs are created in a temporary directory which is cleaned afterwards. This prevents a race condition between nman and nix-store --gc and doesn't pollute the user's working directory. * Instead of building just one build output, nman now checks every output for the requested man page which fixes nman for derivations which have their man pages split between multiple outputs, e. g. man and devman. Future work: * Improve error messages reported to the user * Man page * Implement man page search heuristics if no section is specified: Instead of falling back to section 1, all sections should be checked for the desired page (in an ascending order?) --- pkgs/profpatsch/nman/default.nix | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'pkgs/profpatsch/nman/default.nix') diff --git a/pkgs/profpatsch/nman/default.nix b/pkgs/profpatsch/nman/default.nix index 96699833..9d74d63b 100644 --- a/pkgs/profpatsch/nman/default.nix +++ b/pkgs/profpatsch/nman/default.nix @@ -1,14 +1,8 @@ -{ lib, runCommand, go }: +{ lib, writeRustSimpleBin }: -runCommand "nman" { - meta = with lib; { - description = "Invoke manpage in temporary nix-shell"; - license = licenses.gpl3; +writeRustSimpleBin "nman" { + meta = { + license = lib.licenses.gpl3Only; + description = "Open man page in a temporary nix-shell"; }; -} '' - mkdir cache - env GOCACHE="$PWD/cache" \ - ${lib.getBin go}/bin/go build -o nman ${./nman.go} - install -D nman $out/bin/nman -'' - +} ./nman.rs -- cgit 1.4.1