Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

systemd: Use upstream tmpfiles.d rules

This fixes a failing assert in systemd-timesyncd (issue #5913) as it
expects the directory /run/systemd/netif/links/ to exist, and nothing in
NixOS currently creates it.

Also we get a net reduction in our code as rules for /run/utmp and
/var/log/journal are also provided by the same upstream file.

(cherry picked from commit a278a9224a3c1c5db399d53c86b36a25133b5cda)

authored by Tuomas Tynkkynen and committed by Eelco Dolstra 5d02c02a eedda353

+1 -15
-4
nixos/modules/system/activation/activation-script.nix
··· 114 114 '' 115 115 # Various log/runtime directories. 116 116 117 - touch /run/utmp # must exist 118 - chgrp ${toString config.ids.gids.utmp} /run/utmp 119 - chmod 664 /run/utmp 120 - 121 117 mkdir -m 0755 -p /run/nix/current-load # for distributed builds 122 118 mkdir -m 0700 -p /run/nix/remote-stores 123 119
+1 -11
nixos/modules/system/boot/systemd.nix
··· 639 639 system.activationScripts.systemd = stringAfter [ "groups" ] 640 640 '' 641 641 mkdir -m 0755 -p /var/lib/udev 642 - mkdir -p /var/log/journal 643 - chmod 0755 /var/log/journal 644 - 645 - # Make all journals readable to users in the wheel and adm 646 - # groups, in addition to those in the systemd-journal group. 647 - # Users can always read their own journals. 648 - ${pkgs.acl}/bin/setfacl -nm g:wheel:rx,d:g:wheel:rx,g:adm:rx,d:g:adm:rx /var/log/journal || true 649 642 650 643 if ! [ -e /etc/machine-id ]; then 651 644 ${systemd}/bin/systemd-machine-id-setup ··· 731 724 startSession = true; 732 725 }; 733 726 727 + environment.etc."tmpfiles.d/systemd.conf".source = "${systemd}/example/tmpfiles.d/systemd.conf"; 734 728 environment.etc."tmpfiles.d/x11.conf".source = "${systemd}/example/tmpfiles.d/x11.conf"; 735 729 736 730 environment.etc."tmpfiles.d/nixos.conf".text = 737 731 '' 738 732 # This file is created automatically and should not be modified. 739 733 # Please change the option ‘systemd.tmpfiles.rules’ instead. 740 - 741 - z /var/log/journal 2755 root systemd-journal - - 742 - z /var/log/journal/%m 2755 root systemd-journal - - 743 - z /var/log/journal/%m/* 0640 root systemd-journal - - 744 734 745 735 ${concatStringsSep "\n" cfg.tmpfiles.rules} 746 736 '';