diff --git a/pkgs/by-name/mi/micro/package.nix b/pkgs/by-name/mi/micro/package.nix index ac04ed2bf873..4dc704cfdc4e 100644 --- a/pkgs/by-name/mi/micro/package.nix +++ b/pkgs/by-name/mi/micro/package.nix @@ -19,75 +19,79 @@ else stdenv.isLinux }: -buildGoModule rec { - pname = "micro"; - version = "2.0.13"; +let + self = buildGoModule { + pname = "micro"; + version = "2.0.13"; - src = fetchFromGitHub { - owner = "zyedidia"; - repo = "micro"; - rev = "v${version}"; - hash = "sha256-fe+7RkUwCveBk14bYzg5uLGOqTVVJsrqixBQhCS79hY="; - }; + src = fetchFromGitHub { + owner = "zyedidia"; + repo = "micro"; + rev = "v${self.version}"; + hash = "sha256-fe+7RkUwCveBk14bYzg5uLGOqTVVJsrqixBQhCS79hY="; + }; - vendorHash = "sha256-ePhObvm3m/nT+7IyT0W6K+y+9UNkfd2kYjle2ffAd9Y="; + vendorHash = "sha256-ePhObvm3m/nT+7IyT0W6K+y+9UNkfd2kYjle2ffAd9Y="; - nativeBuildInputs = [ installShellFiles makeWrapper ]; + nativeBuildInputs = [ installShellFiles makeWrapper ]; - outputs = [ "out" "man" ]; + outputs = [ "out" "man" ]; - subPackages = [ "cmd/micro" ]; + 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}" - ]; + ldflags = let t = "github.com/zyedidia/micro/v2/internal"; in [ + "-s" + "-w" + "-X ${t}/util.Version=${self.version}" + "-X ${t}/util.CommitHash=${self.src.rev}" + ]; - strictDeps = true; + strictDeps = true; - preBuild = '' - GOOS= GOARCH= go generate ./runtime + preBuild = '' + GOOS= GOARCH= go generate ./runtime ''; - postInstall = '' - installManPage assets/packaging/micro.1 - 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 + postInstall = '' + installManPage assets/packaging/micro.1 + 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 = let - clipboardPackages = - lib.optionals withXclip [ xclip ] ++ lib.optionals withWlClipboard [ wl-clipboard ]; - in - lib.optionalString (withXclip || withWlClipboard) - '' - wrapProgram "$out/bin/micro" \ - --prefix PATH : "${lib.makeBinPath clipboardPackages}" - ''; + 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 clipboardPackages}" + ''; - passthru = { - tests = { - expect = callPackage ./test-with-expect.nix { }; + passthru = { + tests = { + expect = callPackage ./test-with-expect.nix { + micro = self; + }; + }; + }; + + meta = { + homepage = "https://micro-editor.github.io"; + description = "Modern and intuitive terminal-based text editor"; + 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 ]; }; }; - - meta = { - homepage = "https://micro-editor.github.io"; - description = "Modern and intuitive terminal-based text editor"; - 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 ]; - }; -} +in +self