!PSmBFWNKoXmlQBzUQf:helsinki-systems.de

Stage 1 systemd

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

Load older messages


SenderMessageTime
19 Mar 2022
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgNot exactly clean10:44:09
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgbut it'll do the trick10:44:12
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgAnd it's at least very simple10:44:22
@bobvanderlinden_:matrix.orgbobvanderlinden

thinking about this more. IT could also do in systemd.nix's config section:

systemd.services.*.environment.PATH = mkDefault "${makeBinPath config.path}:${makeSearchPathOutput "bin" "sbin" config.path}";

with some added fiddlyness to handle *

10:46:08
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Yea the fiddlyness for * is the tricky part. I don't know if there's a correct way to do that 10:47:18
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgThere used to be a hack that worked if you defined the option a second time, but I'm pretty sure that stopped working some time ago10:47:38
@elvishjerricco:matrix.org@elvishjerricco:matrix.org and I'm pretty sure it was never intended to work 10:47:48
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de
In reply to @elvishjerricco:matrix.org
Yea the fiddlyness for * is the tricky part. I don't know if there's a correct way to do that
You can iterate over the attrNames and generate a mkMerge
10:50:56
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de* You can iterate over the attrNames and map them to a mkMerge10:51:30
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Janne Heß: No you can't. You can do that to define a different attrsOf in terms of a different attrsOf. But you can't do foo = mapAttrs (...) config.foo because then foo is infinite 10:52:39
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de Oh I see your point now. Pretty sure there was a way somehow that we are using downstream. Maybe Andreas Schrägle remembers? 10:53:48
@elvishjerricco:matrix.org@elvishjerricco:matrix.org

I've seen this before:

# foo.nix
{
  options.foo = mkOption { type = attrsOf (submodule <module>); };
}

#bar.nix
{
  options.foo = mkOption { type attrsOf (submodule <more module>); };
}

But I'm pretty sure this wasn't intended to work, and doesn't work anymore (last I checked, like a year ago)

10:55:25
@elvishjerricco:matrix.org@elvishjerricco:matrix.org *

I've seen this before:

# foo.nix
{
  options.foo = mkOption { type = attrsOf (submodule <module>); };
}

#bar.nix
{
  options.foo = mkOption { type = attrsOf (submodule <more module>); };
}

But I'm pretty sure this wasn't intended to work, and doesn't work anymore (last I checked, like a year ago)

10:55:44
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.deThat should work fine. There's typesMergable for that so that should do it10:56:20
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgtypesMergable?10:56:33
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de Its somewhere in types.nix. I might have an example but I'm only on mobile 10:56:55
@bobvanderlinden_:matrix.orgbobvanderlindenIt seems we do something similar for timer's startAt: https://github.com/nixos/nixpkgs/blob/9bc093b30a3ab38f9e5b30a132b08a9fd9b27ade/nixos/modules/system/boot/systemd.nix#L966-L97210:57:04
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de

We have this:

options.systemd.services = lib.mkOption {
    type = with lib.types; attrsOf (submodule ({ config, ... }: {
      options.reloadTriggers = lib.mkOption {
        default = [];
        type = listOf unitOption;
        description = ''
          An arbitrary list of items such as derivations.  If any item
          in the list changes between reconfigurations, the service will
          be reloaded.  If anything but a reload trigger changes in the
          unit file, the unit will be restarted instead.
        '';
      };

      config = lib.mkIf (config.reloadTriggers != []) {
        unitConfig.X-Reload-Triggers = toString config.reloadTriggers;
      };
    }));
  };
10:57:47
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.deAnd this works 10:57:57
@elvishjerricco:matrix.org@elvishjerricco:matrix.org bobvanderlinden: That would be what I described before, where a different attrsOf is defined in terms of a different attrsOf 10:58:13
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Janne Heß: Well cool. I could have sworn that didn't work anymore 10:58:33
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgI... might just use that10:58:38
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de
In reply to @elvishjerricco:matrix.org
I... might just use that
Oh nio 👀
10:58:49
@janne.hess:helsinki-systems.de@janne.hess:helsinki-systems.de* Oh no 👀10:58:58
@bobvanderlinden_:matrix.orgbobvanderlinden ElvishJerricco: oops you're right, it's creating timers for startAt in services 10:59:03
@bobvanderlinden_:matrix.orgbobvanderlinden ElvishJerricco: is there a way to cooperate in parallel? 11:09:29
@elvishjerricco:matrix.org@elvishjerricco:matrix.org bobvanderlinden: How do you mean? 11:11:55
@bobvanderlinden_:matrix.orgbobvanderlindenAt the moment I feel like it's hard to work on my branch, because it'll conflict with changes you're working on11:13:10
@bobvanderlinden_:matrix.orgbobvanderlindenI was thinking, if the bare-bones version of boot.inird.systemd is there, I can look into one of plymouth, luks, cryptsetup, etc11:14:17
@bobvanderlinden_:matrix.orgbobvanderlindenI'll just ditch the pr-usable-systemd-modules branch, as I think it'll never get approved and I don't see a better way with the current module system11:15:03

Show newer messages


Back to Room ListRoom Version: 6