Cleanup lib use, move to std where possible, use upstream nvim module

This commit is contained in:
Kat Inskip 2023-07-30 10:02:03 -07:00
parent aa5c67c13a
commit 11dd6aabd5
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
19 changed files with 53 additions and 515 deletions

View file

@ -2,10 +2,12 @@
config,
pkgs,
lib,
std,
...
}: let
inherit (lib.types) attrsOf str enum;
inherit (lib.modules) mkIf;
inherit (std) string set tuple list;
cfg = config.base16;
in
with lib; {
@ -32,14 +34,13 @@ in
};
config = mkIf (cfg.schemes != {}) {
base16 = {
# TODO: convert to std
palette =
lib.mapAttrs' (k: v:
lib.nameValuePair
palette = set.fromList (k: v:
tuple.toPair (tuple.tuple2 (
k
"#${v.hex}")
(lib.filterAttrs (n: _: lib.hasInfix "base" n)
cfg.defaultScheme);
"#${v.hex}"
))
(set.filter (n: _: string.hasPrefix "base" n)
cfg.defaultScheme));
};
lib.kittywitch.sassTemplate = {
@ -47,7 +48,7 @@ in
src,
}: let
variables = pkgs.writeText "base-variables.sass" ''
${(concatStringsSep "\n" (mapAttrsToList (var: con: "\$${var}: ${con}") cfg.sass.variables))}
${(string.concatSep "\n" (mapToValues (var: con: "\$${var}: ${con}") cfg.sass.variables))}
'';
source =
pkgs.callPackage
@ -57,7 +58,7 @@ in
}:
stdenv.mkDerivation {
inherit name src variables;
nativeBuildInputs = lib.singleton pkgs.sass;
nativeBuildInputs = list.singleton pkgs.sass;
phases = ["buildPhase"];
buildPhase = ''
cat $variables $src > src-mut.sass