fix(system-manager): remove evaluation-time package reads

Assisted-by: pi (gpt-5.6-sol)
This commit is contained in:
Gabriel Fontes
2026-08-14 15:00:06 -03:00
parent 0ca27c059b
commit 090a94b268
3 changed files with 17 additions and 24 deletions
+7 -6
View File
@@ -4,11 +4,12 @@
pkgs,
...
}: let
dbusSessionConfig =
builtins.replaceStrings
["<include ignore_missing=\"yes\">/etc/dbus-1/session.conf</include>"]
[""]
(builtins.readFile "${pkgs.dbus}/share/dbus-1/session.conf");
dbusSessionConfig = pkgs.runCommandLocal "dbus-session.conf" {} ''
substitute ${pkgs.dbus}/share/dbus-1/session.conf "$out" \
--replace-fail \
'<include ignore_missing="yes">/etc/dbus-1/session.conf</include>' \
""
'';
in {
imports =
[
@@ -28,7 +29,7 @@ in {
# Nix's D-Bus tools use /etc for their primary config, while Ubuntu keeps the
# defaults in /usr/share and reserves /etc for local includes. Remove the
# self-include when installing those defaults into /etc.
environment.etc."dbus-1/session.conf".text = dbusSessionConfig;
environment.etc."dbus-1/session.conf".source = dbusSessionConfig;
# The management CLI on the system PATH (/run/system-manager/sw/bin), like
# nixos-rebuild on NixOS, so switching doesn't need `nix run`.
+5 -1
View File
@@ -11,5 +11,9 @@
# Pinned rather than auto-detected: with an empty list the upstream module
# installs a udev rule that calls /run/current-system/systemd/bin/systemctl,
# a path that does not exist outside NixOS.
networking.wireless.interfaces = ["wlp0s20f3"];
networking.wireless = {
# system-manager lacks the NixOS D-Bus module that installs its policy.
dbusControlled = false;
interfaces = ["wlp0s20f3"];
};
}
+5 -17
View File
@@ -3,9 +3,9 @@
#
# system-manager reuses nixpkgs' systemdUtils, environment.etc and userborn, so
# the unit, the generated wpa_supplicant.conf and the wpa_supplicant user all
# come out unchanged. Only a handful of NixOS-only options are missing: three
# are read but never acted on, and the two that do matter are re-expressed on
# top of environment.etc, which the host distro reads from the same paths.
# come out unchanged. Only a handful of NixOS-only options are missing: four
# are read but never acted on, and the udev rules are re-expressed on top of
# environment.etc, which the host distro reads from the same path.
{
config,
lib,
@@ -51,19 +51,7 @@ in {
};
};
config = {
environment.etc = lib.mkMerge [
(lib.mkIf (cfg.udev.extraRules != "") {
"udev/rules.d/99-system-manager.rules".text = cfg.udev.extraRules;
})
# The attribute name may not carry string context, hence the discard; the
# value keeps its reference to the store path.
(lib.listToAttrs (map (file: {
name = "dbus-1/system.d/" + builtins.unsafeDiscardStringContext (baseNameOf file);
value = {source = file;};
})
(lib.concatMap (pkg: lib.filesystem.listFilesRecursive "${pkg}/share/dbus-1/system.d")
(lib.filter (pkg: builtins.pathExists "${pkg}/share/dbus-1/system.d") cfg.dbus.packages))))
];
config = lib.mkIf (cfg.udev.extraRules != "") {
environment.etc."udev/rules.d/99-system-manager.rules".text = cfg.udev.extraRules;
};
}