forked from mirrors/nixpkgs
4e21215d52
At least the largest portion of the installer, because in the end we don't want the installer to *actually* save the state but only prepare the base image. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
40 lines
779 B
Nix
40 lines
779 B
Nix
{ isoFile
|
|
, productKey
|
|
, sshPublicKey
|
|
}:
|
|
|
|
let
|
|
inherit (import <nixpkgs> {}) lib runCommand;
|
|
|
|
bootstrapAfterLogin = runCommand "bootstrap.sh" {} ''
|
|
cat > "$out" <<EOF
|
|
mkdir -p ~/.ssh
|
|
cat > ~/.ssh/authorized_keys <<PUBKEY
|
|
$(cat "${sshPublicKey}")
|
|
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
|
|
'';
|
|
|
|
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;
|
|
};
|
|
}
|