wry, many thing
This commit is contained in:
parent
6e62eccfba
commit
848ed62c5d
47 changed files with 1598 additions and 1201 deletions
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue