nixos/system/home/browser/nyxt.nix
Evie Litherland-Smith 5ff572a9b7 Major rewrite/refactor to simplify things
Move home/ directory under system/ directory. Remove duplicated
machine-specific config files, now handled as one per host (excluding
hardware-configuration directory)

Move as much configuration as possible out of flake.nix and into more
appropriate files (e.g. system/default.nix)

Add a desktop.nix and laptop.nix for system, both will import
home/desktop.nix and home/laptop.nix respectively to reduce
duplication in machine-specific config files

Remove games and streaming directories, moved directly into Vanguard
config file

Remove home/personal.nix since it ended up being empty after changes

Remove old sway config since I haven't been maintaining it and this
refactor will definitely break it
2024-08-30 12:57:02 +01:00

73 lines
2.8 KiB
Nix

{
config,
pkgs,
fonts,
accentColourName,
...
}:
{
home.packages = [ pkgs.nyxt ];
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)
))
+ ")"
);
};
}