Skip to content

Instantly share code, notes, and snippets.

@aespinosa
Created October 31, 2016 15:24
Show Gist options
  • Save aespinosa/df563b95f938e984737c487cad1314f7 to your computer and use it in GitHub Desktop.
Save aespinosa/df563b95f938e984737c487cad1314f7 to your computer and use it in GitHub Desktop.
NIX_CURRENT_LOAD=`pwd` NIX_REMOTE_SYSTEMS=`pwd`/remotes.conf NIX_BUILD_HOOK=$HOME/.nix-profile/libexec/nix/build-remote.pl nix-build --argstr system x86_64-linux
# To build on macOS
# NIX_CURRENT_LOAD=`pwd` NIX_REMOTE_SYSTEMS=`pwd`/remotes.conf \
# NIX_BUILD_HOOK=$HOME/.nix-profile/libexec/nix/build-remote.pl \
# nix-build --argstr system x86_64-linux
#
# remotes.conf
# vagrant@<ip> x86_64-linux $HOME/.vagrant.sh/insecure_private_key 1
{ system ? builtins.currentSystem }:
with import <nixpkgs> {
system = system;
};
let app = stdenv.mkDerivation {
name = "cpu-app";
enableSharedExecutables = false;
buildInputs = [
(haskellPackages.ghcWithPackages (p: [p.yesod ]))
];
src = ./.;
phases = [ "unpackPhase" "buildPhase" "installPhase" "fixupPhase" ];
}; in
dockerTools.buildImage {
name = "stress";
contents = app;
runAsRoot = ''
#!${stdenv.shell}
useradd app
'';
config = {
User = "app";
};
}
NIX_CURRENT_LOAD=`pwd` NIX_REMOTE_SYSTEMS=`pwd`/remotes.conf NIX_BUILD_HOOK=$HOME/.nix-profile/libexec/nix/build-remote.pl nix-build --argstr system x86_64-linux
these derivations will be built:
/nix/store/52nvjxcsvksy2jxcyirs42n9w77sbil0-docker-layer-stress.drv
/nix/store/hn768w0gfglj3qplw8385gj9sghac86g-runtime-deps.drv
/nix/store/szhpcxm016ab9npwxqal07l0jr0ka8qb-docker-image-stress.tar.gz.drv
building path(s) ‘/nix/store/bwf7qdqcm4pdmdzjh19lcn9j5lc3vz47-docker-layer-stress’
error: a ‘x86_64-linux’ is required to build ‘/nix/store/52nvjxcsvksy2jxcyirs42n9w77sbil0-docker-layer-stress.drv’, but I am a ‘x86_64-darwin’
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment