nixos/system/home/browser/nyxt.nix
Evie Litherland-Smith 68b4a7b063 Flatten directory/file structure a bit
Move system/home/default.nix into system/default.nix,
system/home/desktop/default.nix into system/desktop.nix to reduce
unnecessary duplication. Moved everything in home/desktop up to home/
and adjusted paths accordingly. Moved wallpapers up to system/ since
it makes sense with where it's used.

Merge allowUnfreePredicate into single place again since it seems to
override rather than combine if used multiple times.

Install NoMachine on all machines again by default.
2024-11-14 08:43:27 +00:00

68 lines
2.8 KiB
Nix

{ config, pkgs, ... }:
{
home.packages = [ pkgs.nyxt ];
xdg = {
configFile = {
"nyxt/config.lisp".text =
let
fonts = config.stylix.fonts;
scheme = config.lib.stylix.scheme.withHashtag;
in
''
;; Import custom configuration
(nyxt::load-lisp "${./config.lisp}")
;; Define custom theme
(define-configuration browser
((theme (make-instance 'theme:theme
:dark-p nil
:font-family "${fonts.sansSerif.name}"
:monospace-font-family "${fonts.monospace.name}"
:background-color "${scheme.base00}"
:on-background-color "${scheme.base05}"
:primary-color "${scheme.base02}"
:on-primary-color "${scheme.base05}"
:secondary-color "${scheme.base03}"
:on-secondary-color "${scheme.base05}"
:accent-color "${scheme.base0E}"
:on-accent-color "${scheme.base01}"
:action-color "${scheme.cyan}"
:on-action-color "${scheme.base01}"
:success-color "${scheme.green}"
:on-success-color "${scheme.base01}"
:highlight-color "${scheme.magenta}"
:on-highlight-color "${scheme.base01}"
:warning-color "${scheme.yellow}"
:on-warning-color "${scheme.base01}"
:codeblock-color "${scheme.base02}"
:on-codeblock-color "${scheme.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)
))
+ ")"
);
};
}