···58 before the activation script is run. This behavior is different when the
59 service is socket-activated, as outlined in the following steps.
6061- - The last thing that is taken into account is whether the unit is a service
62- and socket-activated. If `X-StopIfChanged` is **not** set, the service
63- is **restart**ed with the others. If it is set, both the service and the
64- socket are **stop**ped and the socket is **start**ed, leaving socket
65- activation to start the service when it's needed.
000006667## Sysinit reactivation {#sec-sysinit-reactivation}
68
···58 before the activation script is run. This behavior is different when the
59 service is socket-activated, as outlined in the following steps.
6061+ - The last thing that is taken into account is whether the unit is a
62+ service and socket-activated. A correspondence between a
63+ `.service` and its `.socket` unit is detected automatically, but
64+ services can **opt out** of that detection by setting
65+ `X-NotSocketActivated` to `yes` in their `[Service]`
66+ section. Otherwise, if `X-StopIfChanged` is **not** set, the
67+ service is **restart**ed with the others. If it is set, both the
68+ service and the socket are **stop**ped and the socket is
69+ **start**ed, leaving socket activation to start the service when
70+ it's needed.
7172## Sysinit reactivation {#sec-sysinit-reactivation}
73
···535 '';
536 };
537000000000000538 startAt = mkOption {
539 type = with types; either str (listOf str);
540 default = [];
···535 '';
536 };
537538+ notSocketActivated = mkOption {
539+ type = types.bool;
540+ default = false;
541+ description = ''
542+ If set, a changed unit is never assumed to be
543+ socket-activated on configuration switch, even if
544+ it might have associated socket units. Instead, the unit
545+ will be restarted (or stopped/started) as if it had no
546+ associated sockets.
547+ '';
548+ };
549+550 startAt = mkOption {
551 type = with types; either str (listOf str);
552 default = [];
···544 }
545 }
5460000000547 # If the unit is not socket-activated, record
548 # that this unit needs to be started below.
549 # We write this to a file to ensure that the
···544 }
545 }
546547+ if (parse_systemd_bool(\%new_unit_info, "Service", "X-NotSocketActivated", 0)) {
548+ # If the unit explicitly opts out of socket
549+ # activation, restart it as if it weren't (but do
550+ # restart its sockets, that's fine):
551+ $socket_activated = 0;
552+ }
553+554 # If the unit is not socket-activated, record
555 # that this unit needs to be started below.
556 # We write this to a file to ensure that the
···66 # login and store session
67 machine.log(machine.succeed(f"http --check-status --session=frigate post http://localhost/api/login user=admin password={password}"))
6869- # make authenticated api requested
70 machine.log(machine.succeed("http --check-status --session=frigate get http://localhost/api/version"))
0007172 # wait for a recording to appear
73 machine.wait_for_file("/var/cache/frigate/test@*.mp4")
···66 # login and store session
67 machine.log(machine.succeed(f"http --check-status --session=frigate post http://localhost/api/login user=admin password={password}"))
6869+ # make authenticated api request
70 machine.log(machine.succeed("http --check-status --session=frigate get http://localhost/api/version"))
71+72+ # make unauthenticated api request
73+ machine.log(machine.succeed("http --check-status get http://localhost:5000/api/version"))
7475 # wait for a recording to appear
76 machine.wait_for_file("/var/cache/frigate/test@*.mp4")
···2526 meta = {
27 description = "Use natural language to edit your codebase and run commands from your terminal faster";
28- homepage = "https://codebuff.ai";
29 downloadPage = "https://www.npmjs.com/package/codebuff";
30 license = lib.licenses.mit;
31 maintainers = [ lib.maintainers.malo ];
···2526 meta = {
27 description = "Use natural language to edit your codebase and run commands from your terminal faster";
28+ homepage = "https://www.codebuff.com/";
29 downloadPage = "https://www.npmjs.com/package/codebuff";
30 license = lib.licenses.mit;
31 maintainers = [ lib.maintainers.malo ];
···74// `stopIfChanged = true` is ignored, switch-to-configuration will handle `restartIfChanged =
75// false` and `reloadIfChanged = true`. This is the same as specifying a restart trigger in the
76// NixOS module.
0077//
78// The reload file asks this program to reload a unit. This is the same as specifying a reload
79// trigger in the NixOS module and can be ignored if the unit is restarted in this activation.
···613 } else {
614 // If this unit is socket-activated, then stop the socket unit(s) as well, and
615 // restart the socket(s) instead of the service.
00616 let mut socket_activated = false;
617 if unit.ends_with(".service") {
618 let mut sockets = if let Some(Some(Some(sockets))) = new_unit_info.map(|info| {
···662 }
663 }
664 }
000000665 }
666667 // If the unit is not socket-activated, record that this unit needs to be started
···74// `stopIfChanged = true` is ignored, switch-to-configuration will handle `restartIfChanged =
75// false` and `reloadIfChanged = true`. This is the same as specifying a restart trigger in the
76// NixOS module.
77+// In addition, switch-to-configuration will handle notSocketActivated=true to disable treatment
78+// of units as "socket-activated" even though they might have any associated sockets.
79//
80// The reload file asks this program to reload a unit. This is the same as specifying a reload
81// trigger in the NixOS module and can be ignored if the unit is restarted in this activation.
···615 } else {
616 // If this unit is socket-activated, then stop the socket unit(s) as well, and
617 // restart the socket(s) instead of the service.
618+ // We count as "socket-activated" any unit that doesn't declare itself not so
619+ // via X-NotSocketActivated, that has any associated .socket units.
620 let mut socket_activated = false;
621 if unit.ends_with(".service") {
622 let mut sockets = if let Some(Some(Some(sockets))) = new_unit_info.map(|info| {
···666 }
667 }
668 }
669+ }
670+ if parse_systemd_bool(new_unit_info, "Service", "X-NotSocketActivated", false) {
671+ // If the unit explicitly opts out of socket
672+ // activation, restart it as if it weren't (but do
673+ // restart its sockets, that's fine):
674+ socket_activated = false;
675 }
676677 // If the unit is not socket-activated, record that this unit needs to be started