From c313242fe83e4fa6d28b7cfd6f980a8e24573670 Mon Sep 17 00:00:00 2001 From: sunder Date: Sat, 3 Feb 2024 14:27:40 +0300 Subject: [PATCH] micro: fixed clipboard issue --- pkgs/applications/editors/micro/default.nix | 27 ++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/editors/micro/default.nix b/pkgs/applications/editors/micro/default.nix index e20a7942719a..beaf6791f842 100644 --- a/pkgs/applications/editors/micro/default.nix +++ b/pkgs/applications/editors/micro/default.nix @@ -1,5 +1,21 @@ -{ lib, buildGoModule, fetchFromGitHub, installShellFiles, callPackage }: - +{ lib +, stdenv +, buildGoModule +, fetchFromGitHub +, installShellFiles +, callPackage +, wl-clipboard +, xclip +, makeWrapper +, withXclip ? true +, withWlclip ? true +}: +let + clipboardPkgs = if stdenv.isLinux then + lib.optional withXclip xclip ++ + lib.optional withWlclip wl-clipboard + else [ ]; +in buildGoModule rec { pname = "micro"; version = "2.0.13"; @@ -13,7 +29,7 @@ buildGoModule rec { vendorHash = "sha256-ePhObvm3m/nT+7IyT0W6K+y+9UNkfd2kYjle2ffAd9Y="; - nativeBuildInputs = [ installShellFiles ]; + nativeBuildInputs = [ installShellFiles makeWrapper ]; subPackages = [ "cmd/micro" ]; @@ -34,6 +50,11 @@ buildGoModule rec { install -Dm644 assets/micro-logo-mark.svg $out/share/icons/hicolor/scalable/apps/micro.svg ''; + postFixup = '' + wrapProgram "$out/bin/micro" \ + --prefix PATH : "${lib.makeBinPath clipboardPkgs}" + ''; + passthru.tests.expect = callPackage ./test-with-expect.nix { }; meta = with lib; {