Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

micro: 2.0.7 -> 2.0.8 #99949

Merged
merged 1 commit into from Oct 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 9 additions & 16 deletions pkgs/applications/editors/micro/default.nix
@@ -1,40 +1,33 @@
{ stdenv, buildGoPackage, fetchFromGitHub, installShellFiles }:
{ lib, buildGoModule, fetchFromGitHub, installShellFiles }:

buildGoPackage rec {
buildGoModule rec {
pname = "micro";
version = "2.0.7";

goPackagePath = "github.com/zyedidia/micro";
version = "2.0.8";

src = fetchFromGitHub {
owner = "zyedidia";
repo = pname;
rev = "v${version}";
sha256 = "07ck1a9arklic3p0z50wcg608cvpba1kljvlfb4fljr6jhv5cmkb";
fetchSubmodules = true;
sha256 = "1b51fvc9hrjfl8acr3yybp66xfll7d43412qwi76wxwarn06gkci";
};

nativeBuildInputs = [ installShellFiles ];

subPackages = [ "cmd/micro" ];

buildFlagsArray = let t = "${goPackagePath}/internal/util"; in ''
-ldflags=
-X ${t}.Version=${version}
-X ${t}.CommitHash=${src.rev}
'';
vendorSha256 = "19iqvl63g9y6gkzfmv87rrgj4c4y6ngh467ss94rzrhaybj2b2d8";

goDeps = ./deps.nix;
buildFlagsArray = [ "-ldflags=-s -w -X github.com/zyedidia/micro/v2/internal/util.Version=${version} -X github.com/zyedidia/micro/v2/internal/util.CommitHash=${src.rev}" ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit curious. Are these flags something required in new versions of Go?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late response. Golang uses -ldflags to set variable values at compile time, we use it to set the correct version string, and the -s -w helps to reduce the binary size.
These flags are not required per-se, but if we don't include them, calling micro --version doesn't show the correct version.


postInstall = ''
installManPage $src/assets/packaging/micro.1
installManPage assets/packaging/micro.1
install -Dt $out/share/applications assets/packaging/micro.desktop
'';

meta = with stdenv.lib; {
meta = with lib; {
homepage = "https://micro-editor.github.io";
description = "Modern and intuitive terminal-based text editor";
license = licenses.mit;
maintainers = with maintainers; [ dtzWill ];
};
}

345 changes: 0 additions & 345 deletions pkgs/applications/editors/micro/deps.nix

This file was deleted.