Merge pull request #47563 from jameysharp/unscripted
Replace several activation script snippets with declarative configuration
This commit is contained in:
commit
b12c759f76
|
@ -129,17 +129,17 @@ in
|
|||
message = "Option driSupport32Bit only makes sense on a 64-bit system.";
|
||||
};
|
||||
|
||||
system.activationScripts.setup-opengl =
|
||||
''
|
||||
ln -sfn ${package} /run/opengl-driver
|
||||
${if pkgs.stdenv.isi686 then ''
|
||||
ln -sfn opengl-driver /run/opengl-driver-32
|
||||
'' else if cfg.driSupport32Bit then ''
|
||||
ln -sfn ${package32} /run/opengl-driver-32
|
||||
'' else ''
|
||||
rm -f /run/opengl-driver-32
|
||||
''}
|
||||
'';
|
||||
systemd.tmpfiles.rules = [
|
||||
"L+ /run/opengl-driver - - - - ${package}"
|
||||
(
|
||||
if pkgs.stdenv.isi686 then
|
||||
"L+ /run/opengl-driver-32 - - - - opengl-driver"
|
||||
else if cfg.driSupport32Bit then
|
||||
"L+ /run/opengl-driver-32 - - - - ${package32}"
|
||||
else
|
||||
"r /run/opengl-driver-32"
|
||||
)
|
||||
];
|
||||
|
||||
environment.sessionVariables.LD_LIBRARY_PATH =
|
||||
[ "/run/opengl-driver/lib" ] ++ optional cfg.driSupport32Bit "/run/opengl-driver-32/lib";
|
||||
|
|
|
@ -548,6 +548,13 @@ in
|
|||
environment.etc =
|
||||
mapAttrsToList (n: v: makePAMService v) config.security.pam.services;
|
||||
|
||||
systemd.tmpfiles.rules = optionals
|
||||
(any (s: s.updateWtmp) (attrValues config.security.pam.services))
|
||||
[
|
||||
"f /var/log/wtmp"
|
||||
"f /var/log/lastlog"
|
||||
];
|
||||
|
||||
security.pam.services =
|
||||
{ other.text =
|
||||
''
|
||||
|
|
|
@ -88,11 +88,11 @@ in
|
|||
"polkit-agent-helper-1".source = "${pkgs.polkit.out}/lib/polkit-1/polkit-agent-helper-1";
|
||||
};
|
||||
|
||||
system.activationScripts.polkit =
|
||||
''
|
||||
# Probably no more needed, clean up
|
||||
rm -rf /var/lib/{polkit-1,PolicyKit}
|
||||
'';
|
||||
systemd.tmpfiles.rules = [
|
||||
# Probably no more needed, clean up
|
||||
"R /var/lib/polkit-1"
|
||||
"R /var/lib/PolicyKit"
|
||||
];
|
||||
|
||||
users.users.polkituser = {
|
||||
description = "PolKit daemon";
|
||||
|
|
|
@ -128,14 +128,6 @@ in
|
|||
''
|
||||
# Various log/runtime directories.
|
||||
|
||||
mkdir -m 0755 -p /run/nix/current-load # for distributed builds
|
||||
mkdir -m 0700 -p /run/nix/remote-stores
|
||||
|
||||
mkdir -m 0755 -p /var/log
|
||||
|
||||
touch /var/log/wtmp /var/log/lastlog # must exist
|
||||
chmod 644 /var/log/wtmp /var/log/lastlog
|
||||
|
||||
mkdir -m 1777 -p /var/tmp
|
||||
|
||||
# Empty, immutable home directory of many system accounts.
|
||||
|
|
|
@ -152,6 +152,14 @@ ln -sfn /run/booted-system /nix/var/nix/gcroots/booted-system
|
|||
@shell@ @postBootCommands@
|
||||
|
||||
|
||||
# Ensure systemd doesn't try to populate /etc, by forcing its first-boot
|
||||
# heuristic off. It doesn't matter what's in /etc/machine-id for this purpose,
|
||||
# and systemd will immediately fill in the file when it starts, so just
|
||||
# creating it is enough. This `: >>` pattern avoids forking and avoids changing
|
||||
# the mtime if the file already exists.
|
||||
: >> /etc/machine-id
|
||||
|
||||
|
||||
# Reset the logging file descriptors.
|
||||
exec 1>&$logOutFd 2>&$logErrFd
|
||||
exec {logOutFd}>&- {logErrFd}>&-
|
||||
|
|
|
@ -747,6 +747,7 @@ in
|
|||
|
||||
"systemd/journald.conf".text = ''
|
||||
[Journal]
|
||||
Storage=persistent
|
||||
RateLimitInterval=${config.services.journald.rateLimitInterval}
|
||||
RateLimitBurst=${toString config.services.journald.rateLimitBurst}
|
||||
${optionalString (config.services.journald.console != "") ''
|
||||
|
@ -783,19 +784,6 @@ in
|
|||
|
||||
services.dbus.enable = true;
|
||||
|
||||
system.activationScripts.systemd = stringAfter [ "groups" ]
|
||||
''
|
||||
mkdir -m 0755 -p /var/lib/udev
|
||||
|
||||
if ! [ -e /etc/machine-id ]; then
|
||||
${systemd}/bin/systemd-machine-id-setup
|
||||
fi
|
||||
|
||||
# Keep a persistent journal. Note that systemd-tmpfiles will
|
||||
# set proper ownership/permissions.
|
||||
mkdir -m 0700 -p /var/log/journal
|
||||
'';
|
||||
|
||||
users.users.systemd-network.uid = config.ids.uids.systemd-network;
|
||||
users.groups.systemd-network.gid = config.ids.gids.systemd-network;
|
||||
users.users.systemd-resolve.uid = config.ids.uids.systemd-resolve;
|
||||
|
|
Loading…
Reference in a new issue