systemd: support systemd.tmpfiles.settings#148
Conversation
445ebf2 to
354e94f
Compare
|
Thanks! Did you copy this code over from nixpkgs or you wrote it from scratch? I'm also wondering if we should actually generate multiple files, like we do in nixpkgs, which gives more control to users, and it makes sure that modules that rely on this, are portable. You think that that would be feasible? |
|
A test would also be nice. |
|
Yes I copied it from nixpkgs, as I don't know how to reuse it. I'll see if I can get it working with multiple files same as in nixpkgs. And test it as well. |
9edc70b to
126da17
Compare
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
Signed-off-by: phanirithvij <phanirithvij2000@gmail.com>
126da17 to
79cd7d9
Compare
|
Let me preface this by saying I don't have much experience with rust. In tmp_files.rs activate function let mut cmd = process::Command::new("systemd-tmpfiles");
cmd.arg("--create")
.arg("--remove")
.arg("/etc/tmpfiles.d/00-system-manager.conf");Here, I need to change it to something like
I heard |
| exit 1 | ||
| ) | ||
| done | ||
| ''; |
There was a problem hiding this comment.
Here it differs from nixpkgs version
orig nixpkgs version https://github.com/NixOS/nixpkgs/blob/01ddc67fd61124e3c9df1438e6874731af6d3f06/nixos/modules/system/boot/systemd/tmpfiles.nix#L240-L243
'' + concatMapStrings (name: optionalString (hasPrefix "tmpfiles.d/" name) ''
rm -f $out/${removePrefix "tmpfiles.d/" name}
'') config.system.build.etc.passthru.targets;
}) + "/*";- there is no support for globs in system-manager's
environment.etc.sourceso+ "/*";is out. - I don't know what config.system.build.etc.passthru.targets is tbh, can't find it in system-manager codebase
There was a problem hiding this comment.
etc' = lib.filter (f: f.enable) (lib.attrValues config.environment.etc);
etc = pkgs.runCommandLocal "etc" {
# This is needed for the systemd module
passthru.targets = map (x: x.target) etc';
} /* sh */ ''from nixos/modules/system/etc/etc.nix
I don't know if it is needed for system-manager?
r-vdp
left a comment
There was a problem hiding this comment.
One small change to avoid having to call unwrap, besides that, this looks good to me!
It's really unfortunate that we need to copy all this code from nixpkgs, but I don't think we have a real alternative currently. If at some point this project gets more traction, we could have a discussion in the community to see if we can have some sort of re-usable modules that we can share to lower the maintenance burden.
Co-authored-by: Ramses <ramses@well-founded.dev>
copied verbatim from nixpkgs
since this is writing to a single file, I am adding comments for each settings section to distinguish it.edit: it is now writing to different files, one per settings option.cc: @r-vdp
#146