From bc448e7f96374252869d3578520f701134925f11 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Tue, 3 Sep 2024 21:05:50 -0300 Subject: [PATCH 1/3] micro: tidy up the package Basically, removing all references to clipboard things. The idea is to wrap them later in another derivation. --- pkgs/by-name/mi/micro/package.nix | 47 +++++++++---------------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/pkgs/by-name/mi/micro/package.nix b/pkgs/by-name/mi/micro/package.nix index e7c25d77bc40..2e678546b456 100644 --- a/pkgs/by-name/mi/micro/package.nix +++ b/pkgs/by-name/mi/micro/package.nix @@ -1,26 +1,14 @@ { lib, - stdenv, buildGoModule, + callPackage, fetchFromGitHub, installShellFiles, - callPackage, - wl-clipboard, - xclip, - makeWrapper, - # Boolean flags - withXclip ? stdenv.isLinux, - withWlClipboard ? - if withWlclip != null then - lib.warn '' - withWlclip is deprecated and will be removed; - use withWlClipboard instead. - '' withWlclip - else - stdenv.isLinux, + stdenv, # Deprecated options - # Remove them before or right after next version update from Nixpkgs or this - # package itself + # Remove them as soon as possible + withXclip ? null, + withWlClipboard ? null, withWlclip ? null, }: @@ -38,10 +26,7 @@ let vendorHash = "sha256-ePhObvm3m/nT+7IyT0W6K+y+9UNkfd2kYjle2ffAd9Y="; - nativeBuildInputs = [ - installShellFiles - makeWrapper - ]; + nativeBuildInputs = [ installShellFiles ]; outputs = [ "out" @@ -73,17 +58,6 @@ let install -Dm644 assets/micro-logo-mark.svg $out/share/icons/hicolor/scalable/apps/micro.svg ''; - postFixup = - let - clipboardPackages = - lib.optionals withXclip [ xclip ] - ++ lib.optionals withWlClipboard [ wl-clipboard ]; - in - lib.optionalString (withXclip || withWlClipboard) '' - wrapProgram "$out/bin/micro" \ - --prefix PATH : "${lib.makeBinPath clipboardPackages}" - ''; - passthru = { tests = lib.packagesFromDirectoryRecursive { inherit callPackage; @@ -114,4 +88,11 @@ let }; }; in -self +lib.warnIf (withXclip != null || withWlClipboard != null || withWlclip != null) '' + The options `withXclip`, `withWlClipboard`, `withWlclip` were removed. If + you are seeking for clipboard support, please consider the following + packages: + - `micro-with-wl-clipboard` + - `micro-with-xclip` + - `micro-full` +'' self From c16c239724e9de50787ba6b793f603049dfe4e22 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Tue, 3 Sep 2024 21:06:41 -0300 Subject: [PATCH 2/3] micro.wrapper: init --- pkgs/by-name/mi/micro/package.nix | 1 + pkgs/by-name/mi/micro/wrapper.nix | 33 +++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 pkgs/by-name/mi/micro/wrapper.nix diff --git a/pkgs/by-name/mi/micro/package.nix b/pkgs/by-name/mi/micro/package.nix index 2e678546b456..8f2bb8488db3 100644 --- a/pkgs/by-name/mi/micro/package.nix +++ b/pkgs/by-name/mi/micro/package.nix @@ -63,6 +63,7 @@ let inherit callPackage; directory = ./tests; }; + wrapper = callPackage ./wrapper.nix { micro = self; }; }; meta = { diff --git a/pkgs/by-name/mi/micro/wrapper.nix b/pkgs/by-name/mi/micro/wrapper.nix new file mode 100644 index 000000000000..1455fb44c447 --- /dev/null +++ b/pkgs/by-name/mi/micro/wrapper.nix @@ -0,0 +1,33 @@ +{ + lib, + micro, + makeWrapper, + symlinkJoin, + # configurable options + extraPackages ? [ ], +}: + +symlinkJoin { + name = "micro-wrapped-${micro.version}"; + inherit (micro) pname version outputs; + + nativeBuildInputs = [ makeWrapper ]; + + paths = [ micro ]; + + postBuild = '' + ${lib.concatMapStringsSep "\n" ( + output: "ln --verbose --symbolic --no-target-directory ${micro.${output}} \$${output}" + ) (lib.remove "out" micro.outputs)} + + pushd $out/bin + for f in *; do + rm $f + makeWrapper ${micro}/bin/$f $f \ + --prefix PATH ":" "${lib.makeBinPath extraPackages}" + done + popd + ''; + + meta = micro.meta; +} From 7ab079fe17bf64f2aa3bf112ca2b10b1c79c4d1b Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Tue, 3 Sep 2024 21:06:59 -0300 Subject: [PATCH 3/3] {micro-full,micro-with-wl-clipboard,micro-with-xclip}: "init" --- pkgs/top-level/all-packages.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fa1a6a2616e8..3e066ff09648 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25113,6 +25113,25 @@ with pkgs; meteor = callPackage ../servers/meteor { }; + micro-full = micro.wrapper.override { + extraPackages = [ + wl-clipboard + xclip + ]; + }; + + micro-with-wl-clipboard = micro.wrapper.override { + extraPackages = [ + wl-clipboard + ]; + }; + + micro-with-xclip = micro.wrapper.override { + extraPackages = [ + xclip + ]; + }; + micronaut = callPackage ../development/tools/micronaut { }; minio = callPackage ../servers/minio { };