git.iko.soy/typeable/nixpkgs
on master help sign in
nixos/binfmt: move systemd-binfmt.service to binfmt module

Also, remove the dangling systemd.services.systemd-binfmt.wants = [ "proc-sys-fs-binfmt_misc.mount" ]; in systemd.nix. If boot.binfmt.registrations != {}, systemd will install proc-sys-fs-binfmt_misc.automount, which will auto-mount `/proc/sys/fs/binfmt_misc` as soon as systemd-binfmt tries to access it. Fixes https://github.com/NixOS/nixpkgs/issues/87687 Fixes https://github.com/NixOS/nixops/issues/574

commit4e2715934e2c995554c5d70fe4eea12716425480 authorFlorian Klink <flokli@flokli.de> dateWed 13 May 2020, 16:29 (6 years ago) parent3ec270c
2 files changed+5−6
nixos/modules/system/boot/binfmt.nix+5−4 nixos/modules/system/boot/systemd.nix−2
nixos/modules/system/boot/binfmt.nix+5−4
@@ -268,9 +268,10 @@ in {
268268 mkdir -p -m 0755 /run/binfmt
269269 ${lib.concatStringsSep "\n" (lib.mapAttrsToList activationSnippet config.boot.binfmt.registrations)}
270270 '';
271− systemd.additionalUpstreamSystemUnits = lib.mkIf (config.boot.binfmt.registrations != {})
272− [ "proc-sys-fs-binfmt_misc.automount"
273− "proc-sys-fs-binfmt_misc.mount"
274− ];
271+ systemd.additionalUpstreamSystemUnits = lib.mkIf (config.boot.binfmt.registrations != {}) [
272+ "proc-sys-fs-binfmt_misc.automount"
273+ "proc-sys-fs-binfmt_misc.mount"
274+ "systemd-binfmt.service"
275+ ];
275276 };
276277}
nixos/modules/system/boot/systemd.nix−2
@@ -164,7 +164,6 @@ let
164164 "systemd-timedated.service"
165165 "systemd-localed.service"
166166 "systemd-hostnamed.service"
167− "systemd-binfmt.service"
168167 "systemd-exit.service"
169168 "systemd-update-done.service"
170169 ] ++ optionals config.services.journald.enableHttpGateway [
@@ -1056,7 +1055,6 @@ in
10561055 systemd.targets.local-fs.unitConfig.X-StopOnReconfiguration = true;
10571056 systemd.targets.remote-fs.unitConfig.X-StopOnReconfiguration = true;
10581057 systemd.targets.network-online.wantedBy = [ "multi-user.target" ];
1059− systemd.services.systemd-binfmt.wants = [ "proc-sys-fs-binfmt_misc.mount" ];
10601058 systemd.services.systemd-importd.environment = proxy_env;
10611059
10621060 # Don't bother with certain units in containers.