Initial commit
This commit is contained in:
commit
68f9c7db73
4
README.md
Normal file
4
README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Funkytions
|
||||||
|
|
||||||
|
A collection of nix functions that were obnoxious enough to want to have in a
|
||||||
|
sperate repository.
|
5
flake.nix
Normal file
5
flake.nix
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{ description = "A collection of tedious nix functions";
|
||||||
|
outputs = _: {
|
||||||
|
lib = import ./lib.nix;
|
||||||
|
};
|
||||||
|
}
|
3
lib.nix
Normal file
3
lib.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
getKittyColorscheme = import ./lib/getKittyColorscheme.nix;
|
||||||
|
}
|
22
lib/getKittyColorscheme.nix
Normal file
22
lib/getKittyColorscheme.nix
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
{ lib, config, pkgs, ... }:
|
||||||
|
arg:
|
||||||
|
with lib;
|
||||||
|
let cfg = config.colorscheme;
|
||||||
|
|
||||||
|
getKittyTheme = with builtins; (theme:
|
||||||
|
let matching = filter (x: x.name == theme)
|
||||||
|
(fromJSON
|
||||||
|
(readFile
|
||||||
|
"${pkgs.kitty-themes}/share/kitty-themes/themes.json"));
|
||||||
|
|
||||||
|
in throwIf (length matching == 0)
|
||||||
|
"kitty-themes does not contain a theme named ${theme}"
|
||||||
|
"${pkgs.kitty-themes}/share/kitty-themes/${(head matching).file}");
|
||||||
|
|
||||||
|
unwrapKittyTheme = with pkgs; path: let
|
||||||
|
theme = runCommand "theme.toml" { nativebuildinputs = [ coreutils ]; } ''
|
||||||
|
cat '${path}' | sed -E '/^#|^$/d;s/\s+(.*)/ = "\1"/g' > $out
|
||||||
|
'';
|
||||||
|
in (builtins.fromTOML (builtins.readFile theme));
|
||||||
|
|
||||||
|
in unwrapKittyTheme (getKittyTheme arg)
|
Loading…
Reference in a new issue