2024-02-29 20:09:43 +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-11-03 02:18:15 +00:00
|
|
|
buildGoModule rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "micro";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "2.0.13";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zyedidia";
|
2020-06-15 15:56:04 +00:00
|
|
|
repo = pname;
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = "v${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-fe+7RkUwCveBk14bYzg5uLGOqTVVJsrqixBQhCS79hY=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
vendorHash = "sha256-ePhObvm3m/nT+7IyT0W6K+y+9UNkfd2kYjle2ffAd9Y=";
|
2023-10-09 19:29:22 +00:00
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles makeWrapper ];
|
2020-06-15 15:56:04 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
subPackages = [ "cmd/micro" ];
|
|
|
|
|
2022-08-12 12:06:08 +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}"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
preBuild = ''
|
2024-01-02 11:29:13 +00:00
|
|
|
GOOS= GOARCH= go generate ./runtime
|
2022-08-21 13:32:41 +00:00
|
|
|
'';
|
|
|
|
|
2020-06-15 15:56:04 +00:00
|
|
|
postInstall = ''
|
2020-11-03 02:18:15 +00:00
|
|
|
installManPage assets/packaging/micro.1
|
2024-01-02 11:29:13 +00:00
|
|
|
install -Dm444 -t $out/share/applications assets/packaging/micro.desktop
|
2022-08-21 13:32:41 +00:00
|
|
|
install -Dm644 assets/micro-logo-mark.svg $out/share/icons/hicolor/scalable/apps/micro.svg
|
2020-06-15 15:56:04 +00:00
|
|
|
'';
|
|
|
|
|
2024-02-29 20:09:43 +00:00
|
|
|
postFixup = ''
|
|
|
|
wrapProgram "$out/bin/micro" \
|
|
|
|
--prefix PATH : "${lib.makeBinPath clipboardPkgs}"
|
|
|
|
'';
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
passthru.tests.expect = callPackage ./test-with-expect.nix { };
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2020-11-03 02:18:15 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://micro-editor.github.io";
|
|
|
|
description = "Modern and intuitive terminal-based text editor";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ dtzWill ];
|
2023-08-04 22:07:22 +00:00
|
|
|
mainProgram = "micro";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|