-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 <[email protected]>
Signed-off-by: phanirithvij <[email protected]>
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.source
so+ "/*";
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
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