sway: extract binds

This commit is contained in:
Leonardo Eugênio 2023-02-25 18:04:58 -03:00
parent 5f0c129b63
commit c82e25f0a4
4 changed files with 244 additions and 212 deletions

View file

@ -9,6 +9,7 @@
new-packages
patches
variables
lib_extended
];
nur = inputs.nur.overlay;
@ -83,4 +84,18 @@
variables = (final: prev: {
uservars = import ../user/variables.nix;
});
lib_extended = (final: prev: {
lib = prev.lib // rec {
# Utility funcion
# Input: [{v1=1;} {v2=2;}]
# Output: {v1=1;v2=2;}
mergeAttrsSet = prev.lib.foldAttrs (n: _: n) { };
# Easily translate imperative templating code
# Input: [ 1 2 ] (num: { "v${num}" = num; })
# Output: {v1=1;v2=2;}
forEachMerge = list: func: mergeAttrsSet (prev.lib.forEach list func);
};
});
}