mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00

After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
64 lines
1.8 KiB
Nix
64 lines
1.8 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
concatAndSort =
|
|
name: files:
|
|
pkgs.runCommand name { } ''
|
|
awk 1 ${lib.escapeShellArgs files} | sed '{ /^\s*$/d; s/^\s\+//; s/\s\+$// }' | sort | uniq > $out
|
|
'';
|
|
in
|
|
{
|
|
options = {
|
|
environment.wordlist = {
|
|
enable = lib.mkEnableOption "environment variables for lists of words";
|
|
|
|
lists = lib.mkOption {
|
|
type = lib.types.attrsOf (lib.types.nonEmptyListOf lib.types.path);
|
|
|
|
default = {
|
|
WORDLIST = [ "${pkgs.scowl}/share/dict/words.txt" ];
|
|
};
|
|
|
|
defaultText = lib.literalExpression ''
|
|
{
|
|
WORDLIST = [ "''${pkgs.scowl}/share/dict/words.txt" ];
|
|
}
|
|
'';
|
|
|
|
description = ''
|
|
A set with the key names being the environment variable you'd like to
|
|
set and the values being a list of paths to text documents containing
|
|
lists of words. The various files will be merged, sorted, duplicates
|
|
removed, and extraneous spacing removed.
|
|
|
|
If you have a handful of words that you want to add to an already
|
|
existing wordlist, you may find `builtins.toFile` useful for this
|
|
task.
|
|
'';
|
|
|
|
example = lib.literalExpression ''
|
|
{
|
|
WORDLIST = [ "''${pkgs.scowl}/share/dict/words.txt" ];
|
|
AUGMENTED_WORDLIST = [
|
|
"''${pkgs.scowl}/share/dict/words.txt"
|
|
"''${pkgs.scowl}/share/dict/words.variants.txt"
|
|
(builtins.toFile "extra-words" '''
|
|
desynchonization
|
|
oobleck''')
|
|
];
|
|
}
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf config.environment.wordlist.enable {
|
|
environment.variables = lib.mapAttrs (
|
|
name: value: "${concatAndSort "wordlist-${name}" value}"
|
|
) config.environment.wordlist.lists;
|
|
};
|
|
}
|