Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,8 @@ a034fb50f79816c6738fb48b48503b09ea3b0132
# nixfmt 1.0.0
a46262ae77e4016fe5a4a390c4a39c0c1b266428 # !autorebase nix-shell --run treefmt
aefcb0d50d1124314429a11ed6b7aaaedf2861c5 # !autorebase nix-shell --run treefmt

# nixf-diagnose
6c1e6f90d35932355fdee300b13136a8b7ec851c # !autorebase nix-shell --run treefmt
1c6af9ba0a9667e10ad97f53d2cff663abc290c9 # !autorebase nix-shell --run treefmt
5cbdb94f3aa2e7de13f3c0a67899ec17427b58ce # !autorebase nix-shell --run treefmt
26 changes: 26 additions & 0 deletions ci/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,32 @@ let
"pkgs/development/haskell-modules/configuration-hackage2nix/transitive-broken.yaml"
];

programs.nixf-diagnose.enable = true;
settings.formatter.nixf-diagnose = {
# Ensure nixfmt cleans up after nixf-diagnose.
priority = -1;
options = [
"--auto-fix"
# Rule names can currently be looked up here:
# https://github.com/nix-community/nixd/blob/main/libnixf/src/Basic/diagnostic.py
# TODO: Remove the following and fix things.
"--ignore=sema-unused-def-lambda-noarg-formal"
"--ignore=sema-unused-def-lambda-witharg-arg"
"--ignore=sema-unused-def-lambda-witharg-formal"
"--ignore=sema-unused-def-let"
# Keep this rule, because we have `lib.or`.
"--ignore=or-identifier"
];
excludes = [
# Auto-generated; violates sema-extra-with
# Can only sensibly be removed when --auto-fix supports multiple fixes at once:
# https://github.com/inclyc/nixf-diagnose/issues/13
"pkgs/servers/home-assistant/component-packages.nix"
# https://github.com/nix-community/nixd/issues/708
"nixos/maintainers/scripts/azure-new/examples/basic/system.nix"
];
};

