1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 11:03:37 +03:00
mobile-nixos/modules/initrd-devices.nix

43 lines
985 B
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
with lib;
with import ./initrd-order.nix;
let
cfg = config.mobile.boot.stage-1.devices-init;
in
{
options.mobile.boot.stage-1.devices-init = {
enable = mkOption {
type = types.bool;
default = true;
description = ''
Enables devices-init.
This probably shouldn't be disabled, unless you implement
a different one.
'';
};
};
config.mobile.boot.stage-1 = lib.mkIf cfg.enable {
init = lib.mkOrder DEVICE_INIT ''
mkdir -p /proc /sys /dev
mount -t devtmpfs devtmpfs /dev
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mkdir -p /etc/udev /tmp /run /lib /mnt /var/log
mkdir -p /dev/pts
mount -t devpts devpts /dev/pts
touch /var/log/lastlog
2018-07-08 03:22:39 +03:00
# Basic stuff necessary for a shell.
echo '/bin/sh' > /etc/shells
echo 'root:*:0:0:root:/root:/bin/sh' > /etc/passwd
echo 'passwd: files' > /etc/nsswitch.conf
'';
};
}