Compare commits
2 Commits
29c7af5892
...
fb796e61e0
Author | SHA1 | Date | |
---|---|---|---|
|
fb796e61e0 | ||
9f3c80e774 |
@ -22,13 +22,20 @@ in
|
|||||||
outputs = {
|
outputs = {
|
||||||
initramfs =
|
initramfs =
|
||||||
let
|
let
|
||||||
bb = pkgs.busybox.override {
|
bb1 = pkgs.busybox.override {
|
||||||
enableStatic = true;
|
enableStatic = true;
|
||||||
enableMinimal = true;
|
enableMinimal = true;
|
||||||
enableAppletSymlinks = false;
|
enableAppletSymlinks = false;
|
||||||
|
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
CONFIG_ASH y
|
CONFIG_DESKTOP n
|
||||||
CONFIG_LS y
|
CONFIG_ASH n
|
||||||
|
CONFIG_HUSH y
|
||||||
|
CONFIG_HUSH_TICK y
|
||||||
|
CONFIG_HUSH_LOOPS y
|
||||||
|
CONFIG_HUSH_CASE y
|
||||||
|
CONFIG_HUSH_ECHO y
|
||||||
|
CONFIG_HUSH_SET y
|
||||||
CONFIG_LN y
|
CONFIG_LN y
|
||||||
CONFIG_CAT y
|
CONFIG_CAT y
|
||||||
CONFIG_MOUNT y
|
CONFIG_MOUNT y
|
||||||
@ -40,18 +47,23 @@ in
|
|||||||
CONFIG_CHMOD y
|
CONFIG_CHMOD y
|
||||||
CONFIG_MKDIR y
|
CONFIG_MKDIR y
|
||||||
CONFIG_MKNOD y
|
CONFIG_MKNOD y
|
||||||
CONFIG_SH_IS_ASH y
|
|
||||||
CONFIG_BASH_IS_NONE y
|
CONFIG_BASH_IS_NONE y
|
||||||
|
CONFIG_SH_IS_NONE y
|
||||||
|
CONFIG_SH_IS_ASH n
|
||||||
CONFIG_FEATURE_SH_STANDALONE y
|
CONFIG_FEATURE_SH_STANDALONE y
|
||||||
CONFIG_FEATURE_PREFER_APPLETS y
|
CONFIG_FEATURE_PREFER_APPLETS y
|
||||||
|
CONFIG_BUSYBOX_EXEC_PATH "/bin/busybox"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
bb = bb1.overrideAttrs(o: {
|
||||||
|
makeFlags = [];
|
||||||
|
});
|
||||||
slashinit = pkgs.writeScript "init" ''
|
slashinit = pkgs.writeScript "init" ''
|
||||||
#!/bin/sh
|
#!/bin/hush
|
||||||
exec >/dev/console
|
exec >/dev/console
|
||||||
echo Running in initramfs
|
echo Running in initramfs
|
||||||
mount -t proc none /proc
|
mount -t proc none /proc
|
||||||
set -- $(cat /proc/cmdline)
|
set -- `cat /proc/cmdline`
|
||||||
for i in "$@" ; do
|
for i in "$@" ; do
|
||||||
case "''${i}" in
|
case "''${i}" in
|
||||||
root=*)
|
root=*)
|
||||||
@ -62,7 +74,7 @@ in
|
|||||||
echo mount -t jffs2 ''${rootdevice} /target/persist
|
echo mount -t jffs2 ''${rootdevice} /target/persist
|
||||||
mount -t jffs2 ''${rootdevice} /target/persist
|
mount -t jffs2 ''${rootdevice} /target/persist
|
||||||
mount -o bind /target/persist/nix /target/nix
|
mount -o bind /target/persist/nix /target/nix
|
||||||
sh /target/persist/activate /target
|
hush /target/persist/activate /target
|
||||||
cd /target
|
cd /target
|
||||||
mount -o bind /target /
|
mount -o bind /target /
|
||||||
exec chroot . /bin/init "$@"
|
exec chroot . /bin/init "$@"
|
||||||
@ -80,7 +92,8 @@ in
|
|||||||
nod /dev/console 0600 0 0 c 5 1
|
nod /dev/console 0600 0 0 c 5 1
|
||||||
dir /bin 0755 0 0
|
dir /bin 0755 0 0
|
||||||
file /bin/busybox ${bb}/bin/busybox 0755 0 0
|
file /bin/busybox ${bb}/bin/busybox 0755 0 0
|
||||||
slink /bin/sh /bin/busybox 0755 0 0
|
slink /bin/hush /bin/busybox 0755 0 0
|
||||||
|
slink /bin/chroot /bin/busybox 0755 0 0
|
||||||
file /init ${slashinit} 0755 0 0
|
file /init ${slashinit} 0755 0 0
|
||||||
SPECIALS
|
SPECIALS
|
||||||
'';
|
'';
|
||||||
|
@ -69,6 +69,7 @@ in {
|
|||||||
(name: val: dir {
|
(name: val: dir {
|
||||||
".ssh" = dir {
|
".ssh" = dir {
|
||||||
authorized_keys = {
|
authorized_keys = {
|
||||||
|
inherit (val) uid gid;
|
||||||
type = "f";
|
type = "f";
|
||||||
mode = "0400";
|
mode = "0400";
|
||||||
file = lib.concatStringsSep
|
file = lib.concatStringsSep
|
||||||
|
@ -20,12 +20,14 @@ let
|
|||||||
, file ? null
|
, file ? null
|
||||||
, major ? null
|
, major ? null
|
||||||
, minor ? null
|
, minor ? null
|
||||||
|
, uid ? 0
|
||||||
|
, gid ? 0
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
mode' = if mode != null then mode else
|
mode' = if mode != null then mode else
|
||||||
(if type == "d" then "0755" else "0644");
|
(if type == "d" then "0755" else "0644");
|
||||||
pathname = "${prefix}/${filename}";
|
pathname = "${prefix}/${filename}";
|
||||||
line = "${pathname} ${type} ${mode'} 0 0";
|
line = "${pathname} ${type} ${mode'} ${toString uid} ${toString gid}";
|
||||||
in
|
in
|
||||||
if type == "f" then
|
if type == "f" then
|
||||||
"${line} echo -n \"${qprint file}\" |qprint -d"
|
"${line} echo -n \"${qprint file}\" |qprint -d"
|
||||||
|
Loading…
Reference in New Issue
Block a user