Merge pull request #471 from LnL7/carnix-workspace

carnix workspace
This commit is contained in:
Graham Christensen 2020-04-25 08:49:14 -04:00 committed by GitHub
commit bef27f6ab9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 51 additions and 17 deletions

View file

@ -112,7 +112,8 @@ rec {
version = "0.1.8"; version = "0.1.8";
authors = [ "Graham Christensen <graham@grahamc.com>" ]; authors = [ "Graham Christensen <graham@grahamc.com>" ];
edition = "2018"; edition = "2018";
src = include [ "Cargo.toml" "Cargo.lock" "src" "test-srcs" "build.rs" ] ./.; src = include [ "Cargo.toml" "ofborg" ] ./.;
workspace_member = "ofborg";
build = "build.rs"; build = "build.rs";
dependencies = mapFeatures features ([ dependencies = mapFeatures features ([
(crates."amqp"."${deps."ofborg"."0.1.8"."amqp"}" deps) (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 <daiderd@gmail.com>" ];
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 # end
}; };
ofborg = crates.crates.ofborg."0.1.8" deps; 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" = { deps.aho_corasick."0.5.3" = {
memchr = "0.1.11"; memchr = "0.1.11";
}; };
@ -389,6 +416,10 @@ rec {
tempfile = "2.2.0"; tempfile = "2.2.0";
uuid = "0.4.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" = { deps.openssl."0.9.24" = {
bitflags = "0.9.1"; bitflags = "0.9.1";
foreign_types = "0.3.2"; foreign_types = "0.3.2";

View file

@ -1,20 +1,13 @@
{ pkgs ? import ./nix { overlays = [ (import ./nix/overlay.nix) ]; } }: { pkgs ? import ./nix { overlays = [ (import ./nix/overlay.nix) ]; } }:
let let
ofborgOverrides = { ofborgCrates = pkgs.callPackage ./Cargo.nix {
crateOverrides = pkgs.defaultCrateOverrides // { cratesIO = pkgs.callPackage ./crates-io.nix {};
ofborg = attrs: {
buildInputs = pkgs.lib.optional pkgs.stdenv.isDarwin
pkgs.darwin.apple_sdk.frameworks.Security;
};
};
}; };
drv = ((pkgs.callPackage ./ofborg/Cargo.nix { drv = ofborgCrates.ofborg {};
cratesIO = pkgs.callPackage ./ofborg/crates-io.nix {};
}).ofborg {}).override { release = false; };
src = stripDeps (drv.override ofborgOverrides); src = stripDeps (drv.override { release = pkgs.stdenv.isDarwin; });
stripDeps = pkg: pkgs.runCommand "${pkg.name}-deps-stripped" {} stripDeps = pkg: pkgs.runCommand "${pkg.name}-deps-stripped" {}
'' ''
@ -27,6 +20,8 @@ let
in in
{ {
ofborg.simple-build = ofborgCrates.ofborg_simple_build {};
ofborg.rs = pkgs.runCommand "ofborg-rs-symlink-compat" { inherit src; } '' ofborg.rs = pkgs.runCommand "ofborg-rs-symlink-compat" { inherit src; } ''
mkdir -p $out/bin mkdir -p $out/bin
for f in $(find $src -type f); do for f in $(find $src -type f); do

View file

@ -1,5 +1,14 @@
(self: super: { (self: super:
{
defaultCrateOverrides = super.defaultCrateOverrides // { 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: { openssl-sys = attrs: {
buildInputs = [ self.openssl_1_0_2 ]; buildInputs = [ self.openssl_1_0_2 ];
nativeBuildInputs = [ self.pkgconfig ]; nativeBuildInputs = [ self.pkgconfig ];

View file

@ -2,7 +2,5 @@
set -eu set -eu
cd ofborg
cargo build cargo build
carnix generate-nix --src . carnix generate-nix --src .

View file

@ -2,6 +2,7 @@
name = "ofborg-simple-build" name = "ofborg-simple-build"
version = "0.1.0" version = "0.1.0"
authors = ["Daiderd Jordan <daiderd@gmail.com>"] authors = ["Daiderd Jordan <daiderd@gmail.com>"]
include = ["Cargo.toml", "ofborg-simple-build"] # TODO remove when carnix is fixed
edition = "2018" edition = "2018"
[dependencies] [dependencies]

View file

@ -2,7 +2,7 @@
name = "ofborg" name = "ofborg"
version = "0.1.8" version = "0.1.8"
authors = ["Graham Christensen <graham@grahamc.com>"] authors = ["Graham Christensen <graham@grahamc.com>"]
include = ["Cargo.toml", "Cargo.lock", "src", "test-srcs", "build.rs"] include = ["Cargo.toml", "ofborg"] # TODO remove when carnix is fixed
build = "build.rs" build = "build.rs"
edition = "2018" edition = "2018"