mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-19 03:14:03 +00:00
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
This commit is contained in:
parent
7e84c1a283
commit
e439f7ea3c
@ -7,22 +7,25 @@
|
||||
, wl-clipboard
|
||||
, xclip
|
||||
, makeWrapper
|
||||
, withXclip ? true
|
||||
, withWlclip ? true
|
||||
# Boolean flags
|
||||
, withXclip ? stdenv.isLinux
|
||||
, withWlclip ? null
|
||||
, withWlClipboard ?
|
||||
if withWlclip != null then
|
||||
lib.warn ''
|
||||
withWlclip is deprecated and will be removed;
|
||||
use withWlClipboard instead.
|
||||
'' withWlclip
|
||||
else stdenv.isLinux
|
||||
}:
|
||||
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";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "zyedidia";
|
||||
repo = pname;
|
||||
repo = "micro";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-fe+7RkUwCveBk14bYzg5uLGOqTVVJsrqixBQhCS79hY=";
|
||||
};
|
||||
@ -31,6 +34,8 @@ buildGoModule rec {
|
||||
|
||||
nativeBuildInputs = [ installShellFiles makeWrapper ];
|
||||
|
||||
outputs = [ "out" "man" ];
|
||||
|
||||
subPackages = [ "cmd/micro" ];
|
||||
|
||||
ldflags = let t = "github.com/zyedidia/micro/v2/internal"; in [
|
||||
@ -40,28 +45,49 @@ buildGoModule rec {
|
||||
"-X ${t}/util.CommitHash=${src.rev}"
|
||||
];
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
preBuild = ''
|
||||
GOOS= GOARCH= go generate ./runtime
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
installManPage assets/packaging/micro.1
|
||||
install -Dm444 -t $out/share/applications assets/packaging/micro.desktop
|
||||
install -Dm444 assets/packaging/micro.desktop $out/share/applications/micro.desktop
|
||||
install -Dm644 assets/micro-logo-mark.svg $out/share/icons/hicolor/scalable/apps/micro.svg
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
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 clipboardPkgs}"
|
||||
--prefix PATH : "${lib.makeBinPath clipboardPackages}"
|
||||
'';
|
||||
|
||||
passthru.tests.expect = callPackage ./test-with-expect.nix { };
|
||||
passthru = {
|
||||
tests = {
|
||||
expect = callPackage ./test-with-expect.nix { };
|
||||
};
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
meta = {
|
||||
homepage = "https://micro-editor.github.io";
|
||||
description = "Modern and intuitive terminal-based text editor";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ AndersonTorres ];
|
||||
longDescription = ''
|
||||
micro is a terminal-based text editor that aims to be easy to use and
|
||||
intuitive, while also taking advantage of the capabilities of modern
|
||||
terminals.
|
||||
|
||||
As its name indicates, micro aims to be somewhat of a successor to the
|
||||
nano editor by being easy to install and use. It strives to be enjoyable
|
||||
as a full-time editor for people who prefer to work in a terminal, or
|
||||
those who regularly edit files over SSH.
|
||||
'';
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "micro";
|
||||
maintainers = with lib.maintainers; [ AndersonTorres ];
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user