settings.formatter.editorconfig-checker = {
command = "${pkgs.lib.getExe pkgs.editorconfig-checker}";
options = [ "-disable-indent-size" ];
Expand Down
2 changes: 1 addition & 1 deletion lib/customisation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ rec {
outputs = drv.outputs or [ "out" ];

commonAttrs =
drv // (listToAttrs outputsList) // ({ all = map (x: x.value) outputsList; }) // passthru;
drv // (listToAttrs outputsList) // { all = map (x: x.value) outputsList; } // passthru;

outputToAttrListElement = outputName: {
name = outputName;
Expand Down
3 changes: 2 additions & 1 deletion lib/tests/modules/functionTo/submodule-options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ in
default = lib.concatStringsSep " " (
lib.concatLists (
lib.mapAttrsToList (k: v: if k == "_module" then [ ] else [ (lib.showOption v.loc) ]) (
(options.fun.type.getSubOptions [ "fun" ])
options.fun.type.getSubOptions [ "fun" ]
)

)
);
};
Expand Down
4 changes: 1 addition & 3 deletions lib/tests/systems.nix
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,7 @@ lib.runTests (
"x86_64-genode"
];
testredox = mseteq redox [ "x86_64-redox" ];
testgnu = mseteq gnu (
linux # ++ kfreebsd ++ ...
);
testgnu = mseteq gnu linux; # ++ kfreebsd ++ ...
testillumos = mseteq illumos [ "x86_64-solaris" ];
testlinux = mseteq linux [
"aarch64-linux"
Expand Down
2 changes: 1 addition & 1 deletion lib/types.nix
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ let
loc: defs:
mapAttrs (n: v: v.value) (
filterAttrs (n: v: v ? value) (
zipAttrsWith (name: defs: (mergeDefinitions (loc ++ [ name ]) elemType (defs)).optionalValue)
zipAttrsWith (name: defs: (mergeDefinitions (loc ++ [ name ]) elemType defs).optionalValue)
# Push down position info.
(pushPositions defs)
)
Expand Down
4 changes: 2 additions & 2 deletions nixos/lib/eval-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ let
in
locatedModules ++ legacyModules;

noUserModules = evalModulesMinimal ({
noUserModules = evalModulesMinimal {
inherit prefix specialArgs;
modules =
baseModules
Expand All @@ -138,7 +138,7 @@ let
pkgsModule
modulesModule
];
});
};

# Extra arguments that are useful for constructing a similar configuration.
modulesModule = {
Expand Down
5 changes: 3 additions & 2 deletions nixos/lib/systemd-lib.nix
Original file line number Diff line number Diff line change
Expand Up @@ -361,12 +361,13 @@ rec {
}:
let
typeDir =
({
{
system = "system";
initrd = "system";
user = "user";
nspawn = "nspawn";
}).${type};
}
.${type};
in
pkgs.runCommand "${type}-units"
{
Expand Down
7 changes: 4 additions & 3 deletions nixos/lib/testing/network.nix
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ let
optionalString (
config.networking.primaryIPAddress != ""
) "${config.networking.primaryIPAddress} ${hostnames}"
+ optionalString (config.networking.primaryIPv6Address != "") (
"${config.networking.primaryIPv6Address} ${hostnames}"
)
+ optionalString (
config.networking.primaryIPv6Address != ""
) "${config.networking.primaryIPv6Address} ${hostnames}"

);

virtualisation.qemu.options = qemuOptions;
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/config/nix-remote-build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ in
Invalid machine specifications:
''
+ " "
+ (concatStringsSep "\n " (map (m: m.hostName) (filter (badMachine) cfg.buildMachines)));
+ (concatStringsSep "\n " (map (m: m.hostName) (filter badMachine cfg.buildMachines)));
}
];

Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/config/terminfo.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}:
{

options = with lib; {
options = {
environment.enableAllTerminfo = lib.mkOption {
default = false;
type = lib.types.bool;
Expand Down
6 changes: 3 additions & 3 deletions nixos/modules/config/xdg/terminal-exec.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ in
etc = lib.mapAttrs' (
desktop: terminals:
# map desktop name such as GNOME to `xdg/gnome-xdg-terminals.list`, default to `xdg/xdg-terminals.list`
lib.nameValuePair (
"xdg/${if desktop == "default" then "" else "${lib.toLower desktop}-"}xdg-terminals.list"
) { text = lib.concatLines terminals; }
lib.nameValuePair "xdg/${
if desktop == "default" then "" else "${lib.toLower desktop}-"
}xdg-terminals.list" { text = lib.concatLines terminals; }
) cfg.settings;
};
};
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/hardware/opentabletdriver.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ in
boot.blacklistedKernelModules = cfg.blacklistedKernelModules;

systemd.user.services.opentabletdriver =
with pkgs;

lib.mkIf cfg.daemon.enable {
description = "Open source, cross-platform, user-mode tablet driver";
wantedBy = [ "graphical-session.target" ];
Expand Down
8 changes: 4 additions & 4 deletions nixos/modules/hardware/video/nvidia.nix
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ in
lib.mkIf cfg.enabled (
lib.mkMerge [
# Common
({
{
assertions = [
{
assertion = !(nvidiaEnabled && cfg.datacenter.enable);
Expand Down Expand Up @@ -388,7 +388,7 @@ in
extraPackages32 = [ nvidia_x11.lib32 ];
};
environment.systemPackages = [ nvidia_x11.bin ];
})
}

# X11
(lib.mkIf nvidiaEnabled {
Expand Down Expand Up @@ -709,7 +709,7 @@ in
"L+ /run/nvidia-docker/extras/bin/nvidia-persistenced - - - - ${nvidia_x11.persistenced}/origBin/nvidia-persistenced";

services = lib.mkMerge [
({
{
nvidia-fabricmanager = {
enable = true;
description = "Start NVIDIA NVLink Management";
Expand All @@ -736,7 +736,7 @@ in
LimitCORE = "infinity";
};
};
})
}
(lib.mkIf cfg.nvidiaPersistenced {
"nvidia-persistenced" = {
description = "NVIDIA Persistence Daemon";
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/i18n/input-method/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ in
};

meta = {
maintainers = with lib.maintainers; [ ];
maintainers = [ ];
doc = ./default.md;
};

Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/i18n/input-method/fcitx5.nix
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ in
++ lib.optionals (cfg.quickPhraseFiles != { }) [
(pkgs.linkFarm "quickPhraseFiles" (
lib.mapAttrs' (
name: value: lib.nameValuePair ("share/fcitx5/data/quickphrase.d/${name}.mb") value
name: value: lib.nameValuePair "share/fcitx5/data/quickphrase.d/${name}.mb" value
) cfg.quickPhraseFiles
))
];
Expand Down
4 changes: 2 additions & 2 deletions nixos/modules/installer/cd-dvd/iso-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ in
let
cfgFiles =
cfg:
lib.optionals cfg.isoImage.showConfiguration ([
lib.optionals cfg.isoImage.showConfiguration [
{
source = cfg.boot.kernelPackages.kernel + "/" + cfg.system.boot.loader.kernelFile;
target = "/boot/" + cfg.boot.kernelPackages.kernel + "/" + cfg.system.boot.loader.kernelFile;
Expand All @@ -923,7 +923,7 @@ in
source = cfg.system.build.initialRamdisk + "/" + cfg.system.boot.loader.initrdFile;
target = "/boot/" + cfg.system.build.initialRamdisk + "/" + cfg.system.boot.loader.initrdFile;
}
])
]
++ lib.concatLists (
lib.mapAttrsToList (_: { configuration, ... }: cfgFiles configuration) cfg.specialisation
);
Expand Down
2 changes: 0 additions & 2 deletions nixos/modules/installer/netboot/netboot-base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

{ lib, ... }:

with lib;

{
imports = [
./netboot.nix
Expand Down
2 changes: 0 additions & 2 deletions nixos/modules/profiles/headless.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

{ lib, ... }:

with lib;

{
# Don't start a tty on the serial consoles.
systemd.services."serial-getty@ttyS0".enable = lib.mkDefault false;
Expand Down
8 changes: 4 additions & 4 deletions nixos/modules/profiles/nix-builder-vm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,18 @@ in
''
);

run-builder = hostPkgs.writeShellScriptBin "run-builder" (''
run-builder = hostPkgs.writeShellScriptBin "run-builder" ''
set -euo pipefail
KEYS="''${KEYS:-./keys}"
KEYS="$(${hostPkgs.nix}/bin/nix-store --add "$KEYS")" ${lib.getExe config.system.build.vm}
'');
'';

script = hostPkgs.writeShellScriptBin "create-builder" (''
script = hostPkgs.writeShellScriptBin "create-builder" ''
set -euo pipefail
export KEYS="''${KEYS:-./keys}"
${lib.getExe add-keys}
${lib.getExe run-builder}
'');
'';

in
script.overrideAttrs (old: {
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/programs/atop.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ in

options = {

programs.atop = rec {
programs.atop = {

enable = lib.mkEnableOption "Atop, a tool for monitoring system resources";

Expand Down
4 changes: 2 additions & 2 deletions nixos/modules/programs/coolercontrol.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ in
config = lib.mkIf cfg.enable (
lib.mkMerge [
# Common
({
{
environment.systemPackages = with pkgs.coolercontrol; [
coolercontrol-gui
];
Expand All @@ -46,7 +46,7 @@ in
coolercontrold.wantedBy = [ "multi-user.target" ];
};
};
})
}

# Nvidia support
(lib.mkIf cfg.nvidiaSupport {
Expand Down
8 changes: 4 additions & 4 deletions nixos/modules/programs/firefox.nix
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ in
languagePacks = lib.mkOption {
# Available languages can be found in https://releases.mozilla.org/pub/firefox/releases/${cfg.package.version}/linux-x86_64/xpi/
type = lib.types.listOf (
lib.types.enum ([
lib.types.enum [
"ach"
"af"
"an"
Expand Down Expand Up @@ -253,7 +253,7 @@ in
"xh"
"zh-CN"
"zh-TW"
])
]
);
default = [ ];
description = ''
Expand Down Expand Up @@ -285,15 +285,15 @@ in
'';
};

nativeMessagingHosts = ({
nativeMessagingHosts = {
packages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
description = ''
Additional packages containing native messaging hosts that should be made available to Firefox extensions.
'';
};
})
}
// (builtins.mapAttrs (k: v: lib.mkEnableOption "${v.name} support") nmhOptions);
};

Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/programs/gamescope.nix
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ in
environment.systemPackages = lib.mkIf (!cfg.capSysNice) [ gamescope ];
};

meta.maintainers = with lib.maintainers; [ ];
meta.maintainers = [ ];
}
2 changes: 1 addition & 1 deletion nixos/modules/programs/nix-required-mounts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ in
'';
allowedPatterns =
with lib.types;
lib.mkOption rec {
lib.mkOption {
type = attrsOf Pattern;
description = "The hook config, describing which paths to mount for which system features";
default = { };
Expand Down
4 changes: 2 additions & 2 deletions nixos/modules/programs/ssh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ in
ExecStartPre = "${pkgs.coreutils}/bin/rm -f %t/ssh-agent";
ExecStart =
"${cfg.package}/bin/ssh-agent "
+ lib.optionalString (cfg.agentTimeout != null) ("-t ${cfg.agentTimeout} ")
+ lib.optionalString (cfg.agentPKCS11Whitelist != null) ("-P ${cfg.agentPKCS11Whitelist} ")
+ lib.optionalString (cfg.agentTimeout != null) "-t ${cfg.agentTimeout} "
+ lib.optionalString (cfg.agentPKCS11Whitelist != null) "-P ${cfg.agentPKCS11Whitelist} "
+ "-a %t/ssh-agent";
StandardOutput = "null";
Type = "forking";
Expand Down
Loading
Loading