From d2f4d25033da6417a405faa58000dddb3626c7a5 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 23 May 2018 09:58:20 -0400 Subject: [PATCH] nix-linuxkit-runner: init --- nix-linuxkit-runner/.gitignore | 3 + nix-linuxkit-runner/Cargo.lock | 250 +++++++++++++ nix-linuxkit-runner/Cargo.nix | 627 ++++++++++++++++++++++++++++++++ nix-linuxkit-runner/Cargo.toml | 11 + nix-linuxkit-runner/shell.nix | 13 + nix-linuxkit-runner/src/main.rs | 183 ++++++++++ overlay.nix | 1 + 7 files changed, 1088 insertions(+) create mode 100644 nix-linuxkit-runner/.gitignore create mode 100644 nix-linuxkit-runner/Cargo.lock create mode 100644 nix-linuxkit-runner/Cargo.nix create mode 100644 nix-linuxkit-runner/Cargo.toml create mode 100644 nix-linuxkit-runner/shell.nix create mode 100644 nix-linuxkit-runner/src/main.rs diff --git a/nix-linuxkit-runner/.gitignore b/nix-linuxkit-runner/.gitignore new file mode 100644 index 0000000..70e3cae --- /dev/null +++ b/nix-linuxkit-runner/.gitignore @@ -0,0 +1,3 @@ + +/target +**/*.rs.bk diff --git a/nix-linuxkit-runner/Cargo.lock b/nix-linuxkit-runner/Cargo.lock new file mode 100644 index 0000000..82e2475 --- /dev/null +++ b/nix-linuxkit-runner/Cargo.lock @@ -0,0 +1,250 @@ +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "atty" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.41 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bitflags" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "clap" +version = "2.31.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "ctrlc" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libc" +version = "0.2.41" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "nix" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.41 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nix-linuxkit-runner" +version = "0.1.0" +dependencies = [ + "ctrlc 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "proc-macro2" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "redox_syscall" +version = "0.1.38" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_termios" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "redox_syscall 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "strsim" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "structopt" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt-derive 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "structopt-derive" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "syn" +version = "0.13.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "termion" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.41 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "textwrap" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-width" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "vec_map" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[metadata] +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +"checksum atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2fc4a1aa4c24c0718a250f0681885c1af91419d242f29eb8f2ab28502d80dbd1" +"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" +"checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789" +"checksum cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "405216fd8fe65f718daa7102ea808a946b6ce40c742998fbfd3463645552de18" +"checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536" +"checksum ctrlc 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "653abc99aa905f693d89df4797fadc08085baee379db92be9f2496cefe8a6f2c" +"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +"checksum libc 0.2.41 (registry+https://github.com/rust-lang/crates.io-index)" = "ac8ebf8343a981e2fa97042b14768f02ed3e1d602eac06cae6166df3c8ced206" +"checksum nix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2c5afeb0198ec7be8569d666644b574345aad2e95a53baf3a532da3e0f3fb32" +"checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" +"checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" +"checksum redox_syscall 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "0a12d51a5b5fd700e6c757f15877685bfa04fd7eb60c108f01d045cafa0073c2" +"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" +"checksum structopt 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b96fc11ba8cf80bfa5cdd6de538c9f7c66f519f83e8caabc554e431bf3e36d" +"checksum structopt-derive 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "95063e55a45976cfce9f03fcd26dff356ee622f1a14147bfae068ab8bed153a6" +"checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b" +"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +"checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" +"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3" +"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/nix-linuxkit-runner/Cargo.nix b/nix-linuxkit-runner/Cargo.nix new file mode 100644 index 0000000..0bfea02 --- /dev/null +++ b/nix-linuxkit-runner/Cargo.nix @@ -0,0 +1,627 @@ +# Generated by carnix 0.7.2: carnix nix --src . +{ lib, buildPlatform, buildRustCrate, fetchgit }: +let kernel = buildPlatform.parsed.kernel.name; + abi = buildPlatform.parsed.abi.name; + include = includedFiles: src: builtins.filterSource (path: type: + lib.lists.any (f: + let p = toString (src + ("/" + f)); in + (path == p) || (type == "directory" && lib.strings.hasPrefix path p) + ) includedFiles + ) src; + updateFeatures = f: up: functions: builtins.deepSeq f (lib.lists.foldl' (features: fun: fun features) (lib.attrsets.recursiveUpdate f up) functions); + mapFeatures = features: map (fun: fun { features = features; }); + mkFeatures = feat: lib.lists.foldl (features: featureName: + if feat.${featureName} or false then + [ featureName ] ++ features + else + features + ) [] (builtins.attrNames feat); +in +rec { + nix_linuxkit_runner = f: nix_linuxkit_runner_0_1_0 { features = nix_linuxkit_runner_0_1_0_features { nix_linuxkit_runner_0_1_0 = f; }; }; + __all = [ (nix_linuxkit_runner {}) ]; + ansi_term_0_11_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "ansi_term"; + version = "0.11.0"; + authors = [ "ogham@bsago.me" "Ryan Scheel (Havvy) " "Josh Triplett " ]; + sha256 = "08fk0p2xvkqpmz3zlrwnf6l8sj2vngw464rvzspzp31sbgxbwm4v"; + inherit dependencies buildDependencies features; + }; + atty_0_2_10_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "atty"; + version = "0.2.10"; + authors = [ "softprops " ]; + sha256 = "1h26lssj8rwaz0xhwwm5a645r49yly211amfmd243m3m0jl49i2c"; + inherit dependencies buildDependencies features; + }; + bitflags_0_9_1_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "bitflags"; + version = "0.9.1"; + authors = [ "The Rust Project Developers" ]; + sha256 = "18h073l5jd88rx4qdr95fjddr9rk79pb1aqnshzdnw16cfmb9rws"; + inherit dependencies buildDependencies features; + }; + bitflags_1_0_3_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "bitflags"; + version = "1.0.3"; + authors = [ "The Rust Project Developers" ]; + sha256 = "162p4w4h1ad76awq6b5yivmls3d50m9cl27d8g588lsps6g8s5rw"; + inherit dependencies buildDependencies features; + }; + cfg_if_0_1_3_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "cfg-if"; + version = "0.1.3"; + authors = [ "Alex Crichton " ]; + sha256 = "0hphfz5qg40gr5p18gmgy2rzkqj019lii3n0dy3s0a6lnl9106k6"; + inherit dependencies buildDependencies features; + }; + clap_2_31_2_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "clap"; + version = "2.31.2"; + authors = [ "Kevin K. " ]; + sha256 = "0r24ziw85a8y1sf2l21y4mvv5qan3rjafcshpyfsjfadqfxsij72"; + inherit dependencies buildDependencies features; + }; + ctrlc_3_1_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "ctrlc"; + version = "3.1.0"; + authors = [ "Antti Keränen " "nabijaczleweli " "Henning Ottesen " "Peter Atashian " ]; + sha256 = "1dspgfaqvipmmzr3ihjphxsrnlzq5zbnv3z1k0799rlm39d98cy2"; + inherit dependencies buildDependencies features; + }; + kernel32_sys_0_2_2_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "kernel32-sys"; + version = "0.2.2"; + authors = [ "Peter Atashian " ]; + sha256 = "1lrw1hbinyvr6cp28g60z97w32w8vsk6pahk64pmrv2fmby8srfj"; + libName = "kernel32"; + build = "build.rs"; + inherit dependencies buildDependencies features; + }; + libc_0_2_41_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "libc"; + version = "0.2.41"; + authors = [ "The Rust Project Developers" ]; + sha256 = "00fj3gi8x3zvslbnisw8xfgmid3k6nvgjg8i0lly50cf3l8x0s00"; + inherit dependencies buildDependencies features; + }; + nix_0_9_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "nix"; + version = "0.9.0"; + authors = [ "The nix-rust Project Developers" ]; + sha256 = "00p63bphzwwn460rja5l2wcpgmv7ljf7illf6n95cppx63d180q0"; + inherit dependencies buildDependencies features; + }; + nix_linuxkit_runner_0_1_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "nix-linuxkit-runner"; + version = "0.1.0"; + authors = [ "Graham Christensen " ]; + src = ./.; + inherit dependencies buildDependencies features; + }; + proc_macro2_0_3_8_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "proc-macro2"; + version = "0.3.8"; + authors = [ "Alex Crichton " ]; + sha256 = "0ixnavxcd6sk1861hjgnfxly7qgq4ch1iplsx0nclvjjkwg39qdc"; + inherit dependencies buildDependencies features; + }; + quote_0_5_2_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "quote"; + version = "0.5.2"; + authors = [ "David Tolnay " ]; + sha256 = "062cnp12j09x0z0nj4j5pfh26h35zlrks07asxgqhfhcym1ba595"; + inherit dependencies buildDependencies features; + }; + redox_syscall_0_1_38_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "redox_syscall"; + version = "0.1.38"; + authors = [ "Jeremy Soller " ]; + sha256 = "09giwh6n37sya45g9b2k7svmm42xh8bfrnab3g51qwm1czfz5xbx"; + libName = "syscall"; + inherit dependencies buildDependencies features; + }; + redox_termios_0_1_1_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "redox_termios"; + version = "0.1.1"; + authors = [ "Jeremy Soller " ]; + sha256 = "04s6yyzjca552hdaqlvqhp3vw0zqbc304md5czyd3axh56iry8wh"; + libPath = "src/lib.rs"; + inherit dependencies buildDependencies features; + }; + strsim_0_7_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "strsim"; + version = "0.7.0"; + authors = [ "Danny Guo " ]; + sha256 = "0fy0k5f2705z73mb3x9459bpcvrx4ky8jpr4zikcbiwan4bnm0iv"; + inherit dependencies buildDependencies features; + }; + structopt_0_2_8_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "structopt"; + version = "0.2.8"; + authors = [ "Guillaume Pinot " ]; + sha256 = "043ix4f74knvl94ba7c4sywwpbab8qr2q6r7jprrih9givyp2ysc"; + inherit dependencies buildDependencies features; + }; + structopt_derive_0_2_8_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "structopt-derive"; + version = "0.2.8"; + authors = [ "Guillaume Pinot " ]; + sha256 = "1nbnwl7vrqsd82igziyyi32p5akhnppd9smpi9hsrspaxa1sqcj6"; + procMacro = true; + inherit dependencies buildDependencies features; + }; + syn_0_13_11_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "syn"; + version = "0.13.11"; + authors = [ "David Tolnay " ]; + sha256 = "06ybhxbyv8zshli47w0ihcnix74d6ss5yic3imns895q8pqgia2k"; + inherit dependencies buildDependencies features; + }; + termion_1_5_1_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "termion"; + version = "1.5.1"; + authors = [ "ticki " "gycos " "IGI-111 " ]; + sha256 = "02gq4vd8iws1f3gjrgrgpajsk2bk43nds5acbbb4s8dvrdvr8nf1"; + inherit dependencies buildDependencies features; + }; + textwrap_0_9_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "textwrap"; + version = "0.9.0"; + authors = [ "Martin Geisler " ]; + sha256 = "18jg79ndjlwndz01mlbh82kkr2arqm658yn5kwp65l5n1hz8w4yb"; + inherit dependencies buildDependencies features; + }; + unicode_width_0_1_5_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "unicode-width"; + version = "0.1.5"; + authors = [ "kwantam " ]; + sha256 = "0886lc2aymwgy0lhavwn6s48ik3c61ykzzd3za6prgnw51j7bi4w"; + inherit dependencies buildDependencies features; + }; + unicode_xid_0_1_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "unicode-xid"; + version = "0.1.0"; + authors = [ "erick.tryzelaar " "kwantam " ]; + sha256 = "05wdmwlfzxhq3nhsxn6wx4q8dhxzzfb9szsz6wiw092m1rjj01zj"; + inherit dependencies buildDependencies features; + }; + vec_map_0_8_1_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "vec_map"; + version = "0.8.1"; + authors = [ "Alex Crichton " "Jorge Aparicio " "Alexis Beingessner " "Brian Anderson <>" "tbu- <>" "Manish Goregaokar <>" "Aaron Turon " "Adolfo Ochagavía <>" "Niko Matsakis <>" "Steven Fackler <>" "Chase Southwood " "Eduard Burtescu <>" "Florian Wilkens <>" "Félix Raimundo <>" "Tibor Benke <>" "Markus Siemens " "Josh Branchaud " "Huon Wilson " "Corey Farwell " "Aaron Liblong <>" "Nick Cameron " "Patrick Walton " "Felix S Klock II <>" "Andrew Paseltiner " "Sean McArthur " "Vadim Petrochenkov <>" ]; + sha256 = "1jj2nrg8h3l53d43rwkpkikq5a5x15ms4rf1rw92hp5lrqhi8mpi"; + inherit dependencies buildDependencies features; + }; + void_1_0_2_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "void"; + version = "1.0.2"; + authors = [ "Jonathan Reem " ]; + sha256 = "0h1dm0dx8dhf56a83k68mijyxigqhizpskwxfdrs1drwv2cdclv3"; + inherit dependencies buildDependencies features; + }; + winapi_0_2_8_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "winapi"; + version = "0.2.8"; + authors = [ "Peter Atashian " ]; + sha256 = "0a45b58ywf12vb7gvj6h3j264nydynmzyqz8d8rqxsj6icqv82as"; + inherit dependencies buildDependencies features; + }; + winapi_0_3_4_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "winapi"; + version = "0.3.4"; + authors = [ "Peter Atashian " ]; + sha256 = "1qbrf5dcnd8j36cawby5d9r5vx07r0l4ryf672pfncnp8895k9lx"; + build = "build.rs"; + inherit dependencies buildDependencies features; + }; + winapi_build_0_1_1_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "winapi-build"; + version = "0.1.1"; + authors = [ "Peter Atashian " ]; + sha256 = "1lxlpi87rkhxcwp2ykf1ldw3p108hwm24nywf3jfrvmff4rjhqga"; + libName = "build"; + inherit dependencies buildDependencies features; + }; + winapi_i686_pc_windows_gnu_0_4_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "winapi-i686-pc-windows-gnu"; + version = "0.4.0"; + authors = [ "Peter Atashian " ]; + sha256 = "05ihkij18r4gamjpxj4gra24514can762imjzlmak5wlzidplzrp"; + build = "build.rs"; + inherit dependencies buildDependencies features; + }; + winapi_x86_64_pc_windows_gnu_0_4_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { + crateName = "winapi-x86_64-pc-windows-gnu"; + version = "0.4.0"; + authors = [ "Peter Atashian " ]; + sha256 = "0n1ylmlsb8yg1v583i4xy0qmqg42275flvbc51hdqjjfjcl9vlbj"; + build = "build.rs"; + inherit dependencies buildDependencies features; + }; + ansi_term_0_11_0 = { features?(ansi_term_0_11_0_features {}) }: ansi_term_0_11_0_ { + dependencies = (if kernel == "windows" then mapFeatures features ([ winapi_0_3_4 ]) else []); + }; + ansi_term_0_11_0_features = f: updateFeatures f (rec { + ansi_term_0_11_0.default = (f.ansi_term_0_11_0.default or true); + winapi_0_3_4.consoleapi = true; + winapi_0_3_4.default = true; + winapi_0_3_4.errhandlingapi = true; + winapi_0_3_4.processenv = true; + }) [ winapi_0_3_4_features ]; + atty_0_2_10 = { features?(atty_0_2_10_features {}) }: atty_0_2_10_ { + dependencies = (if kernel == "redox" then mapFeatures features ([ termion_1_5_1 ]) else []) + ++ (if (kernel == "linux" || kernel == "darwin") then mapFeatures features ([ libc_0_2_41 ]) else []) + ++ (if kernel == "windows" then mapFeatures features ([ winapi_0_3_4 ]) else []); + }; + atty_0_2_10_features = f: updateFeatures f (rec { + atty_0_2_10.default = (f.atty_0_2_10.default or true); + libc_0_2_41.default = (f.libc_0_2_41.default or false); + termion_1_5_1.default = true; + winapi_0_3_4.consoleapi = true; + winapi_0_3_4.default = true; + winapi_0_3_4.minwinbase = true; + winapi_0_3_4.minwindef = true; + winapi_0_3_4.processenv = true; + winapi_0_3_4.winbase = true; + }) [ termion_1_5_1_features libc_0_2_41_features winapi_0_3_4_features ]; + bitflags_0_9_1 = { features?(bitflags_0_9_1_features {}) }: bitflags_0_9_1_ { + features = mkFeatures (features.bitflags_0_9_1 or {}); + }; + bitflags_0_9_1_features = f: updateFeatures f (rec { + bitflags_0_9_1.default = (f.bitflags_0_9_1.default or true); + bitflags_0_9_1.example_generated = + (f.bitflags_0_9_1.example_generated or false) || + (f.bitflags_0_9_1.default or false) || + (bitflags_0_9_1.default or false); + }) []; + bitflags_1_0_3 = { features?(bitflags_1_0_3_features {}) }: bitflags_1_0_3_ { + features = mkFeatures (features.bitflags_1_0_3 or {}); + }; + bitflags_1_0_3_features = f: updateFeatures f (rec { + bitflags_1_0_3.default = (f.bitflags_1_0_3.default or true); + }) []; + cfg_if_0_1_3 = { features?(cfg_if_0_1_3_features {}) }: cfg_if_0_1_3_ {}; + cfg_if_0_1_3_features = f: updateFeatures f (rec { + cfg_if_0_1_3.default = (f.cfg_if_0_1_3.default or true); + }) []; + clap_2_31_2 = { features?(clap_2_31_2_features {}) }: clap_2_31_2_ { + dependencies = mapFeatures features ([ bitflags_1_0_3 textwrap_0_9_0 unicode_width_0_1_5 ] + ++ (if features.clap_2_31_2.atty or false then [ atty_0_2_10 ] else []) + ++ (if features.clap_2_31_2.strsim or false then [ strsim_0_7_0 ] else []) + ++ (if features.clap_2_31_2.vec_map or false then [ vec_map_0_8_1 ] else [])) + ++ (if !(kernel == "windows") then mapFeatures features ([ ] + ++ (if features.clap_2_31_2.ansi_term or false then [ ansi_term_0_11_0 ] else [])) else []); + features = mkFeatures (features.clap_2_31_2 or {}); + }; + clap_2_31_2_features = f: updateFeatures f (rec { + ansi_term_0_11_0.default = true; + atty_0_2_10.default = true; + bitflags_1_0_3.default = true; + clap_2_31_2.ansi_term = + (f.clap_2_31_2.ansi_term or false) || + (f.clap_2_31_2.color or false) || + (clap_2_31_2.color or false); + clap_2_31_2.atty = + (f.clap_2_31_2.atty or false) || + (f.clap_2_31_2.color or false) || + (clap_2_31_2.color or false); + clap_2_31_2.clippy = + (f.clap_2_31_2.clippy or false) || + (f.clap_2_31_2.lints or false) || + (clap_2_31_2.lints or false); + clap_2_31_2.color = + (f.clap_2_31_2.color or false) || + (f.clap_2_31_2.default or false) || + (clap_2_31_2.default or false); + clap_2_31_2.default = (f.clap_2_31_2.default or true); + clap_2_31_2.strsim = + (f.clap_2_31_2.strsim or false) || + (f.clap_2_31_2.suggestions or false) || + (clap_2_31_2.suggestions or false); + clap_2_31_2.suggestions = + (f.clap_2_31_2.suggestions or false) || + (f.clap_2_31_2.default or false) || + (clap_2_31_2.default or false); + clap_2_31_2.term_size = + (f.clap_2_31_2.term_size or false) || + (f.clap_2_31_2.wrap_help or false) || + (clap_2_31_2.wrap_help or false); + clap_2_31_2.vec_map = + (f.clap_2_31_2.vec_map or false) || + (f.clap_2_31_2.default or false) || + (clap_2_31_2.default or false); + clap_2_31_2.yaml = + (f.clap_2_31_2.yaml or false) || + (f.clap_2_31_2.doc or false) || + (clap_2_31_2.doc or false); + clap_2_31_2.yaml-rust = + (f.clap_2_31_2.yaml-rust or false) || + (f.clap_2_31_2.yaml or false) || + (clap_2_31_2.yaml or false); + strsim_0_7_0.default = true; + textwrap_0_9_0.default = true; + textwrap_0_9_0.term_size = + (f.textwrap_0_9_0.term_size or false) || + (clap_2_31_2.wrap_help or false) || + (f.clap_2_31_2.wrap_help or false); + unicode_width_0_1_5.default = true; + vec_map_0_8_1.default = true; + }) [ atty_0_2_10_features bitflags_1_0_3_features strsim_0_7_0_features textwrap_0_9_0_features unicode_width_0_1_5_features vec_map_0_8_1_features ansi_term_0_11_0_features ]; + ctrlc_3_1_0 = { features?(ctrlc_3_1_0_features {}) }: ctrlc_3_1_0_ { + dependencies = (if (kernel == "linux" || kernel == "darwin") then mapFeatures features ([ nix_0_9_0 ]) else []) + ++ (if kernel == "windows" then mapFeatures features ([ kernel32_sys_0_2_2 winapi_0_2_8 ]) else []); + features = mkFeatures (features.ctrlc_3_1_0 or {}); + }; + ctrlc_3_1_0_features = f: updateFeatures f (rec { + ctrlc_3_1_0.default = (f.ctrlc_3_1_0.default or true); + kernel32_sys_0_2_2.default = true; + nix_0_9_0.default = true; + winapi_0_2_8.default = true; + }) [ nix_0_9_0_features kernel32_sys_0_2_2_features winapi_0_2_8_features ]; + kernel32_sys_0_2_2 = { features?(kernel32_sys_0_2_2_features {}) }: kernel32_sys_0_2_2_ { + dependencies = mapFeatures features ([ winapi_0_2_8 ]); + buildDependencies = mapFeatures features ([ winapi_build_0_1_1 ]); + }; + kernel32_sys_0_2_2_features = f: updateFeatures f (rec { + kernel32_sys_0_2_2.default = (f.kernel32_sys_0_2_2.default or true); + winapi_0_2_8.default = true; + winapi_build_0_1_1.default = true; + }) [ winapi_0_2_8_features winapi_build_0_1_1_features ]; + libc_0_2_41 = { features?(libc_0_2_41_features {}) }: libc_0_2_41_ { + features = mkFeatures (features.libc_0_2_41 or {}); + }; + libc_0_2_41_features = f: updateFeatures f (rec { + libc_0_2_41.default = (f.libc_0_2_41.default or true); + libc_0_2_41.use_std = + (f.libc_0_2_41.use_std or false) || + (f.libc_0_2_41.default or false) || + (libc_0_2_41.default or false); + }) []; + nix_0_9_0 = { features?(nix_0_9_0_features {}) }: nix_0_9_0_ { + dependencies = mapFeatures features ([ bitflags_0_9_1 cfg_if_0_1_3 libc_0_2_41 void_1_0_2 ]); + }; + nix_0_9_0_features = f: updateFeatures f (rec { + bitflags_0_9_1.default = true; + cfg_if_0_1_3.default = true; + libc_0_2_41.default = true; + nix_0_9_0.default = (f.nix_0_9_0.default or true); + void_1_0_2.default = true; + }) [ bitflags_0_9_1_features cfg_if_0_1_3_features libc_0_2_41_features void_1_0_2_features ]; + nix_linuxkit_runner_0_1_0 = { features?(nix_linuxkit_runner_0_1_0_features {}) }: nix_linuxkit_runner_0_1_0_ { + dependencies = mapFeatures features ([ ctrlc_3_1_0 structopt_0_2_8 ]); + }; + nix_linuxkit_runner_0_1_0_features = f: updateFeatures f (rec { + ctrlc_3_1_0.default = true; + ctrlc_3_1_0.termination = true; + nix_linuxkit_runner_0_1_0.default = (f.nix_linuxkit_runner_0_1_0.default or true); + structopt_0_2_8.default = true; + }) [ ctrlc_3_1_0_features structopt_0_2_8_features ]; + proc_macro2_0_3_8 = { features?(proc_macro2_0_3_8_features {}) }: proc_macro2_0_3_8_ { + dependencies = mapFeatures features ([ unicode_xid_0_1_0 ]); + features = mkFeatures (features.proc_macro2_0_3_8 or {}); + }; + proc_macro2_0_3_8_features = f: updateFeatures f (rec { + proc_macro2_0_3_8.default = (f.proc_macro2_0_3_8.default or true); + proc_macro2_0_3_8.proc-macro = + (f.proc_macro2_0_3_8.proc-macro or false) || + (f.proc_macro2_0_3_8.default or false) || + (proc_macro2_0_3_8.default or false) || + (f.proc_macro2_0_3_8.nightly or false) || + (proc_macro2_0_3_8.nightly or false); + unicode_xid_0_1_0.default = true; + }) [ unicode_xid_0_1_0_features ]; + quote_0_5_2 = { features?(quote_0_5_2_features {}) }: quote_0_5_2_ { + dependencies = mapFeatures features ([ proc_macro2_0_3_8 ]); + features = mkFeatures (features.quote_0_5_2 or {}); + }; + quote_0_5_2_features = f: updateFeatures f (rec { + proc_macro2_0_3_8.default = (f.proc_macro2_0_3_8.default or false); + proc_macro2_0_3_8.proc-macro = + (f.proc_macro2_0_3_8.proc-macro or false) || + (quote_0_5_2.proc-macro or false) || + (f.quote_0_5_2.proc-macro or false); + quote_0_5_2.default = (f.quote_0_5_2.default or true); + quote_0_5_2.proc-macro = + (f.quote_0_5_2.proc-macro or false) || + (f.quote_0_5_2.default or false) || + (quote_0_5_2.default or false); + }) [ proc_macro2_0_3_8_features ]; + redox_syscall_0_1_38 = { features?(redox_syscall_0_1_38_features {}) }: redox_syscall_0_1_38_ {}; + redox_syscall_0_1_38_features = f: updateFeatures f (rec { + redox_syscall_0_1_38.default = (f.redox_syscall_0_1_38.default or true); + }) []; + redox_termios_0_1_1 = { features?(redox_termios_0_1_1_features {}) }: redox_termios_0_1_1_ { + dependencies = mapFeatures features ([ redox_syscall_0_1_38 ]); + }; + redox_termios_0_1_1_features = f: updateFeatures f (rec { + redox_syscall_0_1_38.default = true; + redox_termios_0_1_1.default = (f.redox_termios_0_1_1.default or true); + }) [ redox_syscall_0_1_38_features ]; + strsim_0_7_0 = { features?(strsim_0_7_0_features {}) }: strsim_0_7_0_ {}; + strsim_0_7_0_features = f: updateFeatures f (rec { + strsim_0_7_0.default = (f.strsim_0_7_0.default or true); + }) []; + structopt_0_2_8 = { features?(structopt_0_2_8_features {}) }: structopt_0_2_8_ { + dependencies = mapFeatures features ([ clap_2_31_2 structopt_derive_0_2_8 ]); + features = mkFeatures (features.structopt_0_2_8 or {}); + }; + structopt_0_2_8_features = f: updateFeatures f (rec { + clap_2_31_2.color = + (f.clap_2_31_2.color or false) || + (structopt_0_2_8.color or false) || + (f.structopt_0_2_8.color or false); + clap_2_31_2.debug = + (f.clap_2_31_2.debug or false) || + (structopt_0_2_8.debug or false) || + (f.structopt_0_2_8.debug or false); + clap_2_31_2.default = + (f.clap_2_31_2.default or false) || + (structopt_0_2_8.default or false) || + (f.structopt_0_2_8.default or false) || + false; + clap_2_31_2.doc = + (f.clap_2_31_2.doc or false) || + (structopt_0_2_8.doc or false) || + (f.structopt_0_2_8.doc or false); + clap_2_31_2.lints = + (f.clap_2_31_2.lints or false) || + (structopt_0_2_8.lints or false) || + (f.structopt_0_2_8.lints or false); + clap_2_31_2.no_cargo = + (f.clap_2_31_2.no_cargo or false) || + (structopt_0_2_8.no_cargo or false) || + (f.structopt_0_2_8.no_cargo or false); + clap_2_31_2.suggestions = + (f.clap_2_31_2.suggestions or false) || + (structopt_0_2_8.suggestions or false) || + (f.structopt_0_2_8.suggestions or false); + clap_2_31_2.wrap_help = + (f.clap_2_31_2.wrap_help or false) || + (structopt_0_2_8.wrap_help or false) || + (f.structopt_0_2_8.wrap_help or false); + clap_2_31_2.yaml = + (f.clap_2_31_2.yaml or false) || + (structopt_0_2_8.yaml or false) || + (f.structopt_0_2_8.yaml or false); + structopt_0_2_8.default = (f.structopt_0_2_8.default or true); + structopt_derive_0_2_8.default = true; + structopt_derive_0_2_8.nightly = + (f.structopt_derive_0_2_8.nightly or false) || + (structopt_0_2_8.nightly or false) || + (f.structopt_0_2_8.nightly or false); + }) [ clap_2_31_2_features structopt_derive_0_2_8_features ]; + structopt_derive_0_2_8 = { features?(structopt_derive_0_2_8_features {}) }: structopt_derive_0_2_8_ { + dependencies = mapFeatures features ([ proc_macro2_0_3_8 quote_0_5_2 syn_0_13_11 ]); + features = mkFeatures (features.structopt_derive_0_2_8 or {}); + }; + structopt_derive_0_2_8_features = f: updateFeatures f (rec { + proc_macro2_0_3_8.default = true; + proc_macro2_0_3_8.nightly = + (f.proc_macro2_0_3_8.nightly or false) || + (structopt_derive_0_2_8.nightly or false) || + (f.structopt_derive_0_2_8.nightly or false); + quote_0_5_2.default = true; + structopt_derive_0_2_8.default = (f.structopt_derive_0_2_8.default or true); + syn_0_13_11.default = true; + }) [ proc_macro2_0_3_8_features quote_0_5_2_features syn_0_13_11_features ]; + syn_0_13_11 = { features?(syn_0_13_11_features {}) }: syn_0_13_11_ { + dependencies = mapFeatures features ([ proc_macro2_0_3_8 unicode_xid_0_1_0 ] + ++ (if features.syn_0_13_11.quote or false then [ quote_0_5_2 ] else [])); + features = mkFeatures (features.syn_0_13_11 or {}); + }; + syn_0_13_11_features = f: updateFeatures f (rec { + proc_macro2_0_3_8.default = (f.proc_macro2_0_3_8.default or false); + proc_macro2_0_3_8.proc-macro = + (f.proc_macro2_0_3_8.proc-macro or false) || + (syn_0_13_11.proc-macro or false) || + (f.syn_0_13_11.proc-macro or false); + quote_0_5_2.default = (f.quote_0_5_2.default or false); + quote_0_5_2.proc-macro = + (f.quote_0_5_2.proc-macro or false) || + (syn_0_13_11.proc-macro or false) || + (f.syn_0_13_11.proc-macro or false); + syn_0_13_11.clone-impls = + (f.syn_0_13_11.clone-impls or false) || + (f.syn_0_13_11.default or false) || + (syn_0_13_11.default or false); + syn_0_13_11.default = (f.syn_0_13_11.default or true); + syn_0_13_11.derive = + (f.syn_0_13_11.derive or false) || + (f.syn_0_13_11.default or false) || + (syn_0_13_11.default or false); + syn_0_13_11.parsing = + (f.syn_0_13_11.parsing or false) || + (f.syn_0_13_11.default or false) || + (syn_0_13_11.default or false); + syn_0_13_11.printing = + (f.syn_0_13_11.printing or false) || + (f.syn_0_13_11.default or false) || + (syn_0_13_11.default or false); + syn_0_13_11.proc-macro = + (f.syn_0_13_11.proc-macro or false) || + (f.syn_0_13_11.default or false) || + (syn_0_13_11.default or false); + syn_0_13_11.quote = + (f.syn_0_13_11.quote or false) || + (f.syn_0_13_11.printing or false) || + (syn_0_13_11.printing or false); + unicode_xid_0_1_0.default = true; + }) [ proc_macro2_0_3_8_features quote_0_5_2_features unicode_xid_0_1_0_features ]; + termion_1_5_1 = { features?(termion_1_5_1_features {}) }: termion_1_5_1_ { + dependencies = (if !(kernel == "redox") then mapFeatures features ([ libc_0_2_41 ]) else []) + ++ (if kernel == "redox" then mapFeatures features ([ redox_syscall_0_1_38 redox_termios_0_1_1 ]) else []); + }; + termion_1_5_1_features = f: updateFeatures f (rec { + libc_0_2_41.default = true; + redox_syscall_0_1_38.default = true; + redox_termios_0_1_1.default = true; + termion_1_5_1.default = (f.termion_1_5_1.default or true); + }) [ libc_0_2_41_features redox_syscall_0_1_38_features redox_termios_0_1_1_features ]; + textwrap_0_9_0 = { features?(textwrap_0_9_0_features {}) }: textwrap_0_9_0_ { + dependencies = mapFeatures features ([ unicode_width_0_1_5 ]); + }; + textwrap_0_9_0_features = f: updateFeatures f (rec { + textwrap_0_9_0.default = (f.textwrap_0_9_0.default or true); + unicode_width_0_1_5.default = true; + }) [ unicode_width_0_1_5_features ]; + unicode_width_0_1_5 = { features?(unicode_width_0_1_5_features {}) }: unicode_width_0_1_5_ { + features = mkFeatures (features.unicode_width_0_1_5 or {}); + }; + unicode_width_0_1_5_features = f: updateFeatures f (rec { + unicode_width_0_1_5.default = (f.unicode_width_0_1_5.default or true); + }) []; + unicode_xid_0_1_0 = { features?(unicode_xid_0_1_0_features {}) }: unicode_xid_0_1_0_ { + features = mkFeatures (features.unicode_xid_0_1_0 or {}); + }; + unicode_xid_0_1_0_features = f: updateFeatures f (rec { + unicode_xid_0_1_0.default = (f.unicode_xid_0_1_0.default or true); + }) []; + vec_map_0_8_1 = { features?(vec_map_0_8_1_features {}) }: vec_map_0_8_1_ { + dependencies = mapFeatures features ([]); + features = mkFeatures (features.vec_map_0_8_1 or {}); + }; + vec_map_0_8_1_features = f: updateFeatures f (rec { + vec_map_0_8_1.default = (f.vec_map_0_8_1.default or true); + vec_map_0_8_1.serde = + (f.vec_map_0_8_1.serde or false) || + (f.vec_map_0_8_1.eders or false) || + (vec_map_0_8_1.eders or false); + }) []; + void_1_0_2 = { features?(void_1_0_2_features {}) }: void_1_0_2_ { + features = mkFeatures (features.void_1_0_2 or {}); + }; + void_1_0_2_features = f: updateFeatures f (rec { + void_1_0_2.default = (f.void_1_0_2.default or true); + void_1_0_2.std = + (f.void_1_0_2.std or false) || + (f.void_1_0_2.default or false) || + (void_1_0_2.default or false); + }) []; + winapi_0_2_8 = { features?(winapi_0_2_8_features {}) }: winapi_0_2_8_ {}; + winapi_0_2_8_features = f: updateFeatures f (rec { + winapi_0_2_8.default = (f.winapi_0_2_8.default or true); + }) []; + winapi_0_3_4 = { features?(winapi_0_3_4_features {}) }: winapi_0_3_4_ { + dependencies = (if kernel == "i686-pc-windows-gnu" then mapFeatures features ([ winapi_i686_pc_windows_gnu_0_4_0 ]) else []) + ++ (if kernel == "x86_64-pc-windows-gnu" then mapFeatures features ([ winapi_x86_64_pc_windows_gnu_0_4_0 ]) else []); + features = mkFeatures (features.winapi_0_3_4 or {}); + }; + winapi_0_3_4_features = f: updateFeatures f (rec { + winapi_0_3_4.default = (f.winapi_0_3_4.default or true); + winapi_i686_pc_windows_gnu_0_4_0.default = true; + winapi_x86_64_pc_windows_gnu_0_4_0.default = true; + }) [ winapi_i686_pc_windows_gnu_0_4_0_features winapi_x86_64_pc_windows_gnu_0_4_0_features ]; + winapi_build_0_1_1 = { features?(winapi_build_0_1_1_features {}) }: winapi_build_0_1_1_ {}; + winapi_build_0_1_1_features = f: updateFeatures f (rec { + winapi_build_0_1_1.default = (f.winapi_build_0_1_1.default or true); + }) []; + winapi_i686_pc_windows_gnu_0_4_0 = { features?(winapi_i686_pc_windows_gnu_0_4_0_features {}) }: winapi_i686_pc_windows_gnu_0_4_0_ {}; + winapi_i686_pc_windows_gnu_0_4_0_features = f: updateFeatures f (rec { + winapi_i686_pc_windows_gnu_0_4_0.default = (f.winapi_i686_pc_windows_gnu_0_4_0.default or true); + }) []; + winapi_x86_64_pc_windows_gnu_0_4_0 = { features?(winapi_x86_64_pc_windows_gnu_0_4_0_features {}) }: winapi_x86_64_pc_windows_gnu_0_4_0_ {}; + winapi_x86_64_pc_windows_gnu_0_4_0_features = f: updateFeatures f (rec { + winapi_x86_64_pc_windows_gnu_0_4_0.default = (f.winapi_x86_64_pc_windows_gnu_0_4_0.default or true); + }) []; +} diff --git a/nix-linuxkit-runner/Cargo.toml b/nix-linuxkit-runner/Cargo.toml new file mode 100644 index 0000000..7267340 --- /dev/null +++ b/nix-linuxkit-runner/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "nix-linuxkit-runner" +version = "0.1.0" +authors = ["Graham Christensen "] + +[dependencies] +structopt = "0.2" + +[dependencies.ctrlc] +version = "3.1.0" +features = [ "termination" ] \ No newline at end of file diff --git a/nix-linuxkit-runner/shell.nix b/nix-linuxkit-runner/shell.nix new file mode 100644 index 0000000..e0a0955 --- /dev/null +++ b/nix-linuxkit-runner/shell.nix @@ -0,0 +1,13 @@ +{ pkgs ? import {} }: +pkgs.mkShell { + buildInputs = with pkgs; [ + cargo + carnix + ]; + + shellHook = '' + update-carnix() { + carnix nix --src . + } + ''; +} diff --git a/nix-linuxkit-runner/src/main.rs b/nix-linuxkit-runner/src/main.rs new file mode 100644 index 0000000..74f29a4 --- /dev/null +++ b/nix-linuxkit-runner/src/main.rs @@ -0,0 +1,183 @@ +#[macro_use] +extern crate structopt; +extern crate ctrlc; + + +use std::path::PathBuf; +use structopt::StructOpt; +use std::process::{Command, Stdio}; +use std::{thread, time}; +use std::fs; +use std::path::Path; + +#[derive(StructOpt, Debug)] +#[structopt(name = "nix-linuxkit-runner")] +struct Config { + /// Enable verbose / debug mode + #[structopt(short = "v", long = "verbose")] + verbose: bool, + + /// Absolute path to the hyperkit executable + #[structopt(long = "hyperkit", parse(from_os_str))] + hyperkit: PathBuf, + + /// Absolute path to the vpnkit executable + #[structopt(long = "vpnkit", parse(from_os_str))] + vpnkit: PathBuf, + + /// Absolute path to the linuxkit executable + #[structopt(long = "linuxkit", parse(from_os_str))] + linuxkit: PathBuf, + + /// Root directory for storage of state + #[structopt(long = "state-root", parse(from_os_str))] + state_root: PathBuf, + + /// Root directory for the kernel files, expecting a structure like this: + /// + /// For the argument --kernel-files=/foo/bar/kernel-files/ + /// it'll look for: + /// + /// /foo/bar/kernel-files/cmdline + /// /foo/bar/kernel-files/initrd.img + /// /foo/bar/kernel-files/kernel + /// + /// For the argument --kernel-files=/foo/bar/kernel-files/foo + /// it'll look for: + /// + /// /foo/bar/kernel-files/foo-cmdline + /// /foo/bar/kernel-files/foo-initrd.img + /// /foo/bar/kernel-files/foo-kernel + #[structopt(long = "kernel-files", parse(from_os_str))] + kernel_files: PathBuf, + + /// IP address of the system + #[structopt(long = "ip")] + ip: String, + + /// Number of cores to allocate to the system + #[structopt(long = "cpus", default_value = "1")] + cpus: u8, + + /// Size of the root disk, in gigabytes + #[structopt(long = "disk-size", default_value = "80")] + disk_size: u16, + + /// Amount of RAM to allocate to the system, in megabytes + #[structopt(long = "memory", default_value = "4096")] + memory: u16, +} + +fn main() { + let options = Config::from_args(); + + let mut disk = options.state_root.clone(); + disk.push("nix-disk"); + + let mut datafile = options.state_root.clone(); + datafile.push("server-config.tar"); + + let mut vm_state = options.state_root.clone(); + vm_state.push("nix-state"); + + let mut hyperkit_pid = vm_state.clone(); + hyperkit_pid.push("hyperkit.pid"); + + if options.verbose { + println!("Hyperkit PID at: {:?}", hyperkit_pid); + } + + let hyperkit = HyperKit::new(hyperkit_pid.to_str().unwrap()); + + if hyperkit.is_running() { + hyperkit.kill_and_wait(); + } + hyperkit.delete_pidfile().expect("cannot clean up pidfile"); + + ctrlc::set_handler(move || { + println!("Killing hyperkit"); + hyperkit.kill_and_wait(); + }).expect("Error setting Ctrl-C handler"); + + let mut child = Command::new(options.linuxkit); + child.stdin(Stdio::piped()); + child.stdout(Stdio::inherit()); + child.stderr(Stdio::inherit()); + if options.verbose { + child.arg("-verbose"); + } + child.args(&["run", "hyperkit"]); + child.args(&["-hyperkit", options.hyperkit.to_str().unwrap()]); + child.args(&["-vpnkit", options.vpnkit.to_str().unwrap()]); + child.args(&["-console-file"]); + child.args(&["-networking", "vpnkit"]); + child.args(&["-ip", &options.ip]); + child.args(&["-disk", &format!("{},size={}G", disk.to_str().unwrap(), options.disk_size)]); + child.args(&["-data-file", datafile.to_str().unwrap()]); + child.args(&["-cpus", &format!("{}", options.cpus)]); + child.args(&["-mem", &format!("{}", options.memory)]); + child.args(&["-state", vm_state.to_str().unwrap()]); + child.arg(options.kernel_files.to_str().unwrap()); + + if options.verbose { + println!("executing: {:?}", child); + } + + let mut process = child.spawn().expect("Failed to spawn the linuxkit child process!"); + let result = process.wait().expect("can't wait for linuxkit?"); + println!("linuxkit's ending state: {:?}", result); + println!("Bye!"); +} + +struct HyperKit { + pidfile: String, +} + +impl HyperKit { + pub fn new(pidfile: &str) -> HyperKit { + HyperKit { + pidfile: pidfile.to_owned() + } + } + + pub fn is_running(&self) -> bool { + Command::new("/usr/bin/pgrep") + .stdin(Stdio::null()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .args(&["-F", &self.pidfile, "hyperkit"]) + .spawn().expect("Failed to spawn pgrep child process!") + .wait().expect("Can't wait for the pgrep child?") + .success() + } + + pub fn kill_and_wait(&self) { + self.kill(); + while self.is_running() { + println!("Waiting for hyperkit to die"); + thread::sleep(time::Duration::from_millis(500)); + } + } + + pub fn kill(&self) -> bool { + Command::new("/usr/bin/pkill") + .stdin(Stdio::null()) + .stdout(Stdio::null()) + .stderr(Stdio::null()) + .args(&["-F", &self.pidfile, "hyperkit"]) + .spawn().expect("Failed to spawn pkill child process!") + .wait().expect("Can't wait for the pkill child?") + .success() + } + + pub fn delete_pidfile(&self) -> Result<(),&'static str> { + if let Err(x) = fs::remove_file(&self.pidfile) { + println!("Possibly fine error removing the pidfile: {:?}", x); + } + + if Path::new(&self.pidfile).exists() { + return Err("Failed to delete hyperkit's pidfile!"); + } + return Ok(()); + } +} diff --git a/overlay.nix b/overlay.nix index 55b0d68..a9f351e 100644 --- a/overlay.nix +++ b/overlay.nix @@ -9,6 +9,7 @@ self: super: { go-vpnkit = self.callPackage ./go-vpnkit { }; linuxkit = self.callPackage ./linuxkit { }; linuxkit-builder = self.callPackage ./linuxkit-builder { }; + nix-linuxkit-runner = (self.callPackage ./nix-linuxkit-runner/Cargo.nix { }).nix_linuxkit_runner {}; nix-script-store-plugin = self.stdenv.mkDerivation { name = "nix-script-store-plugin";