move simple-build to a separate project

This is mostly intended as an example and since this is only useful for
testing it should be relatively safe.
This commit is contained in:
Daiderd Jordan 2020-04-24 22:07:59 +02:00
parent 1c0c5e304c
commit 7ccb4943a1
No known key found for this signature in database
GPG key ID: D02435D05B810C96
4 changed files with 28 additions and 5 deletions

8
Cargo.lock generated
View file

@ -461,6 +461,14 @@ dependencies = [
"uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "ofborg-simple-build"
version = "0.1.0"
dependencies = [
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ofborg 0.1.8",
]
[[package]] [[package]]
name = "openssl" name = "openssl"
version = "0.9.24" version = "0.9.24"

View file

@ -1,6 +1,7 @@
[workspace] [workspace]
members = [ members = [
"ofborg" "ofborg",
"ofborg-simple-build"
] ]
[profile.release] [profile.release]

View file

@ -0,0 +1,10 @@
[package]
name = "ofborg-simple-build"
version = "0.1.0"
authors = ["Daiderd Jordan <daiderd@gmail.com>"]
edition = "2018"
[dependencies]
ofborg = { path = "../ofborg" }
log = "0.3.8"

View file

@ -1,18 +1,22 @@
use ofborg::config; #[macro_use]
use ofborg::nix; extern crate log;
use std::env; use std::env;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
use std::path::Path; use std::path::Path;
fn main() { use ofborg::config;
let cfg = config::load(env::args().nth(1).unwrap().as_ref()); use ofborg::nix;
fn main() {
ofborg::setup_log(); ofborg::setup_log();
log::info!("Loading config...");
let cfg = config::load(env::args().nth(1).unwrap().as_ref());
let nix = cfg.nix(); let nix = cfg.nix();
log::info!("Running build...");
match nix.safely_build_attrs( match nix.safely_build_attrs(
&Path::new("./"), &Path::new("./"),
nix::File::DefaultNixpkgs, nix::File::DefaultNixpkgs,