blob: beaf6791f842d103152c6b8f9218d79a39d5ee9f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
{ 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";
src = fetchFromGitHub {
owner = "zyedidia";
repo = pname;
rev = "v${version}";
hash = "sha256-fe+7RkUwCveBk14bYzg5uLGOqTVVJsrqixBQhCS79hY=";
};
vendorHash = "sha256-ePhObvm3m/nT+7IyT0W6K+y+9UNkfd2kYjle2ffAd9Y=";
nativeBuildInputs = [ installShellFiles makeWrapper ];
subPackages = [ "cmd/micro" ];
ldflags = let t = "github.com/zyedidia/micro/v2/internal"; in [
"-s"
"-w"
"-X ${t}/util.Version=${version}"
"-X ${t}/util.CommitHash=${src.rev}"
];
preBuild = ''
GOOS= GOARCH= go generate ./runtime
'';
postInstall = ''
installManPage assets/packaging/micro.1
install -Dm444 -t $out/share/applications assets/packaging/micro.desktop
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; {
homepage = "https://micro-editor.github.io";
description = "Modern and intuitive terminal-based text editor";
license = licenses.mit;
maintainers = with maintainers; [ dtzWill ];
mainProgram = "micro";
};
}
|