nix: static linking via nix
This commit is contained in:
parent
4d9d4bcef2
commit
b298c5f572
1
default.nix
Normal file
1
default.nix
Normal file
@ -0,0 +1 @@
|
|||||||
|
with import <nixpkgs> { }; pkgsStatic.callPackage ./package.nix { }
|
24
package.nix
Normal file
24
package.nix
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
buildGoModule,
|
||||||
|
pkg-config,
|
||||||
|
}:
|
||||||
|
buildGoModule {
|
||||||
|
pname = "nix-tool";
|
||||||
|
version = "0.1.4";
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
vendorHash = "sha256-SVSrY9SZnS6NLin+apdN4efqCzHgBBY8LIjXcUCXbUo=";
|
||||||
|
|
||||||
|
ldflags =
|
||||||
|
[ "-s -w" ]
|
||||||
|
++ lib.optionals stdenv.hostPlatform.isStatic [
|
||||||
|
"-linkmode external"
|
||||||
|
"-extldflags \"-static\""
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user