Compare commits

..

1 Commits
main ... work

Author SHA1 Message Date
sloane ess 707a1e37c8 Set work configs 2024-07-19 21:28:53 -04:00
13 changed files with 443 additions and 211 deletions

View File

@ -1,5 +1,20 @@
{
"nodes": {
"cl-nix-lite": {
"locked": {
"lastModified": 1717972076,
"narHash": "sha256-hnZEsDInTcsVSL5LBGDAZegAxVLBus/wiJh+sNM15zU=",
"owner": "hraban",
"repo": "cl-nix-lite",
"rev": "cc920bfb0a6402d3871f470c98d65266126973e4",
"type": "github"
},
"original": {
"owner": "hraban",
"repo": "cl-nix-lite",
"type": "github"
}
},
"crane": {
"inputs": {
"nixpkgs": [
@ -138,6 +153,23 @@
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1697816753,
"narHash": "sha256-40to80AEIyKCQI0xMKCeF5ePoIKTYgjVVCZeu4CnTxM=",
"owner": "hraban",
"repo": "flake-compat",
"rev": "6025bade1336a36014639bc3f67eacc853dab78f",
"type": "github"
},
"original": {
"owner": "hraban",
"ref": "fixed-output",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1696426674,
@ -234,6 +266,23 @@
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"id": "flake-utils",
"type": "indirect"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
@ -350,9 +399,32 @@
"type": "github"
}
},
"mac-app-util": {
"inputs": {
"cl-nix-lite": "cl-nix-lite",
"flake-compat": "flake-compat",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1719942949,
"narHash": "sha256-srSQac7dhXtisqu4XwPGrK8qcmT2rflJJ1mRIV9j0Qk=",
"owner": "hraban",
"repo": "mac-app-util",
"rev": "63f269f737cafb2219ba38780c1ecb1dc24bc4a2",
"type": "github"
},
"original": {
"owner": "hraban",
"repo": "mac-app-util",
"type": "github"
}
},
"nil": {
"inputs": {
"flake-utils": "flake-utils_2",
"flake-utils": "flake-utils_3",
"nixpkgs": [
"nixpkgs"
],
@ -494,7 +566,7 @@
},
"pre-commit": {
"inputs": {
"flake-compat": "flake-compat",
"flake-compat": "flake-compat_2",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
@ -530,6 +602,7 @@
"home-manager": "home-manager",
"homebrew-enabled": "homebrew-enabled",
"ia-writer-family-src": "ia-writer-family-src",
"mac-app-util": "mac-app-util",
"nil": "nil",
"nix-darwin": "nix-darwin",
"nixd": "nixd",
@ -636,6 +709,21 @@
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"terminal-themes": {
"flake": false,
"locked": {

View File

@ -15,6 +15,8 @@
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
ghostty.url = "github:clo4/ghostty-hm-module";
mac-app-util.url = "github:hraban/mac-app-util";
mac-app-util.inputs.nixpkgs.follows = "nixpkgs";
# "flag" for toggling homebrew operations
# https://www.mat.services/posts/command-line-flake-arguments/
@ -34,6 +36,7 @@
ia-writer-family-src.url = "github:iaolo/iA-Fonts";
ia-writer-family-src.flake = false;
# standard kitty terminal themes
terminal-themes.url = "github:mbadolato/iTerm2-Color-Schemes";
terminal-themes.flake = false;

View File

@ -14,6 +14,7 @@
./ghostty.nix
./git.nix
./helix.nix
./kitty.nix
./pijul.nix
./ssh.nix
./starship.nix

View File

@ -1,114 +0,0 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.programs.fish;
in
{
options.programs.fish = {
autoTheme = {
enable = lib.mkEnableOption "Automatically change terminal and shell themes with night mode";
light = lib.mkOption {
type = lib.types.str;
description = "Light mode theme";
};
dark = lib.mkOption {
type = lib.types.str;
description = "Dark mode theme";
};
};
};
config = lib.mkIf (cfg.enable && cfg.autoTheme.enable) {
programs.fish = {
shellInit = ''
set -g theme_dark "${config.programs.fish.autoTheme.dark}"
set -g theme_light "${config.programs.fish.autoTheme.light}"
set-background-to-system
'';
interactiveShellInit = ''
set-shell-colors
set-term-colors
'';
functions =
{
# toggles `$term_background` between "light" and "dark". other Fish functions trigger when this
# variable changes. we use a universal variable so that all instances of Fish have the same
# value for the variable.
toggle-background.body = ''
if test "$term_background" = light
set -U term_background dark
else
set -U term_background light
end
'';
# set `$term_background` based on whether macOS is light or dark mode
set-background-to-system.body = ''
if is-dark-mode
set -U term_background dark
else
set -U term_background light
end
'';
# set `$term_background` based on an env var
set-background-to-env = {
argumentNames = [ "env_var" ];
body = ''
switch $$env_var
case 1
echo "Setting dark mode"
set -U term_background dark
case 0
echo "Setting light mode"
set -U term_background light
end
'';
};
# sets shell utilities to light or dark colorscheme based on `$term_background`.
set-shell-colors = {
body = ''
# Use correct theme for `btm` and `bat`
if test "$term_background" = light
alias btm "btm --color nord-light"
set -xg BAT_THEME OneHalfLight
else
alias btm "btm --color nord"
set -xg BAT_THEME OneHalfDark
end
# Set LS_COLORS
set -xg LS_COLORS (${pkgs.vivid}/bin/vivid generate one-$term_background)
'';
onVariable = "term_background";
};
# use theme.sh to update terminal colors
set-term-colors = {
body = ''
set -l theme theme_$term_background
theme.sh $$theme
'';
onVariable = "term_background";
};
# do i need to implement for linux?
is-dark-mode = abort "is-dark-mode is not defined on ${pkgs.stdenv.system} yet.}";
}
// lib.optionalAttrs pkgs.stdenv.isDarwin {
# determine if dark mode is active
is-dark-mode.body = ''
defaults read -g AppleInterfaceStyle &>/dev/null
'';
};
shellAbbrs = {
tb = "toggle-background";
sb = "set-background-to-system";
};
};
};
}

View File

@ -0,0 +1,86 @@
{
config,
pkgs,
lib,
...
}:
let
cfg = config.programs.kitty;
# helper scripts for changing kitty colors
term-background = pkgs.writeShellScriptBin "term-background" ''
# Accepts the name of a theme file in color-pkg
# If shell is running in a Kitty window set the colors.
if [ -n "$KITTY_WINDOW_ID" ]; then
kitty @ --to $KITTY_LISTEN_ON set-colors --all --configured \
${cfg.colors.colors-path}/"$1".conf &
fi
'';
term-light = pkgs.writeShellScriptBin "term-light" ''
${term-background}/bin/term-background ${cfg.colors.light-name}
'';
term-dark = pkgs.writeShellScriptBin "term-dark" ''
${term-background}/bin/term-background ${cfg.colors.dark-name}
'';
in
{
options.programs.kitty = {
colors = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
When enabled, commands <command>term-dark</command> and <command>term-light</command>
will toggle between your dark and a light colors.
There is also <command>term-background</command> which accepts one argument, the name
of the theme.
(Note that the Kitty setting <literal>allow_remote_control = true</literal> is set to
enable this functionality.)
'';
};
colors-path = lib.mkOption {
type = lib.types.path;
default = "${pkgs.terminal-themes}/kitty";
description = "Path from which to load kitty colors.";
};
color-pkg-path = lib.mkOption {
type = lib.types.optional lib.types.path;
default = null;
description = ''
Path to kitty colors within <literal>color-pkgs</literal>.
'';
};
light-name = lib.mkOption {
type = lib.types.str;
default = "light";
description = "The name to use for the light colorscheme.";
};
dark-name = lib.mkOption {
type = lib.types.str;
default = "dark";
description = "The name to use for the dark colorscheme.";
};
};
};
config = lib.mkIf (cfg.enable && cfg.colors.enable) {
home.packages = [
term-light
term-dark
term-background
];
programs.kitty.settings = {
allow_remote_control = "yes";
listen_on = "unix:/tmp/mykitty";
};
xdg.configFile."kitty/macos-launch-services-cmdline".text = lib.mkIf pkgs.stdenv.isDarwin "--listen-on unix:/tmp/mykitty";
};
}

View File

@ -0,0 +1,27 @@
{ config, lib, ... }:
let
cfg = config.programs.kitty;
in
{
options.programs.kitty = {
useSymbolsFromNerdFont = lib.mkOption {
type = lib.types.str;
default = "";
example = "JetBrainsMono Nerd Font";
description = ''
NerdFont patched fonts frequently suffer from rendering issues in terminals. To mitigate
this, we can use a non-NerdFont with Kitty and use the <literal>symbol_map</literal> setting
to tell Kitty to only use a NerdFont for NerdFont symbols.
Set this option the name of an installed NerdFont (the same name you'd use in the
<literal>font_family</literal> setting), to enable this feature.
'';
};
};
config = lib.mkIf (cfg.enable && cfg.useSymbolsFromNerdFont != "") {
programs.kitty.settings = {
# https://github.com/ryanoasis/nerd-fonts/wiki/Glyph-Sets-and-Code-Points
symbol_map = "U+E5FA-U+E62B,U+E700-U+E7C5,U+F000-U+F2E0,U+E200-U+E2A9,U+F500-U+FD46,U+E300-U+E3EB,U+F400-U+F4A8,U+2665,U+26a1,U+F27C,U+E0A3,U+E0B4-U+E0C8,U+E0CA,U+E0CC-U+E0D2,U+E0D4,U+23FB-U+23FE,U+2B58,U+F300-U+F313,U+E000-U+E00D ${cfg.useSymbolsFromNerdFont}";
};
};
}

View File

@ -1,22 +1,16 @@
{ pkgs, ... }:
{ pkgs, lib, ... }:
let
nixConfigDirectory = "~/dotfiles.nix";
in
{
imports = [ ./extras/fish/auto-theme.nix ];
programs.fish = {
enable = true;
autoTheme = {
enable = true;
light = "rose-pine-dawn";
dark = "rose-pine";
};
# see flake.nix and pkgs/default.nix
plugins = pkgs.fishPlugins.flakePlugins;
functions = {
functions =
{
# user functions
mkdcd = {
argumentNames = [ "target" ];
@ -65,9 +59,69 @@ in
# multi-cd.body = ''
# echo cd (string repeat -n (math (string length -- $argv[1]) - 1) ../)
# '';
}
// lib.optionalAttrs pkgs.stdenv.isDarwin {
# light/dark mode helpers
# determine if dark mode is active
is-dark-mode.body = ''
defaults read -g AppleInterfaceStyle &>/dev/null
'';
# toggles `$term_background` between "light" and "dark". other Fish functions trigger when this
# variable changes. we use a universal variable so that all instances of Fish have the same
# value for the variable.
toggle-background.body = ''
if test "$term_background" = light
set -U term_background dark
else
set -U term_background light
end
'';
# set `$term_background` based on whether macOS is light or dark mode
set-background-to-macOS.body = ''
if is-dark-mode
set -U term_background dark
else
set -U term_background light
end
'';
# set `$term_background` based on an env var
set-background-to-env = {
argumentNames = [ "env_var" ];
body = ''
switch $$env_var
case 1
echo "Setting dark mode"
set -U term_background dark
case 0
echo "Setting light mode"
set -U term_background light
end
'';
};
shellAbbrs = {
# sets shell utilities to light or dark colorscheme based on `$term_background`.
set-shell-colors = {
body = ''
# Use correct theme for `btm` and `bat`
if test "$term_background" = light
alias btm "btm --color nord-light"
set -xg BAT_THEME OneHalfLight
else
alias btm "btm --color nord"
set -xg BAT_THEME OneHalfDark
end
# Set LS_COLORS
set -xg LS_COLORS (${pkgs.vivid}/bin/vivid generate one-$term_background)
'';
onVariable = "term_background";
};
};
shellAbbrs =
{
".." = "cd ..";
# darwin-rebuild build
@ -102,6 +156,10 @@ in
commit = "git commit";
push = "git push";
pull = "git pull";
}
// lib.optionalAttrs pkgs.stdenv.isDarwin {
tb = "toggle-background";
sb = "set-background-to-macOS";
};
shellAliases = {
@ -122,11 +180,13 @@ in
# configuration that should be above `loginShellInit` and `interactiveShellInit`.
shellInit = ''
set -U fish_term24bit 1
${lib.optionalString pkgs.stdenv.isDarwin "set-background-to-macOS"}
'';
interactiveShellInit = ''
set -g fish_greeting (set_color red)"( ³)"(set_color yellow)" hello "(set_color blue)"( ³)"(set_color normal)
fish_vi_key_bindings
${lib.optionalString pkgs.stdenv.isDarwin "set-shell-colors"}
'';
};
home.sessionVariables.VIRTUAL_ENV_DISABLE_PROMPT = "true";

View File

@ -16,8 +16,9 @@
font = "RecMonoDuotone Nerd Font";
in
{
# TODO: auto-theme
config-file = [ "${pkgs.terminal-themes}/ghostty/rose-pine" ];
font-family = font;
theme = "rose-pine";
# font-family-bold = "${font} Bold";
# font-family-italic = "${font} Italic";
# font-family-bold-italic = "${font} Bold Italic";
@ -34,8 +35,8 @@
}
// lib.optionalAttrs pkgs.stdenv.isDarwin {
copy-on-select = "clipboard";
background-blur-radius = 80;
macos-non-native-fullscreen = false;
background-blur-radius = 20;
macos-non-native-fullscreen = "visible-menu";
macos-option-as-alt = true;
};
};

View File

@ -1,3 +1,4 @@
{ pkgs, lib, ... }:
{
imports = [ ./extras/helix/auto-theme.nix ];
programs.helix = {
@ -30,7 +31,7 @@
# };
# }];
autoTheme = {
autoTheme = lib.mkIf pkgs.stdenv.isDarwin {
enable = true;
light = "rose_pine_dawn";
dark = "rose_pine";

73
home/kitty.nix Normal file
View File

@ -0,0 +1,73 @@
{ pkgs, lib, ... }:
let
font = "Rec Mono Duotone";
in
{
imports = [
./extras/kitty/auto-theme.nix
./extras/kitty/nerd-font.nix
];
programs.kitty = {
enable = true;
# using kitty from homebrew
package = pkgs.emptyDirectory;
settings = {
font_family = font;
bold_font = "${font} Bold";
italic_font = "${font} Italic";
bold_italic_font = "${font} Bold Italic";
font_size = "15.0";
adjust_line_height = "120%";
disable_ligatures = "cursor"; # disable ligatures when cursor is on them
hide_window_decorations = "titlebar-only";
window_padding_width = "10";
tab_bar_edge = "top";
tab_bar_style = "powerline";
tab_powerline_style = "angled";
tab_title_template = "{index}: {title}";
active_tab_font_style = "bold";
inactive_tab_font_style = "normal";
tab_activity_symbol = "💬";
# shell integration is manually enabled for fish
shell_integration = "disabled";
} // lib.optionalAttrs pkgs.stdenv.isDarwin { macos_option_as_alt = "both"; };
useSymbolsFromNerdFont = "CaskaydiaCove Nerd Font";
colors = {
enable = true;
dark-name = "rose-pine";
light-name = "rose-pine-dawn";
};
};
programs.fish = {
interactiveShellInit = ''
# Manually enable shell integration
if set -q KITTY_INSTALLATION_DIR
set --global KITTY_SHELL_INTEGRATION enabled
source "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish"
set --prepend fish_complete_path "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_completions.d"
end
set-term-colors
'';
shellAliases = {
s = "kitty +kitten ssh";
e = "edit-in-kitty";
};
functions.set-term-colors = {
body = ''
if test "$term_background" = light
term-light
else
term-dark
end
'';
onVariable = "term_background";
};
};
}

View File

@ -37,8 +37,6 @@
tarsnap
# terminal color support testing
terminal-colors
# terminal color editing utility
theme-sh
# (La)TeX alternative
typst
# extract RAR archives

View File

@ -1,9 +1,10 @@
{
name = "sloane ess";
name = "Sloane Ess";
username = "sloane";
email = "sloane@sloane.lol";
email = "sloane@yelp.com";
sshKeys = [
# secretive
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBKTVoMVtHSvosU9SCam4S5RTP0R2V09vqw5Xiuff+x4J7NtUxsBhqIrkPSfJHSbYlBKITX5RFyFBo5mtsTa95v0= sloane"
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLWD/lvxFOdmE48MUKdigYZOAc3bSIyPxW4M7frWe8Nks9cr58Z/1btvUUmAK+u+J6gw5g+Mt9X0uwR7KPQlavg= sloane"
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOkqyHm9fBDXChdmNgbhxd2U1IpkiD4xjC8AVOvil+uEeKYqDi5mF3oeAGYJrV6BRc7hEO+DQP60pN0wI5tMoYE= yelp"
];
}

View File

@ -14,5 +14,12 @@ inputs: self: super: {
ia-writer-family = self.callPackage ./ia-writer-family.nix {
inherit (inputs) ia-writer-family-src;
};
mac-app-util = inputs.mac-app-util.packages.${super.stdenv.system}.default.overrideAttrs (old: {
postInstall =
old.postInstall
+ ''
wrapProgram "$out/bin/mac-app-util" --suffix PATH : "${super.jq}/bin"
'';
});
recursive-patched = self.callPackage ./recursive-patched.nix { };
}