1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-01 14:41:00 +01:00

Make it easy to build a static nix-find-roots from this source tree

Just `nix build .#nix-find-roots` (or `nix-build -A nix-find-roots`)
This commit is contained in:
Théophane Hufschmitt 2022-04-11 10:20:36 +02:00
parent 80bb58b186
commit bbde40af3e

View file

@ -403,6 +403,23 @@
BINDIR=${placeholder "bin"}/bin BINDIR=${placeholder "bin"}/bin
''; '';
}; };
nix-find-roots = prev.stdenv.mkDerivation {
name = "nix-find-roots-${version}";
inherit version;
src = "${self}/src/nix-find-roots";
CXXFLAGS = prev.lib.optionalString prev.stdenv.hostPlatform.isStatic "-static";
buildPhase = ''
$CXX $CXXFLAGS -std=c++17 nix-find-roots.cc -o nix-find-roots
'';
installPhase = ''
mkdir -p $out/bin
cp nix-find-roots $out/bin/
'';
};
}; };
in { in {
@ -560,6 +577,7 @@
packages = forAllSystems (system: { packages = forAllSystems (system: {
inherit (nixpkgsFor.${system}) nix; inherit (nixpkgsFor.${system}) nix;
} // (nixpkgs.lib.optionalAttrs (builtins.elem system linux64BitSystems) { } // (nixpkgs.lib.optionalAttrs (builtins.elem system linux64BitSystems) {
inherit (nixpkgsFor.${system}.pkgsStatic) nix-find-roots;
nix-static = let nix-static = let
nixpkgs = nixpkgsFor.${system}.pkgsStatic; nixpkgs = nixpkgsFor.${system}.pkgsStatic;
in with commonDeps nixpkgs; nixpkgs.stdenv.mkDerivation { in with commonDeps nixpkgs; nixpkgs.stdenv.mkDerivation {