diff --git a/pkgs/shells/nushell/plugins/default.nix b/pkgs/shells/nushell/plugins/default.nix index 7aa271e82e3b3..352f8504c5373 100644 --- a/pkgs/shells/nushell/plugins/default.nix +++ b/pkgs/shells/nushell/plugins/default.nix @@ -10,4 +10,5 @@ lib.makeScope newScope (self: with self; { units = callPackage ./units.nix { }; highlight = callPackage ./highlight.nix { }; dbus = callPackage ./dbus.nix { inherit dbus; nushell_plugin_dbus = self.dbus; }; + skim = callPackage ./skim.nix { inherit IOKit CoreFoundation; }; }) diff --git a/pkgs/shells/nushell/plugins/skim.nix b/pkgs/shells/nushell/plugins/skim.nix new file mode 100644 index 0000000000000..5edc8483eaba3 --- /dev/null +++ b/pkgs/shells/nushell/plugins/skim.nix @@ -0,0 +1,55 @@ +{ + stdenv, + runCommand, + lib, + rustPlatform, + nix-update-script, + fetchFromGitHub, + IOKit, + CoreFoundation, + nushell, + skim, +}: + +rustPlatform.buildRustPackage rec { + pname = "nu_plugin_skim"; + version = "0.8.0"; + + src = fetchFromGitHub { + owner = "idanarye"; + repo = pname; + rev = "v${version}"; + hash = "sha256-3q2qt35lZ07N8E3p4/BoYX1H4B8qcKXJWnZhdJhgpJE="; + }; + + cargoHash = "sha256-+RYrQsB8LVjxZsQ7dVDK6GT6nXSM4b+qpILOe0Q2SjA="; + + nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ rustPlatform.bindgenHook ]; + buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ + IOKit + CoreFoundation + ]; + + passthru = { + updateScript = nix-update-script { }; + tests.check = + let + nu = lib.getExe nushell; + plugin = lib.getExe skim; + in + runCommand "${pname}-test" { } '' + touch $out + ${nu} -n -c "plugin add --plugin-config $out ${plugin}" + ${nu} -n -c "plugin use --plugin-config $out skim" + ''; + }; + + meta = with lib; { + description = "A nushell plugin that adds integrates the skim fuzzy finder"; + mainProgram = "nu_plugin_skim"; + homepage = "https://github.com/idanarye/nu_plugin_skim"; + license = licenses.mit; + maintainers = with maintainers; [ aftix ]; + platforms = with platforms; all; + }; +}