From 4c396c1fbeee114a22d5e7c0c6f0e3e2820ab2c1 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Fri, 13 Mar 2020 16:23:54 +0800 Subject: [PATCH] add navi --- pkgs/default.nix | 2 ++ pkgs/navi/default.nix | 21 +++++++++++++++++---- system/all/packages.nix | 8 ++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/pkgs/default.nix b/pkgs/default.nix index 43e5c50..49a3ae8 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -28,6 +28,8 @@ in { fuji-cam-wifi-tool = callPackage ./fuji-cam { }; + navi = callPackage ./navi { }; + bitwig-studio3 = callPackage ./bitwig-studio/bitwig-studio3.nix { }; bitwig-studio = callPackage ./bitwig-studio/bitwig-studio-environment.nix { }; diff --git a/pkgs/navi/default.nix b/pkgs/navi/default.nix index 79bb244..54894d2 100644 --- a/pkgs/navi/default.nix +++ b/pkgs/navi/default.nix @@ -1,9 +1,11 @@ -{ stdenv, fetchFromGitHub, ... }: +{ rustPlatform, fetchFromGitHub, stdenv, fzf, makeWrapper, ... }: + +rustPlatform.buildRustPackage rec { -stdenv.mkDerivation rec { - version = "2.0.8"; name = "navi-${version}"; + version = "2.0.8"; + src = fetchFromGitHub { owner = "denisidoro"; repo = "navi"; @@ -11,7 +13,17 @@ stdenv.mkDerivation rec { sha256 = "1kh4s7s595l95xirdb0fvgkdbig3zcfkdiqk8zdz9cfglzcm5192"; }; - buildInputs = [ ]; + cargoSha256 = "18d3b9g2jxkgscx9186v5301y4y01wd00kcs14617fgjnv0lyz1g"; + verifyCargoDeps = true; + + postInstall = '' + mkdir -p $out/share/navi/ + cp -r ./cheats $out/share/navi/ + wrapProgram "$out/bin/navi" \ + --suffix "PATH" : "${fzf}/bin" \ + --suffix "NAVI_PATH" : "$out/share/navi/cheats" + ''; + buildInputs = [ fzf makeWrapper ]; meta = with stdenv.lib; { description = "An interactive cheatsheet tool for the command-line"; @@ -21,3 +33,4 @@ stdenv.mkDerivation rec { maintainers = with maintainers; [ mrVanDalo ]; }; } + diff --git a/system/all/packages.nix b/system/all/packages.nix index 8bdcc08..1dd948d 100644 --- a/system/all/packages.nix +++ b/system/all/packages.nix @@ -85,6 +85,14 @@ in { duc + (pkgs.writers.writeBashBin "cheat" '' + set -eu -o pipefail + output=$( navi --print --path "$HOME/.cheats:${pkgs.navi}/share/navi/cheats" ) + echo "$output" + ${pkgs.bash}/bin/bash -c "$output" + '') + navi + memoryUsage #gitlog2json