micro: cleanup

- put the stdenv.isLinux condition over input arguments
- deprecate withWlclip -> withWlClipboard
- migrate clipboardPackages next to postFixup
- remove references to pname
- split outputs
- strictDeps
- rework postInstall
- desugar passthru
- remove nested with in meta
- add meta.longDescription

+42 -16
+42 -16
pkgs/by-name/mi/micro/package.nix
··· 7 7 , wl-clipboard 8 8 , xclip 9 9 , makeWrapper 10 - , withXclip ? true 11 - , withWlclip ? true 10 + # Boolean flags 11 + , withXclip ? stdenv.isLinux 12 + , withWlclip ? null 13 + , withWlClipboard ? 14 + if withWlclip != null then 15 + lib.warn '' 16 + withWlclip is deprecated and will be removed; 17 + use withWlClipboard instead. 18 + '' withWlclip 19 + else stdenv.isLinux 12 20 }: 13 - let 14 - clipboardPkgs = if stdenv.isLinux then 15 - lib.optional withXclip xclip ++ 16 - lib.optional withWlclip wl-clipboard 17 - else [ ]; 18 - in 21 + 19 22 buildGoModule rec { 20 23 pname = "micro"; 21 24 version = "2.0.13"; 22 25 23 26 src = fetchFromGitHub { 24 27 owner = "zyedidia"; 25 - repo = pname; 28 + repo = "micro"; 26 29 rev = "v${version}"; 27 30 hash = "sha256-fe+7RkUwCveBk14bYzg5uLGOqTVVJsrqixBQhCS79hY="; 28 31 }; ··· 31 34 32 35 nativeBuildInputs = [ installShellFiles makeWrapper ]; 33 36 37 + outputs = [ "out" "man" ]; 38 + 34 39 subPackages = [ "cmd/micro" ]; 35 40 36 41 ldflags = let t = "github.com/zyedidia/micro/v2/internal"; in [ ··· 40 45 "-X ${t}/util.CommitHash=${src.rev}" 41 46 ]; 42 47 48 + strictDeps = true; 49 + 43 50 preBuild = '' 44 51 GOOS= GOARCH= go generate ./runtime 45 52 ''; 46 53 47 54 postInstall = '' 48 55 installManPage assets/packaging/micro.1 49 - install -Dm444 -t $out/share/applications assets/packaging/micro.desktop 56 + install -Dm444 assets/packaging/micro.desktop $out/share/applications/micro.desktop 50 57 install -Dm644 assets/micro-logo-mark.svg $out/share/icons/hicolor/scalable/apps/micro.svg 51 58 ''; 52 59 53 - postFixup = '' 60 + postFixup = let 61 + clipboardPackages = 62 + lib.optionals withXclip [ xclip ] ++ lib.optionals withWlClipboard [ wl-clipboard ]; 63 + in 64 + lib.optionalString (withXclip || withWlClipboard) 65 + '' 54 66 wrapProgram "$out/bin/micro" \ 55 - --prefix PATH : "${lib.makeBinPath clipboardPkgs}" 67 + --prefix PATH : "${lib.makeBinPath clipboardPackages}" 56 68 ''; 57 69 58 - passthru.tests.expect = callPackage ./test-with-expect.nix { }; 70 + passthru = { 71 + tests = { 72 + expect = callPackage ./test-with-expect.nix { }; 73 + }; 74 + }; 59 75 60 - meta = with lib; { 76 + meta = { 61 77 homepage = "https://micro-editor.github.io"; 62 78 description = "Modern and intuitive terminal-based text editor"; 63 - license = licenses.mit; 64 - maintainers = with maintainers; [ AndersonTorres ]; 79 + longDescription = '' 80 + micro is a terminal-based text editor that aims to be easy to use and 81 + intuitive, while also taking advantage of the capabilities of modern 82 + terminals. 83 + 84 + As its name indicates, micro aims to be somewhat of a successor to the 85 + nano editor by being easy to install and use. It strives to be enjoyable 86 + as a full-time editor for people who prefer to work in a terminal, or 87 + those who regularly edit files over SSH. 88 + ''; 89 + license = lib.licenses.mit; 65 90 mainProgram = "micro"; 91 + maintainers = with lib.maintainers; [ AndersonTorres ]; 66 92 }; 67 93 }