idiosyn/home/config/nil/home.nix

402 lines
7.9 KiB
Nix
Raw Normal View History

2024-09-17 16:31:19 +02:00
{ self, nur, stylix, nix-index-database, niri, ripgrep-all, ... }: { config, lib, pkgs, ... }@args:
2024-08-18 13:47:18 +02:00
let
osConfig = args.osConfig or { };
in {
imports = [
nur.hmModules.nur
2024-08-25 19:10:52 +02:00
self.homeModules.greedy
2024-08-18 13:47:18 +02:00
self.homeModules.locale-en_EU
nix-index-database.hmModules.nix-index
stylix.homeManagerModules.stylix
2024-08-25 11:11:12 +02:00
niri.homeModules.config
niri.homeModules.stylix
2024-08-18 13:47:18 +02:00
] ++ self.lib.mods [
2024-08-25 19:10:52 +02:00
./gammarelay.nix
./founts.nix
./stylix.nix
./editor.nix
2024-08-25 19:10:52 +02:00
./desktop.nix
./bar.nix
./terminal.nix
2024-08-18 13:47:18 +02:00
./firefox.nix
2024-08-25 19:10:52 +02:00
./thunderbird.nix
./sioyek.nix
./texlive.nix
2024-08-25 21:57:42 +02:00
./mpv.nix
2024-08-26 13:05:56 +02:00
./music.nix
2024-08-18 13:47:18 +02:00
];
home.stateVersion = "24.11";
home.enableNixpkgsReleaseCheck = false;
home.packages = with pkgs; [
# Terminfo
kitty.terminfo
# Core utilities
(lib.meta.setPrio 0 uutils-coreutils-noprefix)
# Text manipulation
2024-08-28 11:53:20 +02:00
delta
2024-08-18 13:47:18 +02:00
sd
skim
# Networking
dogdns
whois
xh
# Filesystem
file
#xcp
# Development
pijul
# Calculator
fend
2024-09-16 20:20:06 +02:00
jaq
2024-09-17 16:31:19 +02:00
ripgrep-all.packages.${system}.default
2024-08-18 13:47:18 +02:00
];
home.sessionVariables = {
TMPDIR = "$XDG_RUNTIME_DIR/tmp";
};
editorconfig = {
enable = true;
settings = {
"*" = {
indent_style = "tab";
tab_width = 4;
end_of_line = "lf";
charset = "utf-8";
trim_trailing_whitespace = true;
insert_final_newline = true;
};
"*.nix" = {
indent_style = "space";
indent_size = 2;
};
};
};
home.shellAliases = {
icat = "kitten icat";
2024-09-16 20:20:06 +02:00
jq = "jaq";
2024-08-18 13:47:18 +02:00
};
home.preferXdgDirectories = true;
programs.aria2 = {
enable = true;
settings = {
max-concurrent-downloads = 4;
max-connection-per-server = 2;
min-split-size = "16M";
remote-time = true;
split = 4;
http-accept-gzip = true;
max-overall-upload-limit = "256K";
dscp = 8;
enable-mmap = true;
file-allocation = "falloc";
};
};
programs.bat.enable = true;
programs.bottom = {
enable = true;
settings.flags = {
group = true;
battery = true;
color = "gruvbox";
mem_as_value = true;
network_use_binary_prefix = true;
network_use_bytes = true;
};
};
programs.eza = {
enable = true;
icons = true;
git = true;
extraOptions = [
"--binary"
"--colour=automatic"
"--colour-scale=all"
"--colour-scale-mode=gradient"
"--group-directories-first"
];
};
programs.fd.enable = true;
programs.fish = {
enable = true;
functions = {
fish_prompt = ''
set -l user_colour 'green'
if fish_is_root_user
set user_colour 'red'
end
echo -n -s (set_color $user_colour --bold) $USER@ (prompt_hostname) \
2024-09-20 20:44:50 +02:00
(set_color blue --bold) ' ' (prompt_pwd) ' ' (set_color normal)
2024-08-18 13:47:18 +02:00
'';
fish_right_prompt = ''
set -l st $status
if test $st -ne 0
set_color red --bold
printf "%s " (sysexit $st)
set_color normal
end
'';
fish_title = "prompt_pwd";
sysexit = builtins.readFile ./sysexit.fish;
};
interactiveShellInit = ''
if type -q tabs
tabs -4
end
'';
};
2024-08-24 18:15:18 +02:00
programs.git = let
key = "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAICczPHRwY9MAwDGlcB0QgMOJjcpLJhVU3covrW9RBS62AAAABHNzaDo=";
in {
2024-08-18 13:47:18 +02:00
enable = true;
2024-08-28 11:53:20 +02:00
delta.enable = true;
2024-08-18 13:47:18 +02:00
userName = "Mikael Voss";
userEmail = "mvs@nyantec.com";
extraConfig = {
core = {
eol = "lf";
fsync = "committed";
};
2024-08-24 18:15:18 +02:00
user.signingKey = "key::${key}";
2024-08-18 13:47:18 +02:00
init.defaultBranch = "main";
pull.rebase = true;
push.autoSetupRemote = true;
rebase.autoStash = true;
gpg.format = "ssh";
gpg.ssh.allowedSignersFile = toString (pkgs.writeText "allowed-signers" ''
2024-08-24 18:15:18 +02:00
${config.programs.git.userEmail} ${key}
2024-08-18 13:47:18 +02:00
'');
commit.gpgSign = true;
tag.gpgSign = true;
};
};
programs.man.generateCaches =
osConfig.documentation.man.generateCaches or false;
programs.ripgrep.enable = true;
programs.ssh = {
enable = true;
compression = true;
controlMaster = "auto";
controlPath = "\${XDG_RUNTIME_DIR}/ssh/%r@%n:%p";
controlPersist = "1m";
matchBlocks = {
"*.nyantec.com".user = "mvs";
"solitary.social" = {
user = "nil";
forwardAgent = true;
};
};
serverAliveInterval = 10;
serverAliveCountMax = 60;
};
programs.vim = {
enable = true;
settings = {
background = "dark";
expandtab = false;
number = true;
shiftwidth = 4;
tabstop = 4;
};
extraConfig = ''
" no Vi compatibility
set nocompatible
" Unicode support
set encoding=utf-8
" special characters
set list
set listchars=tab:»·,trail:·,extends:
set ruler
" movement
noremap r h
noremap R H
noremap n j
noremap t k
noremap h l
noremap H L
" beginning of previous word
noremap p b
" end of word
noremap l e
noremap L E
" change one char
noremap X s
" repeat search
noremap ; n
noremap : N
" paste
noremap s p
noremap S P
" join lines
noremap N J
" change
noremap e c
noremap E C
" replace
noremap z r
noremap Z R
" inclusive jump
noremap m f
noremap M F
" exlusive jump
noremap f t
noremap F T
" command mode
noremap - :
'';
};
2024-09-27 18:31:12 +02:00
programs.nushell = {
enable = true;
envFile.text = let
ls-colours = pkgs.runCommand "ls-colours" { } ''
${lib.getExe pkgs.vivid} generate catppuccin-mocha >$out
'' |> builtins.readFile;
in ''
2024-09-27 18:31:12 +02:00
load-env {
2024-09-27 22:17:35 +02:00
EDITOR: r#'${lib.getExe config.programs.helix.package}'#
LS_COLORS: r#'${ls-colours}'#
2024-09-27 18:31:12 +02:00
PROMPT_COMMAND: {
let dir = match (do --ignore-shell-errors { $env.PWD | path relative-to $nu.home-path }) {
null => $env.PWD
"" => '~'
$relative_pwd => ([~ $relative_pwd] | path join)
}
[
(if (is-admin) { ansi red_bold } else { ansi green_bold })
(sys host | get hostname)
(char space)
(ansi blue_bold)
($dir | path split | last)
(ansi reset)
(char space)
] | str join
}
PROMPT_COMMAND_RIGHT: {
let duration = $env.CMD_DURATION_MS | into int
if $duration >= 2000 {
[ (ansi light_red) ($duration | into duration --unit ms) ] | str join
}
}
PROMPT_INDICATOR: { " " }
SSH_AUTH_SOCK: $"($env.XDG_RUNTIME_DIR)/ssh-agent"
TMPDIR: $"($env.XDG_RUNTIME_DIR)/tmp"
}
'';
configFile.text = ''
$env.config = {
show_banner: false
history: {
max_size: 131072
sync_on_enter: true
file_format: "sqlite"
isolation: true
}
2024-09-27 18:31:12 +02:00
use_kitty_protocol: true
keybindings: [
{
name: completion_menu
modifier: control
keycode: char_i
mode: [ emacs vi_normal vi_insert ]
event: {
until: [
{ send: menu name: completion_menu }
{ send: menunext }
{ edit: complete }
]
}
}
]
2024-09-27 18:31:12 +02:00
};
'';
};
2024-08-18 13:47:18 +02:00
services.ssh-agent.enable = true;
systemd.user.tmpfiles.rules = [
2024-09-17 16:36:37 +02:00
"d %C 700 - - 90d"
2024-08-18 13:47:18 +02:00
"d %t/ssh 700"
"d %T 700 - - 24h"
2024-08-18 13:47:18 +02:00
];
xdg.userDirs =
let
home = config.home.homeDirectory;
in {
enable = true;
desktop = "${home}/tmp";
documents = "${home}/var";
download = "${home}/tmp";
pictures = "${home}/img";
music = "${home}/msc";
publicShare = null;
templates = null;
videos = null;
};
}