diff --git a/hosts/build02/nixpkgs-update.nix b/hosts/build02/nixpkgs-update.nix index cc0533d..97acb39 100644 --- a/hosts/build02/nixpkgs-update.nix +++ b/hosts/build02/nixpkgs-update.nix @@ -25,11 +25,11 @@ let mkWorker = name: { after = [ - "network-online.target" - "nixpkgs-update-supervisor.service" + config.systemd.targets.network-online.name + config.systemd.services.nixpkgs-update-supervisor.name ]; - wants = [ "network-online.target" ]; - wantedBy = [ "multi-user.target" ]; + wants = [ config.systemd.targets.network-online.name ]; + wantedBy = [ config.systemd.targets.multi-user.name ]; description = "nixpkgs-update ${name} service"; enable = true; restartIfChanged = true; @@ -63,8 +63,8 @@ let }; mkFetcher = name: cmd: { - after = [ "network-online.target" ]; - wants = [ "network-online.target" ]; + after = [ config.systemd.targets.network-online.name ]; + wants = [ config.systemd.targets.network-online.name ]; path = nixpkgsUpdateSystemDependencies ++ [ # nixpkgs-update-github-releases (pkgs.python3.withPackages ( @@ -121,8 +121,8 @@ in systemd.services.nixpkgs-update-delete-done = { startAt = "0/12:10"; # every 12 hours - after = [ "network-online.target" ]; - wants = [ "network-online.target" ]; + after = [ config.systemd.targets.network-online.name ]; + wants = [ config.systemd.targets.network-online.name ]; description = "nixpkgs-update delete done branches"; restartIfChanged = true; path = nixpkgsUpdateSystemDependencies; @@ -160,7 +160,7 @@ in # Too many workers cause out-of-memory. systemd.services.nixpkgs-update-supervisor = { - wantedBy = [ "multi-user.target" ]; + wantedBy = [ config.systemd.targets.multi-user.name ]; description = "nixpkgs-update supervisor service"; enable = true; restartIfChanged = true; diff --git a/hosts/web02/gandi.nix b/hosts/web02/gandi.nix index 7386723..8193689 100644 --- a/hosts/web02/gandi.nix +++ b/hosts/web02/gandi.nix @@ -1,5 +1,10 @@ # This is the configuration required to run NixOS on GandiCloud. -{ lib, modulesPath, ... }: +{ + config, + lib, + modulesPath, + ... +}: { imports = [ (modulesPath + "/virtualisation/openstack-config.nix") ]; config = { @@ -21,7 +26,7 @@ boot.kernelParams = [ "console=ttyS0" ]; systemd.services."serial-getty@ttyS0" = { enable = true; - wantedBy = [ "multi-user.target" ]; + wantedBy = [ config.systemd.targets.multi-user.name ]; serviceConfig.Restart = "always"; }; @@ -31,7 +36,7 @@ # This is to get a prompt via the "openstack console url show" command systemd.services."getty@tty1" = { enable = lib.mkForce true; - wantedBy = [ "multi-user.target" ]; + wantedBy = [ config.systemd.targets.multi-user.name ]; serviceConfig.Restart = "always"; }; diff --git a/modules/nixos/hydra.nix b/modules/nixos/hydra.nix index b8694d1..f69a10b 100644 --- a/modules/nixos/hydra.nix +++ b/modules/nixos/hydra.nix @@ -62,9 +62,9 @@ Type = "oneshot"; TimeoutStartSec = "60"; }; - wantedBy = [ "multi-user.target" ]; - after = [ "hydra-server.service" ]; - requires = [ "hydra-server.service" ]; + wantedBy = [ config.systemd.targets.multi-user.name ]; + after = [ config.systemd.services.hydra-server.name ]; + requires = [ config.systemd.services.hydra-server.name ]; environment = { inherit (config.systemd.services.hydra-init.environment) HYDRA_DBI; }; diff --git a/modules/nixos/monitoring/grafana.nix b/modules/nixos/monitoring/grafana.nix index 575aadd..bed2697 100644 --- a/modules/nixos/monitoring/grafana.nix +++ b/modules/nixos/monitoring/grafana.nix @@ -5,7 +5,7 @@ ... }: { - systemd.services.grafana.after = [ "prometheus.service" ]; + systemd.services.grafana.after = [ config.systemd.services.prometheus.name ]; age.secrets.grafana-client-secret = { file = "${inputs.self}/secrets/grafana-client-secret.age"; diff --git a/modules/nixos/monitoring/matrix-hook.nix b/modules/nixos/monitoring/matrix-hook.nix index cc3f5e2..be20ce5 100644 --- a/modules/nixos/monitoring/matrix-hook.nix +++ b/modules/nixos/monitoring/matrix-hook.nix @@ -20,9 +20,9 @@ in systemd.services.matrix-hook = { description = "Matrix Hook"; - after = [ "network-online.target" ]; - wants = [ "network-online.target" ]; - wantedBy = [ "multi-user.target" ]; + after = [ config.systemd.targets.network-online.name ]; + wants = [ config.systemd.targets.network-online.name ]; + wantedBy = [ config.systemd.targets.multi-user.name ]; environment = { HTTP_ADDRESS = "localhost"; HTTP_PORT = "9088"; diff --git a/modules/nixos/monitoring/prometheus.nix b/modules/nixos/monitoring/prometheus.nix index 0b8aff3..57e68b6 100644 --- a/modules/nixos/monitoring/prometheus.nix +++ b/modules/nixos/monitoring/prometheus.nix @@ -1,8 +1,13 @@ -{ inputs, pkgs, ... }: { - systemd.services.prometheus.after = pkgs.lib.mkForce [ "network-online.target" ]; - systemd.services.prometheus.wants = [ "network-online.target" ]; - systemd.services.alertmanager.after = [ "prometheus.service" ]; + config, + inputs, + pkgs, + ... +}: +{ + systemd.services.prometheus.after = pkgs.lib.mkForce [ config.systemd.targets.network-online.name ]; + systemd.services.prometheus.wants = [ config.systemd.targets.network-online.name ]; + systemd.services.alertmanager.after = [ config.systemd.services.prometheus.name ]; services.prometheus = { enable = true; diff --git a/modules/nixos/nur-update.nix b/modules/nixos/nur-update.nix index 531838e..1f865b7 100644 --- a/modules/nixos/nur-update.nix +++ b/modules/nixos/nur-update.nix @@ -37,6 +37,6 @@ Restart = "always"; RuntimeDirectory = "nur-update"; }; - wantedBy = [ "multi-user.target" ]; + wantedBy = [ config.systemd.targets.multi-user.name ]; }; }