diff --git a/ofborg/Cargo.nix b/Cargo.nix similarity index 92% rename from ofborg/Cargo.nix rename to Cargo.nix index 506622a..5b38965 100644 --- a/ofborg/Cargo.nix +++ b/Cargo.nix @@ -112,7 +112,8 @@ rec { version = "0.1.8"; authors = [ "Graham Christensen " ]; edition = "2018"; - src = include [ "Cargo.toml" "Cargo.lock" "src" "test-srcs" "build.rs" ] ./.; + src = include [ "Cargo.toml" "ofborg" ] ./.; + workspace_member = "ofborg"; build = "build.rs"; dependencies = mapFeatures features ([ (crates."amqp"."${deps."ofborg"."0.1.8"."amqp"}" deps) @@ -183,12 +184,38 @@ rec { ]; +# end +# ofborg-simple-build-0.1.0 + + crates.ofborg_simple_build."0.1.0" = deps: { features?(features_.ofborg_simple_build."0.1.0" deps {}) }: buildRustCrate { + crateName = "ofborg-simple-build"; + version = "0.1.0"; + authors = [ "Daiderd Jordan " ]; + edition = "2018"; + src = include [ "Cargo.toml" "ofborg-simple-build" ] ./.; + workspace_member = "ofborg-simple-build"; + dependencies = mapFeatures features ([ + (cratesIO.crates."log"."${deps."ofborg_simple_build"."0.1.0"."log"}" deps) + (crates."ofborg"."${deps."ofborg_simple_build"."0.1.0"."ofborg"}" deps) + ]); + }; + features_.ofborg_simple_build."0.1.0" = deps: f: updateFeatures f (rec { + log."${deps.ofborg_simple_build."0.1.0".log}".default = true; + ofborg."${deps.ofborg_simple_build."0.1.0".ofborg}".default = true; + ofborg_simple_build."0.1.0".default = (f.ofborg_simple_build."0.1.0".default or true); + }) [ + (cratesIO.features_.log."${deps."ofborg_simple_build"."0.1.0"."log"}" deps) + (features_.ofborg."${deps."ofborg_simple_build"."0.1.0"."ofborg"}" deps) + ]; + + # end }; ofborg = crates.crates.ofborg."0.1.8" deps; - __all = [ (ofborg {}) ]; + ofborg_simple_build = crates.crates.ofborg_simple_build."0.1.0" deps; + __all = [ (ofborg {}) (ofborg_simple_build {}) ]; deps.aho_corasick."0.5.3" = { memchr = "0.1.11"; }; @@ -389,6 +416,10 @@ rec { tempfile = "2.2.0"; uuid = "0.4.0"; }; + deps.ofborg_simple_build."0.1.0" = { + log = "0.3.8"; + ofborg = "0.1.8"; + }; deps.openssl."0.9.24" = { bitflags = "0.9.1"; foreign_types = "0.3.2"; diff --git a/ofborg/crates-io.list b/crates-io.list similarity index 100% rename from ofborg/crates-io.list rename to crates-io.list diff --git a/ofborg/crates-io.nix b/crates-io.nix similarity index 100% rename from ofborg/crates-io.nix rename to crates-io.nix diff --git a/default.nix b/default.nix index 8772120..2096daf 100644 --- a/default.nix +++ b/default.nix @@ -1,20 +1,13 @@ { pkgs ? import ./nix { overlays = [ (import ./nix/overlay.nix) ]; } }: let - ofborgOverrides = { - crateOverrides = pkgs.defaultCrateOverrides // { - ofborg = attrs: { - buildInputs = pkgs.lib.optional pkgs.stdenv.isDarwin - pkgs.darwin.apple_sdk.frameworks.Security; - }; - }; + ofborgCrates = pkgs.callPackage ./Cargo.nix { + cratesIO = pkgs.callPackage ./crates-io.nix {}; }; - drv = ((pkgs.callPackage ./ofborg/Cargo.nix { - cratesIO = pkgs.callPackage ./ofborg/crates-io.nix {}; - }).ofborg {}).override { release = false; }; + drv = ofborgCrates.ofborg {}; - src = stripDeps (drv.override ofborgOverrides); + src = stripDeps (drv.override { release = pkgs.stdenv.isDarwin; }); stripDeps = pkg: pkgs.runCommand "${pkg.name}-deps-stripped" {} '' @@ -27,6 +20,8 @@ let in { + ofborg.simple-build = ofborgCrates.ofborg_simple_build {}; + ofborg.rs = pkgs.runCommand "ofborg-rs-symlink-compat" { inherit src; } '' mkdir -p $out/bin for f in $(find $src -type f); do diff --git a/nix/overlay.nix b/nix/overlay.nix index 7e1b7a5..d874abd 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -1,5 +1,14 @@ -(self: super: { +(self: super: +{ defaultCrateOverrides = super.defaultCrateOverrides // { + ofborg = attrs: { + buildInputs = with self.darwin.apple_sdk.frameworks; + super.lib.optional super.stdenv.isDarwin Security; + }; + ofborg-simple-build = attrs: { + buildInputs = with self.darwin.apple_sdk.frameworks; + super.lib.optional super.stdenv.isDarwin Security; + }; openssl-sys = attrs: { buildInputs = [ self.openssl_1_0_2 ]; nativeBuildInputs = [ self.pkgconfig ]; diff --git a/nix/update-carnix.sh b/nix/update-carnix.sh index 7cf3cd2..d5da7ca 100755 --- a/nix/update-carnix.sh +++ b/nix/update-carnix.sh @@ -2,7 +2,5 @@ set -eu -cd ofborg - cargo build carnix generate-nix --src . diff --git a/ofborg-simple-build/Cargo.toml b/ofborg-simple-build/Cargo.toml index b1bb6b6..5a1a241 100644 --- a/ofborg-simple-build/Cargo.toml +++ b/ofborg-simple-build/Cargo.toml @@ -2,6 +2,7 @@ name = "ofborg-simple-build" version = "0.1.0" authors = ["Daiderd Jordan "] +include = ["Cargo.toml", "ofborg-simple-build"] # TODO remove when carnix is fixed edition = "2018" [dependencies] diff --git a/ofborg/Cargo.toml b/ofborg/Cargo.toml index 4a49573..1af67f1 100644 --- a/ofborg/Cargo.toml +++ b/ofborg/Cargo.toml @@ -2,7 +2,7 @@ name = "ofborg" version = "0.1.8" authors = ["Graham Christensen "] -include = ["Cargo.toml", "Cargo.lock", "src", "test-srcs", "build.rs"] +include = ["Cargo.toml", "ofborg"] # TODO remove when carnix is fixed build = "build.rs" edition = "2018"