This commit is contained in:
elwrcl committed 2026-08-02 04:07:25 +03:00
1 parent 6960ec0663
commit 20ecde0e15
17 files changed
+556 -1

No files matched your search

+18
View File
@@ -31,6 +31,18 @@ in
config.flake.homeModules.home-base
config.flake.homeModules.home-ghostty
config.flake.homeModules.home-nushell
config.flake.homeModules.home-nushell-colors
config.flake.homeModules.home-nushell-completions
config.flake.homeModules.home-nushell-prompt
config.flake.homeModules.home-nushell-commandline-copy
config.flake.homeModules.home-nushell-last
config.flake.homeModules.home-direnv
config.flake.homeModules.home-jujutsu
config.flake.homeModules.home-jujutsu-difftastic
config.flake.homeModules.home-jujutsu-mergiraf
config.flake.homeModules.home-jujutsu-watchman
config.flake.homeModules.home-gh
config.flake.homeModules.home-radicle
config.flake.homeModules.home-zsh
config.flake.homeModules.home-shell-tools
config.flake.homeModules.home-session-vars
@@ -86,6 +98,7 @@ in
config.flake.nixosModules.service-docker
config.flake.nixosModules.service-virt-manager
config.flake.nixosModules.common-git
config.flake.nixosModules.common-agenix
config.flake.nixosModules.common-packages
# import
./copland-hardware.nix
@@ -105,6 +118,11 @@ in
"/share/mime"
"/share/X11"
];
age.secrets.radicle-key = {
file = ../modules/nixos/common/secrets/radicle.age;
owner = "elars";
};
}
];
};
+12
View File
@@ -29,6 +29,18 @@ in
config.flake.homeModules.home-base
config.flake.homeModules.home-ghostty
config.flake.homeModules.home-nushell
config.flake.homeModules.home-nushell-colors
config.flake.homeModules.home-nushell-completions
config.flake.homeModules.home-nushell-prompt
config.flake.homeModules.home-nushell-commandline-copy
config.flake.homeModules.home-nushell-last
config.flake.homeModules.home-direnv
config.flake.homeModules.home-jujutsu
config.flake.homeModules.home-jujutsu-difftastic
config.flake.homeModules.home-jujutsu-mergiraf
config.flake.homeModules.home-jujutsu-watchman
config.flake.homeModules.home-gh
config.flake.homeModules.home-radicle
];
home.username = "sohryu";
home.homeDirectory = "/Users/sohryu";
+12
View File
@@ -0,0 +1,12 @@
{ ... }:
{
flake.homeModules.home-direnv =
{ ... }:
{
programs.direnv = {
enable = true;
nix-direnv.enable = true;
enableNushellIntegration = true;
};
};
}
+11
View File
@@ -0,0 +1,11 @@
{ ... }:
{
flake.homeModules.home-gh =
{ ... }:
{
programs.gh = {
enable = true;
settings.version = 1;
};
};
}
@@ -0,0 +1,19 @@
{ ... }:
{
flake.homeModules.home-jujutsu-difftastic =
{ pkgs, lib, ... }:
let
inherit (lib.meta) getExe;
in
{
home.packages = [ pkgs.difftastic ];
programs.jujutsu.settings.ui.diff-formatter = [
(getExe pkgs.difftastic)
"--color"
"always"
"$left"
"$right"
];
};
}
@@ -0,0 +1,21 @@
{ ... }:
{
flake.homeModules.home-jujutsu-mergiraf =
{ pkgs, lib, ... }:
let
inherit (lib.meta) getExe;
in
{
home.packages = [ pkgs.mergiraf ];
programs.jujutsu.settings = {
aliases.resolve-ast = [
"resolve"
"--tool"
"mergiraf"
];
merge-tools.mergiraf.program = getExe pkgs.mergiraf;
};
};
}
@@ -0,0 +1,21 @@
{ ... }:
{
flake.homeModules.home-jujutsu-watchman =
{ pkgs, lib, ... }:
{
home.packages = [ pkgs.watchman ];
xdg.configFile."watchman/watchman.json".text = builtins.toJSON {
ignore_dirs = [
".direnv"
"node_modules"
"target"
];
};
programs.jujutsu.settings = {
fsmonitor.backend = "watchman";
fsmonitor.watchman.register-snapshot-trigger = true;
};
};
}
+122
View File
@@ -0,0 +1,122 @@
{ ... }:
{
flake.homeModules.home-jujutsu =
{ pkgs, lib, ... }:
let
inherit (lib.meta) getExe;
in
{
programs.jujutsu = {
enable = true;
settings = {
user = {
name = "elwrcl";
email = "elwerici@proton.me";
};
aliases.".." = [
"edit"
"@-"
];
aliases.",," = [
"edit"
"@+"
];
aliases.f = [
"git"
"fetch"
];
aliases.p = [
"git"
"push"
];
aliases.a = [ "abandon" ];
aliases.c = [ "commit" ];
aliases.ci = [
"commit"
"--interactive"
];
aliases.d = [ "diff" ];
aliases.e = [ "edit" ];
aliases.l = [ "log" ];
aliases.la = [
"log"
"--revisions"
"::"
];
aliases.s = [ "squash" ];
aliases.si = [
"squash"
"--interactive"
];
aliases.u = [ "undo" ];
# `jj fork` — renames the current `origin` remote to `upstream`, forks
# the repository on GitHub via `gh`, and tracks the trunk bookmark.
aliases.fork = [
"util"
"exec"
"--"
(getExe (
pkgs.writeShellScriptBin "jj-fork" ''
remote_names() {
jj git remote list | cut -d' ' -f1
}
if ! remote_names | grep -qx upstream; then
jj git remote rename origin upstream
fi
if ! remote_names | grep -qx origin; then
${getExe pkgs.gh} repo fork --remote --remote-name origin
fi
jj git fetch
trunk_remote=$(jj config get 'revset-aliases."trunk()"' | cut -d'@' -f1)
jj bookmark track "$trunk_remote"
''
))
];
revsets.log = # python
''
present(@) | present(trunk()) | ancestors(remote_bookmarks().. | @.., 8)
'';
ui.default-command = "log";
ui.diff-editor = ":builtin";
ui.conflict-marker-style = "snapshot";
templates.draft_commit_description = # python
''
concat(
coalesce(description, "\n"),
surround(
"\nJJ: This commit contains the following changes:\n", "",
indent("JJ: ", diff.stat(72)),
),
"\nJJ: ignore-rest\n",
diff.git(),
)
'';
remotes."*" = {
auto-track-bookmarks = "elwrcl/*";
push-new-bookmarks = true;
};
templates.git_push_bookmark = ''"elwrcl/change-" ++ change_id.short()'';
git.fetch = [
"origin"
"upstream"
];
git.push = "origin";
};
};
};
}
+38
View File
@@ -0,0 +1,38 @@
{ ... }:
{
flake.homeModules.home-nushell-colors =
{ pkgs, lib, ... }:
let
inherit (lib.meta) getExe;
lsColors = pkgs.runCommand "ls_colors.txt" { } ''
${getExe pkgs.vivid} generate gruvbox-dark-hard > $out
'';
in
{
home.packages = [ pkgs.vivid ];
programs.nushell.extraConfig = ''
$env.LS_COLORS = open --raw ${lsColors}
$env.config.color_config.row_index = "light_yellow_bold"
$env.config.color_config.header = "light_yellow_bold"
$env.config.color_config.bool = {||
if $in {
"light_green_bold"
} else {
"light_red_bold"
}
}
$env.config.color_config.string = {||
if $in =~ "^(#|0x)[a-fA-F0-9]+$" {
$in | str replace "0x" "#"
} else {
"white"
}
}
'';
};
}
@@ -0,0 +1,37 @@
{ ... }:
{
flake.homeModules.home-nushell-commandline-copy =
{ ... }:
{
programs.nushell.extraConfig = ''
use std/clip
def nu-highlight-default [] {
let input = $in
$env.config.color_config = {}
$input | nu-highlight
}
def "nu-keybind commandline-copy" []: nothing -> nothing {
commandline
| nu-highlight-default
| [ "```ansi" $in "```" ]
| str join (char nl)
| clip copy --ansi
}
$env.config.keybindings ++= [
{
name: copy_color_commandline
modifier: control_alt
keycode: char_c
mode: [ emacs vi_insert vi_normal ]
event: {
send: executehostcommand
cmd: 'nu-keybind commandline-copy'
}
}
]
'';
};
}
@@ -0,0 +1,68 @@
{ ... }:
{
flake.homeModules.home-nushell-completions =
{ pkgs, lib, ... }:
let
inherit (lib.meta) getExe;
carapaceNu = pkgs.runCommand "carapace.nu" { } ''
${getExe pkgs.carapace} _carapace nushell > $out
'';
in
{
home.packages = [ pkgs.carapace ];
programs.nushell.environmentVariables.CARAPACE_BRIDGES = "zsh,fish,bash";
programs.nushell.extraConfig = ''
let menus = [
{
name: completion_menu
only_buffer_difference: false
marker: ($env.PROMPT_INDICATOR? | default "> ")
type: {
layout: ide
min_completion_width: 0
max_completion_width: 150
max_completion_height: 25
padding: 0
border: false
cursor_offset: 0
description_mode: "prefer_right"
min_description_width: 0
max_description_width: 50
max_description_height: 10
description_offset: 1
correct_cursor_pos: true
}
style: {
text: white
selected_text: white_reverse
description_text: yellow
match_text: { attr: u }
selected_match_text: { attr: ur }
}
}
{
name: history_menu
only_buffer_difference: true
marker: ($env.PROMPT_INDICATOR? | default "> ")
type: {
layout: list
page_size: 10
}
style: {
text: white
selected_text: white_reverse
}
}
]
$env.config.menus = $env.config.menus
| where name not-in ($menus | get name)
| append $menus
source ${carapaceNu}
'';
};
}
+19
View File
@@ -0,0 +1,19 @@
{ ... }:
{
flake.homeModules.home-nushell-last =
{ ... }:
{
programs.nushell.extraConfig = ''
$env.config.hooks.display_output = {||
tee { table --expand | print }
# SQLiteDatabase doesn't support equality comparisons.
| try { if $in != null { $env.last = $in } }
}
# Retrieve the output of the last command.
def _ []: nothing -> any {
$env.last?
}
'';
};
}
+115
View File
@@ -0,0 +1,115 @@
{ ... }:
{
flake.homeModules.home-nushell-prompt =
{ ... }:
{
programs.nushell.extraConfig = ''
do --env {
use std null_device
def prompt-header [
--left-char: string
]: nothing -> string {
let code = $env.LAST_EXIT_CODE
let jj_workspace_root = try {
jj workspace root err> $null_device
} catch {
""
}
let hostname = if ($env.SSH_CONNECTION? | is-not-empty) {
$"(ansi light_green_bold)@(sys host | get hostname)(ansi reset) "
} else {
""
}
let body = if ($jj_workspace_root | is-not-empty) {
let subpath = pwd | path relative-to $jj_workspace_root
let subpath = if ($subpath | is-not-empty) {
$"(ansi magenta_bold) → (ansi reset)(ansi blue)($subpath)"
}
$"($hostname)(ansi light_yellow_bold)($jj_workspace_root | path basename)($subpath)(ansi reset)"
} else {
$"($hostname)(ansi cyan)(
if (pwd | str starts-with $env.HOME) {
"~" | path join (pwd | path relative-to $env.HOME)
} else {
pwd
}
)(ansi reset)"
}
let command_duration = ($env.CMD_DURATION_MS | into int) * 1ms
let command_duration = if $command_duration <= 2sec {
""
} else {
$"┫(ansi light_magenta_bold)($command_duration)(ansi light_yellow_bold)┣━"
}
let exit_code = if $code == 0 {
""
} else {
$"┫(ansi light_red_bold)($code)(ansi light_yellow_bold)┣━"
}
let middle = if $command_duration == "" and $exit_code == "" {
"━"
} else {
""
}
$"(ansi light_yellow_bold)($left_char)($exit_code)($middle)($command_duration)(ansi reset) ($body)(char newline)"
}
$env.PROMPT_INDICATOR = $"(ansi light_yellow_bold)┃(ansi reset) "
$env.PROMPT_INDICATOR_VI_NORMAL = $env.PROMPT_INDICATOR
$env.PROMPT_INDICATOR_VI_INSERT = $env.PROMPT_INDICATOR
$env.PROMPT_MULTILINE_INDICATOR = $env.PROMPT_INDICATOR
$env.PROMPT_COMMAND = {||
prompt-header --left-char "┏"
}
$env.PROMPT_COMMAND_RIGHT = {||
try {
jj --quiet --color always --ignore-working-copy log --no-graph --revisions @ --template '
separate(
" ",
if(empty, label("empty", "(empty)")),
coalesce(
surround(
"\"",
"\"",
if(
description.first_line().substr(0, 24).starts_with(description.first_line()),
description.first_line().substr(0, 24),
description.first_line().substr(0, 23) ++ "…"
)
),
label(if(empty, "empty"), description_placeholder)
),
bookmarks.join(", "),
change_id.shortest(),
commit_id.shortest(),
if(conflict, label("conflict", "(conflict)")),
if(divergent, label("divergent prefix", "(divergent)")),
if(hidden, label("hidden prefix", "(hidden)")),
)
' err> $null_device
} catch {
""
}
}
$env.TRANSIENT_PROMPT_INDICATOR = " "
$env.TRANSIENT_PROMPT_INDICATOR_VI_INSERT = $env.TRANSIENT_PROMPT_INDICATOR
$env.TRANSIENT_PROMPT_INDICATOR_VI_NORMAL = $env.TRANSIENT_PROMPT_INDICATOR
$env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = $env.TRANSIENT_PROMPT_INDICATOR
$env.TRANSIENT_PROMPT_COMMAND = {||
prompt-header --left-char "━"
}
$env.TRANSIENT_PROMPT_COMMAND_RIGHT = $env.PROMPT_COMMAND_RIGHT
}
'';
};
}
+29
View File
@@ -0,0 +1,29 @@
{ ... }:
{
flake.homeModules.home-radicle =
{
osConfig,
pkgs,
lib,
...
}:
let
inherit (lib.attrsets) optionalAttrs;
hasSecret = (osConfig.age.secrets or { }) ? radicle-key;
in
{
home.packages = [ pkgs.radicle-node ];
home.file = {
".radicle/config.json".text = builtins.toJSON {
publicExplorer = "https://radicle.network/nodes/$host/$rid$path";
preferredSeeds = [
"z6MkrLMMsiPWUcNPHcRajuMi9mDfYckSoJyPwwnknocNYPm7@iris.radicle.network:8776"
"z6Mkmqogy2qEM2ummccUthFEaaHvyYmYBYh3dbe9W4ebScxo@rosa.radicle.network:8776"
];
};
}
// optionalAttrs hasSecret {
".radicle/keys/radicle".source = osConfig.age.secrets.radicle-key.path;
};
};
}
+4 -1
View File
@@ -5,6 +5,9 @@
{
programs.starship.enable = true;
programs.fzf.enable = true;
programs.zoxide.enable = true;
programs.zoxide = {
enable = true;
enableNushellIntegration = true;
};
};
}
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
let
admin = "age15akskah37k32fqnktxhh58y9kdhmu3ce4gtw07j49qtfhtjjsvtq8z78hq";
copland = "age1egtkxm54e8gwsvn42sz37cv5x5yj2pkp3x5fwwv2s3ux0cupscmqya3mye";
in
{
"modules/nixos/common/secrets/radicle.age".publicKeys = [
admin
copland
];
}