nixos/wordlist: remove with lib;
This commit is contained in:
parent
609e57485d
commit
30c85fe74d
@ -1,5 +1,4 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
concatAndSort = name: files: pkgs.runCommand name {} ''
|
||||
awk 1 ${lib.escapeShellArgs files} | sed '{ /^\s*$/d; s/^\s\+//; s/\s\+$// }' | sort | uniq > $out
|
||||
@ -8,16 +7,16 @@ in
|
||||
{
|
||||
options = {
|
||||
environment.wordlist = {
|
||||
enable = mkEnableOption "environment variables for lists of words";
|
||||
enable = lib.mkEnableOption "environment variables for lists of words";
|
||||
|
||||
lists = mkOption {
|
||||
type = types.attrsOf (types.nonEmptyListOf types.path);
|
||||
lists = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.nonEmptyListOf lib.types.path);
|
||||
|
||||
default = {
|
||||
WORDLIST = [ "${pkgs.scowl}/share/dict/words.txt" ];
|
||||
};
|
||||
|
||||
defaultText = literalExpression ''
|
||||
defaultText = lib.literalExpression ''
|
||||
{
|
||||
WORDLIST = [ "''${pkgs.scowl}/share/dict/words.txt" ];
|
||||
}
|
||||
@ -34,7 +33,7 @@ in
|
||||
task.
|
||||
'';
|
||||
|
||||
example = literalExpression ''
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
WORDLIST = [ "''${pkgs.scowl}/share/dict/words.txt" ];
|
||||
AUGMENTED_WORDLIST = [
|
||||
@ -50,7 +49,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf config.environment.wordlist.enable {
|
||||
config = lib.mkIf config.environment.wordlist.enable {
|
||||
environment.variables =
|
||||
lib.mapAttrs
|
||||
(name: value: "${concatAndSort "wordlist-${name}" value}")
|
||||
|
Loading…
Reference in New Issue
Block a user