cleverca22
6/30/2016 - 9:57 AM

gistfile1.nix

rec {
  test1 = builtins.scopedImport { __nixPath = [ { path = test4; prefix="ssh-config-file"; } ] ++ __nixPath; };
  test2 = test1 <nixpkgs/pkgs/build-support/fetchgit/private.nix>;
  pkgs = import <nixpkgs> {};
  test3 = pkgs.callPackage test2 {};
  test4 = pkgs.writeText "sshd_config" ''
  # empty file, use programs.ssh.knownHosts in configuration.nix not StrictHostKeyChecking no
  '';
  test5 = test3 {
    url = "git@github.com:cleverca22/not-os.git";
    rev = "ef65e53d360c92cadcb7fa66d6f6d59d05dcfd7a";
    sha256 = "1gz59nv0vcs8dxq3q3rqkca6q17jp3lq1wfxvg5qsi8gv6bryj6d";
  };
}
[clever@amd-nixos:~]$ sudo socat UNIX-LISTEN:/tmp/hax,fork,mode=0070,group=nixbld UNIX-CLIENT:$SSH_AUTH_SOCK
[sudo] password for clever:
^C        (after the build)
[clever@amd-nixos:~]$
[clever@amd-nixos:~/path-test]$ nix-build default.nix -A test5 -I ssh-auth-sock=/tmp/hax
these derivations will be built:
  /nix/store/91yjhzn6j13cz74a91l8s045gkr1pk3v-not-os-ef65e53.drv
building path(s) ‘/nix/store/i532j41xb22pvhq4in3vgp36llci7b01-not-os-ef65e53’
exporting git@github.com:cleverca22/not-os.git (rev ef65e53d360c92cadcb7fa66d6f6d59d05dcfd7a) into /nix/store/i532j41xb22pvhq4in3vgp36llci7b01-not-os-ef65e53
Initialized empty Git repository in /nix/store/i532j41xb22pvhq4in3vgp36llci7b01-not-os-ef65e53/.git/
Failed to add the RSA host key for IP address '192.30.253.113' to the list of known hosts (/var/empty/.ssh/known_hosts).
Failed to add the RSA host key for IP address '192.30.253.113' to the list of known hosts (/var/empty/.ssh/known_hosts).
remote: Counting objects: 29, done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 29 (delta 0), reused 17 (delta 0), pack-reused 0
From github.com:cleverca22/not-os
 * branch            HEAD       -> FETCH_HEAD
Switched to a new branch 'fetchgit'
removing `.git'...
/nix/store/i532j41xb22pvhq4in3vgp36llci7b01-not-os-ef65e53

[clever@amd-nixos:~/path-test]$ ls result/
base.nix  ca  ca.cnf  configuration.nix  default.nix  gen_ca  gen_keys  ipxe.nix  notes.txt  release.nix  runit.nix  ssh  stage-1.nix  stage-2-init.sh  stage-2.nix  systemd-compat.nix  system-path.nix  tests