!PSmBFWNKoXmlQBzUQf:helsinki-systems.de

Stage 1 systemd

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

Load older messages


SenderMessageTime
19 Mar 2022
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgBut if not, and the code isn't crazy, then cool10:38:02
@elvishjerricco:matrix.org@elvishjerricco:matrix.org bobvanderlinden: Yes. I couldn't think of a really clean way to have the default path option differ 10:38:20
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgBecause we don't want anything in that by default for initrd10:38:29
@elvishjerricco:matrix.org@elvishjerricco:matrix.org If anyone actually uses path, we'll have no sane choice but to add the whole bin directory for those packages to the initrd because that's the only thing it could mean 10:39:21
@elvishjerricco:matrix.org@elvishjerricco:matrix.orgSo anything in there by default is necessarily excessive10:39:44
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Though I definitely wasn't supposed to put the initrdServices line in that config lol. Supposed to be in the commit that actually adds that stuff 10:41:33
@elvishjerricco:matrix.org@elvishjerricco:matrix.org * Though I definitely wasn't supposed to put the initrdServices line in that commit lol. Supposed to be in the commit that actually adds that stuff 10:41:50
@bobvanderlinden_:matrix.orgbobvanderlinden

ah, I think you refer to:

https://github.com/nixos/nixpkgs/blob/9bc093b30a3ab38f9e5b30a132b08a9fd9b27ade/nixos/lib/systemd-lib.nix#L299

That should refer to a new option config.systemd.path, which for boot/systemd.nix and boot/systemd/user.nix should refer to config.path.

10:42:36
@bobvanderlinden_:matrix.orgbobvanderlindenbut I guess that'll force serviceConfig to be a function again with its added complexity 😅10:43:15
@elvishjerricco:matrix.org@elvishjerricco:matrix.org Yea, so I just... made a mkServiceConfig function that takes an argument for the default path and created serviceConfig and initrdServiceConfig to keep it simple 10:44:05
@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

There are no newer messages yet.


Back to Room ListRoom Version: 6