From 5b8a624f9776492a0c2421fa4aecb01b840a5254 Mon Sep 17 00:00:00 2001 From: Kat Inskip Date: Sun, 30 Jul 2023 10:05:15 -0700 Subject: [PATCH] Further lib handling --- modules/home/base16.nix | 116 ++++++++++++++++++++-------------------- systems/goliath.nix | 8 +-- 2 files changed, 63 insertions(+), 61 deletions(-) diff --git a/modules/home/base16.nix b/modules/home/base16.nix index a26184fe..4ca22da2 100644 --- a/modules/home/base16.nix +++ b/modules/home/base16.nix @@ -5,71 +5,71 @@ std, ... }: let + inherit (lib.option) mkOption; inherit (lib.types) attrsOf str enum; inherit (lib.modules) mkIf; inherit (std) string set tuple list; cfg = config.base16; -in - with lib; { - options.base16 = { - palette = mkOption { +in { + options.base16 = { + palette = mkOption { + type = attrsOf str; + }; + sass = { + variables = mkOption { type = attrsOf str; + default = + cfg.palette + // { + term_font = "Iosevka"; + font = "Iosevka"; + font_size = "12px"; + }; }; - sass = { - variables = mkOption { - type = attrsOf str; - default = - cfg.palette - // { - term_font = "Iosevka"; - font = "Iosevka"; - font_size = "12px"; - }; - }; - css_style = mkOption { - type = enum ["nested" "compressed" "compact" "expanded"]; - default = "expanded"; - }; + css_style = mkOption { + type = enum ["nested" "compressed" "compact" "expanded"]; + default = "expanded"; }; }; - config = mkIf (cfg.schemes != {}) { - base16 = { - palette = set.fromList (k: v: - tuple.toPair (tuple.tuple2 ( - k - "#${v.hex}" - )) - (set.filter (n: _: string.hasPrefix "base" n) - cfg.defaultScheme)); - }; + }; + config = mkIf (cfg.schemes != {}) { + base16 = { + palette = set.fromList (k: v: + tuple.toPair (tuple.tuple2 ( + k + "#${v.hex}" + )) + (set.filter (n: _: string.hasPrefix "base" n) + cfg.defaultScheme)); + }; - lib.kittywitch.sassTemplate = { - name, - src, - }: let - variables = pkgs.writeText "base-variables.sass" '' - ${(string.concatSep "\n" (mapToValues (var: con: "\$${var}: ${con}") cfg.sass.variables))} - ''; - source = - pkgs.callPackage - ({ - sass, - stdenv, - }: - stdenv.mkDerivation { - inherit name src variables; - nativeBuildInputs = list.singleton pkgs.sass; - phases = ["buildPhase"]; - buildPhase = '' - cat $variables $src > src-mut.sass - sass src-mut.sass $out --sourcemap=none --trace --style=${cfg.sass.css_style} - ''; - }) - {}; - in { - inherit source; - text = builtins.readFile source; - }; - _module.args = {inherit (config.lib) kittywitch;}; + lib.kittywitch.sassTemplate = { + name, + src, + }: let + variables = pkgs.writeText "base-variables.sass" '' + ${(string.concatSep "\n" (mapToValues (var: con: "\$${var}: ${con}") cfg.sass.variables))} + ''; + source = + pkgs.callPackage + ({ + sass, + stdenv, + }: + stdenv.mkDerivation { + inherit name src variables; + nativeBuildInputs = list.singleton pkgs.sass; + phases = ["buildPhase"]; + buildPhase = '' + cat $variables $src > src-mut.sass + sass src-mut.sass $out --sourcemap=none --trace --style=${cfg.sass.css_style} + ''; + }) + {}; + in { + inherit source; + text = builtins.readFile source; }; - } + _module.args = {inherit (config.lib) kittywitch;}; + }; +} diff --git a/systems/goliath.nix b/systems/goliath.nix index c9ba7e78..9493d6bb 100644 --- a/systems/goliath.nix +++ b/systems/goliath.nix @@ -5,7 +5,9 @@ _: let tree, pkgs, ... - }: { + }: let + inherit (lib.modules) mkDefault; + in { imports = with tree.nixos.hardware; [ common-wifi-bt @@ -44,8 +46,8 @@ _: let boot.kernelModules = ["kvm-amd"]; boot.extraModulePackages = []; boot.supportedFilesystems = ["ntfs"]; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + nixpkgs.hostPlatform = mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = mkDefault config.hardware.enableRedistributableFirmware; fileSystems = { "/" = {