!PSmBFWNKoXmlQBzUQf:helsinki-systems.de

Stage 1 systemd

82 Members
systemd in NixOs's stage 1, replacing the current bash tooling https://github.com/NixOS/nixpkgs/projects/5125 Servers

Load older messages


SenderMessageTime
24 Mar 2022
@elvishjerricco:matrix.org@elvishjerricco:matrix.org flokli: The main difference is that it only uses def.environment, not globalEnvironment 18:04:30
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgThough 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 variables18:05:17
@flokli:matrix.orgflokli TZDIR is just set to /etc/zoneinfo, which I think we don't populate 18:07:51
@flokli:matrix.orgflokli 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:matrix.orgflokliMostly thinking around fancy escape sequences in interactive prompts, not garbling when entering cryptsetup passwords with funky characters, …18:09:41
@flokli:matrix.orgflokliBut yeah, this is something we might want to test anyways18:11:33
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgJust make sure the initrd size doesn't increase I guess :P18:12:45
@flokli:matrix.orgflokliI 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 not18:12:45
@flokli:matrix.orgflokliHow do I do that?18:13:04
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Just build config.system.build.initialRamdisk before and after the change and compare sizes 18:15:36
@flokli:matrix.orgflokli

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@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@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@elvishjerricco:matrix.org And doing stuff like nix-build test.nix -A config.system.build.initialRamdisk 18:18:59
@flokli:matrix.orgflokli5bfe21331548db28279776debc073b02de71e2e3…HEAD 10338356 -> 10338951 bytes18:22:17
@flokli:matrix.orgfloklils -lah says 9.9M for both.18:22:40
@flokli:matrix.orgflokliI'll head out for dinner18:31:57
@flokli:matrix.orgflokliThere's some other open conversation about refactoring some of the stuff into a function18:32:13
@flokli:matrix.orgflokli Janne Heß: wanna tackle that? 18:32:25
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.deI want but I don't think I'll find time right now :/18:32:51
@janne.hess:helsinki-systems.de@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@janne.hess:helsinki-systems.de handover works \o/ 19:03:46
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgOh sweet19:10:46
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgHow'd you get the activation script running?19:10:54
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.decan we not talk about that detail :P19:11:02
@elvishjerricco:matrix.org@elvishjerricco:matrix.orglol19:11:06
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgWe'll probably just have to do a chroot thing in stage 119:11:19
@janne.hess:helsinki-systems.de@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@janne.hess:helsinki-systems.deyes!19:11:24
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgInteresting19:12:48

Show newer messages


Back to Room ListRoom Version: 6