treewide: run nixfmt 1.0.0

This commit is contained in:
Wolfgang Walther
2025-07-24 14:57:17 +02:00
parent 03907f2e0a
commit aefcb0d50d
5031 changed files with 96420 additions and 99045 deletions

View File

@@ -45,7 +45,8 @@ rustPlatform.buildRustPackage (finalAttrs: {
# Make sure we can find our libraries
pkg-config
] ++ lib.optionals stdenv.hostPlatform.isLinux [ wrapGAppsHook4 ];
]
++ lib.optionals stdenv.hostPlatform.isLinux [ wrapGAppsHook4 ];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
glib-networking # Most Tauri apps need networking

View File

@@ -177,9 +177,7 @@ For instance, here is how you could add some code to be performed in the derivat
```nix
coqPackages.multinomials.overrideAttrs (oldAttrs: {
postInstall =
oldAttrs.postInstall or ""
+ ''
postInstall = oldAttrs.postInstall or "" + ''
echo "you can do anything you want here"
'';
})

View File

@@ -1370,8 +1370,7 @@ This is especially helpful to select tests or specify flags conditionally:
```nix
{
disabledTests =
[
disabledTests = [
# touches network
"download"
"update"
@@ -2029,7 +2028,8 @@ and letting the package requiring the extra add the list to its dependencies
{
dependencies = [
# ...
] ++ dask.optional-dependencies.complete;
]
++ dask.optional-dependencies.complete;
}
```

View File

@@ -171,7 +171,8 @@ e.g.
{
nativeBuildInputs = [
meson
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ mesonEmulatorHook ];
]
++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ mesonEmulatorHook ];
}
```

View File

@@ -446,8 +446,7 @@ rec {
let
outputs = drv.outputs or [ "out" ];
commonAttrs =
{
commonAttrs = {
inherit (drv) name system meta;
inherit outputs;
}

View File

@@ -355,8 +355,11 @@ let
mergeAttrByFunc =
x: y:
let
mergeAttrBy2 =
{ mergeAttrBy = mergeAttrs; } // (maybeAttr "mergeAttrBy" { } x) // (maybeAttr "mergeAttrBy" { } y);
mergeAttrBy2 = {
mergeAttrBy = mergeAttrs;
}
// (maybeAttr "mergeAttrBy" { } x)
// (maybeAttr "mergeAttrBy" { } y);
in
foldr mergeAttrs { } [
x

View File

@@ -884,8 +884,7 @@ let
path = showOption loc;
depth = length loc;
paragraphs =
[
paragraphs = [
"In module ${file}: expected an option declaration at option path `${path}` but got an attribute set with type ${actualTag}"
]
++ optional (actualTag == "option-type") ''
@@ -1625,8 +1624,7 @@ let
) from
);
config =
{
config = {
warnings = filter (x: x != "") (
map (
f:

View File

@@ -572,8 +572,7 @@ rec {
opt:
let
name = showOption opt.loc;
docOption =
{
docOption = {
loc = opt.loc;
inherit name;
description = opt.description or null;

View File

@@ -14,8 +14,7 @@
pkgs.runCommand "lib-path-tests"
{
nativeBuildInputs =
[
nativeBuildInputs = [
nixVersions.stable
]
++ (with pkgs; [

View File

@@ -444,7 +444,8 @@ rec {
"armv9.1-a" = [
"armv9-a"
"armv8.6-a"
] ++ inferiors."armv8.6-a";
]
++ inferiors."armv8.6-a";
"armv9.2-a" = lib.unique (
[
"armv9.1-a"
@@ -470,12 +471,14 @@ rec {
"armv8.2-a"
"cortex-a53"
"cortex-a72"
] ++ inferiors."armv8.2-a";
]
++ inferiors."armv8.2-a";
cortex-a76 = [
"armv8.2-a"
"cortex-a53"
"cortex-a72"
] ++ inferiors."armv8.2-a";
]
++ inferiors."armv8.2-a";
# Ampere
ampere1 = withInferiors [

View File

@@ -83,8 +83,7 @@ let
# TODO: deprecate args.rustc in favour of args.rust after 23.05 is EOL.
rust = args.rust or args.rustc or { };
final =
{
final = {
# Prefer to parse `config` as it is strictly more informative.
parsed = parse.mkSystemFromString (args.config or allArgs.system);
# This can be losslessly-extracted from `parsed` iff parsing succeeds.

View File

@@ -33,23 +33,28 @@ rec {
sheevaplug = {
config = "armv5tel-unknown-linux-gnueabi";
} // platforms.sheevaplug;
}
// platforms.sheevaplug;
raspberryPi = {
config = "armv6l-unknown-linux-gnueabihf";
} // platforms.raspberrypi;
}
// platforms.raspberrypi;
bluefield2 = {
config = "aarch64-unknown-linux-gnu";
} // platforms.bluefield2;
}
// platforms.bluefield2;
remarkable1 = {
config = "armv7l-unknown-linux-gnueabihf";
} // platforms.zero-gravitas;
}
// platforms.zero-gravitas;
remarkable2 = {
config = "armv7l-unknown-linux-gnueabihf";
} // platforms.zero-sugar;
}
// platforms.zero-sugar;
armv7l-hf-multiplatform = {
config = "armv7l-unknown-linux-gnueabihf";
@@ -65,7 +70,8 @@ rec {
androidSdkVersion = "33";
androidNdkVersion = "26";
useAndroidPrebuilt = true;
} // platforms.armv7a-android;
}
// platforms.armv7a-android;
aarch64-android-prebuilt = {
config = "aarch64-unknown-linux-android";
@@ -86,39 +92,48 @@ rec {
pogoplug4 = {
config = "armv5tel-unknown-linux-gnueabi";
} // platforms.pogoplug4;
}
// platforms.pogoplug4;
ben-nanonote = {
config = "mipsel-unknown-linux-uclibc";
} // platforms.ben_nanonote;
}
// platforms.ben_nanonote;
fuloongminipc = {
config = "mipsel-unknown-linux-gnu";
} // platforms.fuloong2f_n32;
}
// platforms.fuloong2f_n32;
# can execute on 32bit chip
mips-linux-gnu = {
config = "mips-unknown-linux-gnu";
} // platforms.gcc_mips32r2_o32;
}
// platforms.gcc_mips32r2_o32;
mipsel-linux-gnu = {
config = "mipsel-unknown-linux-gnu";
} // platforms.gcc_mips32r2_o32;
}
// platforms.gcc_mips32r2_o32;
# require 64bit chip (for more registers, 64-bit floating point, 64-bit "long long") but use 32bit pointers
mips64-linux-gnuabin32 = {
config = "mips64-unknown-linux-gnuabin32";
} // platforms.gcc_mips64r2_n32;
}
// platforms.gcc_mips64r2_n32;
mips64el-linux-gnuabin32 = {
config = "mips64el-unknown-linux-gnuabin32";
} // platforms.gcc_mips64r2_n32;
}
// platforms.gcc_mips64r2_n32;
# 64bit pointers
mips64-linux-gnuabi64 = {
config = "mips64-unknown-linux-gnuabi64";
} // platforms.gcc_mips64r2_64;
}
// platforms.gcc_mips64r2_64;
mips64el-linux-gnuabi64 = {
config = "mips64el-unknown-linux-gnuabi64";
} // platforms.gcc_mips64r2_64;
}
// platforms.gcc_mips64r2_64;
muslpi = raspberryPi // {
config = "armv6l-unknown-linux-musleabihf";

View File

@@ -255,8 +255,7 @@ rec {
bits = 64;
};
};
isILP32 =
[
isILP32 = [
{
cpu = {
family = "wasm";
@@ -264,7 +263,8 @@ rec {
};
}
]
++ map
++
map
(a: {
abi = {
abi = a;

View File

@@ -5,8 +5,7 @@
{
# Always defined, but the value depends on the presence of an option.
config.set =
{
config.set = {
value = if options ? set.enable then 360 else 7;
}
# Only define if possible.

View File

@@ -5,8 +5,7 @@
{
# Always defined, but the value depends on the presence of an option.
config =
{
config = {
value = if options ? enable then 360 else 7;
}
# Only define if possible.

View File

@@ -27,7 +27,8 @@ pkgs.runCommand "nixpkgs-lib-tests-nix-${nix.version}"
nativeBuildInputs = [
nix
pkgs.gitMinimal
] ++ lib.optional pkgs.stdenv.hostPlatform.isLinux pkgs.inotify-tools;
]
++ lib.optional pkgs.stdenv.hostPlatform.isLinux pkgs.inotify-tools;
strictDeps = true;
}
''

View File

@@ -1210,7 +1210,8 @@ let
# It shouldn't cause an issue since this is cosmetic for the manual.
_module.args.name = lib.mkOptionDefault "name";
}
] ++ modules;
]
++ modules;
};
freeformType = base._module.freeformType;

View File

@@ -40,7 +40,8 @@ let
class = "nixos";
specialArgs = {
modulesPath = builtins.toString ../modules;
} // specialArgs;
}
// specialArgs;
};
in

View File

@@ -31,7 +31,8 @@ pkgs.stdenv.mkDerivation {
btrfs-progs
libfaketime
fakeroot
] ++ lib.optional compressImage zstd;
]
++ lib.optional compressImage zstd;
buildCommand = ''
${if compressImage then "img=temp.img" else "img=$out"}

View File

@@ -33,7 +33,8 @@ pkgs.stdenv.mkDerivation {
libfaketime
perl
fakeroot
] ++ lib.optional compressImage zstd;
]
++ lib.optional compressImage zstd;
buildCommand = ''
${if compressImage then "img=temp.img" else "img=$out"}

View File

@@ -82,7 +82,8 @@ stdenv.mkDerivation {
syslinux
zstd
libossp_uuid
] ++ lib.optionals needSquashfs makeSquashfsDrv.nativeBuildInputs;
]
++ lib.optionals needSquashfs makeSquashfsDrv.nativeBuildInputs;
inherit
isoName

View File

@@ -29,8 +29,7 @@ stdenv.mkDerivation {
nativeBuildInputs = [ squashfsTools ];
buildCommand =
''
buildCommand = ''
closureInfo=${closureInfo { rootPaths = storeContents; }}
# Also include a manifest of the closures in a format suitable

View File

@@ -701,8 +701,7 @@ rec {
{
config = {
name = "${utils.escapeSystemdPath config.where}.mount";
mountConfig =
{
mountConfig = {
What = config.what;
Where = config.where;
}

View File

@@ -35,8 +35,7 @@ python3Packages.buildPythonApplication {
]
++ extraPythonPackages python3Packages;
propagatedBuildInputs =
[
propagatedBuildInputs = [
coreutils
netpbm
qemu_pkg

View File

@@ -49,7 +49,8 @@ let
# inherit testName; TODO (roberth): need this?
nativeBuildInputs = [
hostPkgs.makeWrapper
] ++ lib.optionals (!config.skipTypeCheck) [ hostPkgs.mypy ];
]
++ lib.optionals (!config.skipTypeCheck) [ hostPkgs.mypy ];
buildInputs = [ testDriver ];
testScript = config.testScriptString;
preferLocalBuild = true;

View File

@@ -49,8 +49,9 @@ in
hostPkgs.stdenv.mkDerivation {
name = "vm-test-run-${config.name}";
requiredSystemFeatures =
[ "nixos-test" ]
requiredSystemFeatures = [
"nixos-test"
]
++ lib.optionals hostPkgs.stdenv.hostPlatform.isLinux [ "kvm" ]
++ lib.optionals hostPkgs.stdenv.hostPlatform.isDarwin [ "apple-virt" ];

View File

@@ -40,7 +40,8 @@ in
];
})
] ++ (lib.optional copyChannel ../../../modules/installer/cd-dvd/channel.nix);
]
++ (lib.optional copyChannel ../../../modules/installer/cd-dvd/channel.nix);
options.openstackImage = {
ramMB = mkOption {

View File

@@ -14,7 +14,8 @@ in
imports = [
../../../modules/virtualisation/openstack-config.nix
../../../modules/image/file-options.nix
] ++ (lib.optional copyChannel ../../../modules/installer/cd-dvd/channel.nix);
]
++ (lib.optional copyChannel ../../../modules/installer/cd-dvd/channel.nix);
documentation.enable = copyChannel;

View File

@@ -191,8 +191,7 @@ in
boot.initrd.systemd.additionalUpstreamUnits = [
"systemd-vconsole-setup.service"
];
boot.initrd.systemd.storePaths =
[
boot.initrd.systemd.storePaths = [
"${config.boot.initrd.systemd.package}/lib/systemd/systemd-vconsole-setup"
"${config.boot.initrd.systemd.package.kbd}/bin/setfont"
"${config.boot.initrd.systemd.package.kbd}/bin/loadkeys"

View File

@@ -258,8 +258,7 @@ let
fontconfigNote = "Consider manually configuring fonts.fontconfig according to personal preference.";
in
{
imports =
[
imports = [
(lib.mkRenamedOptionModule
[ "fonts" "fontconfig" "ultimate" "allowBitmaps" ]
[ "fonts" "fontconfig" "allowBitmaps" ]

View File

@@ -7,8 +7,7 @@
let
sanitizeUTF8Capitalization =
lang: (lib.replaceStrings [ "utf8" "utf-8" "UTF8" ] [ "UTF-8" "UTF-8" "UTF-8" ] lang);
aggregatedLocales =
[
aggregatedLocales = [
"${config.i18n.defaultLocale}/${config.i18n.defaultCharset}"
]
++ lib.pipe config.i18n.extraLocaleSettings [
@@ -171,7 +170,8 @@ in
environment.sessionVariables = {
LANG = config.i18n.defaultLocale;
LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
} // config.i18n.extraLocaleSettings;
}
// config.i18n.extraLocaleSettings;
systemd.globalEnvironment = lib.mkIf (config.i18n.supportedLocales != [ ]) {
LOCALE_ARCHIVE = "${config.i18n.glibcLocales}/lib/locale/locale-archive";

View File

@@ -90,8 +90,7 @@ in
NIXOS_STATIC_TIMEZONE = "1";
};
environment.etc =
{
environment.etc = {
zoneinfo.source = tzdir;
}
// lib.optionalAttrs (config.time.timeZone != null) {

View File

@@ -380,8 +380,7 @@ in
group = "root";
mode = "0600";
# password will be added from password file in systemd oneshot
text =
''
text = ''
users.host=${cfg.host}
users.db_user=${cfg.user}
users.database=${cfg.database}

View File

@@ -206,8 +206,7 @@ in
extraHosts
];
environment.etc =
{
environment.etc = {
# /etc/services: TCP/UDP port assignments.
services.source = pkgs.iana-etc + "/etc/services";

View File

@@ -235,8 +235,7 @@ in
[
{
assertion = !(any badMachine cfg.buildMachines);
message =
''
message = ''
At least one system type (via <varname>system</varname> or
<varname>systems</varname>) must be set for every build machine.
Invalid machine specifications:

View File

@@ -50,8 +50,7 @@ let
isNixAtLeast = versionAtLeast (getVersion nixPackage);
defaultSystemFeatures =
[
defaultSystemFeatures = [
"nixos-test"
"benchmark"
"big-parallel"
@@ -170,8 +169,7 @@ let
in
{
imports =
[
imports = [
(mkRenamedOptionModuleWith {
sinceRelease = 2003;
from = [

View File

@@ -15,8 +15,7 @@ let
++ lib.optional cfg.dnsExtensionMechanism "edns0"
++ lib.optional cfg.useLocalResolver "trust-ad";
configText =
''
configText = ''
# This is the default, but we must set it here to prevent
# a collision with an apparently unrelated environment
# variable with the same name exported by dhcpcd.

View File

@@ -285,7 +285,8 @@ in
path = [
pkgs.util-linux
pkgs.e2fsprogs
] ++ lib.optional sw.randomEncryption.enable pkgs.cryptsetup;
]
++ lib.optional sw.randomEncryption.enable pkgs.cryptsetup;
environment.DEVICE = sw.device;

View File

@@ -1036,8 +1036,7 @@ in
};
};
assertions =
[
assertions = [
{
assertion = !cfg.enforceIdUniqueness || (uidsAreUnique && gidsAreUnique);
message = "UIDs and GIDs must be unique!";
@@ -1194,8 +1193,7 @@ in
flip concatMap (attrValues cfg.users) (
user:
let
passwordOptions =
[
passwordOptions = [
"hashedPassword"
"hashedPasswordFile"
"password"

View File

@@ -34,8 +34,7 @@
"/share/pixmaps"
];
environment.systemPackages =
[
environment.systemPackages = [
# Empty icon theme that contains index.theme file describing directories
# where toolkits should look for icons installed by apps.
pkgs.hicolor-icon-theme

View File

@@ -22,8 +22,7 @@ in
# The initrd has to contain any module that might be necessary for
# supporting the most important parts of HW like drives.
boot.initrd.availableKernelModules =
[
boot.initrd.availableKernelModules = [
# SATA/PATA support.
"ahci"

View File

@@ -93,7 +93,8 @@ let
let
includePaths = [
"${lib.getDev cfg.kernelPackage}/lib/modules/${cfg.kernelPackage.modDirVersion}/source/scripts/dtc/include-prefixes"
] ++ cfg.dtboBuildExtraIncludePaths;
]
++ cfg.dtboBuildExtraIncludePaths;
extraPreprocessorFlags = cfg.dtboBuildExtraPreprocessorFlags;
in
if o.dtboFile == null then

View File

@@ -7,8 +7,7 @@
let
cfg = config.hardware.infiniband;
opensm-services =
{
opensm-services = {
"opensm@" = {
enable = true;
description = "Starts OpenSM Infiniband fabric Subnet Managers";

View File

@@ -24,8 +24,7 @@ in
systemd.services.enable-ksm = {
description = "Enable Kernel Same-Page Merging";
wantedBy = [ "multi-user.target" ];
script =
''
script = ''
echo 1 > /sys/kernel/mm/ksm/run
''
+ lib.optionalString (cfg.sleep != null) ''

View File

@@ -80,8 +80,7 @@ in
++ lib.optional cfg.wireless.enable pkgs.logitech-udev-rules
++ lib.optional cfg.lcd.enable pkgs.g15daemon;
extraRules =
''
extraRules = ''
# nixos: hardware.logitech.lcd
''
+ lib.concatMapStringsSep "\n" (

View File

@@ -154,8 +154,7 @@ in
};
config = lib.mkIf cfg.enable {
environment.systemPackages =
[
environment.systemPackages = [
pkgs.libnfc-nci
]
++ lib.optionals cfg.enableIFD [

View File

@@ -24,7 +24,8 @@ let
modules = [
"system76"
"system76-io"
] ++ (optional (versionOlder kpkgs.kernel.version "5.5") "system76-acpi");
]
++ (optional (versionOlder kpkgs.kernel.version "5.5") "system76-acpi");
modulePackages = map (m: kpkgs.${m}) modules;
moduleConfig = mkIf cfg.kernel-modules.enable {
boot.extraModulePackages = modulePackages;

View File

@@ -93,8 +93,7 @@ in
];
boot.kernelModules = lib.optional useBbswitch "bbswitch";
boot.extraModulePackages =
lib.optional useBbswitch kernel.bbswitch
++ lib.optional useNvidia kernel.nvidia_x11.bin;
lib.optional useBbswitch kernel.bbswitch ++ lib.optional useNvidia kernel.nvidia_x11.bin;
environment.systemPackages = [
bumblebee

View File

@@ -488,8 +488,7 @@ in
name = igpuDriver;
display = offloadCfg.enable;
modules = lib.optional (igpuDriver == "amdgpu") pkgs.xorg.xf86videoamdgpu;
deviceSection =
''
deviceSection = ''
BusID "${igpuBusId}"
''
+ lib.optionalString (syncCfg.enable && igpuDriver != "amdgpu") ''
@@ -500,8 +499,7 @@ in
name = "nvidia";
modules = [ nvidia_x11.bin ];
display = !offloadCfg.enable;
deviceSection =
''
deviceSection = ''
Option "SidebandSocketPath" "/run/nvidia-xdriver/"
''
+ lib.optionalString primeEnabled ''
@@ -510,8 +508,7 @@ in
+ lib.optionalString pCfg.allowExternalGpu ''
Option "AllowExternalGpus"
'';
screenSection =
''
screenSection = ''
Option "RandRRotation" "on"
''
+ lib.optionalString syncCfg.enable ''
@@ -644,8 +641,7 @@ in
hardware.firmware = lib.optional cfg.gsp.enable nvidia_x11.firmware;
systemd.tmpfiles.rules =
[
systemd.tmpfiles.rules = [
# Remove the following log message:
# (WW) NVIDIA: Failed to bind sideband socket to
# (WW) NVIDIA: '/var/run/nvidia-xdriver-b4f69129' Permission denied
@@ -653,7 +649,8 @@ in
# https://bbs.archlinux.org/viewtopic.php?pid=1909115#p1909115
"d /run/nvidia-xdriver 0770 root users"
]
++ lib.optional (nvidia_x11.persistenced != null && config.virtualisation.docker.enableNvidia)
++
lib.optional (nvidia_x11.persistenced != null && config.virtualisation.docker.enableNvidia)
"L+ /run/nvidia-docker/extras/bin/nvidia-persistenced - - - - ${nvidia_x11.persistenced}/origBin/nvidia-persistenced";
boot = {

View File

@@ -38,7 +38,8 @@ in
hardware.firmware = [
pkgs.facetimehd-firmware
] ++ lib.optional cfg.withCalibration pkgs.facetimehd-calibration;
]
++ lib.optional cfg.withCalibration pkgs.facetimehd-calibration;
# unload module during suspend/hibernate as it crashes the whole system
powerManagement.powerDownCommands = ''

View File

@@ -104,8 +104,7 @@ in
warnings =
lib.optional (cfg.enabled != null)
"i18n.inputMethod.enabled will be removed in a future release. Please use .type, and .enable = true instead";
environment.systemPackages =
[
environment.systemPackages = [
cfg.package
]
++ lib.optional cfg.enableGtk2 gtk2_cache

View File

@@ -147,8 +147,7 @@ in
) cfg.settings.addons)
];
environment.variables =
{
environment.variables = {
XMODIFIERS = "@im=fcitx";
QT_PLUGIN_PATH = [ "${fcitx5Package}/${pkgs.qt6.qtbase.qtPluginPrefix}" ];
}

View File

@@ -69,8 +69,7 @@ in
XMODIFIERS = "@im=kime";
};
environment.etc."xdg/kime/config.yaml".text =
''
environment.etc."xdg/kime/config.yaml".text = ''
daemon:
modules: [${lib.concatStringsSep "," imcfg.kime.daemonModules}]
indicator:

View File

@@ -148,8 +148,7 @@ stdenvNoCC.mkDerivation (
# to the closure that was used to build it
unsafeDiscardReferences.out = true;
nativeBuildInputs =
[
nativeBuildInputs = [
systemd
util-linux
fakeroot
@@ -168,8 +167,7 @@ stdenvNoCC.mkDerivation (
# relative path to the repart definitions that are read by systemd-repart
finalRepartDefinitions = "repart.d";
systemdRepartFlags =
[
systemdRepartFlags = [
"--architecture=${systemdArch}"
"--dry-run=no"
"--size=auto"
@@ -210,8 +208,7 @@ stdenvNoCC.mkDerivation (
runHook postBuild
'';
installPhase =
''
installPhase = ''
runHook preInstall
mkdir -p $out

View File

@@ -797,7 +797,8 @@ in
device = "/iso/nix-store.squashfs";
options = [
"loop"
] ++ lib.optional (config.boot.kernelPackages.kernel.kernelAtLeast "6.2") "threads=multi";
]
++ lib.optional (config.boot.kernelPackages.kernel.kernelAtLeast "6.2") "threads=multi";
neededForBoot = true;
};
@@ -869,7 +870,8 @@ in
environment.systemPackages = [
grubPkgs.grub2
] ++ lib.optional (config.isoImage.makeBiosBootable) pkgs.syslinux;
]
++ lib.optional (config.isoImage.makeBiosBootable) pkgs.syslinux;
system.extraDependencies = [ grubPkgs.grub2_efi ];
# In stage 1 of the boot, mount the CD as the root FS by label so
@@ -901,8 +903,9 @@ in
# Closures to be copied to the Nix store on the CD, namely the init
# script and the top-level system configuration directory.
isoImage.storeContents =
[ config.system.build.toplevel ]
isoImage.storeContents = [
config.system.build.toplevel
]
++ lib.optional config.isoImage.includeSystemBuildDependencies config.system.build.toplevel.drvPath;
# Individual files to be included on the CD, outside of the Nix

View File

@@ -54,7 +54,8 @@ with lib;
device = "../nix-store.squashfs";
options = [
"loop"
] ++ lib.optional (config.boot.kernelPackages.kernel.kernelAtLeast "6.2") "threads=multi";
]
++ lib.optional (config.boot.kernelPackages.kernel.kernelAtLeast "6.2") "threads=multi";
neededForBoot = true;
};

View File

@@ -30,8 +30,7 @@
sdImage = {
populateFirmwareCommands = "";
populateRootCommands =
''
populateRootCommands = ''
mkdir -p ./files/boot
${config.boot.loader.generic-extlinux-compatible.populateCmd} \
-c ${config.system.build.toplevel} \

View File

@@ -228,7 +228,8 @@ in
libfaketime
mtools
util-linux
] ++ lib.optional config.sdImage.compressImage zstd;
]
++ lib.optional config.sdImage.compressImage zstd;
inherit (config.sdImage) compressImage;

View File

@@ -77,7 +77,8 @@ let
{
_module.check = false;
}
] ++ docModules.eager;
]
++ docModules.eager;
class = "nixos";
specialArgs = specialArgs // {
pkgs = scrubDerivations "pkgs" pkgs;

View File

@@ -61,8 +61,7 @@ with lib;
services.getty.autologinUser = "nixos";
# Some more help text.
services.getty.helpLine =
''
services.getty.helpLine = ''
The "nixos" and "root" accounts have empty passwords.
To log in over ssh you must set a password for either "nixos" or "root"

View File

@@ -71,8 +71,7 @@ in
Restart = "no";
};
environment.systemPackages =
[
environment.systemPackages = [
pkgs.cdemu-daemon
pkgs.cdemu-client
]

View File

@@ -50,7 +50,8 @@ let
(pkgs.writeTextDir "locks/nixos-generated-dconf-locks" (
lib.concatStringsSep "\n" (if val.lockAll then mkAllLocks val.settings else val.locks)
))
] ++ (map checkDconfKeyfiles val.keyfiles);
]
++ (map checkDconfKeyfiles val.keyfiles);
}
);

View File

@@ -293,7 +293,8 @@ in
Additional packages containing native messaging hosts that should be made available to Firefox extensions.
'';
};
}) // (builtins.mapAttrs (k: v: lib.mkEnableOption "${v.name} support") nmhOptions);
})
// (builtins.mapAttrs (k: v: lib.mkEnableOption "${v.name} support") nmhOptions);
};
config =

View File

@@ -63,8 +63,7 @@ in
cfg.package
];
environment.etc."htoprc".text =
''
environment.etc."htoprc".text = ''
# Global htop configuration
# To change set: programs.htop.settings.KEY = VALUE;
''

View File

@@ -123,8 +123,7 @@ in
environment.systemPackages = [ cfg.package ];
environment.variables =
{
environment.variables = {
LESSKEYIN_SYSTEM = builtins.toString lessKey;
}
// lib.optionalAttrs (cfg.lessopen != null) {

View File

@@ -56,7 +56,8 @@ let
config.hardware.graphics.package
# nvidia_x11, etc:
] ++ config.hardware.graphics.extraPackages; # nvidia_x11
]
++ config.hardware.graphics.extraPackages; # nvidia_x11
defaults = {
nvidia-gpu.onFeatures = package.allowedPatterns.nvidia-gpu.onFeatures;

View File

@@ -264,7 +264,8 @@ in
environment.systemPackages = [
cfg.package
] ++ lib.optional cfg.gamescopeSession.enable opengamepadui-gamescope;
]
++ lib.optional cfg.gamescopeSession.enable opengamepadui-gamescope;
};
meta.maintainers = with lib.maintainers; [ shadowapex ];

View File

@@ -96,8 +96,7 @@ in
environment = {
systemPackages = [ cfg.package ];
etc =
{
etc = {
# schroot requires this directory to exist
"schroot/chroot.d/.keep".text = "";

View File

@@ -32,7 +32,8 @@ let
knownHostsFiles = [
"/etc/ssh/ssh_known_hosts"
] ++ builtins.map pkgs.copyPathToStore cfg.knownHostsFiles;
]
++ builtins.map pkgs.copyPathToStore cfg.knownHostsFiles;
in
{
@@ -319,8 +320,7 @@ in
|| config.services.openssh.settings.X11Forwarding
);
assertions =
[
assertions = [
{
assertion = cfg.forwardX11 == true -> cfg.setXAuthLocation;
message = "cannot enable X11 forwarding without setting XAuth location";

View File

@@ -241,8 +241,7 @@ in
hardware.steam-hardware.enable = true;
environment.systemPackages =
[
environment.systemPackages = [
cfg.package
cfg.package.run
]

View File

@@ -254,8 +254,7 @@ let
cfg = config.programs.tsmClient;
servernames = map (s: s.servername) (attrValues cfg.servers);
assertions =
[
assertions = [
{
assertion = allUnique (map toLower servernames);
message = ''

View File

@@ -155,8 +155,7 @@ in
# Needed for the default wallpaper:
pathsToLink = lib.optional (cfg.package != null) "/share/backgrounds/sway";
etc =
{
etc = {
"sway/config.d/nixos.conf".source = pkgs.writeText "nixos.conf" ''
# Import the most important environment variables into the D-Bus and systemd
# user environments (e.g. required for screen sharing and Pinentry prompts):

View File

@@ -308,7 +308,8 @@ in
environment.systemPackages = [
pkgs.zsh
] ++ lib.optional cfg.enableCompletion pkgs.nix-zsh-completions;
]
++ lib.optional cfg.enableCompletion pkgs.nix-zsh-completions;
environment.pathsToLink = lib.optional cfg.enableCompletion "/share/zsh";

View File

@@ -284,8 +284,7 @@ let
data.webroot
];
commonOpts =
[
commonOpts = [
"--accept-tos" # Checking the option is covered by the assertions
"--path"
"."
@@ -420,7 +419,8 @@ let
"network-online.target"
"acme-setup.service"
"nss-lookup.target"
] ++ selfsignedDeps;
]
++ selfsignedDeps;
wants = [ "network-online.target" ] ++ selfsignedDeps;
requires = [ "acme-setup.service" ];

View File

@@ -149,8 +149,7 @@ in
}) enabledPolicies
++ lib.mapAttrsToList (name: path: { inherit name path; }) cfg.includes
);
environment.etc."apparmor/parser.conf".text =
''
environment.etc."apparmor/parser.conf".text = ''
${if cfg.enableCache then "write-cache" else "skip-cache"}
cache-loc /var/cache/apparmor
Include /etc/apparmor.d

View File

@@ -39,8 +39,7 @@ in
alias /sbin -> /run/current-system/sw/sbin,
alias /usr -> /run/current-system/sw,
'';
"abstractions/audio" =
''
"abstractions/audio" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/audio"
''
+ lib.concatMapStringsSep "\n" etcRule [
@@ -74,8 +73,7 @@ in
"openal/alsoft.conf"
"wildmidi/wildmidi.conf"
];
"abstractions/authentication" =
''
"abstractions/authentication" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/authentication"
# Defined in security.pam
include <abstractions/pam>
@@ -102,8 +100,7 @@ in
r ${pkgs.tzdata}/share/zoneinfo/**,
r ${pkgs.stdenv.cc.libc}/share/i18n/**,
'';
"abstractions/bash" =
''
"abstractions/bash" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/bash"
# bash inspects filesystems at startup
@@ -166,8 +163,7 @@ in
trail = "/**";
}}
'';
"abstractions/gnome" =
''
"abstractions/gnome" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/gnome"
include <abstractions/fonts>
''
@@ -216,8 +212,7 @@ in
}
"xdg/mimeapps.list"
];
"abstractions/kde" =
''
"abstractions/kde" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/kde"
''
+ lib.concatMapStringsSep "\n" etcRule [
@@ -248,8 +243,7 @@ in
trail = "/Trolltech.conf";
}
];
"abstractions/kerberosclient" =
''
"abstractions/kerberosclient" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/kerberosclient"
''
+ lib.concatMapStringsSep "\n" etcRule [
@@ -269,8 +263,7 @@ in
"krb.realms"
"srvtab"
];
"abstractions/ldapclient" =
''
"abstractions/ldapclient" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/ldapclient"
''
+ lib.concatMapStringsSep "\n" etcRule [
@@ -296,8 +289,7 @@ in
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/mdns"
${etcRule "nss_mdns.conf"}
'';
"abstractions/nameservice" =
''
"abstractions/nameservice" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/nameservice"
# Many programs wish to perform nameservice-like operations, such as
@@ -367,8 +359,7 @@ in
trail = "/openssl.cnf";
}}
'';
"abstractions/p11-kit" =
''
"abstractions/p11-kit" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/p11-kit"
''
+ lib.concatMapStringsSep "\n" etcRule [
@@ -396,8 +387,7 @@ in
trail = "/**";
}}
'';
"abstractions/php" =
''
"abstractions/php" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/php"
''
+ lib.concatMapStringsSep "\n" etcRule [
@@ -426,8 +416,7 @@ in
trail = "/**.ini";
}
];
"abstractions/postfix-common" =
''
"abstractions/postfix-common" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/postfix-common"
''
+ lib.concatMapStringsSep "\n" etcRule [
@@ -442,8 +431,7 @@ in
"abstractions/python" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/python"
'';
"abstractions/qt5" =
''
"abstractions/qt5" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/qt5"
''
+ lib.concatMapStringsSep "\n" etcRule [
@@ -464,8 +452,7 @@ in
trail = "/*";
}}
'';
"abstractions/ssl_certs" =
''
"abstractions/ssl_certs" = ''
include "${pkgs.apparmor-profiles}/etc/apparmor.d/abstractions/ssl_certs"
# For the NixOS module: security.acme

View File

@@ -144,8 +144,7 @@ in
};
config = lib.mkIf (cfg.enable && cfg.stateful) {
systemd.services =
{
systemd.services = {
dhparams-init = {
description = "Clean Up Old Diffie-Hellman Parameters";

View File

@@ -21,9 +21,7 @@ let
fallback_local_ip=${boolToStr cfg.fallbackLocalIP}
'';
configFileLogin =
configFilePam
+ ''
configFileLogin = configFilePam + ''
motd=${boolToStr cfg.motd}
accept_env_factor=${boolToStr cfg.acceptEnvFactor}
'';

View File

@@ -124,8 +124,7 @@ rec {
in
submodule {
freeformType = attrsOf sectionType;
options =
{
options = {
include = mkOption {
default = [ ];
description = ''

View File

@@ -2270,7 +2270,8 @@ in
a malicious process can then edit such an authorized_keys file and bypass the ssh-agent-based authentication.
See https://github.com/NixOS/nixpkgs/issues/31611
''
++ lib.optional
++
lib.optional
(
with config.security.pam.rssh;
enable && settings.auth_key_file or null != null && settings.authorized_keys_command or null != null
@@ -2310,8 +2311,7 @@ in
environment.etc = lib.mapAttrs' makePAMService enabledServices;
security.pam.services =
{
security.pam.services = {
other.text = ''
auth required pam_warn.so
auth required pam_deny.so

View File

@@ -158,7 +158,8 @@ in
user = user.name;
path = user.cryptHomeLuks;
mountpoint = user.home;
} // user.pamMount;
}
// user.pamMount;
in
"<volume ${lib.concatStringsSep " " (lib.mapAttrsToList mkAttr attrs)} />\n";
in

View File

@@ -11,8 +11,7 @@ stdenv.mkDerivation {
name = "security-wrapper-${baseNameOf sourceProg}";
buildInputs = [ linuxHeaders ];
dontUnpack = true;
CFLAGS =
[
CFLAGS = [
''-DSOURCE_PROG="${sourceProg}"''
]
++ (

View File

@@ -97,8 +97,7 @@ in
isSystemUser = true;
};
systemd.tmpfiles.settings."10-oxidized" =
{
systemd.tmpfiles.settings."10-oxidized" = {
"${cfg.dataDir}" = {
d = {
mode = "0750";

View File

@@ -157,8 +157,7 @@ in
config = lib.mkIf (cfg.enable) {
networking.firewall.allowedTCPPorts = lib.mkIf (cfg.openFirewall) [ cfg.port ];
services.pgadmin.settings =
{
services.pgadmin.settings = {
DEFAULT_SERVER_PORT = cfg.port;
PASSWORD_LENGTH_MIN = cfg.minimumPasswordLength;
SERVER_MODE = true;
@@ -227,7 +226,8 @@ in
ExecStart = "${cfg.package}/bin/pgadmin4";
LoadCredential = [
"initial_password:${cfg.initialPasswordFile}"
] ++ lib.optional cfg.emailServer.enable "email_password:${cfg.emailServer.passwordFile}";
]
++ lib.optional cfg.emailServer.enable "email_password:${cfg.emailServer.passwordFile}";
};
};

View File

@@ -175,8 +175,7 @@ in
users.groups.rabbitmq.gid = config.ids.gids.rabbitmq;
services.rabbitmq.configItems =
{
services.rabbitmq.configItems = {
"listeners.tcp.1" = lib.mkDefault "${cfg.listenAddress}:${toString cfg.port}";
}
// lib.optionalAttrs cfg.managementPlugin.enable {
@@ -213,7 +212,8 @@ in
RABBITMQ_ENABLED_PLUGINS_FILE = pkgs.writeText "enabled_plugins" ''
[ ${lib.concatStringsSep "," cfg.plugins} ].
'';
} // lib.optionalAttrs (cfg.config != "") { RABBITMQ_ADVANCED_CONFIG_FILE = advanced_config_file; };
}
// lib.optionalAttrs (cfg.config != "") { RABBITMQ_ADVANCED_CONFIG_FILE = advanced_config_file; };
serviceConfig = {
ExecStart = "${cfg.package}/sbin/rabbitmq-server";

View File

@@ -63,8 +63,7 @@ in
cfg.settings.playlists-path
cfg.settings.podcast-path
];
BindReadOnlyPaths =
[
BindReadOnlyPaths = [
# gonic can access scrobbling services
"-/etc/resolv.conf"
"${config.security.pki.caBundle}:/etc/ssl/certs/ca-certificates.crt"

View File

@@ -122,8 +122,7 @@ in
config.environment.etc."hqplayer/hqplayerd.xml".source
];
preStart =
''
preStart = ''
cp -r "${pkg}/var/lib/hqplayer/web" "${stateDir}"
chmod -R u+wX "${stateDir}/web"

View File

@@ -254,8 +254,7 @@ in
systemd.services.jack = {
description = "JACK Audio Connection Kit";
serviceConfig =
{
serviceConfig = {
User = "jackaudio";
SupplementaryGroups = lib.optional (
config.services.pulseaudio.enable && !config.services.pulseaudio.systemWide

View File

@@ -258,8 +258,7 @@ in
systemd.services.mpd = {
wantedBy = lib.optional (!cfg.startWhenNeeded) "multi-user.target";
preStart =
''
preStart = ''
set -euo pipefail
install -m 600 ${mpdConf} /run/mpd/mpd.conf
''

View File

@@ -127,8 +127,7 @@ in
BindPaths =
optional (cfg.settings ? DataFolder) cfg.settings.DataFolder
++ optional (cfg.settings ? CacheFolder) cfg.settings.CacheFolder;
BindReadOnlyPaths =
[
BindReadOnlyPaths = [
# navidrome uses online services to download additional album metadata / covers
"${config.security.pki.caBundle}:/etc/ssl/certs/ca-certificates.crt"
builtins.storeDir

View File

@@ -286,8 +286,7 @@ in
"pulse/default.pa".source = myConfigFile;
};
systemd.user = {
services.pulseaudio =
{
services.pulseaudio = {
restartIfChanged = true;
serviceConfig = {
RestartSec = "500ms";

View File

@@ -165,8 +165,7 @@ let
CPUSchedulingPolicy = "idle";
IOSchedulingClass = "idle";
ProtectSystem = "strict";
ReadWritePaths =
[
ReadWritePaths = [
"${userHome}/.config/borg"
"${userHome}/.cache/borg"
]
@@ -175,8 +174,7 @@ let
++ lib.optional (isLocalPath cfg.repo) cfg.repo;
PrivateTmp = cfg.privateTmp;
};
environment =
{
environment = {
BORG_REPO = cfg.repo;
}
// (mkPassEnv cfg)
@@ -223,7 +221,11 @@ let
mkWrapperDrv {
original = lib.getExe config.services.borgbackup.package;
name = "borg-job-${name}";
set = { BORG_REPO = cfg.repo; } // (mkPassEnv cfg) // cfg.environment;
set = {
BORG_REPO = cfg.repo;
}
// (mkPassEnv cfg)
// cfg.environment;
};
# Paths listed in ReadWritePaths must exist before service is started
@@ -895,7 +897,8 @@ in
environment.systemPackages = [
config.services.borgbackup.package
] ++ (lib.mapAttrsToList mkBorgWrapper jobs);
]
++ (lib.mapAttrsToList mkBorgWrapper jobs);
}
);
}

View File

@@ -354,8 +354,9 @@ in
value = {
description = "Takes BTRFS snapshots and maintains retention policies.";
unitConfig.Documentation = "man:btrbk(1)";
path =
[ "/run/wrappers" ]
path = [
"/run/wrappers"
]
++ cfg.extraPackages
++ optional (instance.settings.stream_compress != "no") (
getAttr instance.settings.stream_compress streamCompressMap

View File

@@ -162,8 +162,7 @@ in
config = lib.mkIf cfg.enable {
systemd = {
services.duplicity =
{
services.duplicity = {
description = "backup files with duplicity";
environment.HOME = stateDirectory;
@@ -221,8 +220,7 @@ in
)
} ${extra}
'';
serviceConfig =
{
serviceConfig = {
PrivateTmp = true;
ProtectSystem = "strict";
ProtectHome = "read-only";

View File

@@ -52,8 +52,7 @@ let
))
];
fullConfig =
{
fullConfig = {
global = normalize (cfg.settings // flattenWithIndex cfg.repos "repo");
}
// lib.mapAttrs (

View File

@@ -367,8 +367,7 @@ in
in
lib.nameValuePair "restic-backups-${name}" (
{
environment =
{
environment = {
# not %C, because that wouldn't work in the wrapper script
RESTIC_CACHE_DIR = "/var/cache/restic-backups-${name}";
RESTIC_PASSWORD_FILE = backup.passwordFile;
@@ -395,8 +394,7 @@ in
restartIfChanged = false;
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig =
{
serviceConfig = {
Type = "oneshot";
ExecStart =
(lib.optionals doBackup [

View File

@@ -191,8 +191,7 @@ in
snapraid-sync = {
description = "Synchronize the state of the SnapRAID array";
startAt = sync.interval;
serviceConfig =
{
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.snapraid}/bin/snapraid sync";
Nice = 19;

View File

@@ -253,7 +253,8 @@ in
tmpDirs = [
(attrByPath [ "druid.lookup.snapshotWorkingDir" ] "" cfg."${name}".config)
] ++ (map (x: x.path) cfg."${name}".segmentLocations);
]
++ (map (x: x.path) cfg."${name}".segmentLocations);
allowedTCPPorts = [ (attrByPath [ "druid.plaintextPort" ] 8083 cfg."${name}".config) ];
@@ -266,7 +267,8 @@ in
tmpDirs = [
"/var/log/druid/indexer"
] ++ [ (attrByPath [ "druid.indexer.task.baseTaskDir" ] "" cfg."${name}".config) ];
]
++ [ (attrByPath [ "druid.indexer.task.baseTaskDir" ] "" cfg."${name}".config) ];
allowedTCPPorts = [ (attrByPath [ "druid.plaintextPort" ] 8091 cfg."${name}".config) ];

View File

@@ -146,8 +146,7 @@ in
'';
};
hbase =
{
hbase = {
package = lib.mkPackageOption pkgs "hbase" { };

View File

@@ -492,7 +492,8 @@ in
top.masterAddress
apiserverServiceIP
"127.0.0.1"
] ++ cfg.extraSANs;
]
++ cfg.extraSANs;
action = "systemctl restart kube-apiserver.service";
};
apiserverProxyClient = mkCert {

Some files were not shown because too many files have changed in this diff Show More