nixpkgs/pkgs/applications/editors/micro/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

68 lines
1.6 KiB
Nix
Raw Normal View History

2024-02-03 11:27:40 +00:00
{ 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
2020-10-07 04:20:00 +00:00
buildGoModule rec {
pname = "micro";
version = "2.0.13";
2018-01-06 19:49:58 +00:00
src = fetchFromGitHub {
owner = "zyedidia";
2020-06-19 16:53:34 +00:00
repo = pname;
2018-01-06 19:49:58 +00:00
rev = "v${version}";
hash = "sha256-fe+7RkUwCveBk14bYzg5uLGOqTVVJsrqixBQhCS79hY=";
2018-01-06 19:49:58 +00:00
};
vendorHash = "sha256-ePhObvm3m/nT+7IyT0W6K+y+9UNkfd2kYjle2ffAd9Y=";
2023-09-07 05:43:25 +00:00
2024-02-03 11:27:40 +00:00
nativeBuildInputs = [ installShellFiles makeWrapper ];
2020-06-22 13:13:19 +00:00
2018-01-06 19:49:58 +00:00
subPackages = [ "cmd/micro" ];
2022-08-01 08:03:41 +00:00
ldflags = let t = "github.com/zyedidia/micro/v2/internal"; in [
"-s"
"-w"
"-X ${t}/util.Version=${version}"
"-X ${t}/util.CommitHash=${src.rev}"
];
2018-01-06 19:49:58 +00:00
preBuild = ''
2023-12-29 22:09:27 +00:00
GOOS= GOARCH= go generate ./runtime
'';
2020-06-22 13:13:19 +00:00
postInstall = ''
2020-10-07 04:20:00 +00:00
installManPage assets/packaging/micro.1
install -Dm444 -t $out/share/applications assets/packaging/micro.desktop
2022-08-07 14:47:03 +00:00
install -Dm644 assets/micro-logo-mark.svg $out/share/icons/hicolor/scalable/apps/micro.svg
2020-06-22 13:13:19 +00:00
'';
2024-02-03 11:27:40 +00:00
postFixup = ''
wrapProgram "$out/bin/micro" \
--prefix PATH : "${lib.makeBinPath clipboardPkgs}"
'';
2023-09-07 05:43:25 +00:00
passthru.tests.expect = callPackage ./test-with-expect.nix { };
2022-02-27 15:55:03 +00:00
2020-10-07 04:20:00 +00:00
meta = with lib; {
homepage = "https://micro-editor.github.io";
2018-01-06 19:49:58 +00:00
description = "Modern and intuitive terminal-based text editor";
license = licenses.mit;
maintainers = with maintainers; [ dtzWill ];
mainProgram = "micro";
2018-01-06 19:49:58 +00:00
};
}