add back Security on darwin and cleanup expression

This commit is contained in:
Daiderd Jordan 2018-12-04 21:35:33 +01:00
parent f96d6ed492
commit f6a94756cb
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -1,6 +1,21 @@
{ pkgs ? import ./nix {} { pkgs ? import ./nix {} }:
}:
let let
ofborgOverrides = {
crateOverrides = pkgs.defaultCrateOverrides // {
ofborg = attrs: {
buildInputs = pkgs.lib.optional pkgs.stdenv.isDarwin
pkgs.darwin.apple_sdk.frameworks.Security;
};
};
};
drv = (pkgs.callPackage ./ofborg/Cargo.nix {
cratesIO = pkgs.callPackage ./ofborg/crates-io.nix {};
}).ofborg {};
src = stripDeps (drv.override ofborgOverrides);
stripDeps = pkg: pkgs.runCommand "${pkg.name}-deps-stripped" {} stripDeps = pkg: pkgs.runCommand "${pkg.name}-deps-stripped" {}
'' ''
cp -r ${pkg} $out cp -r ${pkg} $out
@ -9,14 +24,10 @@ let
find $out/bin -name '*.d' -delete find $out/bin -name '*.d' -delete
chmod -R a-w $out chmod -R a-w $out
''; '';
in { in
ofborg.rs = let
drv = (pkgs.callPackage ./ofborg/Cargo.nix { {
cratesIO = pkgs.callPackage ./ofborg/crates-io.nix {}; ofborg.rs = pkgs.runCommand "ofborg-rs-symlink-compat" { inherit src; } ''
}).ofborg {};
in pkgs.runCommand "ofborg-rs-symlink-compat" {
src = stripDeps drv;
} ''
mkdir -p $out/bin mkdir -p $out/bin
for f in $(find $src -type f); do for f in $(find $src -type f); do
bn=$(basename "$f") bn=$(basename "$f")
@ -44,21 +55,21 @@ in {
Build failed because you bumped the Cargo Build failed because you bumped the Cargo
version without regenerating the carnix version without regenerating the carnix
file. file.
Run: Run:
nix-shell --run ./nix/update-carnix.sh nix-shell --run ./nix/update-carnix.sh
and commit those changes. and commit those changes.
EOF EOF
fi fi
''; '';