summaryrefslogtreecommitdiffstats
path: root/nixos/modules
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/config/terminfo.nix5
-rw-r--r--nixos/modules/hardware/all-firmware.nix24
-rw-r--r--nixos/modules/installer/tools/nix-fallback-paths.nix10
-rw-r--r--nixos/modules/installer/tools/nixos-option/default.nix1
-rw-r--r--nixos/modules/programs/fish.nix2
-rw-r--r--nixos/modules/security/pam.nix6
-rw-r--r--nixos/modules/security/sudo.nix139
-rw-r--r--nixos/modules/services/audio/wyoming/faster-whisper.nix3
-rw-r--r--nixos/modules/services/backup/restic.nix8
-rw-r--r--nixos/modules/services/monitoring/netdata.nix12
-rw-r--r--nixos/modules/services/monitoring/smartd.nix2
-rw-r--r--nixos/modules/services/networking/trust-dns.nix4
-rw-r--r--nixos/modules/services/networking/wireguard.nix1
-rw-r--r--nixos/modules/system/boot/initrd-ssh.nix2
-rw-r--r--nixos/modules/system/boot/stage-1-init.sh2
-rw-r--r--nixos/modules/system/boot/stage-1.nix10
-rw-r--r--nixos/modules/system/boot/systemd/initrd.nix1
-rw-r--r--nixos/modules/system/boot/systemd/journald.nix11
-rw-r--r--nixos/modules/virtualisation/azure-agent.nix11
-rw-r--r--nixos/modules/virtualisation/google-compute-image.nix8
-rw-r--r--nixos/modules/virtualisation/oci-containers.nix3
21 files changed, 156 insertions, 109 deletions
diff --git a/nixos/modules/config/terminfo.nix b/nixos/modules/config/terminfo.nix
index d1dbc4e0d059..ebd1aaea8f04 100644
--- a/nixos/modules/config/terminfo.nix
+++ b/nixos/modules/config/terminfo.nix
@@ -16,10 +16,7 @@ with lib;
};
security.sudo.keepTerminfo = mkOption {
- default = config.security.sudo.package.pname != "sudo-rs";
- defaultText = literalMD ''
- `true` unless using `sudo-rs`
- '';
+ default = true;
type = types.bool;
description = lib.mdDoc ''
Whether to preserve the `TERMINFO` and `TERMINFO_DIRS`
diff --git a/nixos/modules/hardware/all-firmware.nix b/nixos/modules/hardware/all-firmware.nix
index 08141bb0e87b..6f58e848b38a 100644
--- a/nixos/modules/hardware/all-firmware.nix
+++ b/nixos/modules/hardware/all-firmware.nix
@@ -18,29 +18,16 @@ in {
options = {
- hardware.enableAllFirmware = mkOption {
- default = false;
- type = types.bool;
- description = lib.mdDoc ''
- Turn on this option if you want to enable all the firmware.
- '';
- };
+ hardware.enableAllFirmware = mkEnableOption "all firmware regardless of license";
- hardware.enableRedistributableFirmware = mkOption {
+ hardware.enableRedistributableFirmware = mkEnableOption "firmware with a license allowing redistribution" // {
default = config.hardware.enableAllFirmware;
defaultText = lib.literalExpression "config.hardware.enableAllFirmware";
- type = types.bool;
- description = lib.mdDoc ''
- Turn on this option if you want to enable all the firmware with a license allowing redistribution.
- '';
};
- hardware.wirelessRegulatoryDatabase = mkOption {
- default = false;
- type = types.bool;
- description = lib.mdDoc ''
- Load the wireless regulatory database at boot.
- '';
+ hardware.wirelessRegulatoryDatabase = mkEnableOption "loading the wireless regulatory database at boot" // {
+ default = cfg.enableRedistributableFirmware || cfg.enableAllFirmware;
+ defaultText = literalMD "Enabled if proprietary firmware is allowed via {option}`enableRedistributableFirmware` or {option}`enableAllFirmware`.";
};
};
@@ -65,7 +52,6 @@ in {
++ optionals (versionOlder config.boot.kernelPackages.kernel.version "4.13") [
rtl8723bs-firmware
];
- hardware.wirelessRegulatoryDatabase = true;
})
(mkIf cfg.enableAllFirmware {
assertions = [{
diff --git a/nixos/modules/installer/tools/nix-fallback-paths.nix b/nixos/modules/installer/tools/nix-fallback-paths.nix
index 10c37a46fdac..e4241e965403 100644
--- a/nixos/modules/installer/tools/nix-fallback-paths.nix
+++ b/nixos/modules/installer/tools/nix-fallback-paths.nix
@@ -1,7 +1,7 @@
{
- x86_64-linux = "/nix/store/3wqasl97rjiza3vd7fxjnvli2w9l30mk-nix-2.17.0";
- i686-linux = "/nix/store/z360xswxfx55pmm1fng3hw748rbs0kkj-nix-2.17.0";
- aarch64-linux = "/nix/store/9670sxa916xmv8n1kqs7cdvmnsrhrdjv-nix-2.17.0";
- x86_64-darwin = "/nix/store/2rdbky9j8hc3mbgl6pnda4hkjllyfwnn-nix-2.17.0";
- aarch64-darwin = "/nix/store/jl9qma14fb4zk9lq1k0syw2k9qm2gqjw-nix-2.17.0";
+ x86_64-linux = "/nix/store/azvn85cras6xv4z5j85fiy406f24r1q0-nix-2.18.1";
+ i686-linux = "/nix/store/9bnwy7f9h0kzdzmcnjjsjg0aak5waj40-nix-2.18.1";
+ aarch64-linux = "/nix/store/hh65xwqm9s040s3cgn9vzcmrxj0sf5ij-nix-2.18.1";
+ x86_64-darwin = "/nix/store/6zi5fqzn9n17wrk8r41rhdw4j7jqqsi3-nix-2.18.1";
+ aarch64-darwin = "/nix/store/0pbq6wzr2f1jgpn5212knyxpwmkjgjah-nix-2.18.1";
}
diff --git a/nixos/modules/installer/tools/nixos-option/default.nix b/nixos/modules/installer/tools/nixos-option/default.nix
deleted file mode 100644
index 061460f38a3b..000000000000
--- a/nixos/modules/installer/tools/nixos-option/default.nix
+++ /dev/null
@@ -1 +0,0 @@
-{ pkgs, ... }: pkgs.nixos-option
diff --git a/nixos/modules/programs/fish.nix b/nixos/modules/programs/fish.nix
index e6ac6e9957ba..a4c20560bc9b 100644
--- a/nixos/modules/programs/fish.nix
+++ b/nixos/modules/programs/fish.nix
@@ -268,7 +268,7 @@ in
''
mkdir -p $out
if [ -d $package/share/man ]; then
- find $package/share/man -type f | xargs ${pkgs.python3.pythonForBuild.interpreter} ${patchedGenerator}/create_manpage_completions.py --directory $out >/dev/null
+ find $package/share/man -type f | xargs ${pkgs.python3.pythonOnBuildForHost.interpreter} ${patchedGenerator}/create_manpage_completions.py --directory $out >/dev/null
fi
'';
in
diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix
index 709bb8b94a65..b7e1ea526535 100644
--- a/nixos/modules/security/pam.nix
+++ b/nixos/modules/security/pam.nix
@@ -1531,6 +1531,10 @@ in
(map (module: "mr ${module},"))
concatLines
]);
- };
+ security.sudo.extraConfig = optionalString config.security.pam.enableSSHAgentAuth ''
+ # Keep SSH_AUTH_SOCK so that pam_ssh_agent_auth.so can do its magic.
+ Defaults env_keep+=SSH_AUTH_SOCK
+ '';
+ };
}
diff --git a/nixos/modules/security/sudo.nix b/nixos/modules/security/sudo.nix
index c665c15242a5..ff912dec5073 100644
--- a/nixos/modules/security/sudo.nix
+++ b/nixos/modules/security/sudo.nix
@@ -6,6 +6,8 @@ let
cfg = config.security.sudo;
+ inherit (config.security.pam) enableSSHAgentAuth;
+
toUserString = user: if (isInt user) then "#${toString user}" else "${user}";
toGroupString = group: if (isInt group) then "%#${toString group}" else "%${group}";
@@ -28,9 +30,18 @@ in
###### interface
- options = {
+ options.security.sudo = {
+
+ defaultOptions = mkOption {
+ type = with types; listOf str;
+ default = [ "SETENV" ];
+ description = mdDoc ''
+ Options used for the default rules, granting `root` and the
+ `wheel` group permission to run any command as any user.
+ '';
+ };
- security.sudo.enable = mkOption {
+ enable = mkOption {
type = types.bool;
default = true;
description =
@@ -40,29 +51,21 @@ in
'';
};
- security.sudo.package = mkOption {
- type = types.package;
- default = pkgs.sudo;
- defaultText = literalExpression "pkgs.sudo";
- description = lib.mdDoc ''
- Which package to use for `sudo`.
- '';
- };
+ package = mkPackageOption pkgs "sudo" { };
- security.sudo.wheelNeedsPassword = mkOption {
+ wheelNeedsPassword = mkOption {
type = types.bool;
default = true;
- description =
- lib.mdDoc ''
- Whether users of the `wheel` group must
- provide a password to run commands as super user via {command}`sudo`.
- '';
+ description = mdDoc ''
+ Whether users of the `wheel` group must
+ provide a password to run commands as super user via {command}`sudo`.
+ '';
};
- security.sudo.execWheelOnly = mkOption {
+ execWheelOnly = mkOption {
type = types.bool;
default = false;
- description = lib.mdDoc ''
+ description = mdDoc ''
Only allow members of the `wheel` group to execute sudo by
setting the executable's permissions accordingly.
This prevents users that are not members of `wheel` from
@@ -70,19 +73,18 @@ in
'';
};
- security.sudo.configFile = mkOption {
+ configFile = mkOption {
type = types.lines;
# Note: if syntax errors are detected in this file, the NixOS
# configuration will fail to build.
- description =
- lib.mdDoc ''
- This string contains the contents of the
- {file}`sudoers` file.
- '';
+ description = mdDoc ''
+ This string contains the contents of the
+ {file}`sudoers` file.
+ '';
};
- security.sudo.extraRules = mkOption {
- description = lib.mdDoc ''
+ extraRules = mkOption {
+ description = mdDoc ''
Define specific rules to be in the {file}`sudoers` file.
More specific rules should come after more general ones in order to
yield the expected behavior. You can use mkBefore/mkAfter to ensure
@@ -112,7 +114,7 @@ in
options = {
users = mkOption {
type = with types; listOf (either str int);
- description = lib.mdDoc ''
+ description = mdDoc ''
The usernames / UIDs this rule should apply for.
'';
default = [];
@@ -120,7 +122,7 @@ in
groups = mkOption {
type = with types; listOf (either str int);
- description = lib.mdDoc ''
+ description = mdDoc ''
The groups / GIDs this rule should apply for.
'';
default = [];
@@ -129,7 +131,7 @@ in
host = mkOption {
type = types.str;
default = "ALL";
- description = lib.mdDoc ''
+ description = mdDoc ''
For what host this rule should apply.
'';
};
@@ -137,7 +139,7 @@ in
runAs = mkOption {
type = with types; str;
default = "ALL:ALL";
- description = lib.mdDoc ''
+ description = mdDoc ''
Under which user/group the specified command is allowed to run.
A user can be specified using just the username: `"foo"`.
@@ -147,7 +149,7 @@ in
};
commands = mkOption {
- description = lib.mdDoc ''
+ description = mdDoc ''
The commands for which the rule should apply.
'';
type = with types; listOf (either str (submodule {
@@ -155,7 +157,7 @@ in
options = {
command = mkOption {
type = with types; str;
- description = lib.mdDoc ''
+ description = mdDoc ''
A command being either just a path to a binary to allow any arguments,
the full command with arguments pre-set or with `""` used as the argument,
not allowing arguments to the command at all.
@@ -164,7 +166,7 @@ in
options = mkOption {
type = with types; listOf (enum [ "NOPASSWD" "PASSWD" "NOEXEC" "EXEC" "SETENV" "NOSETENV" "LOG_INPUT" "NOLOG_INPUT" "LOG_OUTPUT" "NOLOG_OUTPUT" ]);
- description = lib.mdDoc ''
+ description = mdDoc ''
Options for running the command. Refer to the [sudo manual](https://www.sudo.ws/man/1.7.10/sudoers.man.html).
'';
default = [];
@@ -177,10 +179,10 @@ in
});
};
- security.sudo.extraConfig = mkOption {
+ extraConfig = mkOption {
type = types.lines;
default = "";
- description = lib.mdDoc ''
+ description = mdDoc ''
Extra configuration text appended to {file}`sudoers`.
'';
};
@@ -195,39 +197,48 @@ in
message = "The NixOS `sudo` module does not work with `sudo-rs` yet."; }
];
- # We `mkOrder 600` so that the default rule shows up first, but there is
- # still enough room for a user to `mkBefore` it.
- security.sudo.extraRules = mkOrder 600 [
- { groups = [ "wheel" ];
- commands = [ { command = "ALL"; options = (if cfg.wheelNeedsPassword then [ "SETENV" ] else [ "NOPASSWD" "SETENV" ]); } ];
- }
- ];
-
- security.sudo.configFile =
+ security.sudo.extraRules =
+ let
+ defaultRule = { users ? [], groups ? [], opts ? [] }: [ {
+ inherit users groups;
+ commands = [ {
+ command = "ALL";
+ options = opts ++ cfg.defaultOptions;
+ } ];
+ } ];
+ in mkMerge [
+ # This is ordered before users' `mkBefore` rules,
+ # so as not to introduce unexpected changes.
+ (mkOrder 400 (defaultRule { users = [ "root" ]; }))
+
+ # This is ordered to show before (most) other rules, but
+ # late-enough for a user to `mkBefore` it.
+ (mkOrder 600 (defaultRule {
+ groups = [ "wheel" ];
+ opts = (optional (!cfg.wheelNeedsPassword) "NOPASSWD");
+ }))
+ ];
+
+ security.sudo.configFile = concatStringsSep "\n" (filter (s: s != "") [
''
# Don't edit this file. Set the NixOS options ‘security.sudo.configFile’
# or ‘security.sudo.extraRules’ instead.
-
- # Keep SSH_AUTH_SOCK so that pam_ssh_agent_auth.so can do its magic.
- Defaults env_keep+=SSH_AUTH_SOCK
-
- # "root" is allowed to do anything.
- root ALL=(ALL:ALL) SETENV: ALL
-
- # extraRules
- ${concatStringsSep "\n" (
- lists.flatten (
- map (
- rule: optionals (length rule.commands != 0) [
- (map (user: "${toUserString user} ${rule.host}=(${rule.runAs}) ${toCommandsString rule.commands}") rule.users)
- (map (group: "${toGroupString group} ${rule.host}=(${rule.runAs}) ${toCommandsString rule.commands}") rule.groups)
- ]
- ) cfg.extraRules
- )
- )}
-
+ ''
+ (pipe cfg.extraRules [
+ (filter (rule: length rule.commands != 0))
+ (map (rule: [
+ (map (user: "${toUserString user} ${rule.host}=(${rule.runAs}) ${toCommandsString rule.commands}") rule.users)
+ (map (group: "${toGroupString group} ${rule.host}=(${rule.runAs}) ${toCommandsString rule.commands}") rule.groups)
+ ]))
+ flatten
+ (concatStringsSep "\n")
+ ])
+ "\n"
+ (optionalString (cfg.extraConfig != "") ''
+ # extraConfig
${cfg.extraConfig}
- '';
+ '')
+ ]);
security.wrappers = let
owner = "root";
diff --git a/nixos/modules/services/audio/wyoming/faster-whisper.nix b/nixos/modules/services/audio/wyoming/faster-whisper.nix
index f156e8314a95..2d56acdc1b4c 100644
--- a/nixos/modules/services/audio/wyoming/faster-whisper.nix
+++ b/nixos/modules/services/audio/wyoming/faster-whisper.nix
@@ -146,6 +146,8 @@ in
CapabilityBoundingSet = "";
DeviceAllow = if builtins.elem options.device [ "cuda" "auto" ] then [
# https://docs.nvidia.com/dgx/pdf/dgx-os-5-user-guide.pdf
+ # CUDA not working? Check DeviceAllow and PrivateDevices first!
+ "/dev/nvidia0"
"/dev/nvidia1"
"/dev/nvidia2"
"/dev/nvidia3"
@@ -160,7 +162,6 @@ in
DevicePolicy = "closed";
LockPersonality = true;
MemoryDenyWriteExecute = true;
- PrivateDevices = true;
PrivateUsers = true;
ProtectHome = true;
ProtectHostname = true;
diff --git a/nixos/modules/services/backup/restic.nix b/nixos/modules/services/backup/restic.nix
index fcdd3082f5a6..87595f39796d 100644
--- a/nixos/modules/services/backup/restic.nix
+++ b/nixos/modules/services/backup/restic.nix
@@ -133,13 +133,15 @@ in
};
timerConfig = mkOption {
- type = types.attrsOf unitOption;
+ type = types.nullOr (types.attrsOf unitOption);
default = {
OnCalendar = "daily";
Persistent = true;
};
description = lib.mdDoc ''
- When to run the backup. See {manpage}`systemd.timer(5)` for details.
+ When to run the backup. See {manpage}`systemd.timer(5)` for
+ details. If null no timer is created and the backup will only
+ run when explicitly started.
'';
example = {
OnCalendar = "00:05";
@@ -378,7 +380,7 @@ in
wantedBy = [ "timers.target" ];
timerConfig = backup.timerConfig;
})
- config.services.restic.backups;
+ (filterAttrs (_: backup: backup.timerConfig != null) config.services.restic.backups);
# generate wrapper scripts, as described in the createWrapper option
environment.systemPackages = lib.mapAttrsToList (name: backup: let
diff --git a/nixos/modules/services/monitoring/netdata.nix b/nixos/modules/services/monitoring/netdata.nix
index 3833418b5add..de0e044453ee 100644
--- a/nixos/modules/services/monitoring/netdata.nix
+++ b/nixos/modules/services/monitoring/netdata.nix
@@ -12,6 +12,7 @@ let
ln -s /run/wrappers/bin/perf.plugin $out/libexec/netdata/plugins.d/perf.plugin
ln -s /run/wrappers/bin/slabinfo.plugin $out/libexec/netdata/plugins.d/slabinfo.plugin
ln -s /run/wrappers/bin/freeipmi.plugin $out/libexec/netdata/plugins.d/freeipmi.plugin
+ ln -s /run/wrappers/bin/systemd-journal.plugin $out/libexec/netdata/plugins.d/systemd-journal.plugin
'';
plugins = [
@@ -254,7 +255,7 @@ in {
# Capabilities
CapabilityBoundingSet = [
"CAP_DAC_OVERRIDE" # is required for freeipmi and slabinfo plugins
- "CAP_DAC_READ_SEARCH" # is required for apps plugin
+ "CAP_DAC_READ_SEARCH" # is required for apps and systemd-journal plugin
"CAP_FOWNER" # is required for freeipmi plugin
"CAP_SETPCAP" # is required for apps, perf and slabinfo plugins
"CAP_SYS_ADMIN" # is required for perf plugin
@@ -263,6 +264,7 @@ in {
"CAP_NET_RAW" # is required for fping app
"CAP_SYS_CHROOT" # is required for cgroups plugin
"CAP_SETUID" # is required for cgroups and cgroups-network plugins
+ "CAP_SYSLOG" # is required for systemd-journal plugin
];
# Sandboxing
ProtectSystem = "full";
@@ -318,6 +320,14 @@ in {
permissions = "u+rx,g+x,o-rwx";
};
+ "systemd-journal.plugin" = {
+ source = "${cfg.package}/libexec/netdata/plugins.d/systemd-journal.plugin.org";
+ capabilities = "cap_dac_read_search,cap_syslog+ep";
+ owner = cfg.user;
+ group = cfg.group;
+ permissions = "u+rx,g+x,o-rwx";
+ };
+
"slabinfo.plugin" = {
source = "${cfg.package}/libexec/netdata/plugins.d/slabinfo.plugin.org";
capabilities = "cap_dac_override+ep";
diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix
index 1e654cad5dd2..8b79ac0e0c1e 100644
--- a/nixos/modules/services/monitoring/smartd.nix
+++ b/nixos/modules/services/monitoring/smartd.nix
@@ -19,7 +19,7 @@ let
{
${pkgs.coreutils}/bin/cat << EOF
From: smartd on ${host} <${nm.sender}>
- To: undisclosed-recipients:;
+ To: ${nm.recipient}
Subject: $SMARTD_SUBJECT
$SMARTD_FULLMESSAGE
diff --git a/nixos/modules/services/networking/trust-dns.nix b/nixos/modules/services/networking/trust-dns.nix
index 4196d124a2ab..758e33f16d38 100644
--- a/nixos/modules/services/networking/trust-dns.nix
+++ b/nixos/modules/services/networking/trust-dns.nix
@@ -54,7 +54,7 @@ in
defaultText = "pkgs.trust-dns";
description = mdDoc ''
Trust-dns package to use.
- Only `bin/trust-dns` need be provided: the other trust-dns utilities (client and resolver) are not needed.
+ The package must provide `meta.mainProgram` which names the server binary; any other utilities (client, resolver) are not needed.
'';
};
quiet = mkOption {
@@ -135,7 +135,7 @@ in
flags = (lib.optional cfg.debug "--debug") ++ (lib.optional cfg.quiet "--quiet");
flagsStr = builtins.concatStringsSep " " flags;
in ''
- ${cfg.package}/bin/trust-dns --config ${configFile} ${flagsStr}
+ ${cfg.package}/bin/${cfg.package.meta.mainProgram} --config ${configFile} ${flagsStr}
'';
Type = "simple";
Restart = "on-failure";
diff --git a/nixos/modules/services/networking/wireguard.nix b/nixos/modules/services/networking/wireguard.nix
index d4099be12a27..d36be87daf60 100644
--- a/nixos/modules/services/networking/wireguard.nix
+++ b/nixos/modules/services/networking/wireguard.nix
@@ -586,6 +586,7 @@ in
}) all_peers;
boot.extraModulePackages = optional (versionOlder kernel.kernel.version "5.6") kernel.wireguard;
+ boot.kernelModules = [ "wireguard" ];
environment.systemPackages = [ pkgs.wireguard-tools ];
systemd.services =
diff --git a/nixos/modules/system/boot/initrd-ssh.nix b/nixos/modules/system/boot/initrd-ssh.nix
index 3df14030ab68..a8cd2e8f05fc 100644
--- a/nixos/modules/system/boot/initrd-ssh.nix
+++ b/nixos/modules/system/boot/initrd-ssh.nix
@@ -166,7 +166,7 @@ in
}
];
- warnings = lib.optional (config.boot.initrd.systemd.enable -> cfg.shell != null) ''
+ warnings = lib.optional (config.boot.initrd.systemd.enable && cfg.shell != null) ''
Please set 'boot.initrd.systemd.users.root.shell' instead of 'boot.initrd.network.ssh.shell'
'';
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh
index bac354b4724b..086e5d65da2f 100644
--- a/nixos/modules/system/boot/stage-1-init.sh
+++ b/nixos/modules/system/boot/stage-1-init.sh
@@ -495,6 +495,8 @@ if test -e /sys/power/resume -a -e /sys/power/disk; then
fi
fi
+@postResumeCommands@
+
# If we have a path to an iso file, find the iso and link it to /dev/root
if [ -n "$isoPath" ]; then
mkdir -p /findiso
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix
index f139902cdc85..322a234e0c43 100644
--- a/nixos/modules/system/boot/stage-1.nix
+++ b/nixos/modules/system/boot/stage-1.nix
@@ -316,7 +316,7 @@ let
inherit (config.system.build) earlyMountScript;
inherit (config.boot.initrd) checkJournalingFS verbose
- preLVMCommands preDeviceCommands postDeviceCommands postMountCommands preFailCommands kernelModules;
+ preLVMCommands preDeviceCommands postDeviceCommands postResumeCommands postMountCommands preFailCommands kernelModules;
resumeDevices = map (sd: if sd ? device then sd.device else "/dev/disk/by-label/${sd.label}")
(filter (sd: hasPrefix "/dev/" sd.device && !sd.randomEncryption.enable
@@ -527,6 +527,14 @@ in
'';
};
+ boot.initrd.postResumeCommands = mkOption {
+ default = "";
+ type = types.lines;
+ description = lib.mdDoc ''
+ Shell commands to be executed immediately after attempting to resume.
+ '';
+ };
+
boot.initrd.postMountCommands = mkOption {
default = "";
type = types.lines;
diff --git a/nixos/modules/system/boot/systemd/initrd.nix b/nixos/modules/system/boot/systemd/initrd.nix
index be40b8e969a1..e223451652b2 100644
--- a/nixos/modules/system/boot/systemd/initrd.nix
+++ b/nixos/modules/system/boot/systemd/initrd.nix
@@ -358,6 +358,7 @@ in {
[ "preDeviceCommands" ]
[ "preLVMCommands" ]
[ "postDeviceCommands" ]
+ [ "postResumeCommands" ]
[ "postMountCommands" ]
[ "extraUdevRulesCommands" ]
[ "extraUtilsCommands" ]
diff --git a/nixos/modules/system/boot/systemd/journald.nix b/nixos/modules/system/boot/systemd/journald.nix
index 773163bbcb81..7e62a4c9bfed 100644
--- a/nixos/modules/system/boot/systemd/journald.nix
+++ b/nixos/modules/system/boot/systemd/journald.nix
@@ -28,6 +28,15 @@ in {
'';
};
+ services.journald.storage = mkOption {
+ default = "persistent";
+ type = types.enum [ "persistent" "volatile" "auto" "none" ];
+ description = mdDoc ''
+ Controls where to store journal data. See
+ {manpage}`journald.conf(5)` for further information.
+ '';
+ };
+
services.journald.rateLimitBurst = mkOption {
default = 10000;
type = types.int;
@@ -100,7 +109,7 @@ in {
environment.etc = {
"systemd/journald.conf".text = ''
[Journal]
- Storage=persistent
+ Storage=${cfg.storage}
RateLimitInterval=${cfg.rateLimitInterval}
RateLimitBurst=${toString cfg.rateLimitBurst}
${optionalString (cfg.console != "") ''
diff --git a/nixos/modules/virtualisation/azure-agent.nix b/nixos/modules/virtualisation/azure-agent.nix
index 6e6021cf80fe..a88b78bc9821 100644
--- a/nixos/modules/virtualisation/azure-agent.nix
+++ b/nixos/modules/virtualisation/azure-agent.nix
@@ -241,7 +241,16 @@ in
after = [ "network-online.target" "sshd.service" ];
wants = [ "network-online.target" ];
- path = [ pkgs.e2fsprogs pkgs.bash ];
+ path = [
+ pkgs.e2fsprogs
+ pkgs.bash
+
+ # waagent's Microsoft.OSTCExtensions.VMAccessForLinux needs Python 3
+ pkgs.python3
+
+ # waagent's Microsoft.CPlat.Core.RunCommandLinux needs lsof
+ pkgs.lsof
+ ];
description = "Windows Azure Agent Service";
unitConfig.ConditionPathExists = "/etc/waagent.conf";
serviceConfig = {
diff --git a/nixos/modules/virtualisation/google-compute-image.nix b/nixos/modules/virtualisation/google-compute-image.nix
index 197ebb18b9ad..dcdd1b59eef5 100644
--- a/nixos/modules/virtualisation/google-compute-image.nix
+++ b/nixos/modules/virtualisation/google-compute-image.nix
@@ -44,10 +44,17 @@ in
GZIP compression level of the resulting disk image (1-9).
'';
};
+ virtualisation.googleComputeImage.efi = mkEnableOption "EFI booting";
};
#### implementation
config = {
+ boot.initrd.availableKernelModules = [ "nvme" ];
+ boot.loader.grub = mkIf cfg.efi {
+ device = mkForce "nodev";
+ efiSupport = true;
+ efiInstallAsRemovable = true;
+ };
system.build.googleComputeImage = import ../../lib/make-disk-image.nix {
name = "google-compute-image";
@@ -62,6 +69,7 @@ in
'';
format = "raw";
configFile = if cfg.configFile == null then defaultConfigFile else cfg.configFile;
+ partitionTableType = if cfg.efi then "efi" else "legacy";
inherit (cfg) diskSize;
inherit config lib pkgs;
};
diff --git a/nixos/modules/virtualisation/oci-containers.nix b/nixos/modules/virtualisation/oci-containers.nix
index 4ee5b0badded..a4a40346f093 100644
--- a/nixos/modules/virtualisation/oci-containers.nix
+++ b/nixos/modules/virtualisation/oci-containers.nix
@@ -252,11 +252,10 @@ let
text = ''
${cfg.backend} rm -f ${name} || true
${optionalString (isValidLogin container.login) ''
- cat ${container.login.passwordFile} | \
${cfg.backend} login \
${container.login.registry} \
--username ${container.login.username} \
- --password-stdin
+ --password-stdin < ${container.login.passwordFile}
''}
${optionalString (container.imageFile != null) ''
${cfg.backend} load -i ${container.imageFile}