├── .gitignore ├── nix-linuxkit-runner ├── .gitignore ├── shell.nix ├── Cargo.toml ├── default.nix ├── src │ └── main.rs ├── Cargo.lock └── Cargo.nix ├── default.nix ├── linuxkit-builder ├── example.nix ├── daemon.plist ├── integrated.sh ├── kernel.nix ├── ui.sh ├── stage-1.sh ├── stage-2.sh ├── configure.sh └── default.nix ├── example.nix ├── release.nix ├── nix-script-store-plugin └── default.nix ├── virtsock └── default.nix ├── go-vpnkit └── default.nix ├── vpnkit └── default.nix ├── linuxkit └── default.nix ├── overlay.nix ├── hyperkit └── default.nix ├── COPYING └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | result 2 | result-bin 3 | *~ 4 | \#*\# 5 | -------------------------------------------------------------------------------- /nix-linuxkit-runner/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | /target 3 | **/*.rs.bk 4 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import { } }: 2 | (import pkgs.path { 3 | system = "x86_64-darwin"; 4 | overlays = [ (import ./overlay.nix) ]; 5 | }) 6 | -------------------------------------------------------------------------------- /linuxkit-builder/example.nix: -------------------------------------------------------------------------------- 1 | with (import { }).forceSystem "x86_64-linux" "x86_64"; 2 | 3 | hello.overrideDerivation (x: { 4 | name = "hello-${toString builtins.currentTime}"; 5 | }) 6 | -------------------------------------------------------------------------------- /example.nix: -------------------------------------------------------------------------------- 1 | with (import { }).forceSystem "x86_64-linux" "x86_64"; 2 | 3 | dockerTools.buildImage { 4 | name = "linuxkit-builder-example-${toString builtins.currentTime}"; 5 | contents = [ hello gitAndTools.tig ]; 6 | } 7 | -------------------------------------------------------------------------------- /release.nix: -------------------------------------------------------------------------------- 1 | { 2 | inherit (import ./default.nix {}) 3 | go-vpnkit 4 | hyperkit 5 | linuxkit 6 | linuxkit-builder 7 | nix-linuxkit-runner 8 | nix-script-store-plugin 9 | virtsock 10 | vpnkit 11 | ; 12 | } 13 | -------------------------------------------------------------------------------- /nix-linuxkit-runner/shell.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import {} }: 2 | pkgs.mkShell { 3 | buildInputs = with pkgs; [ 4 | cargo 5 | carnix 6 | ]; 7 | 8 | shellHook = '' 9 | update-carnix() { 10 | carnix nix --src . 11 | } 12 | ''; 13 | } 14 | -------------------------------------------------------------------------------- /nix-linuxkit-runner/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "nix-linuxkit-runner" 3 | version = "0.1.0" 4 | authors = ["Graham Christensen "] 5 | 6 | [dependencies] 7 | structopt = "0.2" 8 | 9 | [dependencies.ctrlc] 10 | version = "3.1.0" 11 | features = [ "termination" ] -------------------------------------------------------------------------------- /linuxkit-builder/daemon.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ExitTimeOut 6 | 30 7 | Label 8 | org.nix-community.linuxkit-builder 9 | Program 10 | @builderScript@ 11 | RunAtLoad 12 | 13 | 14 | -------------------------------------------------------------------------------- /nix-linuxkit-runner/default.nix: -------------------------------------------------------------------------------- 1 | { callPackage 2 | , defaultCrateOverrides 3 | , Security 4 | }: 5 | let 6 | needSecurity = attrs: { 7 | buildInputs = [ Security ]; 8 | }; 9 | 10 | cargoDeps = callPackage ./Cargo.nix {}; 11 | 12 | runner = cargoDeps.nix_linuxkit_runner {}; 13 | in 14 | runner.override { 15 | crateOverrides = defaultCrateOverrides // { 16 | ctrlc = needSecurity; 17 | structopt-derive = needSecurity; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /linuxkit-builder/integrated.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -eu 4 | 5 | root=$(dirname "$0") 6 | 7 | ( 8 | i=0 9 | while ! ssh -F "$root/ssh-config" nix-linuxkit -o ConnectTimeout=1 true; do 10 | i=$((i + 1)) 11 | if [ "$i" -gt 30 ]; then 12 | echo "Failed to connect to the linuxkit builder within 30 tries" 13 | exit 1 14 | fi 15 | sleep 1 16 | done 17 | ) >&2 < /dev/null 18 | 19 | exec ssh -F "$root/ssh-config" nix-linuxkit nix-daemon --stdio 20 | -------------------------------------------------------------------------------- /linuxkit-builder/kernel.nix: -------------------------------------------------------------------------------- 1 | { stdenv, fetchurl, linux_4_9, linuxManualConfig, hostPlatform }: 2 | 3 | linuxManualConfig { 4 | inherit stdenv; 5 | inherit (linux_4_9) src; 6 | version = "${linux_4_9.version}-linuxkit"; 7 | configfile = fetchurl { 8 | url = https://raw.githubusercontent.com/linuxkit/linuxkit/cb1c74977297b326638daeb824983f0a2e13fdf2/kernel/kernel_config-4.9.x-x86_64; 9 | sha256 = "1lpz2q5mhvq7g5ys2s2zynibbxczqzscxbwxfbhb4mkkpps8dv08"; 10 | }; 11 | allowImportFromDerivation = true; 12 | } 13 | -------------------------------------------------------------------------------- /nix-script-store-plugin/default.nix: -------------------------------------------------------------------------------- 1 | { stdenv 2 | , fetchFromGitHub 3 | , pkgconfig 4 | , cmake 5 | , boost 6 | , nix 7 | }: 8 | stdenv.mkDerivation { 9 | name = "nix-script-store-plugin"; 10 | nativeBuildInputs = [ pkgconfig cmake ]; 11 | buildInputs = [ boost nix ]; 12 | src = fetchFromGitHub { 13 | owner = "puffnfresh"; 14 | repo = "nix-script-store-plugin"; 15 | rev = "fe6bff57d2a6b8fdefad63b1881b477a6c3e646b"; 16 | sha256 = "0b1jbnw9hl99cqcqyv0szxs1mhvxzp91gy65194yyfhrdj5rx19m"; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /virtsock/default.nix: -------------------------------------------------------------------------------- 1 | { stdenv, buildGoPackage, fetchFromGitHub }: 2 | 3 | buildGoPackage rec { 4 | name = "virtsock-unstable-${version}"; 5 | version = "2017-09-14"; 6 | rev = "cce5df4cc3fbd5966290ae44f43b407205d4a2e4"; 7 | 8 | goPackagePath = "github.com/linuxkit/virtsock"; 9 | 10 | src = fetchFromGitHub { 11 | owner = "linuxkit"; 12 | repo = "virtsock"; 13 | inherit rev; 14 | sha256 = "1qc3v9xrpzvk2xw9hgqvimwcahl9nva5jghadqzlpqw51a39didh"; 15 | }; 16 | 17 | # TODO: add metadata https://nixos.org/nixpkgs/manual/#sec-standard-meta-attributes 18 | meta = { 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /go-vpnkit/default.nix: -------------------------------------------------------------------------------- 1 | { stdenv, lib, buildGoPackage, fetchFromGitHub }: 2 | 3 | buildGoPackage rec { 4 | name = "vpnkit-${version}"; 5 | version = "0.3.0"; 6 | 7 | goPackagePath = "github.com/moby/vpnkit"; 8 | 9 | src = fetchFromGitHub { 10 | owner = "moby"; 11 | repo = "vpnkit"; 12 | rev = "v${version}"; 13 | sha256 = "04p6agsky1iyx2gd828vscyjsnfsmhpxj8g3v5654v8nznvd3r3i"; 14 | }; 15 | 16 | meta = { 17 | description = "Client commands for VPNKit"; 18 | homepage = "https://github.com/moby/vpnkit"; 19 | maintainers = [ lib.maintainers.puffnfresh ]; 20 | platforms = lib.platforms.unix; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /vpnkit/default.nix: -------------------------------------------------------------------------------- 1 | { stdenv, lib, fetchurl }: 2 | 3 | let 4 | rev = "75434cdd2c2c7c3be257f07f3b7c1a91eca27225"; 5 | in 6 | stdenv.mkDerivation rec { 7 | name = "vpnkit-${version}"; 8 | version = lib.strings.substring 0 7 rev; 9 | 10 | src = fetchurl { 11 | url = https://1013-58395340-gh.circle-artifacts.com/0/Users/distiller/vpnkit/vpnkit.tgz; 12 | sha256 = "1jcgx1cg70kdlxc7xrggk1fkb96aqn1h5sklqavpnxn08myla8bj"; 13 | }; 14 | 15 | sourceRoot = "."; 16 | 17 | installPhase = '' 18 | cp -r Contents/Resources $out 19 | ''; 20 | 21 | meta = { 22 | description = "VPN-friendly networking devices for HyperKit"; 23 | homepage = "https://github.com/moby/vpnkit"; 24 | maintainers = [ lib.maintainers.puffnfresh ]; 25 | platforms = lib.platforms.darwin; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /linuxkit/default.nix: -------------------------------------------------------------------------------- 1 | { lib, buildGoPackage, go, fetchFromGitHub }: 2 | 3 | let 4 | # Make sure to keep those in sync 5 | version = "0.6"; 6 | rev = "10f07ca"; 7 | in 8 | buildGoPackage { 9 | name = "linuxkit-${version}"; 10 | 11 | goPackagePath = "github.com/linuxkit/linuxkit"; 12 | 13 | src = fetchFromGitHub { 14 | owner = "linuxkit"; 15 | repo = "linuxkit"; 16 | rev = "v${version}"; 17 | sha256 = "12nph1sxgp7l2sb3ar7x8a2rrk2bqphca6snwbcqaqln2ixsh78i"; 18 | }; 19 | 20 | subPackages = [ "src/cmd/linuxkit" ]; 21 | 22 | preBuild = '' 23 | buildFlagsArray+=("-ldflags" "-X main.GitCommit=${rev} -X main.Version=${version}") 24 | ''; 25 | 26 | meta = { 27 | description = "A toolkit for building secure, portable and lean operating systems for containers"; 28 | license = lib.licenses.asl20; 29 | homepage = https://github.com/linuxkit/linuxkit; 30 | platforms = lib.platforms.unix; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /overlay.nix: -------------------------------------------------------------------------------- 1 | self: pkgs: { 2 | pkgsForLinux = import pkgs.path { 3 | system = "x86_64-linux"; 4 | overlays = [ (import ./overlay.nix) ]; 5 | }; 6 | 7 | hyperkit = pkgs.callPackage ./hyperkit { 8 | inherit (pkgs.darwin.apple_sdk.frameworks) Hypervisor vmnet SystemConfiguration; 9 | inherit (pkgs.darwin.apple_sdk.libs) xpc; 10 | inherit (pkgs.darwin) libobjc dtrace; 11 | }; 12 | virtsock = pkgs.callPackage ./virtsock { }; 13 | vpnkit = pkgs.callPackage ./vpnkit { }; 14 | go-vpnkit = pkgs.callPackage ./go-vpnkit { }; 15 | linuxkit = pkgs.callPackage ./linuxkit { }; 16 | linuxkit-builder = pkgs.callPackage ./linuxkit-builder { }; 17 | 18 | nix-linuxkit-runner = pkgs.callPackage ./nix-linuxkit-runner { 19 | inherit (pkgs.darwin.apple_sdk.frameworks) Security; 20 | }; 21 | 22 | nix-script-store-plugin = pkgs.callPackage ./nix-script-store-plugin { 23 | stdenv = with pkgs; if stdenv.cc.isClang then llvmPackages_6.stdenv else stdenv; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /linuxkit-builder/ui.sh: -------------------------------------------------------------------------------- 1 | #!@bash@/bin/bash -eux 2 | 3 | PATH=@coreutils@/bin:@openssh@/bin:@gnutar@/bin 4 | BOOT_FILES=@boot_files@ 5 | VPNKIT_ROOT=@vpnkit@ 6 | HYPERKIT_ROOT=@hyperkit@ 7 | LINUXKIT_ROOT=@linuxkit@ 8 | CONTAINER_IP=@containerIp@ 9 | NIX_LINUXKIT_RUNNER=@nix_linuxkit_runner@ 10 | 11 | DIR="${XDG_CACHE_HOME:-${HOME}/.cache}/nix-linuxkit-builder/" 12 | 13 | FEATURES="big-parallel" 14 | SIZE="80" 15 | CPUS=1 16 | MEM=4096 17 | VERBOSE="" 18 | 19 | cfg_path="$DIR/configure" 20 | if [ -f "$cfg_path" ]; then 21 | echo "Configuration is loaded from $cfg_path" >&2 22 | # shellcheck disable=SC1090 23 | . "$cfg_path" 24 | else 25 | echo "Configuration would be loaded from $cfg_path, but it does not exist." >&2 26 | fi 27 | 28 | ( 29 | echo 30 | echo "Reconfigure with nix-linuxkit-configure" 31 | echo 32 | echo "Current configuration options:" 33 | echo "FEATURES=$FEATURES" 34 | echo "SIZE=$SIZE" 35 | echo "MEM=$MEM" 36 | echo "VERBOSE=$VERBOSE" 37 | ) >&2 38 | 39 | exec $NIX_LINUXKIT_RUNNER/bin/nix-linuxkit-runner \ 40 | $VERBOSE \ 41 | --linuxkit "$LINUXKIT_ROOT/bin/linuxkit" \ 42 | --hyperkit "$HYPERKIT_ROOT/bin/hyperkit" \ 43 | --vpnkit "$VPNKIT_ROOT/bin/vpnkit" \ 44 | --ip "$CONTAINER_IP" \ 45 | --disk-size "$SIZE" \ 46 | --state-root "$DIR" \ 47 | --cpus "$CPUS" \ 48 | --memory "$MEM" \ 49 | --kernel-files "$BOOT_FILES/nix" 50 | -------------------------------------------------------------------------------- /hyperkit/default.nix: -------------------------------------------------------------------------------- 1 | { stdenv, lib, fetchFromGitHub, Hypervisor, vmnet, SystemConfiguration, xpc, libobjc, dtrace }: 2 | 3 | let 4 | # Make sure to keep those in sync 5 | version = "0.20180403"; 6 | rev = "06c3cf7ec253534b2d81f61ee3c85c5c9aafa4ee"; 7 | in 8 | stdenv.mkDerivation rec { 9 | name = "hyperkit-${version}"; 10 | 11 | src = fetchFromGitHub { 12 | owner = "moby"; 13 | repo = "hyperkit"; 14 | inherit rev; 15 | sha256 = "0c8fp03b65kk2lnjvg3fbcrnvxryy4f487l5l9r38r3j39aryzc2"; 16 | }; 17 | 18 | buildInputs = [ Hypervisor vmnet SystemConfiguration xpc libobjc dtrace ]; 19 | 20 | # Don't use git to determine version 21 | prePatch = '' 22 | substituteInPlace Makefile \ 23 | --replace 'shell git describe --abbrev=6 --dirty --always --tags' "$version" \ 24 | --replace 'shell git rev-parse HEAD' "${rev}" \ 25 | --replace 'PHONY: clean' 'PHONY:' 26 | make src/include/xhyve/dtrace.h 27 | ''; 28 | 29 | makeFlags = [ 30 | "CFLAGS+=-Wno-shift-sign-overflow" 31 | ''CFLAGS+=-DVERSION=\"${version}\"'' 32 | ''CFLAGS+=-DVERSION_SHA1=\"${rev}\"'' 33 | ]; 34 | 35 | installPhase = '' 36 | mkdir -p $out/bin 37 | cp build/hyperkit $out/bin 38 | ''; 39 | 40 | meta = { 41 | description = "A toolkit for embedding hypervisor capabilities in your application"; 42 | homepage = "https://github.com/moby/hyperkit"; 43 | maintainers = [ lib.maintainers.puffnfresh ]; 44 | platforms = lib.platforms.darwin; 45 | license = lib.licenses.bsd3; 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright (c) 2003-2018 Eelco Dolstra and the Nixpkgs/NixOS contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | ====================================================================== 23 | 24 | Note: the license above does not apply to the packages built by the 25 | Nix Packages collection, merely to the package descriptions (i.e., Nix 26 | expressions, build scripts, etc.). It also might not apply to patches 27 | included in Nixpkgs, which may be derivative works of the packages to 28 | which they apply. The aforementioned artifacts are all covered by the 29 | licenses of the respective packages. 30 | -------------------------------------------------------------------------------- /linuxkit-builder/stage-1.sh: -------------------------------------------------------------------------------- 1 | #! @initrdUtils@/bin/ash -eu 2 | # shellcheck shell=dash 3 | 4 | export PATH=@initrdUtils@/bin:@e2fsprogs@/bin; 5 | HD=/dev/@hd@ 6 | SYSTEM_TARBALL_PATH=@systemTarballPath@ 7 | STAGE_TWO=@stage2Init@ 8 | MODULE_LIST=@modulesClosure@/insmod-list 9 | 10 | mkdir /etc 11 | echo -n > /etc/fstab 12 | 13 | mount -t proc none /proc 14 | mount -t sysfs none /sys 15 | 16 | echo 2 > /proc/sys/vm/panic_on_oom 17 | 18 | if [ -f "$MODULE_LIST" ]; then 19 | echo "loading kernel modules..." 20 | while IFS= read -r module 21 | do 22 | insmod "$module" 23 | done < "$MODULE_LIST" 24 | else 25 | echo "Not loading kernel modules: $MODULE_LIST does not exist." 26 | fi 27 | 28 | mount -t devtmpfs devtmpfs /dev 29 | 30 | ifconfig lo up 31 | 32 | mkdir /fs 33 | 34 | if ! mount -t ext4 "$HD" /fs 2>/dev/null; then 35 | mkfs.ext4 -q "$HD" 36 | mount -t ext4 "$HD" /fs 37 | fi 38 | 39 | mkdir -p /fs/dev 40 | mount -o bind /dev /fs/dev 41 | 42 | mkdir -p /fs/dev/shm /fs/dev/pts 43 | mount -t tmpfs -o "mode=1777" none /fs/dev/shm 44 | mount -t devpts none /fs/dev/pts 45 | 46 | echo "extracting Nix store..." 47 | EXTRACT_UNSAFE_SYMLINKS=1 tar -C /fs -xf "$SYSTEM_TARBALL_PATH" nix nix-path-registration 48 | 49 | mkdir -p /fs/tmp /fs/run /fs/var 50 | mount -t tmpfs -o "mode=755" none /fs/run 51 | ln -sfn /run /fs/var/run 52 | 53 | mkdir -p /fs/proc 54 | mount -t proc none /fs/proc 55 | 56 | mkdir -p /fs/sys 57 | mount -t sysfs none /fs/sys 58 | 59 | mkdir -p /fs/etc 60 | ln -sf /proc/mounts /fs/etc/mtab 61 | echo "127.0.0.1 localhost" > /fs/etc/hosts 62 | 63 | echo "starting stage 2: $STAGE_TWO" 64 | exec switch_root /fs "$STAGE_TWO" 65 | -------------------------------------------------------------------------------- /linuxkit-builder/stage-2.sh: -------------------------------------------------------------------------------- 1 | #! @busybox@/bin/sh -eu 2 | 3 | export PATH=@busybox@/bin 4 | export SH_PATH=@busybox@/bin/sh 5 | export RUNIT_PATH=@runit@/bin/runit 6 | export MODPROBE_PATH=@script_modprobe@ 7 | export PASSWD_PATH=@file_passwd@ 8 | export GROUP_PATH=@file_group@ 9 | export BASHRC_PATH=@file_bashrc@ 10 | export POWEROFF_PATH=@script_poweroff@ 11 | export RUNIT_TARGETS_PATH=@runit_targets@ 12 | export CONTAINER_IP=@containerIp@ 13 | export NIX_STORE=@storeDir@ 14 | export NIX_BUILD_TOP=/tmp 15 | export TMPDIR=/tmp 16 | cd "$NIX_BUILD_TOP" 17 | 18 | 19 | mkdir -p /bin 20 | ln -fs "$SH_PATH" /bin/sh 21 | ln -s /proc/self/fd /dev/fd 22 | 23 | # # Set up automatic kernel module loading. 24 | cat $MODPROBE_PATH > /run/modprobe 25 | chmod 755 /run/modprobe 26 | echo /run/modprobe > /proc/sys/kernel/modprobe 27 | 28 | cat $PASSWD_PATH > /etc/passwd 29 | cat $GROUP_PATH > /etc/group 30 | 31 | mkdir -p /etc/ssh /root /var/db /var/empty 32 | chown root:root /root 33 | chmod 0700 /root 34 | 35 | cat $BASHRC_PATH > /etc/profile 36 | chmod 0555 /etc/profile 37 | # Note: I try not to reference substituted variables in the body of 38 | # the program because I think it is confusing, and easier to 39 | # understand by declaring them all at the top. However, shellcheck can 40 | # follow the bashrc only if we explicitly specif its source here, and 41 | # it won't follow a variable (even though it is statically set 42 | # above...) so, here we go. 43 | # 44 | # shellcheck source=@file_bashrc@ 45 | . $BASHRC_PATH 46 | 47 | ls -la /nix/var/nix/ || true 48 | ls -la /nix/var/nix/db || true 49 | 50 | if [ -f /nix-path-registration ]; then 51 | nix-store --load-db < /nix-path-registration 52 | nix-store --verify --check-contents 53 | rm /nix-path-registration 54 | fi 55 | 56 | ifconfig eth0 $CONTAINER_IP 57 | route add default gw 192.168.65.1 eth0 58 | echo 'nameserver 192.168.65.1' > /etc/resolv.conf 59 | 60 | mkdir -p /mnt 61 | mount /dev/sr0 /mnt 62 | 63 | if [ ! -f /mnt/config ]; then 64 | echo "FAIL FAIL FAIL" 65 | echo "You must pass an SSH key data file via via a CDROM (ie: -data on linuxkit)" 66 | exit 1 67 | fi 68 | 69 | mkdir /extract-ssh-keys 70 | ( 71 | rm -rf /root/.ssh 72 | mkdir -p /root/.ssh 73 | chmod 0700 /root/.ssh 74 | 75 | cd /extract-ssh-keys 76 | tar -xf /mnt/config 77 | chmod 0600 ./* 78 | chmod 0644 ./*.pub 79 | 80 | mv client.pub /root/.ssh/authorized_keys 81 | chmod 0600 /root/.ssh/authorized_keys 82 | chown root:root /root/.ssh/authorized_keys 83 | mv ssh_host_* /etc/ssh/ 84 | ) 85 | rm -rf /extract-ssh-keys 86 | 87 | mkdir -p /port 88 | mount -v -t 9p -o trans=virtio,dfltuid=1001,dfltgid=50,version=9p2000 port /port 89 | 90 | mkdir -p /etc/acpi/PWRF /etc/acpi/events 91 | cat $POWEROFF_PATH > /etc/acpi/PWRF/00000080 92 | chmod +x /etc/acpi/PWRF/00000080 93 | 94 | mkdir -p /dev/input /var/log 95 | 96 | rm -rf /etc/runit 97 | cp -r $RUNIT_TARGETS_PATH /etc/runit/ 98 | 99 | exec $RUNIT_PATH 100 | -------------------------------------------------------------------------------- /linuxkit-builder/configure.sh: -------------------------------------------------------------------------------- 1 | #!@bash@/bin/bash -eu 2 | 3 | PATH=@nix@/bin:@coreutils@/bin:@gnugrep@/bin:@openssh@/bin:@gnutar@/bin:@ed@:/bin 4 | HOST_PORT=@hostPort@ 5 | EXAMPLE_PATH=@example_path@ 6 | if [[ -v NIX_REMOTE ]] && [ "$NIX_REMOTE" = daemon ]; then 7 | HOME_TARGET=~root/ 8 | else 9 | HOME_TARGET=~/ 10 | fi 11 | PLIST=@plist@ 12 | 13 | usage() { 14 | echo "Usage: $(basename "$0") [-q] [-v] [-f features] [-s size] [-c cpus] [-m mem]" >&2 15 | echo "" >&2 16 | echo " -v verbose" >&2 17 | echo " -q quiet" >&2 18 | echo "" >&2 19 | echo "Multiple features: kvm,big-parallel,my-extra-feature" >&2 20 | } 21 | 22 | # Let's us keep /usr/bin out of the PATH but still use sudo =) 23 | sudo() { 24 | if [[ -v NIX_REMOTE ]] && [ "$NIX_REMOTE" = daemon ]; then 25 | /usr/bin/sudo "$@" 26 | else 27 | "$@" 28 | fi 29 | } 30 | 31 | DIR="${XDG_CACHE_HOME:-${HOME}/.cache}/nix-linuxkit-builder" 32 | 33 | FEATURES="kvm,big-parallel" 34 | SIZE="80" 35 | CPUS=1 36 | MEM=4096 37 | VERBOSE="" 38 | QUIET=0 39 | while getopts "d:f:s:c:m:hvq" opt; do 40 | case $opt in 41 | d) DIR="$OPTARG" ;; 42 | f) FEATURES="$OPTARG" ;; 43 | s) SIZE="$OPTARG" ;; 44 | c) CPUS="$OPTARG" ;; 45 | m) MEM="$OPTARG" ;; 46 | v) VERBOSE="-v" ;; 47 | q) QUIET=1 ;; 48 | h | \?) 49 | usage 50 | exit 64 51 | ;; 52 | esac 53 | done 54 | 55 | mkdir -p "$DIR" 56 | 57 | ( 58 | # When you change these, make sure you change ui.sh's config printer 59 | echo "FEATURES=$FEATURES" 60 | echo "SIZE=$SIZE" 61 | echo "MEM=$MEM" 62 | echo "VERBOSE=$VERBOSE" 63 | ) > "$DIR/configure" 64 | 65 | if [ ! -f "$DIR/server-config.tar" ]; then 66 | ( 67 | cd "$DIR" 68 | rm -rf ./keys 69 | 70 | mkdir "$DIR/keys" 71 | ( 72 | cd "$DIR/keys" 73 | ssh-keygen -C "Nix LinuxKit Builder, Client" -N "" -f client 74 | ssh-keygen -C "Nix LinuxKit Builder, Server" -f ssh_host_ecdsa_key -N "" -t ecdsa 75 | 76 | tar -cf server-config.tar client.pub ssh_host_ecdsa_key.pub ssh_host_ecdsa_key 77 | 78 | echo -n "[localhost]:$HOST_PORT " > known_host 79 | cat ssh_host_ecdsa_key.pub >> known_host 80 | ) 81 | 82 | cd "$DIR" 83 | mv ./keys/server-config.tar ./ 84 | ) 85 | fi 86 | 87 | 88 | nix-store --add-root "$DIR/gcroot" --indirect --realize "$PLIST" 89 | 90 | mkdir -p ~/Library/LaunchAgents 91 | launchctl unload ~/Library/LaunchAgents/org.nix-community.linuxkit-builder.plist 2> /dev/null || true 92 | chmod 0640 ~/Library/LaunchAgents/org.nix-community.linuxkit-builder.plist 2> /dev/null || true 93 | cp "$PLIST" ~/Library/LaunchAgents/org.nix-community.linuxkit-builder.plist 94 | chmod 0640 ~/Library/LaunchAgents/org.nix-community.linuxkit-builder.plist 2> /dev/null || true 95 | launchctl load ~/Library/LaunchAgents/org.nix-community.linuxkit-builder.plist 96 | 97 | cp "$EXAMPLE_PATH" "$DIR/example.nix" 98 | chmod u+w "$DIR/example.nix" 99 | 100 | ssh_config_path="$HOME_TARGET/.ssh/nix-linuxkit-ssh-config" 101 | echo "Setting up $ssh_config_path..." 102 | sudo mkdir -m 0700 -p "$HOME_TARGET/.ssh" 103 | 104 | cat < /dev/null 105 | Host nix-linuxkit 106 | HostName localhost 107 | User root 108 | Port $HOST_PORT 109 | IdentityFile $DIR/keys/client 110 | StrictHostKeyChecking yes 111 | UserKnownHostsFile $DIR/keys/known_host 112 | IdentitiesOnly yes 113 | EOF 114 | sudo chmod 0600 "$ssh_config_path" 115 | 116 | ssh_config_line="Include $ssh_config_path" 117 | sudo touch "$HOME_TARGET/.ssh/config" 118 | sudo chmod 0600 "$HOME_TARGET/.ssh/config" 119 | if ! sudo grep -q "$ssh_config_line" "$HOME_TARGET/.ssh/config" 2> /dev/null; then 120 | echo "Adding the SSH configuration ($ssh_config_path) to $HOME_TARGET/.ssh/config..." 121 | sudo ed -s "$HOME_TARGET/.ssh/config" < /dev/null; then 133 | echo "Adding the Nix Machines configuration (/etc/nix/machines) to /etc/nix/machines..." 134 | printf "\\n%s\\n" "$machines_config_line" | sudo tee -a "/etc/nix/machines" 135 | fi 136 | 137 | if [ $QUIET -eq 0 ]; then 138 | echo "Ok, try it out!" 139 | echo "" 140 | echo " nix-build $DIR/example.nix" 141 | echo "" 142 | echo "If this doesn't work right away, maybe wait a 10+ seconds and try again." 143 | fi 144 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | *__You should look at the 2 | [darwin.builder](https://nixos.org/manual/nixpkgs/unstable/#sec-darwin-builder), 3 | which is now part of nixpkgs.__* 4 | 5 | linuxkit-nix was started in 2017 when QEMU did not support macOS' 6 | Hypervisor.framework API. This meant that QEMU had to use full 7 | emulation with no hardware acceleration. Not ideal for building large 8 | software. 9 | 10 | QEMU also had some issues on macOS with userspace networking. 11 | 12 | At the time, LinuxKit was the easiest way to spin up a VM for builds, 13 | because it spun up HyperKit for hardware accelerated virtualisation 14 | and VPNKit for userspace networking - both used in Docker for Mac. 15 | 16 | Theoretically the underlying technology was stable but it was bit 17 | tricky to get everything working well together. There were 18 | bootstrapping issues. For example, we had to be careful when 19 | referencing `linux-x86_64` packages because we were on `darwin-x86_64` 20 | and it could only fetch from Hydra - it couldn't even build a custom 21 | shell script for the Linux VM until we got that initial VM running. 22 | 23 | This project also had issues with daemons, permissions and race 24 | conditions. 25 | 26 | In 2018, QEMU got experimental support for Hypervisor.framework and 27 | that got promoted to stable in 2019. QEMU is now fast and since 28 | nixpkgs has great support for building and running QEMU virtual 29 | machines, there's little need for this project. 30 | 31 | --- 32 | 33 | # LinuxKit Nix - Linux on Mac Nix builder 34 | 35 | [hydra jobset](https://hydra.nixos.org/jobset/linux-on-mac-builder/master) 36 | 37 | LinuxKit Nix makes it easy to build Linux binaries from a macOS machine using 38 | Nix. It's installing a VM using the native virtualization 39 | (Hypervisor.Framework) so it's quite liteweight compared to installing 40 | VirtualBox. The project also comes with an installation script that configures 41 | Nix to use the VM as a remote builder automatically. 42 | 43 | ## Requirements 44 | 45 | This project depends on Nix and a nixpkgs channel >= 18.03. 46 | 47 | ## Installation 48 | 49 | Fetch it from the NixOS binary cache: 50 | 51 | nix-env -i /nix/store/jgq3savsyyrpsxvjlrz41nx09z7r0lch-linuxkit-builder 52 | nix-linuxkit-configure 53 | 54 | It'll write to: 55 | 56 | - ~/.cache/nix-linuxkit-builder/, in particular 57 | ~/.cache/nix-linuxkit-builder/nix-state/console-ring is interesting 58 | - ~root/.ssh/ for the SSH config 59 | - /etc/nix/machines 60 | - ~/Library/LaunchAgents/org.nix-community.linuxkit-builder.plist 61 | 62 | Once installed the daemon should automatically start and stay running. 63 | 64 | ## Debugging 65 | 66 | To see if the daemon is running execute the following command and look at the 67 | first column. If it has a number (PID) it's running, if it's `-` then it's 68 | stopped: 69 | 70 | launchctl list | grep linuxkit 71 | 72 | You can force start it with: 73 | 74 | launchctl start org.nix-community.linuxkit-builder 75 | 76 | You can force stop it with: 77 | 78 | launchctl stop org.nix-community.linuxkit-builder 79 | 80 | If after you stop it you may want to check for processes, like: 81 | 82 | pgrep vpnkit 83 | pgrep linuxkit 84 | pgrep hyperkit 85 | 86 | If something goes wrong and it didn't stop properly, you can try: 87 | 88 | pkill -F ~/.cache/nix-linuxkit-builder/nix-state/hyperkit.pid hyperkit 89 | 90 | ## Troubleshooting 91 | 92 | ### `cannot build on 'ssh://nix-linuxkit': cannot connect to 'nix-linuxkit' ...` 93 | 94 | When runninng `nix-linuxkit-configure`, an SSH config is created at 95 | `/var/root/.ssh/nix-linuxkit-ssh-config`. Copy the contents of that SSH config 96 | into your regular SSH config located at `~/.ssh/config`. 97 | 98 | ### `error: 'x86_64-linux' is require to build ...` 99 | 100 | Check the `/etc/nix/nix.conf` file for a `builders` option. It should either 101 | be set to `@/etc/nix/machines` or not set at all for LinuxKit Nix to work 102 | properly. 103 | 104 | Another solution is to set `export NIX_REMOTE_SYSTEMS=/etc/nix/machines` 105 | before running the nix or nixops command. 106 | 107 | ### `cannot build on 'ssh://nix-linuxkit': cannot connect ...: Operation timed out` 108 | 109 | Something is wrong with LinuxKit. See the debugging section to try things out. 110 | 111 | Leave an issue at https://github.com/nix-community/linuxkit-nix/issues 112 | 113 | ## Uninstalling 114 | 115 | ```sh 116 | # Remove configuration 117 | rm -rf ~/.cache/nix-linuxkit-builder/ 118 | 119 | # Remove build machine 120 | # (edit manually if you have other configuration here) 121 | sudo rm -f /etc/nix/machines 122 | 123 | # Remove LaunchAgent 124 | launchctl stop org.nix-community.linuxkit-builder 125 | rm -f ~/Library/LaunchAgents/org.nix-community.linuxkit-builder.plist 126 | 127 | # Remove SSH config 128 | # (edit manually if you have other configuration here) 129 | sudo rm -rf /var/root/.ssh 130 | 131 | # Uninstall Nix package 132 | nix-env -e linuxkit-builder 133 | ``` 134 | -------------------------------------------------------------------------------- /nix-linuxkit-runner/src/main.rs: -------------------------------------------------------------------------------- 1 | #[macro_use] 2 | extern crate structopt; 3 | extern crate ctrlc; 4 | 5 | 6 | use std::path::PathBuf; 7 | use structopt::StructOpt; 8 | use std::process::{Command, Stdio}; 9 | use std::{thread, time}; 10 | use std::fs; 11 | use std::path::Path; 12 | 13 | #[derive(StructOpt, Debug)] 14 | #[structopt(name = "nix-linuxkit-runner")] 15 | struct Config { 16 | /// Enable verbose / debug mode 17 | #[structopt(short = "v", long = "verbose")] 18 | verbose: bool, 19 | 20 | /// Absolute path to the hyperkit executable 21 | #[structopt(long = "hyperkit", parse(from_os_str))] 22 | hyperkit: PathBuf, 23 | 24 | /// Absolute path to the vpnkit executable 25 | #[structopt(long = "vpnkit", parse(from_os_str))] 26 | vpnkit: PathBuf, 27 | 28 | /// Absolute path to the linuxkit executable 29 | #[structopt(long = "linuxkit", parse(from_os_str))] 30 | linuxkit: PathBuf, 31 | 32 | /// Root directory for storage of state 33 | #[structopt(long = "state-root", parse(from_os_str))] 34 | state_root: PathBuf, 35 | 36 | /// Root directory for the kernel files, expecting a structure like this: 37 | /// 38 | /// For the argument --kernel-files=/foo/bar/kernel-files/ 39 | /// it'll look for: 40 | /// 41 | /// /foo/bar/kernel-files/cmdline 42 | /// /foo/bar/kernel-files/initrd.img 43 | /// /foo/bar/kernel-files/kernel 44 | /// 45 | /// For the argument --kernel-files=/foo/bar/kernel-files/foo 46 | /// it'll look for: 47 | /// 48 | /// /foo/bar/kernel-files/foo-cmdline 49 | /// /foo/bar/kernel-files/foo-initrd.img 50 | /// /foo/bar/kernel-files/foo-kernel 51 | #[structopt(long = "kernel-files", parse(from_os_str))] 52 | kernel_files: PathBuf, 53 | 54 | /// IP address of the system 55 | #[structopt(long = "ip")] 56 | ip: String, 57 | 58 | /// Number of cores to allocate to the system 59 | #[structopt(long = "cpus", default_value = "1")] 60 | cpus: u8, 61 | 62 | /// Size of the root disk, in gigabytes 63 | #[structopt(long = "disk-size", default_value = "80")] 64 | disk_size: u16, 65 | 66 | /// Amount of RAM to allocate to the system, in megabytes 67 | #[structopt(long = "memory", default_value = "4096")] 68 | memory: u16, 69 | } 70 | 71 | fn main() { 72 | let options = Config::from_args(); 73 | 74 | let mut disk = options.state_root.clone(); 75 | disk.push("nix-disk"); 76 | 77 | let mut datafile = options.state_root.clone(); 78 | datafile.push("server-config.tar"); 79 | 80 | let mut vm_state = options.state_root.clone(); 81 | vm_state.push("nix-state"); 82 | 83 | let mut hyperkit_pid = vm_state.clone(); 84 | hyperkit_pid.push("hyperkit.pid"); 85 | 86 | if options.verbose { 87 | println!("Hyperkit PID at: {:?}", hyperkit_pid); 88 | } 89 | 90 | let hyperkit = HyperKit::new(hyperkit_pid.to_str().unwrap()); 91 | 92 | if hyperkit.is_running() { 93 | hyperkit.kill_and_wait(); 94 | } 95 | hyperkit.delete_pidfile().expect("cannot clean up pidfile"); 96 | 97 | ctrlc::set_handler(move || { 98 | println!("Killing hyperkit"); 99 | hyperkit.kill_and_wait(); 100 | }).expect("Error setting Ctrl-C handler"); 101 | 102 | let mut child = Command::new(options.linuxkit); 103 | child.stdin(Stdio::piped()); 104 | child.stdout(Stdio::inherit()); 105 | child.stderr(Stdio::inherit()); 106 | if options.verbose { 107 | child.arg("-v"); 108 | } 109 | child.args(&["run", "hyperkit"]); 110 | child.args(&["-hyperkit", options.hyperkit.to_str().unwrap()]); 111 | child.args(&["-vpnkit", options.vpnkit.to_str().unwrap()]); 112 | child.args(&["-console-file"]); 113 | child.args(&["-networking", "vpnkit"]); 114 | child.args(&["-ip", &options.ip]); 115 | child.args(&["-disk", &format!("{},size={}G", disk.to_str().unwrap(), options.disk_size)]); 116 | child.args(&["-data-file", datafile.to_str().unwrap()]); 117 | child.args(&["-cpus", &format!("{}", options.cpus)]); 118 | child.args(&["-mem", &format!("{}", options.memory)]); 119 | child.args(&["-state", vm_state.to_str().unwrap()]); 120 | child.arg(options.kernel_files.to_str().unwrap()); 121 | 122 | if options.verbose { 123 | println!("executing: {:?}", child); 124 | } 125 | 126 | let mut process = child.spawn().expect("Failed to spawn the linuxkit child process!"); 127 | let result = process.wait().expect("can't wait for linuxkit?"); 128 | println!("linuxkit's ending state: {:?}", result); 129 | println!("Bye!"); 130 | } 131 | 132 | struct HyperKit { 133 | pidfile: String, 134 | } 135 | 136 | impl HyperKit { 137 | pub fn new(pidfile: &str) -> HyperKit { 138 | HyperKit { 139 | pidfile: pidfile.to_owned() 140 | } 141 | } 142 | 143 | pub fn is_running(&self) -> bool { 144 | Command::new("/usr/bin/pgrep") 145 | .stdin(Stdio::null()) 146 | .stdout(Stdio::null()) 147 | .stderr(Stdio::null()) 148 | .args(&["-F", &self.pidfile, "hyperkit"]) 149 | .spawn().expect("Failed to spawn pgrep child process!") 150 | .wait().expect("Can't wait for the pgrep child?") 151 | .success() 152 | } 153 | 154 | pub fn kill_and_wait(&self) { 155 | self.kill(); 156 | while self.is_running() { 157 | println!("Waiting for hyperkit to die"); 158 | thread::sleep(time::Duration::from_millis(500)); 159 | } 160 | } 161 | 162 | pub fn kill(&self) -> bool { 163 | Command::new("/usr/bin/pkill") 164 | .stdin(Stdio::null()) 165 | .stdout(Stdio::null()) 166 | .stderr(Stdio::null()) 167 | .args(&["-F", &self.pidfile, "hyperkit"]) 168 | .spawn().expect("Failed to spawn pkill child process!") 169 | .wait().expect("Can't wait for the pkill child?") 170 | .success() 171 | } 172 | 173 | pub fn delete_pidfile(&self) -> Result<(),&'static str> { 174 | if let Err(x) = fs::remove_file(&self.pidfile) { 175 | println!("Possibly fine error removing the pidfile: {:?}", x); 176 | } 177 | 178 | if Path::new(&self.pidfile).exists() { 179 | return Err("Failed to delete hyperkit's pidfile!"); 180 | } 181 | return Ok(()); 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /linuxkit-builder/default.nix: -------------------------------------------------------------------------------- 1 | # Builds a script to start a Linux x86_64 remote builder using LinuxKit. This 2 | # script relies on darwin-x86_64 and linux-x86_64 dependencies so an existing 3 | # remote builder should be used. 4 | 5 | # The VM runs SSH with Nix available, so we can use it as a remote builder. 6 | 7 | # TODO: Sadly this file has lots of duplication with vmTools. 8 | 9 | { system 10 | , stdenv 11 | , path 12 | , pixz 13 | , bash 14 | , nix 15 | , closureInfo 16 | , hyperkit 17 | , vpnkit 18 | , linuxkit 19 | , nix-linuxkit-runner 20 | , buildEnv 21 | , writeScript 22 | , writeText 23 | , writeTextFile 24 | , runCommand 25 | , vmTools 26 | , makeInitrd 27 | , shellcheck 28 | , coreutils 29 | , openssh 30 | , gnutar 31 | , gnugrep 32 | , ed 33 | , substituteAll 34 | , pkgsForLinux 35 | , linuxkitKernel ? pkgsForLinux.callPackage ./kernel.nix { } 36 | , storeDir ? builtins.storeDir 37 | 38 | , hostPort ? "24083" 39 | }: 40 | 41 | let 42 | writeScriptDir = name: text: writeTextFile {inherit name text; executable = true; destination = "/${name}"; }; 43 | writeRunitForegroundService = name: run: writeTextFile {inherit name; text = run; executable = true; destination = "/${name}/run"; }; 44 | shellcheckedScriptBin = name: src: substitutions: runCommand "shellchecked-${name}" { 45 | sub_src = shellcheckedScript name src substitutions; 46 | } "mkdir -p $out/bin; cp $sub_src $out/bin/${name}"; 47 | shellcheckedScript = name: src: substitutions: runCommand "shellchecked-${name}" (substitutions // { 48 | buildInputs = [ shellcheck ]; 49 | }) '' 50 | cp ${src} './${name}' 51 | substituteAllInPlace '${name}' 52 | patchShebangs '${name}' 53 | 54 | if grep -qE '@[^[:space:]]+@' '${name}'; then 55 | echo "WARNING: Found @alpha@ placeholders!" 56 | grep -E '@[^[:space:]]+@' '${name}' 57 | exit 1 58 | fi 59 | 60 | if [ "''${debug:-0}" -eq 1 ]; then 61 | cat '${name}' 62 | fi 63 | 64 | shellcheck -x '${name}' 65 | chmod +x '${name}' 66 | mv '${name}' $out 67 | ''; 68 | 69 | vmToolsLinux = vmTools.override { kernel = linuxkitKernel; pkgs = pkgsForLinux; }; 70 | containerIp = "192.168.65.2"; 71 | 72 | hd = "sda"; 73 | systemTarball = import "${toString path}/nixos/lib/make-system-tarball.nix" { 74 | inherit stdenv closureInfo pixz; 75 | contents = []; 76 | storeContents = [ 77 | { 78 | object = stage2Init; 79 | symlink = "none"; 80 | } 81 | ]; 82 | }; 83 | stage1Init = shellcheckedScript "vm-run-stage1" ./stage-1.sh { 84 | inherit (vmToolsLinux) initrdUtils; 85 | inherit (vmToolsLinux) modulesClosure; 86 | inherit (pkgsForLinux) e2fsprogs; 87 | inherit hd stage2Init; 88 | systemTarballPath = "${systemTarball}/tarball/nixos-system-${system}.tar.xz"; 89 | }; 90 | 91 | sshdConfig = writeText "linuxkit-sshd-config" '' 92 | LogLevel VERBOSE 93 | PermitRootLogin yes 94 | PasswordAuthentication no 95 | ChallengeResponseAuthentication no 96 | ''; 97 | 98 | stage2Init = shellcheckedScript "vm-run-stage2" ./stage-2.sh rec { 99 | inherit (pkgsForLinux) busybox runit; 100 | inherit storeDir containerIp; 101 | 102 | script_modprobe = writeScript "modeprobe" '' 103 | #! /bin/sh 104 | export MODULE_DIR=${linuxkitKernel}/lib/modules/ 105 | exec ${pkgsForLinux.kmod}/bin/modprobe "$@" 106 | ''; 107 | 108 | file_passwd = let 109 | wrapped_shell = writeScript "busybox-sh-wrapper" '' 110 | #!${pkgsForLinux.busybox}/bin/sh 111 | exec ${pkgsForLinux.busybox}/bin/sh -l "$@" 112 | ''; 113 | in writeText "passwd" '' 114 | root:x:0:0:System administrator:/root:${wrapped_shell} 115 | sshd:x:1:65534:SSH privilege separation user:/var/empty:${pkgsForLinux.busybox}/bin/false 116 | nixbld1:x:30001:30000:Nix build user 1:/var/empty:${pkgsForLinux.busybox}/bin/false 117 | ''; 118 | 119 | file_group = writeText "group" '' 120 | nixbld:x:30000:nixbld1 121 | root:x:0:root 122 | ''; 123 | 124 | file_bashrc = writeScript "bashrc" '' 125 | export PATH="${vmToolsLinux.initrdUtils}/bin:${pkgsForLinux.nix}/bin" 126 | export NIX_SSL_CERT_FILE='${pkgsForLinux.cacert}/etc/ssl/certs/ca-bundle.crt' 127 | ''; 128 | 129 | script_poweroff = writeScript "poweroff" '' 130 | #!/bin/sh 131 | exec ${pkgsForLinux.busybox}/bin/poweroff -f 132 | ''; 133 | 134 | file_instructions = writeText "instructions" '' 135 | ====================================================================== 136 | Remote builder has started. 137 | 138 | If this is a fresh VM you need to run the following on the host: 139 | ~/.nixpkgs/linuxkit-builder/finish-setup.sh 140 | 141 | 142 | Exit this VM by running: 143 | kill $(cat ~/.nixpkgs/linuxkit-builder/nix-state/hyperkit.pid) 144 | 145 | Or, in this terminal, type 'stop'. 146 | ====================================================================== 147 | ''; 148 | 149 | runit_targets = buildEnv { 150 | name = "runit-targets"; 151 | paths = [ 152 | # Startup 153 | (writeScriptDir "1" '' 154 | #!/bin/sh 155 | echo 'Hello world!' 156 | touch /etc/runit/stopit 157 | chmod 0 /etc/runit/stopit 158 | '') 159 | 160 | # Run-time 161 | (writeScriptDir "2" '' 162 | #!/bin/sh 163 | echo "Entering run-time" 164 | 165 | cat /proc/uptime 166 | echo "Running services in ${service_targets}..." 167 | exec ${pkgsForLinux.runit}/bin/runsvdir -P ${service_targets} 168 | '') 169 | 170 | # Shutdown 171 | (writeScriptDir "3" '' 172 | #!/bin/sh 173 | echo 'Ok, bye...' 174 | '') 175 | ]; 176 | }; 177 | 178 | service_targets = buildEnv { 179 | name = "service-targets"; 180 | paths = [ 181 | (writeRunitForegroundService "acpid" '' 182 | #!/bin/sh 183 | mkdir -p /var/lib/acpid && cd /var/lib/acpid 184 | exec ${pkgsForLinux.busybox}/bin/acpid -f 185 | '') 186 | 187 | (writeRunitForegroundService "sshd" '' 188 | #!/bin/sh 189 | mkdir -p /var/lib/sshd && cd /var/lib/sshd 190 | exec ${pkgsForLinux.openssh}/bin/sshd -D -e -f ${sshdConfig} 191 | '') 192 | 193 | (writeRunitForegroundService "vpnkit-expose-port" '' 194 | #!/bin/sh 195 | mkdir -p /var/lib/vpnkit-expose-port && cd /var/lib/vpnkit-expose-port 196 | 197 | ${pkgsForLinux.go-vpnkit}/bin/vpnkit-expose-port \ 198 | -i \ 199 | -host-ip 127.0.0.1 -host-port ${hostPort} \ 200 | -container-ip 192.168.65.2 -container-port 22 \ 201 | -no-local-ip 202 | echo "VPNKit expose port exited $?, which may be fine" 203 | kill -stop $$ 204 | '') 205 | 206 | (writeRunitForegroundService "vpnkit-forwarder" '' 207 | #!/bin/sh 208 | 209 | mkdir -p /var/lib/vpnkit-forwarder && cd /var/lib/vpnkit-forwarder 210 | exec ${pkgsForLinux.go-vpnkit}/bin/vpnkit-forwarder 211 | '') 212 | ]; 213 | }; 214 | }; 215 | 216 | img = "bzImage"; 217 | initrd = makeInitrd { 218 | contents = [ 219 | { object = stage1Init; 220 | symlink = "/init"; 221 | } 222 | ]; 223 | }; 224 | 225 | builderScript = shellcheckedScript "nix-linuxkit-builder" ./ui.sh { 226 | inherit bash hostPort vpnkit hyperkit linuxkit containerIp coreutils 227 | openssh gnutar; 228 | nix_linuxkit_runner = nix-linuxkit-runner; 229 | 230 | boot_files = runCommand "linuxkit-kernel-files" { 231 | kernel_path = "${linuxkitKernel}/${img}"; 232 | initrd_path = "${initrd}/initrd"; 233 | kernel_cmdline_path = writeText "nix-cmdline" 234 | "console=ttyS0 panic=1 command=${stage2Init} loglevel=7 debug noapic nolapic"; 235 | } '' 236 | mkdir $out 237 | cd $out 238 | 239 | ln -fs $kernel_path "./nix-kernel" 240 | ln -fs $initrd_path "./nix-initrd.img" 241 | ln -fs $kernel_cmdline_path "./nix-cmdline" 242 | ''; 243 | integrated_path = ./integrated.sh; 244 | example_path = ./example.nix; 245 | }; 246 | 247 | plist = substituteAll { 248 | src = ./daemon.plist; 249 | inherit builderScript; 250 | }; 251 | 252 | in buildEnv { 253 | name = "linuxkit-builder"; 254 | paths = [ 255 | (shellcheckedScriptBin "nix-linuxkit-configure" ./configure.sh { 256 | inherit bash hostPort coreutils openssh gnutar gnugrep ed plist nix; 257 | example_path = ./example.nix; 258 | }) 259 | 260 | ]; 261 | } 262 | -------------------------------------------------------------------------------- /nix-linuxkit-runner/Cargo.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "ansi_term" 3 | version = "0.11.0" 4 | source = "registry+https://github.com/rust-lang/crates.io-index" 5 | dependencies = [ 6 | "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", 7 | ] 8 | 9 | [[package]] 10 | name = "atty" 11 | version = "0.2.10" 12 | source = "registry+https://github.com/rust-lang/crates.io-index" 13 | dependencies = [ 14 | "libc 0.2.41 (registry+https://github.com/rust-lang/crates.io-index)", 15 | "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 16 | "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", 17 | ] 18 | 19 | [[package]] 20 | name = "bitflags" 21 | version = "0.9.1" 22 | source = "registry+https://github.com/rust-lang/crates.io-index" 23 | 24 | [[package]] 25 | name = "bitflags" 26 | version = "1.0.3" 27 | source = "registry+https://github.com/rust-lang/crates.io-index" 28 | 29 | [[package]] 30 | name = "cfg-if" 31 | version = "0.1.3" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | 34 | [[package]] 35 | name = "clap" 36 | version = "2.31.2" 37 | source = "registry+https://github.com/rust-lang/crates.io-index" 38 | dependencies = [ 39 | "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 40 | "atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", 41 | "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", 42 | "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 43 | "textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 44 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 45 | "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 46 | ] 47 | 48 | [[package]] 49 | name = "ctrlc" 50 | version = "3.1.0" 51 | source = "registry+https://github.com/rust-lang/crates.io-index" 52 | dependencies = [ 53 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 54 | "nix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 55 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 56 | ] 57 | 58 | [[package]] 59 | name = "kernel32-sys" 60 | version = "0.2.2" 61 | source = "registry+https://github.com/rust-lang/crates.io-index" 62 | dependencies = [ 63 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 64 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 65 | ] 66 | 67 | [[package]] 68 | name = "libc" 69 | version = "0.2.41" 70 | source = "registry+https://github.com/rust-lang/crates.io-index" 71 | 72 | [[package]] 73 | name = "nix" 74 | version = "0.9.0" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | dependencies = [ 77 | "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", 78 | "cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 79 | "libc 0.2.41 (registry+https://github.com/rust-lang/crates.io-index)", 80 | "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", 81 | ] 82 | 83 | [[package]] 84 | name = "nix-linuxkit-runner" 85 | version = "0.1.0" 86 | dependencies = [ 87 | "ctrlc 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 88 | "structopt 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 89 | ] 90 | 91 | [[package]] 92 | name = "proc-macro2" 93 | version = "0.3.8" 94 | source = "registry+https://github.com/rust-lang/crates.io-index" 95 | dependencies = [ 96 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 97 | ] 98 | 99 | [[package]] 100 | name = "quote" 101 | version = "0.5.2" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | dependencies = [ 104 | "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 105 | ] 106 | 107 | [[package]] 108 | name = "redox_syscall" 109 | version = "0.1.38" 110 | source = "registry+https://github.com/rust-lang/crates.io-index" 111 | 112 | [[package]] 113 | name = "redox_termios" 114 | version = "0.1.1" 115 | source = "registry+https://github.com/rust-lang/crates.io-index" 116 | dependencies = [ 117 | "redox_syscall 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", 118 | ] 119 | 120 | [[package]] 121 | name = "strsim" 122 | version = "0.7.0" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | 125 | [[package]] 126 | name = "structopt" 127 | version = "0.2.8" 128 | source = "registry+https://github.com/rust-lang/crates.io-index" 129 | dependencies = [ 130 | "clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)", 131 | "structopt-derive 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 132 | ] 133 | 134 | [[package]] 135 | name = "structopt-derive" 136 | version = "0.2.8" 137 | source = "registry+https://github.com/rust-lang/crates.io-index" 138 | dependencies = [ 139 | "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 140 | "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", 141 | "syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)", 142 | ] 143 | 144 | [[package]] 145 | name = "syn" 146 | version = "0.13.11" 147 | source = "registry+https://github.com/rust-lang/crates.io-index" 148 | dependencies = [ 149 | "proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", 150 | "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", 151 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 152 | ] 153 | 154 | [[package]] 155 | name = "termion" 156 | version = "1.5.1" 157 | source = "registry+https://github.com/rust-lang/crates.io-index" 158 | dependencies = [ 159 | "libc 0.2.41 (registry+https://github.com/rust-lang/crates.io-index)", 160 | "redox_syscall 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", 161 | "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 162 | ] 163 | 164 | [[package]] 165 | name = "textwrap" 166 | version = "0.9.0" 167 | source = "registry+https://github.com/rust-lang/crates.io-index" 168 | dependencies = [ 169 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 170 | ] 171 | 172 | [[package]] 173 | name = "unicode-width" 174 | version = "0.1.5" 175 | source = "registry+https://github.com/rust-lang/crates.io-index" 176 | 177 | [[package]] 178 | name = "unicode-xid" 179 | version = "0.1.0" 180 | source = "registry+https://github.com/rust-lang/crates.io-index" 181 | 182 | [[package]] 183 | name = "vec_map" 184 | version = "0.8.1" 185 | source = "registry+https://github.com/rust-lang/crates.io-index" 186 | 187 | [[package]] 188 | name = "void" 189 | version = "1.0.2" 190 | source = "registry+https://github.com/rust-lang/crates.io-index" 191 | 192 | [[package]] 193 | name = "winapi" 194 | version = "0.2.8" 195 | source = "registry+https://github.com/rust-lang/crates.io-index" 196 | 197 | [[package]] 198 | name = "winapi" 199 | version = "0.3.4" 200 | source = "registry+https://github.com/rust-lang/crates.io-index" 201 | dependencies = [ 202 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 203 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 204 | ] 205 | 206 | [[package]] 207 | name = "winapi-build" 208 | version = "0.1.1" 209 | source = "registry+https://github.com/rust-lang/crates.io-index" 210 | 211 | [[package]] 212 | name = "winapi-i686-pc-windows-gnu" 213 | version = "0.4.0" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | 216 | [[package]] 217 | name = "winapi-x86_64-pc-windows-gnu" 218 | version = "0.4.0" 219 | source = "registry+https://github.com/rust-lang/crates.io-index" 220 | 221 | [metadata] 222 | "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" 223 | "checksum atty 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2fc4a1aa4c24c0718a250f0681885c1af91419d242f29eb8f2ab28502d80dbd1" 224 | "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" 225 | "checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789" 226 | "checksum cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "405216fd8fe65f718daa7102ea808a946b6ce40c742998fbfd3463645552de18" 227 | "checksum clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f0f16b89cbb9ee36d87483dc939fe9f1e13c05898d56d7b230a0d4dff033a536" 228 | "checksum ctrlc 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "653abc99aa905f693d89df4797fadc08085baee379db92be9f2496cefe8a6f2c" 229 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 230 | "checksum libc 0.2.41 (registry+https://github.com/rust-lang/crates.io-index)" = "ac8ebf8343a981e2fa97042b14768f02ed3e1d602eac06cae6166df3c8ced206" 231 | "checksum nix 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a2c5afeb0198ec7be8569d666644b574345aad2e95a53baf3a532da3e0f3fb32" 232 | "checksum proc-macro2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1b06e2f335f48d24442b35a19df506a835fb3547bc3c06ef27340da9acf5cae7" 233 | "checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" 234 | "checksum redox_syscall 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "0a12d51a5b5fd700e6c757f15877685bfa04fd7eb60c108f01d045cafa0073c2" 235 | "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" 236 | "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" 237 | "checksum structopt 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b96fc11ba8cf80bfa5cdd6de538c9f7c66f519f83e8caabc554e431bf3e36d" 238 | "checksum structopt-derive 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "95063e55a45976cfce9f03fcd26dff356ee622f1a14147bfae068ab8bed153a6" 239 | "checksum syn 0.13.11 (registry+https://github.com/rust-lang/crates.io-index)" = "14f9bf6292f3a61d2c716723fdb789a41bbe104168e6f496dc6497e531ea1b9b" 240 | "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" 241 | "checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693" 242 | "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" 243 | "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 244 | "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" 245 | "checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" 246 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 247 | "checksum winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "04e3bd221fcbe8a271359c04f21a76db7d0c6028862d1bb5512d85e1e2eb5bb3" 248 | "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 249 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 250 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 251 | -------------------------------------------------------------------------------- /nix-linuxkit-runner/Cargo.nix: -------------------------------------------------------------------------------- 1 | # Generated by carnix 0.7.2: carnix nix --src . 2 | { lib, buildPlatform, buildRustCrate, fetchgit }: 3 | let kernel = buildPlatform.parsed.kernel.name; 4 | abi = buildPlatform.parsed.abi.name; 5 | include = includedFiles: src: builtins.filterSource (path: type: 6 | lib.lists.any (f: 7 | let p = toString (src + ("/" + f)); in 8 | (path == p) || (type == "directory" && lib.strings.hasPrefix path p) 9 | ) includedFiles 10 | ) src; 11 | updateFeatures = f: up: functions: builtins.deepSeq f (lib.lists.foldl' (features: fun: fun features) (lib.attrsets.recursiveUpdate f up) functions); 12 | mapFeatures = features: map (fun: fun { features = features; }); 13 | mkFeatures = feat: lib.lists.foldl (features: featureName: 14 | if feat.${featureName} or false then 15 | [ featureName ] ++ features 16 | else 17 | features 18 | ) [] (builtins.attrNames feat); 19 | in 20 | rec { 21 | 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; }; }; 22 | __all = [ (nix_linuxkit_runner {}) ]; 23 | ansi_term_0_11_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 24 | crateName = "ansi_term"; 25 | version = "0.11.0"; 26 | authors = [ "ogham@bsago.me" "Ryan Scheel (Havvy) " "Josh Triplett " ]; 27 | sha256 = "08fk0p2xvkqpmz3zlrwnf6l8sj2vngw464rvzspzp31sbgxbwm4v"; 28 | inherit dependencies buildDependencies features; 29 | }; 30 | atty_0_2_10_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 31 | crateName = "atty"; 32 | version = "0.2.10"; 33 | authors = [ "softprops " ]; 34 | sha256 = "1h26lssj8rwaz0xhwwm5a645r49yly211amfmd243m3m0jl49i2c"; 35 | inherit dependencies buildDependencies features; 36 | }; 37 | bitflags_0_9_1_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 38 | crateName = "bitflags"; 39 | version = "0.9.1"; 40 | authors = [ "The Rust Project Developers" ]; 41 | sha256 = "18h073l5jd88rx4qdr95fjddr9rk79pb1aqnshzdnw16cfmb9rws"; 42 | inherit dependencies buildDependencies features; 43 | }; 44 | bitflags_1_0_3_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 45 | crateName = "bitflags"; 46 | version = "1.0.3"; 47 | authors = [ "The Rust Project Developers" ]; 48 | sha256 = "162p4w4h1ad76awq6b5yivmls3d50m9cl27d8g588lsps6g8s5rw"; 49 | inherit dependencies buildDependencies features; 50 | }; 51 | cfg_if_0_1_3_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 52 | crateName = "cfg-if"; 53 | version = "0.1.3"; 54 | authors = [ "Alex Crichton " ]; 55 | sha256 = "0hphfz5qg40gr5p18gmgy2rzkqj019lii3n0dy3s0a6lnl9106k6"; 56 | inherit dependencies buildDependencies features; 57 | }; 58 | clap_2_31_2_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 59 | crateName = "clap"; 60 | version = "2.31.2"; 61 | authors = [ "Kevin K. " ]; 62 | sha256 = "0r24ziw85a8y1sf2l21y4mvv5qan3rjafcshpyfsjfadqfxsij72"; 63 | inherit dependencies buildDependencies features; 64 | }; 65 | ctrlc_3_1_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 66 | crateName = "ctrlc"; 67 | version = "3.1.0"; 68 | authors = [ "Antti Keränen " "nabijaczleweli " "Henning Ottesen " "Peter Atashian " ]; 69 | sha256 = "1dspgfaqvipmmzr3ihjphxsrnlzq5zbnv3z1k0799rlm39d98cy2"; 70 | inherit dependencies buildDependencies features; 71 | }; 72 | kernel32_sys_0_2_2_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 73 | crateName = "kernel32-sys"; 74 | version = "0.2.2"; 75 | authors = [ "Peter Atashian " ]; 76 | sha256 = "1lrw1hbinyvr6cp28g60z97w32w8vsk6pahk64pmrv2fmby8srfj"; 77 | libName = "kernel32"; 78 | build = "build.rs"; 79 | inherit dependencies buildDependencies features; 80 | }; 81 | libc_0_2_41_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 82 | crateName = "libc"; 83 | version = "0.2.41"; 84 | authors = [ "The Rust Project Developers" ]; 85 | sha256 = "00fj3gi8x3zvslbnisw8xfgmid3k6nvgjg8i0lly50cf3l8x0s00"; 86 | inherit dependencies buildDependencies features; 87 | }; 88 | nix_0_9_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 89 | crateName = "nix"; 90 | version = "0.9.0"; 91 | authors = [ "The nix-rust Project Developers" ]; 92 | sha256 = "00p63bphzwwn460rja5l2wcpgmv7ljf7illf6n95cppx63d180q0"; 93 | inherit dependencies buildDependencies features; 94 | }; 95 | nix_linuxkit_runner_0_1_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 96 | crateName = "nix-linuxkit-runner"; 97 | version = "0.1.0"; 98 | authors = [ "Graham Christensen " ]; 99 | src = ./.; 100 | inherit dependencies buildDependencies features; 101 | }; 102 | proc_macro2_0_3_8_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 103 | crateName = "proc-macro2"; 104 | version = "0.3.8"; 105 | authors = [ "Alex Crichton " ]; 106 | sha256 = "0ixnavxcd6sk1861hjgnfxly7qgq4ch1iplsx0nclvjjkwg39qdc"; 107 | inherit dependencies buildDependencies features; 108 | }; 109 | quote_0_5_2_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 110 | crateName = "quote"; 111 | version = "0.5.2"; 112 | authors = [ "David Tolnay " ]; 113 | sha256 = "062cnp12j09x0z0nj4j5pfh26h35zlrks07asxgqhfhcym1ba595"; 114 | inherit dependencies buildDependencies features; 115 | }; 116 | redox_syscall_0_1_38_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 117 | crateName = "redox_syscall"; 118 | version = "0.1.38"; 119 | authors = [ "Jeremy Soller " ]; 120 | sha256 = "09giwh6n37sya45g9b2k7svmm42xh8bfrnab3g51qwm1czfz5xbx"; 121 | libName = "syscall"; 122 | inherit dependencies buildDependencies features; 123 | }; 124 | redox_termios_0_1_1_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 125 | crateName = "redox_termios"; 126 | version = "0.1.1"; 127 | authors = [ "Jeremy Soller " ]; 128 | sha256 = "04s6yyzjca552hdaqlvqhp3vw0zqbc304md5czyd3axh56iry8wh"; 129 | libPath = "src/lib.rs"; 130 | inherit dependencies buildDependencies features; 131 | }; 132 | strsim_0_7_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 133 | crateName = "strsim"; 134 | version = "0.7.0"; 135 | authors = [ "Danny Guo " ]; 136 | sha256 = "0fy0k5f2705z73mb3x9459bpcvrx4ky8jpr4zikcbiwan4bnm0iv"; 137 | inherit dependencies buildDependencies features; 138 | }; 139 | structopt_0_2_8_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 140 | crateName = "structopt"; 141 | version = "0.2.8"; 142 | authors = [ "Guillaume Pinot " ]; 143 | sha256 = "043ix4f74knvl94ba7c4sywwpbab8qr2q6r7jprrih9givyp2ysc"; 144 | inherit dependencies buildDependencies features; 145 | }; 146 | structopt_derive_0_2_8_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 147 | crateName = "structopt-derive"; 148 | version = "0.2.8"; 149 | authors = [ "Guillaume Pinot " ]; 150 | sha256 = "1nbnwl7vrqsd82igziyyi32p5akhnppd9smpi9hsrspaxa1sqcj6"; 151 | procMacro = true; 152 | inherit dependencies buildDependencies features; 153 | }; 154 | syn_0_13_11_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 155 | crateName = "syn"; 156 | version = "0.13.11"; 157 | authors = [ "David Tolnay " ]; 158 | sha256 = "06ybhxbyv8zshli47w0ihcnix74d6ss5yic3imns895q8pqgia2k"; 159 | inherit dependencies buildDependencies features; 160 | }; 161 | termion_1_5_1_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 162 | crateName = "termion"; 163 | version = "1.5.1"; 164 | authors = [ "ticki " "gycos " "IGI-111 " ]; 165 | sha256 = "02gq4vd8iws1f3gjrgrgpajsk2bk43nds5acbbb4s8dvrdvr8nf1"; 166 | inherit dependencies buildDependencies features; 167 | }; 168 | textwrap_0_9_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 169 | crateName = "textwrap"; 170 | version = "0.9.0"; 171 | authors = [ "Martin Geisler " ]; 172 | sha256 = "18jg79ndjlwndz01mlbh82kkr2arqm658yn5kwp65l5n1hz8w4yb"; 173 | inherit dependencies buildDependencies features; 174 | }; 175 | unicode_width_0_1_5_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 176 | crateName = "unicode-width"; 177 | version = "0.1.5"; 178 | authors = [ "kwantam " ]; 179 | sha256 = "0886lc2aymwgy0lhavwn6s48ik3c61ykzzd3za6prgnw51j7bi4w"; 180 | inherit dependencies buildDependencies features; 181 | }; 182 | unicode_xid_0_1_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 183 | crateName = "unicode-xid"; 184 | version = "0.1.0"; 185 | authors = [ "erick.tryzelaar " "kwantam " ]; 186 | sha256 = "05wdmwlfzxhq3nhsxn6wx4q8dhxzzfb9szsz6wiw092m1rjj01zj"; 187 | inherit dependencies buildDependencies features; 188 | }; 189 | vec_map_0_8_1_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 190 | crateName = "vec_map"; 191 | version = "0.8.1"; 192 | 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 <>" ]; 193 | sha256 = "1jj2nrg8h3l53d43rwkpkikq5a5x15ms4rf1rw92hp5lrqhi8mpi"; 194 | inherit dependencies buildDependencies features; 195 | }; 196 | void_1_0_2_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 197 | crateName = "void"; 198 | version = "1.0.2"; 199 | authors = [ "Jonathan Reem " ]; 200 | sha256 = "0h1dm0dx8dhf56a83k68mijyxigqhizpskwxfdrs1drwv2cdclv3"; 201 | inherit dependencies buildDependencies features; 202 | }; 203 | winapi_0_2_8_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 204 | crateName = "winapi"; 205 | version = "0.2.8"; 206 | authors = [ "Peter Atashian " ]; 207 | sha256 = "0a45b58ywf12vb7gvj6h3j264nydynmzyqz8d8rqxsj6icqv82as"; 208 | inherit dependencies buildDependencies features; 209 | }; 210 | winapi_0_3_4_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 211 | crateName = "winapi"; 212 | version = "0.3.4"; 213 | authors = [ "Peter Atashian " ]; 214 | sha256 = "1qbrf5dcnd8j36cawby5d9r5vx07r0l4ryf672pfncnp8895k9lx"; 215 | build = "build.rs"; 216 | inherit dependencies buildDependencies features; 217 | }; 218 | winapi_build_0_1_1_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 219 | crateName = "winapi-build"; 220 | version = "0.1.1"; 221 | authors = [ "Peter Atashian " ]; 222 | sha256 = "1lxlpi87rkhxcwp2ykf1ldw3p108hwm24nywf3jfrvmff4rjhqga"; 223 | libName = "build"; 224 | inherit dependencies buildDependencies features; 225 | }; 226 | winapi_i686_pc_windows_gnu_0_4_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 227 | crateName = "winapi-i686-pc-windows-gnu"; 228 | version = "0.4.0"; 229 | authors = [ "Peter Atashian " ]; 230 | sha256 = "05ihkij18r4gamjpxj4gra24514can762imjzlmak5wlzidplzrp"; 231 | build = "build.rs"; 232 | inherit dependencies buildDependencies features; 233 | }; 234 | winapi_x86_64_pc_windows_gnu_0_4_0_ = { dependencies?[], buildDependencies?[], features?[] }: buildRustCrate { 235 | crateName = "winapi-x86_64-pc-windows-gnu"; 236 | version = "0.4.0"; 237 | authors = [ "Peter Atashian " ]; 238 | sha256 = "0n1ylmlsb8yg1v583i4xy0qmqg42275flvbc51hdqjjfjcl9vlbj"; 239 | build = "build.rs"; 240 | inherit dependencies buildDependencies features; 241 | }; 242 | ansi_term_0_11_0 = { features?(ansi_term_0_11_0_features {}) }: ansi_term_0_11_0_ { 243 | dependencies = (if kernel == "windows" then mapFeatures features ([ winapi_0_3_4 ]) else []); 244 | }; 245 | ansi_term_0_11_0_features = f: updateFeatures f (rec { 246 | ansi_term_0_11_0.default = (f.ansi_term_0_11_0.default or true); 247 | winapi_0_3_4.consoleapi = true; 248 | winapi_0_3_4.default = true; 249 | winapi_0_3_4.errhandlingapi = true; 250 | winapi_0_3_4.processenv = true; 251 | }) [ winapi_0_3_4_features ]; 252 | atty_0_2_10 = { features?(atty_0_2_10_features {}) }: atty_0_2_10_ { 253 | dependencies = (if kernel == "redox" then mapFeatures features ([ termion_1_5_1 ]) else []) 254 | ++ (if (kernel == "linux" || kernel == "darwin") then mapFeatures features ([ libc_0_2_41 ]) else []) 255 | ++ (if kernel == "windows" then mapFeatures features ([ winapi_0_3_4 ]) else []); 256 | }; 257 | atty_0_2_10_features = f: updateFeatures f (rec { 258 | atty_0_2_10.default = (f.atty_0_2_10.default or true); 259 | libc_0_2_41.default = (f.libc_0_2_41.default or false); 260 | termion_1_5_1.default = true; 261 | winapi_0_3_4.consoleapi = true; 262 | winapi_0_3_4.default = true; 263 | winapi_0_3_4.minwinbase = true; 264 | winapi_0_3_4.minwindef = true; 265 | winapi_0_3_4.processenv = true; 266 | winapi_0_3_4.winbase = true; 267 | }) [ termion_1_5_1_features libc_0_2_41_features winapi_0_3_4_features ]; 268 | bitflags_0_9_1 = { features?(bitflags_0_9_1_features {}) }: bitflags_0_9_1_ { 269 | features = mkFeatures (features.bitflags_0_9_1 or {}); 270 | }; 271 | bitflags_0_9_1_features = f: updateFeatures f (rec { 272 | bitflags_0_9_1.default = (f.bitflags_0_9_1.default or true); 273 | bitflags_0_9_1.example_generated = 274 | (f.bitflags_0_9_1.example_generated or false) || 275 | (f.bitflags_0_9_1.default or false) || 276 | (bitflags_0_9_1.default or false); 277 | }) []; 278 | bitflags_1_0_3 = { features?(bitflags_1_0_3_features {}) }: bitflags_1_0_3_ { 279 | features = mkFeatures (features.bitflags_1_0_3 or {}); 280 | }; 281 | bitflags_1_0_3_features = f: updateFeatures f (rec { 282 | bitflags_1_0_3.default = (f.bitflags_1_0_3.default or true); 283 | }) []; 284 | cfg_if_0_1_3 = { features?(cfg_if_0_1_3_features {}) }: cfg_if_0_1_3_ {}; 285 | cfg_if_0_1_3_features = f: updateFeatures f (rec { 286 | cfg_if_0_1_3.default = (f.cfg_if_0_1_3.default or true); 287 | }) []; 288 | clap_2_31_2 = { features?(clap_2_31_2_features {}) }: clap_2_31_2_ { 289 | dependencies = mapFeatures features ([ bitflags_1_0_3 textwrap_0_9_0 unicode_width_0_1_5 ] 290 | ++ (if features.clap_2_31_2.atty or false then [ atty_0_2_10 ] else []) 291 | ++ (if features.clap_2_31_2.strsim or false then [ strsim_0_7_0 ] else []) 292 | ++ (if features.clap_2_31_2.vec_map or false then [ vec_map_0_8_1 ] else [])) 293 | ++ (if !(kernel == "windows") then mapFeatures features ([ ] 294 | ++ (if features.clap_2_31_2.ansi_term or false then [ ansi_term_0_11_0 ] else [])) else []); 295 | features = mkFeatures (features.clap_2_31_2 or {}); 296 | }; 297 | clap_2_31_2_features = f: updateFeatures f (rec { 298 | ansi_term_0_11_0.default = true; 299 | atty_0_2_10.default = true; 300 | bitflags_1_0_3.default = true; 301 | clap_2_31_2.ansi_term = 302 | (f.clap_2_31_2.ansi_term or false) || 303 | (f.clap_2_31_2.color or false) || 304 | (clap_2_31_2.color or false); 305 | clap_2_31_2.atty = 306 | (f.clap_2_31_2.atty or false) || 307 | (f.clap_2_31_2.color or false) || 308 | (clap_2_31_2.color or false); 309 | clap_2_31_2.clippy = 310 | (f.clap_2_31_2.clippy or false) || 311 | (f.clap_2_31_2.lints or false) || 312 | (clap_2_31_2.lints or false); 313 | clap_2_31_2.color = 314 | (f.clap_2_31_2.color or false) || 315 | (f.clap_2_31_2.default or false) || 316 | (clap_2_31_2.default or false); 317 | clap_2_31_2.default = (f.clap_2_31_2.default or true); 318 | clap_2_31_2.strsim = 319 | (f.clap_2_31_2.strsim or false) || 320 | (f.clap_2_31_2.suggestions or false) || 321 | (clap_2_31_2.suggestions or false); 322 | clap_2_31_2.suggestions = 323 | (f.clap_2_31_2.suggestions or false) || 324 | (f.clap_2_31_2.default or false) || 325 | (clap_2_31_2.default or false); 326 | clap_2_31_2.term_size = 327 | (f.clap_2_31_2.term_size or false) || 328 | (f.clap_2_31_2.wrap_help or false) || 329 | (clap_2_31_2.wrap_help or false); 330 | clap_2_31_2.vec_map = 331 | (f.clap_2_31_2.vec_map or false) || 332 | (f.clap_2_31_2.default or false) || 333 | (clap_2_31_2.default or false); 334 | clap_2_31_2.yaml = 335 | (f.clap_2_31_2.yaml or false) || 336 | (f.clap_2_31_2.doc or false) || 337 | (clap_2_31_2.doc or false); 338 | clap_2_31_2.yaml-rust = 339 | (f.clap_2_31_2.yaml-rust or false) || 340 | (f.clap_2_31_2.yaml or false) || 341 | (clap_2_31_2.yaml or false); 342 | strsim_0_7_0.default = true; 343 | textwrap_0_9_0.default = true; 344 | textwrap_0_9_0.term_size = 345 | (f.textwrap_0_9_0.term_size or false) || 346 | (clap_2_31_2.wrap_help or false) || 347 | (f.clap_2_31_2.wrap_help or false); 348 | unicode_width_0_1_5.default = true; 349 | vec_map_0_8_1.default = true; 350 | }) [ 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 ]; 351 | ctrlc_3_1_0 = { features?(ctrlc_3_1_0_features {}) }: ctrlc_3_1_0_ { 352 | dependencies = (if (kernel == "linux" || kernel == "darwin") then mapFeatures features ([ nix_0_9_0 ]) else []) 353 | ++ (if kernel == "windows" then mapFeatures features ([ kernel32_sys_0_2_2 winapi_0_2_8 ]) else []); 354 | features = mkFeatures (features.ctrlc_3_1_0 or {}); 355 | }; 356 | ctrlc_3_1_0_features = f: updateFeatures f (rec { 357 | ctrlc_3_1_0.default = (f.ctrlc_3_1_0.default or true); 358 | kernel32_sys_0_2_2.default = true; 359 | nix_0_9_0.default = true; 360 | winapi_0_2_8.default = true; 361 | }) [ nix_0_9_0_features kernel32_sys_0_2_2_features winapi_0_2_8_features ]; 362 | kernel32_sys_0_2_2 = { features?(kernel32_sys_0_2_2_features {}) }: kernel32_sys_0_2_2_ { 363 | dependencies = mapFeatures features ([ winapi_0_2_8 ]); 364 | buildDependencies = mapFeatures features ([ winapi_build_0_1_1 ]); 365 | }; 366 | kernel32_sys_0_2_2_features = f: updateFeatures f (rec { 367 | kernel32_sys_0_2_2.default = (f.kernel32_sys_0_2_2.default or true); 368 | winapi_0_2_8.default = true; 369 | winapi_build_0_1_1.default = true; 370 | }) [ winapi_0_2_8_features winapi_build_0_1_1_features ]; 371 | libc_0_2_41 = { features?(libc_0_2_41_features {}) }: libc_0_2_41_ { 372 | features = mkFeatures (features.libc_0_2_41 or {}); 373 | }; 374 | libc_0_2_41_features = f: updateFeatures f (rec { 375 | libc_0_2_41.default = (f.libc_0_2_41.default or true); 376 | libc_0_2_41.use_std = 377 | (f.libc_0_2_41.use_std or false) || 378 | (f.libc_0_2_41.default or false) || 379 | (libc_0_2_41.default or false); 380 | }) []; 381 | nix_0_9_0 = { features?(nix_0_9_0_features {}) }: nix_0_9_0_ { 382 | dependencies = mapFeatures features ([ bitflags_0_9_1 cfg_if_0_1_3 libc_0_2_41 void_1_0_2 ]); 383 | }; 384 | nix_0_9_0_features = f: updateFeatures f (rec { 385 | bitflags_0_9_1.default = true; 386 | cfg_if_0_1_3.default = true; 387 | libc_0_2_41.default = true; 388 | nix_0_9_0.default = (f.nix_0_9_0.default or true); 389 | void_1_0_2.default = true; 390 | }) [ bitflags_0_9_1_features cfg_if_0_1_3_features libc_0_2_41_features void_1_0_2_features ]; 391 | nix_linuxkit_runner_0_1_0 = { features?(nix_linuxkit_runner_0_1_0_features {}) }: nix_linuxkit_runner_0_1_0_ { 392 | dependencies = mapFeatures features ([ ctrlc_3_1_0 structopt_0_2_8 ]); 393 | }; 394 | nix_linuxkit_runner_0_1_0_features = f: updateFeatures f (rec { 395 | ctrlc_3_1_0.default = true; 396 | ctrlc_3_1_0.termination = true; 397 | nix_linuxkit_runner_0_1_0.default = (f.nix_linuxkit_runner_0_1_0.default or true); 398 | structopt_0_2_8.default = true; 399 | }) [ ctrlc_3_1_0_features structopt_0_2_8_features ]; 400 | proc_macro2_0_3_8 = { features?(proc_macro2_0_3_8_features {}) }: proc_macro2_0_3_8_ { 401 | dependencies = mapFeatures features ([ unicode_xid_0_1_0 ]); 402 | features = mkFeatures (features.proc_macro2_0_3_8 or {}); 403 | }; 404 | proc_macro2_0_3_8_features = f: updateFeatures f (rec { 405 | proc_macro2_0_3_8.default = (f.proc_macro2_0_3_8.default or true); 406 | proc_macro2_0_3_8.proc-macro = 407 | (f.proc_macro2_0_3_8.proc-macro or false) || 408 | (f.proc_macro2_0_3_8.default or false) || 409 | (proc_macro2_0_3_8.default or false) || 410 | (f.proc_macro2_0_3_8.nightly or false) || 411 | (proc_macro2_0_3_8.nightly or false); 412 | unicode_xid_0_1_0.default = true; 413 | }) [ unicode_xid_0_1_0_features ]; 414 | quote_0_5_2 = { features?(quote_0_5_2_features {}) }: quote_0_5_2_ { 415 | dependencies = mapFeatures features ([ proc_macro2_0_3_8 ]); 416 | features = mkFeatures (features.quote_0_5_2 or {}); 417 | }; 418 | quote_0_5_2_features = f: updateFeatures f (rec { 419 | proc_macro2_0_3_8.default = (f.proc_macro2_0_3_8.default or false); 420 | proc_macro2_0_3_8.proc-macro = 421 | (f.proc_macro2_0_3_8.proc-macro or false) || 422 | (quote_0_5_2.proc-macro or false) || 423 | (f.quote_0_5_2.proc-macro or false); 424 | quote_0_5_2.default = (f.quote_0_5_2.default or true); 425 | quote_0_5_2.proc-macro = 426 | (f.quote_0_5_2.proc-macro or false) || 427 | (f.quote_0_5_2.default or false) || 428 | (quote_0_5_2.default or false); 429 | }) [ proc_macro2_0_3_8_features ]; 430 | redox_syscall_0_1_38 = { features?(redox_syscall_0_1_38_features {}) }: redox_syscall_0_1_38_ {}; 431 | redox_syscall_0_1_38_features = f: updateFeatures f (rec { 432 | redox_syscall_0_1_38.default = (f.redox_syscall_0_1_38.default or true); 433 | }) []; 434 | redox_termios_0_1_1 = { features?(redox_termios_0_1_1_features {}) }: redox_termios_0_1_1_ { 435 | dependencies = mapFeatures features ([ redox_syscall_0_1_38 ]); 436 | }; 437 | redox_termios_0_1_1_features = f: updateFeatures f (rec { 438 | redox_syscall_0_1_38.default = true; 439 | redox_termios_0_1_1.default = (f.redox_termios_0_1_1.default or true); 440 | }) [ redox_syscall_0_1_38_features ]; 441 | strsim_0_7_0 = { features?(strsim_0_7_0_features {}) }: strsim_0_7_0_ {}; 442 | strsim_0_7_0_features = f: updateFeatures f (rec { 443 | strsim_0_7_0.default = (f.strsim_0_7_0.default or true); 444 | }) []; 445 | structopt_0_2_8 = { features?(structopt_0_2_8_features {}) }: structopt_0_2_8_ { 446 | dependencies = mapFeatures features ([ clap_2_31_2 structopt_derive_0_2_8 ]); 447 | features = mkFeatures (features.structopt_0_2_8 or {}); 448 | }; 449 | structopt_0_2_8_features = f: updateFeatures f (rec { 450 | clap_2_31_2.color = 451 | (f.clap_2_31_2.color or false) || 452 | (structopt_0_2_8.color or false) || 453 | (f.structopt_0_2_8.color or false); 454 | clap_2_31_2.debug = 455 | (f.clap_2_31_2.debug or false) || 456 | (structopt_0_2_8.debug or false) || 457 | (f.structopt_0_2_8.debug or false); 458 | clap_2_31_2.default = 459 | (f.clap_2_31_2.default or false) || 460 | (structopt_0_2_8.default or false) || 461 | (f.structopt_0_2_8.default or false) || 462 | false; 463 | clap_2_31_2.doc = 464 | (f.clap_2_31_2.doc or false) || 465 | (structopt_0_2_8.doc or false) || 466 | (f.structopt_0_2_8.doc or false); 467 | clap_2_31_2.lints = 468 | (f.clap_2_31_2.lints or false) || 469 | (structopt_0_2_8.lints or false) || 470 | (f.structopt_0_2_8.lints or false); 471 | clap_2_31_2.no_cargo = 472 | (f.clap_2_31_2.no_cargo or false) || 473 | (structopt_0_2_8.no_cargo or false) || 474 | (f.structopt_0_2_8.no_cargo or false); 475 | clap_2_31_2.suggestions = 476 | (f.clap_2_31_2.suggestions or false) || 477 | (structopt_0_2_8.suggestions or false) || 478 | (f.structopt_0_2_8.suggestions or false); 479 | clap_2_31_2.wrap_help = 480 | (f.clap_2_31_2.wrap_help or false) || 481 | (structopt_0_2_8.wrap_help or false) || 482 | (f.structopt_0_2_8.wrap_help or false); 483 | clap_2_31_2.yaml = 484 | (f.clap_2_31_2.yaml or false) || 485 | (structopt_0_2_8.yaml or false) || 486 | (f.structopt_0_2_8.yaml or false); 487 | structopt_0_2_8.default = (f.structopt_0_2_8.default or true); 488 | structopt_derive_0_2_8.default = true; 489 | structopt_derive_0_2_8.nightly = 490 | (f.structopt_derive_0_2_8.nightly or false) || 491 | (structopt_0_2_8.nightly or false) || 492 | (f.structopt_0_2_8.nightly or false); 493 | }) [ clap_2_31_2_features structopt_derive_0_2_8_features ]; 494 | structopt_derive_0_2_8 = { features?(structopt_derive_0_2_8_features {}) }: structopt_derive_0_2_8_ { 495 | dependencies = mapFeatures features ([ proc_macro2_0_3_8 quote_0_5_2 syn_0_13_11 ]); 496 | features = mkFeatures (features.structopt_derive_0_2_8 or {}); 497 | }; 498 | structopt_derive_0_2_8_features = f: updateFeatures f (rec { 499 | proc_macro2_0_3_8.default = true; 500 | proc_macro2_0_3_8.nightly = 501 | (f.proc_macro2_0_3_8.nightly or false) || 502 | (structopt_derive_0_2_8.nightly or false) || 503 | (f.structopt_derive_0_2_8.nightly or false); 504 | quote_0_5_2.default = true; 505 | structopt_derive_0_2_8.default = (f.structopt_derive_0_2_8.default or true); 506 | syn_0_13_11.default = true; 507 | }) [ proc_macro2_0_3_8_features quote_0_5_2_features syn_0_13_11_features ]; 508 | syn_0_13_11 = { features?(syn_0_13_11_features {}) }: syn_0_13_11_ { 509 | dependencies = mapFeatures features ([ proc_macro2_0_3_8 unicode_xid_0_1_0 ] 510 | ++ (if features.syn_0_13_11.quote or false then [ quote_0_5_2 ] else [])); 511 | features = mkFeatures (features.syn_0_13_11 or {}); 512 | }; 513 | syn_0_13_11_features = f: updateFeatures f (rec { 514 | proc_macro2_0_3_8.default = (f.proc_macro2_0_3_8.default or false); 515 | proc_macro2_0_3_8.proc-macro = 516 | (f.proc_macro2_0_3_8.proc-macro or false) || 517 | (syn_0_13_11.proc-macro or false) || 518 | (f.syn_0_13_11.proc-macro or false); 519 | quote_0_5_2.default = (f.quote_0_5_2.default or false); 520 | quote_0_5_2.proc-macro = 521 | (f.quote_0_5_2.proc-macro or false) || 522 | (syn_0_13_11.proc-macro or false) || 523 | (f.syn_0_13_11.proc-macro or false); 524 | syn_0_13_11.clone-impls = 525 | (f.syn_0_13_11.clone-impls or false) || 526 | (f.syn_0_13_11.default or false) || 527 | (syn_0_13_11.default or false); 528 | syn_0_13_11.default = (f.syn_0_13_11.default or true); 529 | syn_0_13_11.derive = 530 | (f.syn_0_13_11.derive or false) || 531 | (f.syn_0_13_11.default or false) || 532 | (syn_0_13_11.default or false); 533 | syn_0_13_11.parsing = 534 | (f.syn_0_13_11.parsing or false) || 535 | (f.syn_0_13_11.default or false) || 536 | (syn_0_13_11.default or false); 537 | syn_0_13_11.printing = 538 | (f.syn_0_13_11.printing or false) || 539 | (f.syn_0_13_11.default or false) || 540 | (syn_0_13_11.default or false); 541 | syn_0_13_11.proc-macro = 542 | (f.syn_0_13_11.proc-macro or false) || 543 | (f.syn_0_13_11.default or false) || 544 | (syn_0_13_11.default or false); 545 | syn_0_13_11.quote = 546 | (f.syn_0_13_11.quote or false) || 547 | (f.syn_0_13_11.printing or false) || 548 | (syn_0_13_11.printing or false); 549 | unicode_xid_0_1_0.default = true; 550 | }) [ proc_macro2_0_3_8_features quote_0_5_2_features unicode_xid_0_1_0_features ]; 551 | termion_1_5_1 = { features?(termion_1_5_1_features {}) }: termion_1_5_1_ { 552 | dependencies = (if !(kernel == "redox") then mapFeatures features ([ libc_0_2_41 ]) else []) 553 | ++ (if kernel == "redox" then mapFeatures features ([ redox_syscall_0_1_38 redox_termios_0_1_1 ]) else []); 554 | }; 555 | termion_1_5_1_features = f: updateFeatures f (rec { 556 | libc_0_2_41.default = true; 557 | redox_syscall_0_1_38.default = true; 558 | redox_termios_0_1_1.default = true; 559 | termion_1_5_1.default = (f.termion_1_5_1.default or true); 560 | }) [ libc_0_2_41_features redox_syscall_0_1_38_features redox_termios_0_1_1_features ]; 561 | textwrap_0_9_0 = { features?(textwrap_0_9_0_features {}) }: textwrap_0_9_0_ { 562 | dependencies = mapFeatures features ([ unicode_width_0_1_5 ]); 563 | }; 564 | textwrap_0_9_0_features = f: updateFeatures f (rec { 565 | textwrap_0_9_0.default = (f.textwrap_0_9_0.default or true); 566 | unicode_width_0_1_5.default = true; 567 | }) [ unicode_width_0_1_5_features ]; 568 | unicode_width_0_1_5 = { features?(unicode_width_0_1_5_features {}) }: unicode_width_0_1_5_ { 569 | features = mkFeatures (features.unicode_width_0_1_5 or {}); 570 | }; 571 | unicode_width_0_1_5_features = f: updateFeatures f (rec { 572 | unicode_width_0_1_5.default = (f.unicode_width_0_1_5.default or true); 573 | }) []; 574 | unicode_xid_0_1_0 = { features?(unicode_xid_0_1_0_features {}) }: unicode_xid_0_1_0_ { 575 | features = mkFeatures (features.unicode_xid_0_1_0 or {}); 576 | }; 577 | unicode_xid_0_1_0_features = f: updateFeatures f (rec { 578 | unicode_xid_0_1_0.default = (f.unicode_xid_0_1_0.default or true); 579 | }) []; 580 | vec_map_0_8_1 = { features?(vec_map_0_8_1_features {}) }: vec_map_0_8_1_ { 581 | dependencies = mapFeatures features ([]); 582 | features = mkFeatures (features.vec_map_0_8_1 or {}); 583 | }; 584 | vec_map_0_8_1_features = f: updateFeatures f (rec { 585 | vec_map_0_8_1.default = (f.vec_map_0_8_1.default or true); 586 | vec_map_0_8_1.serde = 587 | (f.vec_map_0_8_1.serde or false) || 588 | (f.vec_map_0_8_1.eders or false) || 589 | (vec_map_0_8_1.eders or false); 590 | }) []; 591 | void_1_0_2 = { features?(void_1_0_2_features {}) }: void_1_0_2_ { 592 | features = mkFeatures (features.void_1_0_2 or {}); 593 | }; 594 | void_1_0_2_features = f: updateFeatures f (rec { 595 | void_1_0_2.default = (f.void_1_0_2.default or true); 596 | void_1_0_2.std = 597 | (f.void_1_0_2.std or false) || 598 | (f.void_1_0_2.default or false) || 599 | (void_1_0_2.default or false); 600 | }) []; 601 | winapi_0_2_8 = { features?(winapi_0_2_8_features {}) }: winapi_0_2_8_ {}; 602 | winapi_0_2_8_features = f: updateFeatures f (rec { 603 | winapi_0_2_8.default = (f.winapi_0_2_8.default or true); 604 | }) []; 605 | winapi_0_3_4 = { features?(winapi_0_3_4_features {}) }: winapi_0_3_4_ { 606 | dependencies = (if kernel == "i686-pc-windows-gnu" then mapFeatures features ([ winapi_i686_pc_windows_gnu_0_4_0 ]) else []) 607 | ++ (if kernel == "x86_64-pc-windows-gnu" then mapFeatures features ([ winapi_x86_64_pc_windows_gnu_0_4_0 ]) else []); 608 | features = mkFeatures (features.winapi_0_3_4 or {}); 609 | }; 610 | winapi_0_3_4_features = f: updateFeatures f (rec { 611 | winapi_0_3_4.default = (f.winapi_0_3_4.default or true); 612 | winapi_i686_pc_windows_gnu_0_4_0.default = true; 613 | winapi_x86_64_pc_windows_gnu_0_4_0.default = true; 614 | }) [ winapi_i686_pc_windows_gnu_0_4_0_features winapi_x86_64_pc_windows_gnu_0_4_0_features ]; 615 | winapi_build_0_1_1 = { features?(winapi_build_0_1_1_features {}) }: winapi_build_0_1_1_ {}; 616 | winapi_build_0_1_1_features = f: updateFeatures f (rec { 617 | winapi_build_0_1_1.default = (f.winapi_build_0_1_1.default or true); 618 | }) []; 619 | 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_ {}; 620 | winapi_i686_pc_windows_gnu_0_4_0_features = f: updateFeatures f (rec { 621 | winapi_i686_pc_windows_gnu_0_4_0.default = (f.winapi_i686_pc_windows_gnu_0_4_0.default or true); 622 | }) []; 623 | 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_ {}; 624 | winapi_x86_64_pc_windows_gnu_0_4_0_features = f: updateFeatures f (rec { 625 | winapi_x86_64_pc_windows_gnu_0_4_0.default = (f.winapi_x86_64_pc_windows_gnu_0_4_0.default or true); 626 | }) []; 627 | } 628 | --------------------------------------------------------------------------------