mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
Merge master into staging-next
This commit is contained in:
commit
d7e9da1742
61 changed files with 609 additions and 323 deletions
|
@ -108,8 +108,7 @@ in
|
|||
ProtectClock = true;
|
||||
ProtectHome = true;
|
||||
ProtectHostname = true;
|
||||
# Would re-mount paths ignored by temporary root
|
||||
#ProtectSystem = "strict";
|
||||
ProtectSystem = "strict";
|
||||
ProtectControlGroups = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectKernelModules = true;
|
||||
|
@ -121,9 +120,7 @@ in
|
|||
RestrictSUIDSGID = true;
|
||||
SystemCallArchitectures = "native";
|
||||
SystemCallFilter = [ "@system-service" "~@privileged @setuid @keyring" ];
|
||||
TemporaryFileSystem = "/:ro";
|
||||
# Does not work well with the temporary root
|
||||
#UMask = "0066";
|
||||
UMask = "0066";
|
||||
} // optionalAttrs (cfg.environmentFile != null) {
|
||||
EnvironmentFile = cfg.environmentFile;
|
||||
};
|
||||
|
|
|
@ -16,29 +16,28 @@ with lib;
|
|||
};
|
||||
|
||||
config = mkIf config.boot.growPartition {
|
||||
assertions = [
|
||||
{
|
||||
assertion = !config.boot.initrd.systemd.repart.enable && !config.systemd.repart.enable;
|
||||
message = "systemd-repart already grows the root partition and thus you should not use boot.growPartition";
|
||||
}
|
||||
];
|
||||
systemd.services.growpart = {
|
||||
wantedBy = [ "-.mount" ];
|
||||
after = [ "-.mount" ];
|
||||
before = [ "systemd-growfs-root.service" ];
|
||||
conflicts = [ "shutdown.target" ];
|
||||
unitConfig.DefaultDependencies = false;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
TimeoutSec = "infinity";
|
||||
# growpart returns 1 if the partition is already grown
|
||||
SuccessExitStatus = "0 1";
|
||||
};
|
||||
|
||||
assertions = [{
|
||||
assertion = !config.boot.initrd.systemd.enable;
|
||||
message = "systemd stage 1 does not support 'boot.growPartition' yet.";
|
||||
}];
|
||||
|
||||
boot.initrd.extraUtilsCommands = ''
|
||||
copy_bin_and_libs ${pkgs.gawk}/bin/gawk
|
||||
copy_bin_and_libs ${pkgs.gnused}/bin/sed
|
||||
copy_bin_and_libs ${pkgs.util-linux}/sbin/sfdisk
|
||||
copy_bin_and_libs ${pkgs.util-linux}/sbin/lsblk
|
||||
|
||||
substitute "${pkgs.cloud-utils.guest}/bin/.growpart-wrapped" "$out/bin/growpart" \
|
||||
--replace "${pkgs.bash}/bin/sh" "/bin/sh" \
|
||||
--replace "awk" "gawk" \
|
||||
--replace "sed" "gnused"
|
||||
|
||||
ln -s sed $out/bin/gnused
|
||||
'';
|
||||
|
||||
boot.initrd.postDeviceCommands = ''
|
||||
rootDevice="${config.fileSystems."/".device}"
|
||||
if waitDevice "$rootDevice"; then
|
||||
script = ''
|
||||
rootDevice="${config.fileSystems."/".device}"
|
||||
rootDevice="$(readlink -f "$rootDevice")"
|
||||
parentDevice="$rootDevice"
|
||||
while [ "''${parentDevice%[0-9]}" != "''${parentDevice}" ]; do
|
||||
|
@ -48,11 +47,8 @@ with lib;
|
|||
if [ "''${parentDevice%[0-9]p}" != "''${parentDevice}" ] && [ -b "''${parentDevice%p}" ]; then
|
||||
parentDevice="''${parentDevice%p}"
|
||||
fi
|
||||
TMPDIR=/run sh $(type -P growpart) "$parentDevice" "$partNum"
|
||||
udevadm settle
|
||||
fi
|
||||
'';
|
||||
|
||||
"${pkgs.cloud-utils.guest}/bin/growpart" "$parentDevice" "$partNum"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue