2014-02-15 18:17:21 +01:00
|
|
|
{ isoFile
|
|
|
|
, productKey
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2014-02-15 18:23:43 +01:00
|
|
|
inherit (import <nixpkgs> {}) lib stdenv runCommand openssh;
|
2014-02-15 18:17:21 +01:00
|
|
|
|
|
|
|
bootstrapAfterLogin = runCommand "bootstrap.sh" {} ''
|
|
|
|
cat > "$out" <<EOF
|
|
|
|
mkdir -p ~/.ssh
|
|
|
|
cat > ~/.ssh/authorized_keys <<PUBKEY
|
2014-02-15 18:23:43 +01:00
|
|
|
$(cat "${cygwinSshKey}/key.pub")
|
2014-02-15 18:17:21 +01:00
|
|
|
PUBKEY
|
|
|
|
ssh-host-config -y -c 'binmode ntsec' -w dummy
|
|
|
|
cygrunsrv -S sshd
|
|
|
|
|
|
|
|
net use S: '\\192.168.0.2\nixstore'
|
|
|
|
mkdir -p /nix/store
|
|
|
|
mount -o bind /cygdrives/s /nix/store
|
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
|
2014-02-15 18:23:43 +01:00
|
|
|
cygwinSshKey = stdenv.mkDerivation {
|
|
|
|
name = "snakeoil-ssh-cygwin";
|
|
|
|
buildCommand = ''
|
|
|
|
ensureDir "$out"
|
|
|
|
${openssh}/bin/ssh-keygen -t ecdsa -f "$out/key" -N ""
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2014-02-15 18:17:21 +01:00
|
|
|
packages = [ "openssh" ];
|
|
|
|
|
|
|
|
in {
|
|
|
|
iso = import ../cygwin-iso {
|
|
|
|
inherit packages;
|
|
|
|
extraContents = lib.singleton {
|
|
|
|
source = bootstrapAfterLogin;
|
|
|
|
target = "bootstrap.sh";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
floppy = import ./unattended-image.nix {
|
|
|
|
cygwinPackages = packages;
|
|
|
|
inherit productKey;
|
|
|
|
};
|
2014-02-15 18:23:43 +01:00
|
|
|
|
|
|
|
sshKey = "${cygwinSshKey}/key";
|
2014-02-15 18:17:21 +01:00
|
|
|
}
|