1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 11:03:37 +03:00
mobile-nixos/modules/initrd-ssh.nix
Samuel Dionne-Riel b5e3397783 (broken) removes initrd-order
This allows my staging area to become a bit cleaner.
2020-02-03 16:19:10 -05:00

41 lines
944 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
device_name = config.mobile.device.name;
cfg = config.mobile.boot.stage-1.ssh;
in
{
options.mobile.boot.stage-1.ssh = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Enables ssh.
CURRENT CONFIGURATION ALSO OPENS ACCESS TO ALL WITHOUT A PASSWORD NOR SSH KEY.
'';
};
};
config.mobile.boot.stage-1 = lib.mkIf cfg.enable {
init = lib.mkOrder SERVICES_INIT ''
#
# Oh boy, that's insecure!
#
passwd -u root
passwd -d root
echo "From a mobile-nixos device ${device_name}" >> /etc/banner
mkdir -p /etc/dropbear/
# THIS IS HIGHLY INSECURE
# This allows blank login passwords.
dropbear -ERB -b /etc/banner
'';
extraUtils = with pkgs; [
{ package = dropbear; extraCommand = "cp -fpv ${glibc.out}/lib/libnss_files.so.* $out/lib"; }
];
};
}