| 24 Mar 2022 |
@elvishjerricco:matrix.org | flokli: The main difference is that it only uses def.environment, not globalEnvironment | 18:04:30 |
@elvishjerricco:matrix.org | Though I guess that shouldn't matter much? Just adds a TZ thing and a LOCALE_ARCHIVE thing. As long as we aren't copying those closures in we're good, they'll just be broken env variables | 18:05:17 |
flokli | TZDIR is just set to /etc/zoneinfo, which I think we don't populate | 18:07:51 |
flokli | LOCALE_ARCHIVE… we might /want/ to eventually provide some UTF-8 locales in initrd, even if it's just C.UTF-8 | 18:09:00 |
flokli | Mostly thinking around fancy escape sequences in interactive prompts, not garbling when entering cryptsetup passwords with funky characters, … | 18:09:41 |
flokli | But yeah, this is something we might want to test anyways | 18:11:33 |
@elvishjerricco:matrix.org | Just make sure the initrd size doesn't increase I guess :P | 18:12:45 |
flokli | I don't think it'll cause harm to have it point into the void. We might eventually later realize we need to provide these files, but I don't think right now it matters much if these env vars are set or not | 18:12:45 |
flokli | How do I do that? | 18:13:04 |
@elvishjerricco:matrix.org | Just build config.system.build.initialRamdisk before and after the change and compare sizes | 18:15:36 |
flokli | Like
❯ nix-build nixos/tests/systemd-initrd-simple.nix -A nodes.machine.config.system.build.initialRamdisk
error: the expression selected by the selection path 'nodes.machine.config.system.build.initialRamdisk' should be a set but is a function
?
| 18:17:13 |
@elvishjerricco:matrix.org | I dunno if there's a smarter way to do it, but I've just been testing with this file:
import ./nixos { configuration = { lib, config, pkgs, ... }: {
imports = [./nixos/modules/virtualisation/qemu-vm.nix];
boot.initrd.systemd = {
enable = true;
emergencyHashedPassword = "";
# additionalUpstreamUnits = ["cryptsetup.target"];
# package = pkgs.systemdMinimal.override { withCryptsetup = true; };
# services.foo = {
# wantedBy = ["initrd.target"];
# after = ["local-fs.target"];
# before = ["initrd.target" "initrd-cleanup.service"];
# serviceConfig.ExecStart = "/bin/systemctl emergency";
# serviceConfig.Type = "oneshot";
# };
};
virtualisation = {
graphics = false;
memorySize = 8192;
cores = 4;
};
documentation.enable = false;
services.getty.autologinUser = "root";
}; }
| 18:18:33 |
@elvishjerricco:matrix.org | * I dunno if there's a smarter way to do it, but I've just been testing with this file:
import ./nixos { configuration = { lib, config, pkgs, ... }: {
imports = [./nixos/modules/virtualisation/qemu-vm.nix];
boot.initrd.systemd = {
enable = true;
emergencyHashedPassword = "";
# services.foo = {
# wantedBy = ["initrd.target"];
# after = ["local-fs.target"];
# before = ["initrd.target" "initrd-cleanup.service"];
# serviceConfig.ExecStart = "/bin/systemctl emergency";
# serviceConfig.Type = "oneshot";
# };
};
virtualisation = {
graphics = false;
memorySize = 8192;
cores = 4;
};
documentation.enable = false;
services.getty.autologinUser = "root";
}; }
| 18:18:45 |
@elvishjerricco:matrix.org | And doing stuff like nix-build test.nix -A config.system.build.initialRamdisk | 18:18:59 |
flokli | 5bfe21331548db28279776debc073b02de71e2e3…HEAD
10338356 -> 10338951 bytes | 18:22:17 |
flokli | ls -lah says 9.9M for both. | 18:22:40 |
flokli | I'll head out for dinner | 18:31:57 |
flokli | There's some other open conversation about refactoring some of the stuff into a function | 18:32:13 |
flokli | Janne Heß: wanna tackle that? | 18:32:25 |
@janne.hess:helsinki-systems.de | I want but I don't think I'll find time right now :/ | 18:32:51 |
@janne.hess:helsinki-systems.de | $ systemd-analyze
Startup finished in 392ms (kernel) + 1.902s (initrd) + 6.241s (userspace) = 8.536s
multi-user.target reached after 6.166s in userspace
| 19:03:43 |
@janne.hess:helsinki-systems.de | handover works \o/ | 19:03:46 |
@elvishjerricco:matrix.org | Oh sweet | 19:10:46 |
@elvishjerricco:matrix.org | How'd you get the activation script running? | 19:10:54 |
@janne.hess:helsinki-systems.de | can we not talk about that detail :P | 19:11:02 |
@elvishjerricco:matrix.org | lol | 19:11:06 |
@elvishjerricco:matrix.org | We'll probably just have to do a chroot thing in stage 1 | 19:11:19 |
@janne.hess:helsinki-systems.de | boot.initrd.systemd.objects = [
{ object = pkgs.busybox; }
{ object = pkgs.writeShellScript "nixos-activation" ''
set -x
init=
for o in $(</proc/cmdline); do
case $o in
boot.debugtrace)
# Show each command.
set -x
;;
init=*)
set -- $(IFS==; echo $o)
init=$2
;;
esac
done
closure="$(${pkgs.busybox}/bin/dirname "$init")"
${pkgs.busybox}/bin/mkdir -p /sysroot/run
${pkgs.busybox}/bin/mount --bind /run /sysroot/run
${pkgs.busybox}/bin/chroot /sysroot $closure/systemd-activation
${pkgs.busybox}/bin/umount /sysroot/run
''; symlink = "/nixos-activation"; }
| 19:11:22 |
@janne.hess:helsinki-systems.de | yes! | 19:11:24 |
@elvishjerricco:matrix.org | Interesting | 19:12:48 |