chore: reformat codebase

This commit is contained in:
Gabriel Arazas 2024-02-25 18:20:13 +08:00
parent 947f1da754
commit 15a43cd1e5
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
15 changed files with 458 additions and 417 deletions

View File

@ -24,7 +24,8 @@ in
local hsluv = lush.hsluv local hsluv = lush.hsluv
''; '';
themes = themes =
lib.mapAttrs (name: metadata: { lib.mapAttrs
(name: metadata: {
extraConfigLua = '' extraConfigLua = ''
${lib.foldlAttrs initLushBase16 "" metadata.palette} ${lib.foldlAttrs initLushBase16 "" metadata.palette}
@ -357,6 +358,7 @@ in
"${sym "@text.uri"}" = { fg = mkRaw "base0C"; }; "${sym "@text.uri"}" = { fg = mkRaw "base0C"; };
}) })
]; ];
}) config.bahaghari.tinted-theming.schemes; })
config.bahaghari.tinted-theming.schemes;
}; };
} }

View File

@ -1,6 +1,7 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
extraPlugins = builtins.map (path: extraPlugins = builtins.map
(path:
pkgs.runCommand "vim-plugin-bare" { } '' pkgs.runCommand "vim-plugin-bare" { } ''
mkdir -p "$out" mkdir -p "$out"
cp -r ${path}/* "$out" cp -r ${path}/* "$out"

View File

@ -27,7 +27,8 @@ in
lua = true; lua = true;
} // settings; } // settings;
in in
lib.mapAttrsToList mkDAPBinding { lib.mapAttrsToList mkDAPBinding
{
"b" = { "b" = {
options.desc = "Toggle breakpoint"; options.desc = "Toggle breakpoint";
action = "require('dap').toggle_breakpoint"; action = "require('dap').toggle_breakpoint";

View File

@ -3,4 +3,4 @@
import ../default.nix { inherit lib; } import ../default.nix { inherit lib; }
// import ../home-manager.nix { inherit lib; } // import ../home-manager.nix { inherit lib; }
// { sops-nix = import ../sops.nix { inherit lib; }; } // { sops-nix = import ../sops.nix { inherit lib; }; }

View File

@ -3,4 +3,4 @@
import ../default.nix { inherit lib; } import ../default.nix { inherit lib; }
// import ../nixos.nix { inherit lib; } // import ../nixos.nix { inherit lib; }
// { sops-nix = import ../sops.nix { inherit lib; }; } // { sops-nix = import ../sops.nix { inherit lib; }; }

View File

@ -28,7 +28,8 @@ in {
lib.count (attr: pred attr.name attr.value) lib.count (attr: pred attr.name attr.value)
(lib.mapAttrsToList lib.nameValuePair attrs); (lib.mapAttrsToList lib.nameValuePair attrs);
enabledThemes = countAttrs (_: theme: theme.enable) cfg.workflows; enabledThemes = countAttrs (_: theme: theme.enable) cfg.workflows;
in cfg.disableLimit || (enabledThemes <= 1); in
cfg.disableLimit || (enabledThemes <= 1);
message = "Can't have more than one theme enabled at any given time."; message = "Can't have more than one theme enabled at any given time.";
}]; }];
}; };

View File

@ -1,5 +1,5 @@
# This is just kept for future compatiblity in case we require pkgs or something. # This is just kept for future compatiblity in case we require pkgs or something.
{ }: {}:
{ {
nixosModules = rec { nixosModules = rec {

View File

@ -8,7 +8,8 @@
outputs = inputs@{ self, nixpkgs, ... }: outputs = inputs@{ self, nixpkgs, ... }:
let systems = inputs.flake-utils.lib.defaultSystems; let systems = inputs.flake-utils.lib.defaultSystems;
in inputs.flake-utils.lib.eachSystem systems (system: { in inputs.flake-utils.lib.eachSystem systems
(system: {
devShells.default = devShells.default =
import ./shell.nix { pkgs = import nixpkgs { inherit system; }; }; import ./shell.nix { pkgs = import nixpkgs { inherit system; }; };
}) // import ./default.nix { }; }) // import ./default.nix { };

View File

@ -24,7 +24,7 @@
${pkgs.lib.getExe' pkgs.yaml2json "yaml2json"} < "${path}" > "$out" ${pkgs.lib.getExe' pkgs.yaml2json "yaml2json"} < "${path}" > "$out"
''; '';
in in
pkgs.lib.importJSON dataDrv.outPath; pkgs.lib.importJSON dataDrv;
/* Convert a given decimal number to a specified base digit with the set of /* Convert a given decimal number to a specified base digit with the set of
glyphs for each digit as returned from lib.toBaseDigits. glyphs for each digit as returned from lib.toBaseDigits.
@ -34,11 +34,13 @@
Example: Example:
toBaseDigitWithGlyphs 24 267 { toBaseDigitWithGlyphs 24 267 {
"0" = "0"; "0" = "0";
"1" = "1";
"2" = "2";
# ... # ...
"22" = "L"; "22" = "O";
"23" = "M"; "23" = "P";
"24" = "N";
} }
=>
*/ */
toBaseDigitsWithGlyphs = base: i: glyphs: toBaseDigitsWithGlyphs = base: i: glyphs:
let let
@ -55,10 +57,20 @@
Example: Example:
generateGlyphSet [ "0" "1" "2" "3" "4" "5" "6" "7" "8 "9" "A" "B" "C" "D" "E" "F" ] generateGlyphSet [ "0" "1" "2" "3" "4" "5" "6" "7" "8 "9" "A" "B" "C" "D" "E" "F" ]
=> {
"0" = "0";
"1" = "1";
# ...
"14" = "E";
"15" = "F";
}
*/ */
generateGlyphSet = glyphsList: generateGlyphSet = glyphsList:
let let
glyphsList' = pkgs.lib.lists.imap0 (i: glyph: { "${builtins.toString i}" = glyph; }) glyphsList; glyphsList' =
pkgs.lib.lists.imap0
(i: glyph: { "${builtins.toString i}" = glyph; })
glyphsList;
in in
pkgs.lib.foldl (acc: glyph: acc // glyph) { } glyphsList'; pkgs.lib.foldl (acc: glyph: acc // glyph) { } glyphsList';
} }

View File

@ -6,7 +6,7 @@ in
rec { rec {
# Return a derivation containing all of the template output from the given # Return a derivation containing all of the template output from the given
# schemes. # schemes.
generateOutputFromSchemes = { schemes ? {}, template }: generateOutputFromSchemes = { schemes ? { }, template }:
let let
schemesDir = pkgs.runCommand "aggregate-schemes" { } schemesDir = pkgs.runCommand "aggregate-schemes" { }
'' ''

View File

@ -48,9 +48,32 @@ pkgs.lib.runTests {
testGenerateBase24GlyphSet = { testGenerateBase24GlyphSet = {
expr = expr =
lib.trivial.generateGlyphSet lib.trivial.generateGlyphSet
[ "0" "1" "2" "3" "4" "5" "6" "7" [
"8" "9" "A" "B" "C" "D" "E" "F" "0"
"G" "H" "I" "J" "M" "N" "O" "P" ]; "1"
"2"
"3"
"4"
"5"
"6"
"7"
"8"
"9"
"A"
"B"
"C"
"D"
"E"
"F"
"G"
"H"
"I"
"J"
"M"
"N"
"O"
"P"
];
expected = customBase24Glyphs; expected = customBase24Glyphs;
}; };