64 lines
2.6 KiB
Nix
64 lines
2.6 KiB
Nix
|
{
|
||
|
config,
|
||
|
fonts,
|
||
|
accentColourName,
|
||
|
...
|
||
|
}: {
|
||
|
xdg = {
|
||
|
configFile = {
|
||
|
"nyxt/config.lisp".text = let
|
||
|
sc = config.scheme.withHashtag;
|
||
|
in ''
|
||
|
;; Import custom configuration
|
||
|
(nyxt::load-lisp "${./config.lisp}")
|
||
|
;; Define custom theme
|
||
|
(define-configuration browser
|
||
|
((theme (make-instance 'theme:theme
|
||
|
:dark-p t
|
||
|
:font-family "${fonts.sansSerif.name}"
|
||
|
:monospace-font-family "${fonts.monospace.name}"
|
||
|
:background-color "${sc.base00}"
|
||
|
:on-background-color "${sc.base05}"
|
||
|
:primary-color "${sc.base02}"
|
||
|
:on-primary-color "${sc.base05}"
|
||
|
:secondary-color "${sc.base03}"
|
||
|
:on-secondary-color "${sc.base05}"
|
||
|
:accent-color "${sc.${accentColourName}}"
|
||
|
:on-accent-color "${sc.base01}"
|
||
|
:action-color "${sc.cyan}"
|
||
|
:on-action-color "${sc.base01}"
|
||
|
:success-color "${sc.green}"
|
||
|
:on-success-color "${sc.base01}"
|
||
|
:highlight-color "${sc.magenta}"
|
||
|
:on-highlight-color "${sc.base01}"
|
||
|
:warning-color "${sc.yellow}"
|
||
|
:on-warning-color "${sc.base01}"
|
||
|
:codeblock-color "${sc.base02}"
|
||
|
:on-codeblock-color "${sc.base05}"))))
|
||
|
'';
|
||
|
};
|
||
|
dataFile."nyxt/bookmarks.lisp".text = let
|
||
|
# Make a string of lisp-style list of strings, from nix-style
|
||
|
# list
|
||
|
convertTags = tags: "(" + (builtins.foldl' (x: y: x + " \"" + y + "\"") "" tags) + " )";
|
||
|
# Take bookmarks as returned from JSON file and convert to NYXT
|
||
|
# expected format
|
||
|
convertBookmark = {
|
||
|
name,
|
||
|
tags,
|
||
|
url,
|
||
|
}: "(:url \"${url}\" :title \"${name}\" :tags ${convertTags tags})\n";
|
||
|
in (
|
||
|
# Fold all entries in bookmarks.json into single string of NYXT
|
||
|
# format bookmarks, each entry on a new line and with 2 space
|
||
|
# indentation, just for visual clarity if reading the outputted
|
||
|
# file
|
||
|
"(\n"
|
||
|
+ (builtins.foldl'
|
||
|
(x: y: x + " " + convertBookmark y) ""
|
||
|
(builtins.fromJSON (builtins.readFile ./bookmarks.json)))
|
||
|
+ ")"
|
||
|
);
|
||
|
};
|
||
|
}
|