mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 15:56:50 +01:00
elvish: properly set buildinfo via ldflags
As of [this commit][1] (v0.16.0), the module path of Elvish changed from
`github.com/elves/elvish` to `src.elv.sh`. This is also reflected in the
updated [packaging instructions][2].
This commit updates the `ldflags` in the derivation to use the new
module path so that `buildinfo.Reproducible` is correctly set to `true`.
[1]: 196eea21d4
[2]: https://github.com/elves/elvish/blob/master/PACKAGING.md
This commit is contained in:
parent
e14a4826d2
commit
5773043ac1
1 changed files with 17 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
{ lib, buildGoModule, fetchFromGitHub }:
|
{ lib, buildGoModule, fetchFromGitHub, runCommand, elvish }:
|
||||||
|
|
||||||
buildGoModule rec {
|
buildGoModule rec {
|
||||||
pname = "elvish";
|
pname = "elvish";
|
||||||
|
@ -6,7 +6,7 @@ buildGoModule rec {
|
||||||
|
|
||||||
subPackages = [ "cmd/elvish" ];
|
subPackages = [ "cmd/elvish" ];
|
||||||
|
|
||||||
ldflags = [ "-s" "-w" "-X github.com/elves/elvish/pkg/buildinfo.Version==${version}" "-X github.com/elves/elvish/pkg/buildinfo.Reproducible=true" ];
|
ldflags = [ "-s" "-w" "-X src.elv.sh/pkg/buildinfo.Version==${version}" "-X src.elv.sh/pkg/buildinfo.Reproducible=true" ];
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "elves";
|
owner = "elves";
|
||||||
|
@ -33,5 +33,20 @@ buildGoModule rec {
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
shellPath = "/bin/elvish";
|
shellPath = "/bin/elvish";
|
||||||
|
tests = runCommand "${pname}-buildinfo-test" {} ''
|
||||||
|
mkdir $out
|
||||||
|
|
||||||
|
${elvish}/bin/elvish -c "
|
||||||
|
fn expect {|key expected|
|
||||||
|
var actual = \$buildinfo[\$key]
|
||||||
|
if (not-eq \$actual \$expected) {
|
||||||
|
fail '\$buildinfo['\$key']: expected '(to-string \$expected)', got '(to-string \$actual)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
expect version ${version}
|
||||||
|
expect reproducible \$true
|
||||||
|
"
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue