wry, many thing

This commit is contained in:
atagen 2026-04-08 11:43:10 +10:00
parent 6e62eccfba
commit 848ed62c5d
47 changed files with 1598 additions and 1201 deletions

View file

@ -1,26 +1,140 @@
{
pkgs,
lib,
getPkgs,
config,
...
}:
let
pal = config.rice.palette.hex;
ui = config.rice.roles pal;
wrap =
name: pkg: args:
pkgs.symlinkJoin {
inherit name;
paths = [ pkg ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = "wrapProgram $out/bin/${name} ${args}";
};
wrapXdg =
name: pkg: configDir:
wrap name pkg ''--set XDG_CONFIG_HOME "${configDir}"'';
lazygitConfig = pkgs.writeText "lazygit-config.yml" ''
gui:
theme:
activeBorderColor:
- "${ui.highlight}"
- bold
inactiveBorderColor:
- "${ui.muted}"
searchingActiveBorderColor:
- "${ui.accent}"
- bold
optionsTextColor:
- "${ui.primary}"
selectedLineBgColor:
- "${ui.surface}"
selectedRangeBgColor:
- "${ui.surface}"
cherryPickedCommitBgColor:
- "${ui.accent}"
cherryPickedCommitFgColor:
- "${ui.bg}"
unstagedChangesColor:
- "${ui.error}"
defaultFgColor:
- "${ui.fg}"
'';
zellijConfig = pkgs.writeTextDir "zellij-config.kdl" ''
themes {
nix-rice {
fg "${ui.fg}"
bg "${ui.surface}"
black "${pal.normal.black}"
red "${pal.normal.red}"
green "${pal.normal.green}"
yellow "${pal.normal.yellow}"
blue "${pal.normal.blue}"
magenta "${pal.normal.magenta}"
cyan "${pal.normal.cyan}"
white "${pal.normal.white}"
orange "${ui.highlight}"
}
}
theme "nix-rice"
'';
btopConfig = pkgs.writeText "btop.conf" ''
color_theme = "nix-rice"
'';
btopThemeDir = pkgs.runCommand "btop-themes" { } ''
mkdir -p $out
cp ${pkgs.writeText "nix-rice.theme" ''
theme[main_bg]="${ui.bg}"
theme[main_fg]="${ui.fg}"
theme[title]="${ui.fg}"
theme[hi_fg]="${ui.accent}"
theme[selected_bg]="${ui.surface}"
theme[selected_fg]="${ui.fg}"
theme[inactive_fg]="${ui.muted}"
theme[graph_text]="${ui.fg}"
theme[meter_bg]="${ui.overlay}"
theme[proc_misc]="${ui.primary}"
theme[cpu_box]="${ui.primary}"
theme[mem_box]="${ui.accent}"
theme[net_box]="${pal.normal.green}"
theme[proc_box]="${pal.normal.magenta}"
theme[div_line]="${ui.overlay}"
theme[temp_start]="${pal.normal.green}"
theme[temp_mid]="${ui.highlight}"
theme[temp_end]="${ui.error}"
theme[cpu_start]="${ui.primary}"
theme[cpu_mid]="${ui.accent}"
theme[cpu_end]="${ui.highlight}"
theme[free_start]="${pal.normal.green}"
theme[free_mid]="${ui.accent}"
theme[free_end]="${ui.primary}"
theme[cached_start]="${ui.primary}"
theme[cached_mid]="${ui.accent}"
theme[cached_end]="${pal.normal.green}"
theme[available_start]="${pal.normal.green}"
theme[available_mid]="${ui.accent}"
theme[available_end]="${ui.highlight}"
theme[used_start]="${ui.highlight}"
theme[used_mid]="${ui.error}"
theme[used_end]="${pal.bright.red}"
theme[download_start]="${pal.normal.green}"
theme[download_mid]="${ui.accent}"
theme[download_end]="${ui.primary}"
theme[upload_start]="${ui.highlight}"
theme[upload_mid]="${pal.bright.red}"
theme[upload_end]="${ui.error}"
theme[process_start]="${ui.primary}"
theme[process_mid]="${ui.accent}"
theme[process_end]="${pal.normal.green}"
''} $out/nix-rice.theme
'';
in
{
environment.systemPackages = getPkgs {
inherit (pkgs)
curl
eza
git
btop
bat
ripgrep
fd
ouch
btop
bat
;
lazygit = wrap "lazygit" pkgs.lazygit ''--add-flags "--use-config-file=${lazygitConfig}"'';
zellij = wrap "zellij" pkgs.zellij ''--add-flags "--config-dir ${zellijConfig}"'';
# btop = wrap "btop" pkgs.btop ''--add-flags "--config ${btopConfig} --themes-dir ${btopThemeDir}"'';
};
user.packages = getPkgs {
inherit (pkgs)
lazygit
zellij
;
};
environment.variables.BAT_THEME = "ansi";
}

View file

@ -1,180 +0,0 @@
{
config,
...
}:
with config.rice.palette.hex;
scope "user.programs.helix.themes.nix-rice" {
"attribute" = bright.cyan;
"keyword" = {
fg = normal.red;
};
"keyword.directive" = normal.red;
"namespace" = bright.cyan;
"punctuation" = bright.yellow;
"punctuation.delimiter" = bright.yellow;
"operator" = bright.magenta;
"special" = normal.magenta;
"variable.other.member" = bright.blue;
"variable" = util.fg;
"variable.builtin" = bright.yellow;
"variable.parameter" = bright.white;
"type" = normal.yellow;
"type.builtin" = normal.yellow;
"constructor" = {
fg = bright.magenta;
modifiers = [ "bold" ];
};
"function" = {
fg = normal.green;
modifiers = [ "bold" ];
};
"function.macro" = bright.cyan;
"function.builtin" = normal.yellow;
"tag" = normal.red;
"comment" = {
fg = normal.magenta;
modifiers = [ "italic" ];
};
"constant" = {
fg = bright.magenta;
};
"constant.builtin" = {
fg = bright.magenta;
modifiers = [ "bold" ];
};
"string" = normal.green;
"constant.numeric" = bright.magenta;
"constant.character.escape" = {
fg = bright.white;
modifiers = [ "bold" ];
};
"label" = bright.cyan;
"module" = bright.cyan;
"diff.plus" = bright.green;
"diff.delta" = bright.yellow;
"diff.minus" = bright.red;
"warning" = bright.yellow;
"error" = bright.red;
"info" = bright.cyan;
"hint" = bright.blue;
"ui.background" = {
inherit (util) bg;
};
"ui.linenr" = {
fg = normal.cyan;
};
"ui.linenr.selected" = {
fg = normal.yellow;
modifiers = [ "bold" ];
};
"ui.cursorline" = {
bg = normal.black;
};
"ui.statusline" = {
inherit (util) fg;
bg = bright.black;
};
"ui.statusline.normal" = {
inherit (util) fg;
bg = bright.black;
};
"ui.statusline.insert" = {
inherit (util) fg;
bg = normal.blue;
};
"ui.statusline.select" = {
inherit (util) fg;
bg = bright.yellow;
};
"ui.statusline.inactive" = {
fg = normal.white;
bg = normal.black;
};
"ui.popup" = {
bg = normal.black;
};
"ui.window" = {
bg = normal.black;
};
"ui.help" = {
bg = normal.black;
inherit (util) fg;
};
"ui.text" = {
inherit (util) fg;
};
"ui.text.focus" = {
inherit (util) fg;
};
"ui.selection" = {
# modifiers = ["reversed"];
bg = bright.yellow;
};
"ui.selection.primary" = {
modifiers = [ "reversed" ];
};
# "ui.selection.primary" = { bg = bright.cyan; };
"ui.cursor.primary" = {
bg = normal.white;
fg = normal.black;
};
"ui.cursor.match" = {
bg = bright.cyan;
};
"ui.menu" = {
inherit (util) fg;
bg = bright.black;
};
"ui.menu.selected" = {
fg = bright.black;
bg = bright.blue;
modifiers = [ "bold" ];
};
"ui.virtual.whitespace" = bright.black;
"ui.virtual.ruler" = {
bg = normal.black;
};
"ui.virtual.inlay-hint" = {
fg = normal.magenta;
};
"diagnostic.warning" = {
underline = {
color = bright.yellow;
style = "curl";
};
};
"diagnostic.error" = {
underline = {
color = bright.red;
style = "curl";
};
};
"diagnostic.info" = {
underline = {
color = bright.cyan;
style = "curl";
};
};
"diagnostic.hint" = {
underline = {
color = bright.blue;
style = "curl";
};
};
"markup.heading" = bright.cyan;
"markup.bold" = {
modifiers = [ "bold" ];
};
"markup.italic" = {
modifiers = [ "italic" ];
};
"markup.strikethrough" = {
modifiers = [ "crossed_out" ];
};
"markup.link.url" = {
fg = bright.green;
modifiers = [ "underlined" ];
};
"markup.link.text" = bright.red;
"markup.raw" = bright.red;
}

View file

@ -1,12 +1,16 @@
{
pkgs,
lib,
config,
...
}:
(scope "apps.editor" <| pkgs.helix)
// scope "user.programs.helix" {
enable = true;
settings = {
let
toml = (pkgs.formats.toml { }).generate;
pal = config.rice.palette.hex;
ui = config.rice.roles pal;
helixConfig = toml "config.toml" {
theme = "nix-rice";
editor = {
bufferline = "multiple";
@ -28,7 +32,7 @@
};
};
languages = {
helixLanguages = toml "languages.toml" {
language = [
{
name = "rust";
@ -64,4 +68,204 @@
};
};
};
}
helixTheme = toml "nix-rice.toml" {
# === Syntax (palette) ===
"attribute" = pal.bright.cyan;
"keyword" = {
fg = pal.normal.red;
};
"keyword.directive" = pal.normal.red;
"namespace" = pal.bright.cyan;
"punctuation" = pal.bright.yellow;
"punctuation.delimiter" = pal.bright.yellow;
"operator" = pal.bright.magenta;
"special" = pal.normal.magenta;
"variable.other.member" = pal.bright.blue;
"variable" = pal.util.fg;
"variable.builtin" = pal.bright.yellow;
"variable.parameter" = pal.bright.white;
"type" = pal.normal.yellow;
"type.builtin" = pal.normal.yellow;
"constructor" = {
fg = pal.bright.magenta;
modifiers = [ "bold" ];
};
"function" = {
fg = pal.normal.green;
modifiers = [ "bold" ];
};
"function.macro" = pal.bright.cyan;
"function.builtin" = pal.normal.yellow;
"tag" = pal.normal.red;
"comment" = {
fg = pal.normal.magenta;
modifiers = [ "italic" ];
};
"constant" = {
fg = pal.bright.magenta;
};
"constant.builtin" = {
fg = pal.bright.magenta;
modifiers = [ "bold" ];
};
"string" = pal.normal.green;
"constant.numeric" = pal.bright.magenta;
"constant.character.escape" = {
fg = pal.bright.white;
modifiers = [ "bold" ];
};
"label" = pal.bright.cyan;
"module" = pal.bright.cyan;
# === Markup (palette) ===
"markup.heading" = pal.bright.cyan;
"markup.bold" = {
modifiers = [ "bold" ];
};
"markup.italic" = {
modifiers = [ "italic" ];
};
"markup.strikethrough" = {
modifiers = [ "crossed_out" ];
};
"markup.link.url" = {
fg = pal.bright.green;
modifiers = [ "underlined" ];
};
"markup.link.text" = pal.bright.red;
"markup.raw" = pal.bright.red;
# === Diff / diagnostics (roles) ===
"diff.plus" = ui.added;
"diff.delta" = ui.changed;
"diff.minus" = ui.removed;
"warning" = ui.warning;
"error" = ui.error;
"info" = ui.info;
"hint" = ui.hint;
"diagnostic.warning" = {
underline = {
color = ui.warning;
style = "curl";
};
};
"diagnostic.error" = {
underline = {
color = ui.error;
style = "curl";
};
};
"diagnostic.info" = {
underline = {
color = ui.info;
style = "curl";
};
};
"diagnostic.hint" = {
underline = {
color = ui.hint;
style = "curl";
};
};
# === UI (roles) ===
"ui.background" = {
bg = ui.bg;
};
"ui.text" = {
fg = ui.fg;
};
"ui.text.focus" = {
fg = ui.fg;
};
"ui.linenr" = {
fg = pal.normal.cyan;
};
"ui.linenr.selected" = {
fg = pal.normal.yellow;
modifiers = [ "bold" ];
};
"ui.cursorline" = {
bg = ui.surface;
};
"ui.statusline" = {
fg = ui.fg;
bg = ui.overlay;
};
"ui.statusline.normal" = {
fg = ui.fg;
bg = ui.overlay;
};
"ui.statusline.insert" = {
fg = ui.fg;
bg = ui.primary;
};
"ui.statusline.select" = {
fg = ui.fg;
bg = ui.highlight;
};
"ui.statusline.inactive" = {
fg = ui.muted;
bg = ui.surface;
};
"ui.popup" = {
bg = ui.surface;
};
"ui.window" = {
bg = ui.surface;
};
"ui.help" = {
bg = ui.surface;
fg = ui.fg;
};
"ui.selection" = {
bg = ui.highlight;
};
"ui.selection.primary" = {
modifiers = [ "reversed" ];
};
"ui.cursor.primary" = {
bg = ui.muted;
fg = ui.surface;
};
"ui.cursor.match" = {
bg = ui.accent;
};
"ui.menu" = {
fg = ui.fg;
bg = ui.overlay;
};
"ui.menu.selected" = {
fg = ui.overlay;
bg = ui.secondary;
modifiers = [ "bold" ];
};
"ui.virtual.whitespace" = ui.overlay;
"ui.virtual.ruler" = {
bg = ui.surface;
};
"ui.virtual.inlay-hint" = {
fg = pal.normal.magenta;
};
};
helixConfigDir = pkgs.runCommand "helix-xdg" { } ''
mkdir -p $out/helix/themes
cp ${helixConfig} $out/helix/config.toml
cp ${helixLanguages} $out/helix/languages.toml
cp ${helixTheme} $out/helix/themes/nix-rice.toml
'';
helixWrapped = pkgs.symlinkJoin {
name = "helix";
paths = [ pkgs.helix ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/hx \
--set XDG_CONFIG_HOME "${helixConfigDir}"
'';
meta.mainProgram = "hx";
};
in
scope "apps.editor" <| helixWrapped

View file

@ -13,6 +13,7 @@
schemes = {
atagen = "git+https://git.lobotomise.me/atagen/{path}";
amaan = "github:amaanq/{path}";
kosslan = "git+ssh://git@git.kosslan.dev/{path}";
};
};
}

View file

@ -23,11 +23,6 @@
system.nixos.tags = [ "fatcock-xxl" ];
hjem = {
clobberByDefault = true;
linker = getFlakePkg' inputs.hjem "smfh";
};
environment.arbys = {
enable = true;
clobber = true;

View file

@ -9,7 +9,7 @@ scope "nix.settings" {
# "https://cache.atagen.co"
# "https://cache.privatevoid.net"
"https://cache.flox.dev"
"https://cache.amaanq.com"
# "https://cache.amaanq.com"
"https://cache.nixos-cuda.org"
"https://niri.cachix.org"
];
@ -20,7 +20,7 @@ scope "nix.settings" {
# "cache.atagen.co:SOUkNQxuu/eQ7FcI8nlUe7FpV27e7YjQlDQdn8HTUnw="
# "cache.privatevoid.net:SErQ8bvNWANeAvtsOESUwVYr2VJynfuc9JRwlzTTkVg="
"flox-cache-public-1:7F4OyH7ZCnFhcze3fJdfyXYLQw/aV7GEed86nQ7IsOs="
"cache.amaanq.com:H0iXsEEFsvUNtWb5v9V8Kss+L4F/tnXwDHXcY+xbmKk="
# "cache.amaanq.com:H0iXsEEFsvUNtWb5v9V8Kss+L4F/tnXwDHXcY+xbmKk="
"cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M="
"niri.cachix.org-1:Wv0OmO7PsuocRKzfDoJ3mulSl7Z6oezYhGhR+3W2964="
];

View file

@ -13,12 +13,16 @@ let
theme = kitty-themes.parseTheme ./pal.conf;
in
{
options.rice = lib.mkOption {
description = "ricing related variables";
default = { };
type = lib.types.attrsOf lib.types.anything;
};
config.rice = rec {
# first, map straight colours
palette = theme // {
normal = {
black = theme.color0;
@ -51,5 +55,36 @@ in
hex = toRGBHex palette;
shortHex = toRGBShortHex palette;
};
# then map colours to roles
# these are general UI roles — not code-syntax tokens.
# editors and shells should use palette directly for syntax.
roles = p: {
# base
fg = p.util.fg;
bg = p.util.bg;
surface = p.normal.black; # panels, popups, recessed areas
overlay = p.bright.black; # menus, statuslines, elevated UI
muted = p.normal.white; # secondary text, inactive borders
# emphasis
primary = p.normal.red; # main interactive accent
secondary = p.bright.blue; # secondary interactive accent
accent = p.bright.magenta; # highlights, matches
highlight = p.bright.yellow; # selection, active borders, branding
# state
success = p.bright.green;
warning = p.normal.yellow;
error = p.bright.red;
info = p.bright.cyan;
hint = p.bright.blue;
# diff
added = p.normal.green;
changed = p.bright.yellow;
removed = p.normal.red;
};
};
}

View file

@ -1,13 +1,89 @@
{
lib,
pkgs,
# inputs,
inputs,
# getFlakePkg',
config,
mainUser,
...
}:
let
inherit (pkgs) nushell;
cfg = config.programs.inshellah;
nushellWrapped = pkgs.symlinkJoin {
name = "nushell";
paths = [ nushell ];
nativeBuildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/nu \
--add-flags "--config ${nuConfig}"
'';
passthru = nushell.passthru or { } // {
shellPath = "/bin/nu";
};
};
theme =
let
pal = config.rice.palette.hex;
ui = config.rice.roles pal;
in
''
let theme = {
separator: "${pal.bright.yellow}"
leading_trailing_space_bg: "${ui.highlight}"
header: "${pal.normal.yellow}"
empty: "${ui.muted}"
bool: "${pal.bright.magenta}"
int: "${pal.bright.magenta}"
filesize: "${pal.bright.magenta}"
duration: "${pal.bright.magenta}"
date: "${pal.bright.cyan}"
range: "${pal.bright.magenta}"
float: "${pal.bright.magenta}"
string: "${pal.normal.green}"
nothing: "${ui.muted}"
binary: "${pal.bright.magenta}"
cell-path: "${pal.bright.blue}"
row_index: "${pal.bright.blue}"
record: "${pal.bright.cyan}"
list: "${pal.bright.cyan}"
block: "${pal.bright.cyan}"
hints: "${ui.hint}"
search_result: "${ui.highlight}"
shape_and: "${pal.normal.red}"
shape_binary: "${pal.bright.magenta}"
shape_block: "${pal.bright.cyan}"
shape_bool: "${pal.bright.magenta}"
shape_custom: "${ui.accent}"
shape_datetime: "${pal.bright.cyan}"
shape_external: "${pal.normal.green}"
shape_externalarg: "${pal.normal.green}"
shape_filepath: "${pal.normal.green}"
shape_flag: "${ui.accent}"
shape_float: "${pal.bright.magenta}"
shape_globpattern: "${pal.normal.green}"
shape_int: "${pal.bright.magenta}"
shape_internalcall: "${pal.normal.green}"
shape_list: "${pal.bright.cyan}"
shape_literal: "${pal.bright.magenta}"
shape_operator: "${pal.bright.magenta}"
shape_option: "${ui.accent}"
shape_range: "${pal.bright.magenta}"
shape_record: "${pal.bright.cyan}"
shape_string: "${pal.normal.green}"
shape_variable: "${pal.bright.blue}"
};
$env.config = ($env.config | upsert color_config $theme)
'';
prompt = ''
do --env {
def prompt-header [
@ -118,6 +194,7 @@ let
}
}
'';
aliases = {
"l" = "ls";
"la" = "ls -a";
@ -135,7 +212,9 @@ let
"fg" = "job unfreeze";
"jobs" = "job list";
};
nuScriptsPath = "${pkgs.nu_scripts}/share/nu_scripts";
nuConfig = pkgs.writeText "config.nu" ''
use std/config *
@ -153,6 +232,8 @@ let
$env.config.buffer_editor = "${lib.getExe config.apps.editor}"
# aliases
#
def fresh [] {
clear
${./rice/header.sh}
@ -164,21 +245,34 @@ let
git push --force
}
# direnv
# Initialize the PWD hook as an empty list if it doesn't exist
$env.config.hooks.env_change.PWD = $env.config.hooks.env_change.PWD? | default []
$env.config.hooks.env_change.PWD ++= [{||
if (which direnv | is-empty) {
# If direnv isn't installed, do nothing
return
}
direnv export json | from json | default {} | load-env
# If direnv changes the PATH, it will become a string and we need to re-convert it to a list
$env.PATH = do (env-conversions).path.from_string $env.PATH
}]
# direnv
$env.config = ($env.config? | default {})
$env.config.hooks = ($env.config.hooks? | default {})
$env.config.hooks.pre_prompt = (
$env.config.hooks.pre_prompt?
| default []
| append {||
${pkgs.direnv}/bin/direnv export json
| from json --strict
| default {}
| items {|key, value|
let value = do (
{
"PATH": {
from_string: {|s| $s | split row (char esep) | path expand --no-symlink }
to_string: {|v| $v | path expand --no-symlink | str join (char esep) }
}
}
| merge ($env.ENV_CONVERSIONS? | default {})
| get ([[value, optional, insensitive]; [$key, true, true] [from_string, true, false]] | into cell-path)
| if ($in | is-empty) { {|x| $x} } else { $in }
) $value
return [ $key $value ]
}
| into record
| load-env
}
)
# $cmd doesn't carry its args ?
# $env.config.hooks.command_not_found = { |cmd| , $cmd; echo }
@ -187,71 +281,12 @@ let
$env.config.edit_mode = "vi";
$env.config.completions.algorithm = "fuzzy";
# TODO
$env.config.color_config = {
# separator default
# header green_bold
# empty blue
# bool light_cyan
# int default
# filesize cyan
# duration default
# datetime purple
# range default
# float default
# string default
# nothing default
# binary default
# cell-path default
# row_index green_bold
# record default
# list default
# block default
# hints dark_gray
# search_result bg red
# fg white
# shape_binary purple_bold
# shape_block blue_bold
# shape_bool light_cyan
# shape_closure green_bold
# shape_custom green
# shape_datetime cyan_bold
# shape_directory cyan
# shape_external cyan
# shape_externalarg green_bold
# shape_external_resolved light_yellow_bold
# shape_filepath cyan
# shape_flag blue_bold
# shape_float purple_bold
# shape_garbage fg white
# bg red
# attr b
# shape_glob_interpolation cyan_bold
# shape_globpattern cyan_bold
# shape_int purple_bold
# shape_internalcall cyan_bold
# shape_keyword cyan_bold
# shape_list cyan_bold
# shape_literal blue
# shape_match_pattern green
# shape_matching_brackets attr u
# shape_nothing light_cyan
# shape_operator yellow
# shape_pipe purple_bold
# shape_range yellow_bold
# shape_record cyan_bold
# shape_redirection purple_bold
# shape_signature green_bold
# shape_string green
# shape_string_interpolation cyan_bold
# shape_table blue_bold
# shape_variable purple
# shape_vardecl purple
# shape_raw_string light_purple
}
${prompt}
${cfg.snippet}
${theme}
$env.config.show_banner = false
fresh
@ -260,19 +295,24 @@ let
in
{
user.xdg.config.files."nushell/config.nu".source = nuConfig;
imports = [ inputs.inshellah.nixosModules.default ];
programs.inshellah = {
enable = true;
helpOnlyCommands = [ "nh" ];
};
programs.command-not-found.enable = false;
programs.zoxide.enable = true;
environment.shellAliases = {
};
environment.systemPackages = [
nushell
nushellWrapped
];
environment.shells = [
nushell
nushellWrapped
];
users.defaultUserShell = nushell;
users.defaultUserShell = nushellWrapped;
console.font = "Lat2-Terminus16";
environment.variables = {