···429429 '';
430430 };
431431432432- # Activation script to append the password from the password file
432432+ # preStart script to append the password from the password file
433433 # to the configuration files. It also fixes the owner of the
434434 # libnss-mysql-root.cfg because it is changed to root after the
435435 # password is appended.
436436- system.activationScripts.mysql-auth-passwords = ''
436436+ systemd.services.mysql.preStart = ''
437437 if [[ -r ${cfg.passwordFile} ]]; then
438438 org_umask=$(umask)
439439 umask 0077
+4-7
nixos/modules/config/nix-channel.nix
···97979898 nix.settings.nix-path = mkIf (! cfg.channel.enable) (mkDefault "");
9999100100- system.activationScripts.nix-channel = mkIf cfg.channel.enable
101101- (stringAfter [ "etc" "users" ] ''
102102- # Subscribe the root user to the NixOS channel by default.
103103- if [ ! -e "/root/.nix-channels" ]; then
104104- echo "${config.system.defaultChannel} nixos" > "/root/.nix-channels"
105105- fi
106106- '');
100100+ systemd.tmpfiles.rules = lib.mkIf cfg.channel.enable [
101101+ "f /root/.nix-channels -"
102102+ ''w "/root/.nix-channels" - - - - "${config.system.defaultChannel} nixos\n"''
103103+ ];
107104 };
108105}
···4646 wantedBy = [ "sysinit.target" ];
4747 aliases = [ "dbus-org.freedesktop.timesync1.service" ];
4848 restartTriggers = [ config.environment.etc."systemd/timesyncd.conf".source ];
4949+5050+ preStart = (
5151+ # Ensure that we have some stored time to prevent
5252+ # systemd-timesyncd to resort back to the fallback time. If
5353+ # the file doesn't exist we assume that our current system
5454+ # clock is good enough to provide an initial value.
5555+ ''
5656+ if ! [ -f /var/lib/systemd/timesync/clock ]; then
5757+ test -d /var/lib/systemd/timesync || mkdir -p /var/lib/systemd/timesync
5858+ touch /var/lib/systemd/timesync/clock
5959+ fi
6060+ '' +
6161+ # workaround an issue of systemd-timesyncd not starting due to upstream systemd reverting their dynamic users changes
6262+ # - https://github.com/NixOS/nixpkgs/pull/61321#issuecomment-492423742
6363+ # - https://github.com/systemd/systemd/issues/12131
6464+ (lib.optionalString (versionOlder config.system.stateVersion "19.09") ''
6565+ if [ -L /var/lib/systemd/timesync ]; then
6666+ rm /var/lib/systemd/timesync
6767+ mv /var/lib/private/systemd/timesync /var/lib/systemd/timesync
6868+ fi
6969+ '')
7070+ );
4971 };
50725173 environment.etc."systemd/timesyncd.conf".text = ''
···5981 group = "systemd-timesync";
6082 };
6183 users.groups.systemd-timesync.gid = config.ids.gids.systemd-timesync;
6262-6363- system.activationScripts.systemd-timesyncd-migration =
6464- # workaround an issue of systemd-timesyncd not starting due to upstream systemd reverting their dynamic users changes
6565- # - https://github.com/NixOS/nixpkgs/pull/61321#issuecomment-492423742
6666- # - https://github.com/systemd/systemd/issues/12131
6767- mkIf (versionOlder config.system.stateVersion "19.09") ''
6868- if [ -L /var/lib/systemd/timesync ]; then
6969- rm /var/lib/systemd/timesync
7070- mv /var/lib/private/systemd/timesync /var/lib/systemd/timesync
7171- fi
7272- '';
7373- system.activationScripts.systemd-timesyncd-init-clock =
7474- # Ensure that we have some stored time to prevent systemd-timesyncd to
7575- # resort back to the fallback time.
7676- # If the file doesn't exist we assume that our current system clock is
7777- # good enough to provide an initial value.
7878- ''
7979- if ! [ -f /var/lib/systemd/timesync/clock ]; then
8080- test -d /var/lib/systemd/timesync || mkdir -p /var/lib/systemd/timesync
8181- touch /var/lib/systemd/timesync/clock
8282- fi
8383- '';
8484 };
8585-8685}
+6-12
nixos/modules/tasks/network-interfaces.nix
···14061406 val = tempaddrValues.${opt}.sysctl;
14071407 in nameValuePair "net.ipv6.conf.${replaceStrings ["."] ["/"] i.name}.use_tempaddr" val));
1408140814091409- # Set the host and domain names in the activation script. Don't
14101410- # clear it if it's not configured in the NixOS configuration,
14111411- # since it may have been set by dhcpcd in the meantime.
14121412- system.activationScripts.hostname = let
14131413- effectiveHostname = config.boot.kernel.sysctl."kernel.hostname" or cfg.hostName;
14141414- in optionalString (effectiveHostname != "") ''
14151415- hostname "${effectiveHostname}"
14161416- '';
14171417- system.activationScripts.domain =
14181418- optionalString (cfg.domain != null) ''
14191419- domainname "${cfg.domain}"
14201420- '';
14091409+ systemd.services.domainname = lib.mkIf (cfg.domain != null) {
14101410+ wantedBy = [ "sysinit.target" ];
14111411+ before = [ "sysinit.target" ];
14121412+ unitConfig.DefaultDependencies = false;
14131413+ serviceConfig.ExecStart = ''domainname "${cfg.domain}"'';
14141414+ };
1421141514221416 environment.etc.hostid = mkIf (cfg.hostId != null) { source = hostidFile; };
14231417 boot.initrd.systemd.contents."/etc/hostid" = mkIf (cfg.hostId != null) { source = hostidFile; };