initial commit

This commit is contained in:
2025-05-04 02:47:36 +02:00
commit d5e06f3f49
91 changed files with 9063 additions and 0 deletions

10
users/modules/basics.nix Normal file
View File

@@ -0,0 +1,10 @@
{
programs = {
fd.enable = true;
fzf.enable = true;
home-manager.enable = true;
htop.enable = true;
jq.enable = true;
ripgrep.enable = true;
};
}

25
users/modules/bat.nix Normal file
View File

@@ -0,0 +1,25 @@
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.modules.bat;
in {
options.modules.bat.extras = mkEnableOption "Enables extra packages for bat.";
config.programs.bat = {
enable = true;
config = {
theme = "Nord";
map-syntax = [
".spacemacs*:Lisp"
];
};
extraPackages = mkIf cfg.extras (with pkgs.bat-extras; [
batman
batpipe
batgrep
]);
};
}

24
users/modules/btop.nix Normal file
View File

@@ -0,0 +1,24 @@
{pkgs, ...}: {
programs.btop = {
enable = true;
package = pkgs.btop.override {
rocmSupport = true;
cudaSupport = true;
};
settings = {
color_theme = "${pkgs.btop}/share/btop/themes/nord.theme";
cpu_bottom = false;
cpu_sensor = "auto";
io_graph_combined = false;
io_mode = true;
only_physical = true;
proc_tree = true;
rounded_corners = true;
show_disks = true;
show_gpu_info = "on";
show_uptime = true;
theme_background = true;
vim_keys = false;
};
};
}

16
users/modules/default.nix Normal file
View File

@@ -0,0 +1,16 @@
{
imports = [
./basics.nix
./bat.nix
./btop.nix
./direnv.nix
./eza.nix
./mopidy.nix
./nh.nix
./shell
./ssh.nix
./tealdeer.nix
./tmux.nix
./vcs
];
}

7
users/modules/direnv.nix Normal file
View File

@@ -0,0 +1,7 @@
{
programs.direnv = {
enable = true;
config.global.load_dotenv = true;
nix-direnv.enable = true;
};
}

36
users/modules/emacs.nix Normal file
View File

@@ -0,0 +1,36 @@
{
pkgs,
config,
lib,
...
}: let
emacsDefaultPackage = with pkgs; ((emacsPackagesFor emacsNativeComp).emacsWithPackages (
epkgs: [
epkgs.vterm
epkgs.mu4e
epkgs.pdf-tools
]
));
cfg = config.modules.emacs;
in {
options.modules.emacs = {
enable = lib.mkEnableOption "enables Emacs";
package = lib.mkOption {
type = lib.types.package;
default = emacsDefaultPackage;
};
service = lib.mkEnableOption "enables Emacs service";
};
config = {
programs.emacs = lib.mkIf cfg.enable {
enable = true;
inherit (cfg) package;
};
services.emacs = lib.mkIf cfg.service {
enable = true;
inherit (cfg) package;
startWithUserSession = "graphical";
};
};
}

4739
users/modules/emoji.nix Normal file

File diff suppressed because it is too large Load Diff

8
users/modules/eza.nix Normal file
View File

@@ -0,0 +1,8 @@
{
programs.eza = {
enable = true;
colors = "auto";
icons = "auto";
git = true;
};
}

View File

@@ -0,0 +1,8 @@
{
imports = [../../programs/hyprland.nix];
modules.hyprland = {
enable = true;
config = builtins.readFile ./config/hypr/hyprland.conf;
waybar.style = ./config/waybar/style.css;
};
}

View File

@@ -0,0 +1,6 @@
{
services.kdeconnect = {
enable = true;
indicator = true;
};
}

89
users/modules/kitty.nix Normal file
View File

@@ -0,0 +1,89 @@
{
programs.kitty = {
enable = true;
settings = {
enable_audio_bell = true;
enabled_layouts = "fat,fat:mirrored=true,tall,tall:mirrored=true";
kitty_mod = "ctrl+shift";
};
keybindings = {
"alt+c" = "copy_to_clipboard";
"kitty_mod+c" = "copy_to_clipboard";
"alt+v" = "paste_from_clipboard";
"kitty_mod+v" = "paste_from_clipboard";
"kitty_mod+s>c" = "show_scrollback";
"kitty_mod+s>down" = "scroll_line_down";
"kitty_mod+s>t" = "scroll_line_down";
"kitty_mod+s>up" = "scroll_line_up";
"kitty_mod+s>s" = "scroll_line_up";
"kitty_mod+s>end" = "scroll_end";
"kitty_mod+s>home" = "scroll_home";
"kitty_mod+s>page_down" = "scroll_page_down";
"kitty_mod+s>page_up" = "scroll_page_up";
"kitty_mod+enter" = "new_window";
"kitty_mod+w>q" = "close_window";
"kitty_mod+w>p" = "next_window";
"kitty_mod+w>n" = "previous_window";
"kitty_mod+w>f" = "move_window_forward";
"kitty_mod+w>b" = "move_window_backward";
"kitty_mod+w>t" = "move_window_to_top";
"kitty_mod+w>r" = "start_resizing_window";
"kitty_mod+w>1" = "first_window";
"kitty_mod+w>2" = "second_window";
"kitty_mod+w>3" = "third_window";
"kitty_mod+w>4" = "fourth_window";
"kitty_mod+w>5" = "fifth_window";
"kitty_mod+w>6" = "sixth_window";
"kitty_mod+w>7" = "seventh_window";
"kitty_mod+w>8" = "eighth_window";
"kitty_mod+w>9" = "ninth_window";
"kitty_mod+w>0" = "tenth_window";
"kitty_mod+tab>n" = "next_tab";
"kitty_mod+tab>p" = "previous_tab";
"kitty_mod+tab>c" = "new_tab";
"kitty_mod+tab>q" = "close_tab";
"kitty_mod+tab>shift+n" = "move_tab_backward";
"kitty_mod+tab>shift+p" = "move_tab_forward";
"kitty_mod+tab>t" = "set_tab_title";
"kitty_mod+l" = "next_layout";
"kitty_mod+f>equal" = "change_font_size all 0";
"kitty_mod+f>kp_add" = "change_font_size all +2.0";
"kitty_mod+f>plus" = "change_font_size all +2.0";
"kitty_mod+f>kp_subtract" = "change_font_size all -2.0";
"kitty_mod+f>minus" = "change_font_size all -2.0";
"kitty_mod+shift+h" = "kitten hints";
"kitty_mod+h>p" = "kitten hints --type path --program -";
"kitty_mod+h>shift+p" = "kitten hints --type path";
"kitty_mod+h>l" = "kitten hints --type line --program -";
"kitty_mod+h>w" = "kitten hints --type word --program -";
"kitty_mod+h>h" = "kitten hints --type hash --program -";
"kitty_mod+h>n" = "kitten hints --type linenum";
"kitty_mod+h>y" = "kitten hints --type hyperlink";
"kitty_mod+f10" = "toggle_maximized";
"kitty_mod+f11" = "toggle_fullscreen";
"kitty_mod+a>equal" = "set_background_opacity 1";
"kitty_mod+a>d" = "set_background_opacity default";
"kitty_mod+a>plus" = "set_background_opacity +0.1";
"kitty_mod+a>up" = "set_background_opacity +0.1";
"kitty_mod+a>kp_add" = "set_background_opacity +0.1";
"kitty_mod+a>minus" = "set_background_opacity -0.1";
"kitty_mod+a>down" = "set_background_opacity -0.1";
"kitty_mod+a>kp_substract" = "set_background_opacity -0.1";
"kitty_mod+delete" = "clear_terminal reset active";
"kitty_mod+escape" = "kitty_shell window";
"kitty_mod+f2" = "edit_config_file";
"kitty_mod+n" = "new_os_window";
"kitty_mod+o" = "pass_selection_to_program";
"kitty_mod+u" = "kitten unicode_input";
};
};
}

60
users/modules/mbsync.nix Normal file
View File

@@ -0,0 +1,60 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.modules.mbsync;
in {
options.modules.mbsync = {
enable = mkEnableOption "Enables mbsync";
passwordFile = mkOption {
type = types.str;
example = "/var/email/password";
};
service.enable = mkOption {
type = types.bool;
default = true;
};
host = mkOption {
type = types.str;
default = "mail.phundrak.com";
};
user = mkOption {
type = types.str;
default = "lucien@phundrak.com";
};
};
config = mkIf cfg.enable {
systemd.user.services.mbsync.unitConfig.After = ["sops-nix.service"];
services.mbsync.enable = cfg.service.enable;
programs.mbsync = {
enable = true;
extraConfig = ''
IMAPAccount Main
Host ${cfg.host}
User ${cfg.user}
PassCmd "cat ${cfg.passwordFile}"
SSLType IMAPS
SSLVersion TLSv1.2
CertificateFile /etc/ssl/certs/ca-certificates.crt
IMAPStore main-remote
Account Main
MaildirStore main-local
Subfolders Verbatim
Path ~/Mail/
Inbox ~/Mail/Inbox
Channel main
Far :main-remote:
Near :main-local:
Create Both
SyncState *
Patterns *
'';
};
};
}

46
users/modules/mopidy.nix Normal file
View File

@@ -0,0 +1,46 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.modules.mopidy;
in {
options.modules.mopidy = {
enable = mkEnableOption "Enables Mopidy.";
};
config.services.mopidy = mkIf cfg.enable {
inherit (cfg) enable;
extensionPackages = with pkgs; [
mopidy-bandcamp
mopidy-mpd
mopidy-mpris
mopidy-muse
mopidy-notify
mopidy-spotify
];
extraConfigFiles = [
config.sops.secrets."mopidy/bandcamp".path
config.sops.secrets."mopidy/spotify".path
];
settings = {
mpd = {
enabled = true;
hostname = "::";
port = 6600;
};
mpris.enabled = true;
muse = {
enabled = true;
mopidy_host = "localhost";
mopidy_port = 6690;
mopidy_ssl = false;
snapcast_host = "localhost";
snapcast_port = 1780;
snapcast_ssl = false;
};
};
};
}

21
users/modules/mpd.nix Normal file
View File

@@ -0,0 +1,21 @@
{
services.mpd = {
enable = true;
musicDirectory = "/home/phundrak/Music";
playlistDirectory = "/home/phundrak/Music/playlists";
extraConfig = ''
follow_outside_symlinks "yes"
follow_inside_symlinks "yes"
bind_to_address "localhost"
auto_update "yes"
audio_output {
type "fifo"
name "my_fifo"
path "/tmp/mpd.fifo"
format "44100:16:2"
}
'';
};
}

60
users/modules/mpv.nix Normal file
View File

@@ -0,0 +1,60 @@
{pkgs, ...}: {
programs.mpv = {
enable = true;
config = {
force-window = "immediate";
ytdl-format = "bestvideo[height<=1080]+bestaudio";
force-seekable = true; # force streams to be seekable
cache-default = 4000000;
slang = "jpn,jp,eng,en,fra,fr";
alang = "eng,en,fra,fr";
gpu-api = "vulkan";
osc = true;
profile = "gpu-hq";
geometry = "50%x50%";
autofit-larger = "90%x90%";
# Screenshots
screenshot-format = "png";
screenshot-high-bit-depth = true;
screenshot-png-compression = 6;
screenshot-directory = "~/Pictures/Screenshots/mpv";
deband = true;
deband-iterations = 2;
deband-threshold = 35;
deband-range = 20;
deband-grand = 5;
dither-depth = "auto";
sub-auto = "fuzzy";
scale = "ewa_lanczossharp";
dscale = "mitchel";
cscale = "ewa_lanczossharp";
};
scripts = with pkgs.mpvScripts; [
crop
encode
inhibit-gnome
mpris
mpv-cheatsheet
quality-menu
sponsorblock
thumbfast
# twitch-chat
youtube-chat
youtube-upnext
];
bindings = {
Q = "quit-watch-later";
P = "show-progress";
"/" = "add volume -2";
"*" = "add volume 2";
m = "cycle mute";
M = "vf toggle hflip";
"Ctrl+r" = "cycle_values video-rotate \"90\" \"180\" \"270\" \"0\"";
};
};
}

20
users/modules/nh.nix Normal file
View File

@@ -0,0 +1,20 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.modules.nh;
in {
options.modules.nh.flake = mkOption {
type = types.path;
default = "/home/phundrak/.dotfiles";
example = "/etc/nixos";
};
config.programs.nh = {
enable = true;
clean.enable = true;
clean.extraArgs = "--keep-since 15d --keep 5";
inherit (cfg) flake;
};
}

3
users/modules/qt.nix Normal file
View File

@@ -0,0 +1,3 @@
{
qt.enable = true;
}

View File

@@ -0,0 +1,43 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.modules.bash;
in {
options.modules.bash = {
enable = lib.mkEnableOption "enables bash";
aliases = lib.mkOption {
type = types.attrsOf types.str;
default = {};
example = {
cp = "cp -i";
lns = "ln -si";
};
};
bashrcExtra = lib.mkOption {
type = types.lines;
default = "";
};
};
config = lib.mkIf cfg.enable {
programs.bash = {
enable = true;
shellAliases = cfg.aliases;
shellOptions = [
"histappend"
"cmdhist"
"lithist"
"checkwinsize"
"extglob"
"globstar"
"checkjobs"
"autocd"
"cdspell"
"dirspell"
];
};
};
}

View File

@@ -0,0 +1,124 @@
{
config,
lib,
...
}:
with lib; let
aliases = {
df = "df -H";
diskspace = "sudo df -h | grep -E \"sd|lv|Size\"";
du = "du -ch";
meminfo = "free -m -l -t";
gpumeminfo = "grep -i --color memory /var/log/Xorg.0.log";
cpuinfo = "lscpu";
pscpu = "ps auxf | sort -nr -k 3";
pscpu10 = "ps auxf | sort -nr -k 3 | head -10";
psmem = "ps auxf | sort -nr -k 4";
psmem10 = "ps auxf | sort -nr -k 4 | head -10";
s = "systemctl";
dc = "docker compose";
dcd = "docker compose down";
dcl = "docker compose logs";
dclf = "docker compose logs -f";
dcp = "docker compose pull";
dcu = "docker compose up";
dcud = "docker compose up -d";
dcudp = "docker compose up -d --pull=always";
dcr = "docker compose restart";
enw = "emacsclient -nw";
e = "emacsclient -n -c";
cp = "cp -i";
rsync = "rsync -Pa --progress";
ln = "ln -i";
lns = "ln -si";
mv = "mv -i";
rm = "rm -Iv";
rmd = "rm --preserve-root -Irv";
rmdf = "rm --preserve-root -Irfv";
rmf = "rm --preserve-root -Ifv";
chgrp = "chgrp --preserve-root -v";
chmod = "chmod --preserve-root -v";
chown = "chown --preserve-root -v";
lsl = "eza -halg@ --group-directories-first --git";
flac = "yt-dlp -x --audio-format flac --audio-quality 0 o \"~/Music/%(uploader)s/%(title)s.%(ext)s\"";
please = "sudo -A";
wget = "wget --hsts-file=\"$XDG_DATA_HOME/wget-hsts\" -c";
};
cfg = config.modules.shell;
in {
imports = [
./bash.nix
./fish.nix
./starship.nix
./zsh.nix
];
options.modules.shell = {
enableBash = mkOption {
type = types.bool;
default = true;
description = "enables bash";
};
enableFish = mkOption {
type = types.bool;
default = true;
description = "enables fish";
};
enableZsh = mkOption {
type = types.bool;
default = true;
description = "enables zsh";
};
starship = {
enable = mkEnableOption "Enables the starship prompt.";
jjIntegration = mkEnableOption "Enables Jujutsu integration in starship.";
};
zoxide = {
enable = mkOption {
type = types.bool;
default = true;
description = "enables zoxide";
};
replaceCd = mkOption {
type = types.bool;
default = true;
description = "makes zoxide replace cd";
};
};
};
config = {
home.shell = {
enableFishIntegration = mkDefault cfg.enableFish;
enableBashIntegration = mkDefault cfg.enableBash;
enableZshIntegration = mkDefault cfg.enableZsh;
};
modules = {
fish = {
enable = mkDefault cfg.enableFish;
abbrs = mkDefault aliases;
};
bash = {
enable = mkDefault cfg.enableBash;
aliases = mkDefault aliases;
};
zsh = {
enable = mkDefault cfg.enableZsh;
abbrs = mkDefault aliases;
};
inherit (cfg) starship;
};
programs.zoxide = mkIf cfg.zoxide.enable {
enable = true;
options = mkIf cfg.zoxide.replaceCd [
"--cmd cd"
];
};
};
}

View File

@@ -0,0 +1,75 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.modules.fish;
in {
options.modules.fish = {
enable = lib.mkEnableOption "enables fish";
abbrs = lib.mkOption {
type = types.attrsOf types.str;
default = {};
example = {
cp = "cp -i";
lns = "ln -si";
};
};
};
config = lib.mkIf cfg.enable {
programs.fish = {
enable = true;
shellAbbrs = cfg.abbrs;
preferAbbrs = true;
shellInit = ''
function fish_command_not_found
__fish_default_command_not_found_handler $argv
end
'';
plugins = [
{
name = "bass";
inherit (pkgs.fishPlugins.bass) src;
# src = pkgs.fishPlugins.bass.src;
}
{
name = "colored-man-pages";
inherit (pkgs.fishPlugins.colored-man-pages) src;
}
{
name = "done";
inherit (pkgs.fishPlugins.done) src;
}
{
name = "fzf";
inherit (pkgs.fishPlugins.fzf) src;
}
{
name = "pisces";
inherit (pkgs.fishPlugins.pisces) src;
}
{
name = "getopts.fish";
src = pkgs.fetchFromGitHub {
owner = "jorgebucaran";
repo = "getopts.fish";
rev = "4b74206725c3e11d739675dc2bb84c77d893e901";
sha256 = "9hRFBmjrCgIUNHuOJZvOufyLsfreJfkeS6XDcCPesvw=";
};
}
{
name = "replay.fish";
src = pkgs.fetchFromGitHub {
owner = "jorgebucaran";
repo = "replay.fish";
rev = "d2ecacd3fe7126e822ce8918389f3ad93b14c86c";
sha256 = "TzQ97h9tBRUg+A7DSKeTBWLQuThicbu19DHMwkmUXdg=";
};
}
];
};
};
}

View File

@@ -0,0 +1,45 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.modules.starship;
in {
options.modules.starship = {
enable = mkEnableOption "Enables the starship prompt.";
jjIntegration = mkEnableOption "Enables Jujutsu integration in starship.";
};
config.programs.starship = mkIf cfg.enable {
inherit (cfg) enable;
enableTransience = true;
settings.custom = {
jj = {
description = "The current jj status";
detect_folders = [".jj"];
symbol = "🥋 ";
command = ''
jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template '
separate(" ",
change_id.shortest(4),
bookmarks,
"|",
concat(
if(conflict, "💥"),
if(divergent, "🚧"),
if(hidden, "👻"),
if(immutable, "🔒"),
),
raw_escape_sequence("\x1b[1;32m") ++ if(empty, "(empty)"),
raw_escape_sequence("\x1b[1;32m") ++ coalesce(
truncate_end(29, description.first_line(), ""),
"(no description set)",
) ++ raw_escape_sequence("\x1b[0m"),
)
'
'';
};
};
};
}

View File

@@ -0,0 +1,96 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.modules.zsh;
in {
options.modules.zsh = {
enable = lib.mkEnableOption "enables zsh";
abbrs = lib.mkOption {
type = types.attrsOf types.str;
default = {};
example = {
cp = "cp -i";
lns = "ln -si";
};
};
zshrcExtra = lib.mkOption {
type = types.lines;
default = ''
bindkey -e
bindkey '^p' history-search-backward
bindkey '^n' history-search-forward
# Completion styling
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "''${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview '${pkgs.eza}/bin/eza $realpath'
'';
};
};
config.programs.zsh = lib.mkIf cfg.enable {
enable = true;
autocd = true;
autosuggestion = {
enable = true;
strategy = ["match_prev_cmd" "completion"];
};
enableCompletion = true;
history = {
findNoDups = true;
ignoreAllDups = true;
ignoreDups = true;
ignoreSpace = true;
path = "${config.xdg.dataHome}/zsh/zsh_history";
saveNoDups = true;
};
historySubstringSearch.enable = true;
initContent = cfg.zshrcExtra;
oh-my-zsh = {
enable = true;
plugins = [
"dirhistory"
"sudo"
];
};
plugins = [
{
name = "fzf-tab";
src = pkgs.fetchFromGitHub {
owner = "Aloxaf";
repo = "fzf-tab";
rev = "v1.2.0";
sha256 = "sha256-q26XVS/LcyZPRqDNwKKA9exgBByE0muyuNb0Bbar2lY=";
};
}
{
name = "auto-notify";
src = pkgs.fetchFromGitHub {
owner = "MichaelAquilina";
repo = "zsh-auto-notify";
rev = "0.11.0";
sha256 = "sha256-8r5RsyldJIzlWr9+G8lrkHvJ8KxTVO859M//wDnYOUY=";
};
}
{
name = "zsh-autopair";
src = pkgs.fetchFromGitHub {
owner = "hlissner";
repo = "zsh-autopair";
rev = "449a7c3d095bc8f3d78cf37b9549f8bb4c383f3d";
sha256 = "sha256-3zvOgIi+q7+sTXrT+r/4v98qjeiEL4Wh64rxBYnwJvQ=";
};
}
];
syntaxHighlighting.enable = true;
zsh-abbr = {
enable = true;
abbreviations = cfg.abbrs;
};
};
}

23
users/modules/ssh.nix Normal file
View File

@@ -0,0 +1,23 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.modules.ssh;
in {
options.modules.ssh = {
enable = mkEnableOption "enables SSH";
hosts = mkOption {
type = types.nullOr types.path;
default = null;
};
};
config = {
programs.ssh = mkIf cfg.enable {
enable = true;
includes = mkIf (cfg.hosts != null) [cfg.hosts];
};
};
}

View File

@@ -0,0 +1,6 @@
{
programs.tealdeer = {
enable = true;
enableAutoUpdates = true;
};
}

86
users/modules/tmux.nix Normal file
View File

@@ -0,0 +1,86 @@
{pkgs, ...}: {
programs.tmux = {
enable = true;
baseIndex = 1;
clock24 = true;
customPaneNavigationAndResize = true;
keyMode = "vi";
mouse = true;
newSession = true;
prefix = "M-space";
plugins = with pkgs.tmuxPlugins; [
cpu
nord
prefix-highlight
resurrect
sensible
yank
];
extraConfig = ''
set-option -sa terminal-overrides ",xterm*:Tc"
unbind C-b
bind-key -T prefix « select-window -p
bind-key -T prefix » select-window -n
bind-key -T prefix Tab switch-client -T windows
bind-key -T prefix w switch-client -T pane
bind-key -T prefix y switch-client -T copy-mode
bind-key -T pane / split-window -h -c "#{pane-current_path}"
bind-key -T pane - split-window -v -c "#{pane-current_path}"
bind-key -T pane c select-pane -L
bind-key -T pane t select-pane -D
bind-key -T pane s select-pane -U
bind-key -T pane r select-pane -R
bind-key -T pane f resize-pane -Z
bind-key -T pane . switch-client -T pane-resize
bind-key -T pane-resize c resize-pane -L 5\; switch-client -T pane-resize
bind-key -T pane-resize t resize-pane -D 5\; switch-client -T pane-resize
bind-key -T pane-resize s resize-pane -U 5\; switch-client -T pane-resize
bind-key -T pane-resize r resize-pane -R 5\; switch-client -T pane-resize
bind-key -T pane-resize C resize-pane -L\; switch-client -T pane-resize
bind-key -T pane-resize T resize-pane -D\; switch-client -T pane-resize
bind-key -T pane-resize S resize-pane -U\; switch-client -T pane-resize
bind-key -T pane-resize R resize-pane -R\; switch-client -T pane-resize
bind-key -T windows c new-window
bind-key -T windows n next-window
bind-key -T windows p previous-window
bind-key -T windows \" select-window -t :=1
bind-key -T windows « select-window -t :=2
bind-key -T windows » select-window -t :=3
bind-key -T windows ( select-window -t :=4
bind-key -T windows ) select-window -t :=5
bind-key -T windows @ select-window -t :=6
bind-key -T windows + select-window -t :=7
bind-key -T windows - select-window -t :=8
bind-key -T windows / select-window -t :=9
bind-key -T windows * select-window -t :=10
unbind -T copy-mode-vi H
unbind -T copy-mode-vi J
unbind -T copy-mode-vi K
unbind -T copy-mode-vi L
unbind -T copy-mode-vi h
unbind -T copy-mode-vi j
unbind -T copy-mode-vi k
unbind -T copy-mode-vi l
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
bind-key -T copy-mode-vi C send-keys -X top-line
bind-key -T copy-mode-vi J send-keys -X jump-to-backward
bind-key -T copy-mode-vi S send-keys -X scroll-up
bind-key -T copy-mode-vi R send-keys -X bottom-line
bind-key -T copy-mode-vi T send-keys -X scroll-down
bind-key -T copy-mode-vi c send-keys -X cursor-left
bind-key -T copy-mode-vi t send-keys -X cursor-down
bind-key -T copy-mode-vi s send-keys -X cursor-up
bind-key -T copy-mode-vi r send-keys -X cursor-right
'';
};
}

View File

@@ -0,0 +1,112 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.modules.vcs;
in {
imports = [./git.nix ./jujutsu.nix];
options.modules.vcs = {
git = {
enable = mkEnableOption "enables git";
sendmail = {
enable = mkOption {
type = types.bool;
default = true;
};
server = mkOption {
type = types.nullOr types.str;
default = "mail.phundrak.com";
};
user = mkOption {
type = types.nullOr types.str;
default = null;
};
encryption = mkOption {
type = types.enum ["tls" "ssl" "none"];
default = "none";
};
port = mkOption {
type = types.nullOr types.int;
default = 587;
};
passwordFile = mkOption {
type = types.nullOr types.path;
default = null;
description = ''
Path to a file containing the password necessary for authenticating
against the mailserver.
This file should contain the password only, with no newline.
'';
};
};
browser = mkOption {
type = types.nullOr types.str;
example = "${pkgs.firefox}/bin/firefox";
default = null;
};
completeConfig = mkEnableOption "Complete configuration for workstations";
mergeTool = mkOption {
type = types.str;
default = "ediff";
};
emacs = {
integration = mkEnableOption "enables Emacs integration";
pkg = mkOption {
type = types.package;
default = pkgs.emacs;
};
};
};
jj.enable = mkEnableOption "enables jujutsu";
name = mkOption {
type = types.str;
default = "Lucien Cartier-Tilet";
};
email = mkOption {
type = types.str;
default = "lucien@phundrak.com";
};
editor = mkOption {
type = types.str;
default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs";
};
publicKey = {
content = mkOption {
type = types.nullOr types.str;
example = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGj+J6N6SO+4P8dOZqfR1oiay2yxhhHnagH52avUqw5h";
default = null;
};
file = mkOption {
type = with types; nullOr path;
default = "/home/phundrak/.ssh/id_ed25519.pub";
};
};
};
config = lib.mkIf (cfg.git.enable || cfg.jj.enable) {
home.file.".ssh/allowed_signers".text = mkIf (cfg.publicKey.content != null) (mkDefault ''
${cfg.email} namespaces="git" ${cfg.publicKey.content}
'');
modules = {
git = mkIf cfg.git.enable {
inherit (cfg.git) enable sendmail browser completeConfig emacs mergeTool;
inherit (cfg) email name editor;
publicKeyFile = cfg.publicKey.file;
};
jj = mkIf cfg.jj.enable {
inherit (cfg.jj) enable;
inherit (cfg) name email editor;
signing.enable = cfg.publicKey.content != null;
signing.sshKey =
if (cfg.publicKey.file == null)
then cfg.publicKey.content
else cfg.publicKey.file;
};
};
};
}

273
users/modules/vcs/git.nix Normal file
View File

@@ -0,0 +1,273 @@
{
lib,
config,
pkgs,
...
}:
with lib; let
cfg = config.modules.git;
in {
options.modules.git = {
enable = mkEnableOption "enables git";
email = mkOption {
type = types.str;
default = "lucien@phundrak.com";
};
name = mkOption {
type = types.str;
default = "Lucien Cartier-Tilet";
};
sendmail = {
enable = mkOption {
type = types.bool;
default = true;
};
server = mkOption {
type = types.nullOr types.str;
default = "mail.phundrak.com";
};
user = mkOption {
type = types.nullOr types.str;
default = null;
};
encryption = mkOption {
type = types.enum ["tls" "ssl" "none"];
default = "none";
};
port = mkOption {
type = types.nullOr types.int;
default = 587;
};
passwordFile = mkOption {
type = types.nullOr types.path;
default = null;
description = ''
Path to a file containing the password necessary for authenticating
against the mailserver.
This file should contain the password only, with no newline.
'';
};
};
browser = mkOption {
type = types.nullOr types.str;
example = "${pkgs.firefox}/bin/firefox";
default = null;
};
completeConfig = mkEnableOption "Complete configuration for workstations";
emacs = {
integration = mkEnableOption "enables Emacs integration";
pkg = mkOption {
type = types.package;
default = pkgs.emacs;
};
};
mergeTool = mkOption {
type = types.str;
default = "ediff";
};
editor = mkOption {
type = types.str;
default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs";
};
publicKeyFile = mkOption {
type = types.nullOr types.str;
default = null;
};
};
config = lib.mkIf cfg.enable {
programs.git = let
smtpEmail =
if (cfg.sendmail.user == null)
then cfg.email
else cfg.sendmail.user;
in {
enable = true;
userEmail = cfg.email;
userName = cfg.name;
extraConfig = {
color.ui = "auto";
column.ui = "auto";
tag.sort = "version:refname";
core = mkIf cfg.completeConfig {
compression = 9;
inherit (cfg) editor;
whitespace = "fix,-indent-with-non-tab,trailing-space";
preloadindex = true;
};
status = {
branch = true;
showStash = true;
};
diff = {
algorithm = "histogram";
colorMoved = "plain";
mnemonicPrefix = true;
renames = "copy";
interHunkContext = 10;
};
commit.gpgsign = cfg.publicKeyFile != null;
gpg.format = "ssh";
gpg.ssh.allowedSignersFile = (mkIf (cfg.publicKeyFile != null)) "~/.ssh/allowed_signers";
init.defaultBranch = "main";
pull.rebase = true;
push = {
default = "simple";
autoSetupRemote = true;
followTags = true;
};
rebase = {
autoSquash = true;
autoStash = true;
missingCommitsCheck = "warn";
updateRefs = true;
};
help.autocorrect = "prompt";
user.signingkey = mkIf (cfg.publicKeyFile != null) cfg.publicKeyFile;
web.browser = mkIf (cfg.browser != null) cfg.browser;
sendemail = mkIf cfg.sendmail.enable {
smtpserver = cfg.sendmail.server;
smtpuser = smtpEmail;
smtpencryption = cfg.sendmail.encryption;
smtpserverport = cfg.sendmail.port;
};
credentials = mkIf (cfg.sendmail.passwordFile != null) {
"smtp://${smtpEmail}@${cfg.sendmail.server}:${toString cfg.sendmail.port}" = {
helper = "cat ${cfg.sendmail.passwordFile}";
};
};
magithub = mkIf cfg.emacs.integration {
online = true;
"status" = {
includeStatusHeader = true;
includePullRequestsSection = true;
includeIssuesSection = true;
};
};
merge = {
tool = mkIf cfg.completeConfig cfg.mergeTool;
conflictstyle = "zdiff3";
};
mergetool.ediff.cmd = mkIf (cfg.emacs.integration && cfg.completeConfig) "\"${cfg.emacs.pkg} --eval \" (progn (defun ediff-write-merge-buffer () (let ((file ediff-merge-store-file)) (set-buffer ediff-buffer-C) (write-region (point-min) (point-max) file) (message \\\"Merge buffer saved in: %s\\\" file) (set-buffer-modified-p nil) (sit-for 1))) (setq ediff-quit-hook 'kill-emacs ediff-quit-merge-hook 'ediff-write-merge-buffer) (ediff-merge-files-with-ancestor \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$BASE\\\" nil \\\"$MERGED\\\"))\"\"";
github.user = "phundrak";
url = {
"https://phundrak@github.com" = {
insteadOf = "https://github.com";
};
"https://phundrak@labs.phundrak.com" = {
insteadOf = "https://labs.phundrak.com";
};
"https://github.com/RustSec/advisory-db" = {
insteadOf = "https://github.com/RustSec/advisory-db";
};
"git@github.com:Phundrak/" = {
insteadOf = "pg:";
};
"git@labs.phundrak.com/phundrak:" = {
insteadOf = "p:";
};
"git@github.com" = {
insteadOf = "gh:";
};
"git@labs.phundrak.com" = {
insteadOf = "labs:";
};
};
};
ignores = [
".env"
".direnv/"
"*~"
"\#*\#"
"*.elc"
"auto-save-list"
".\#*"
"*_flymake.*"
"/auto/"
".projectile"
".dir-locals.el"
"# Org mode files"
".org-id-locations"
"*_archive"
"*.out"
"*.o"
"*.so"
"# Archives"
"*.7zz"
"*.dmg"
"*.gz"
"*.iso"
"*.jar"
"*.rar"
"*.tar"
"*.zip"
"*.log"
"*.sqlite"
"dist/"
];
aliases = {
a = "add --all";
aca = "!git add --all && git commit --amend";
acan = "!git add --all && git commit --amend --no-edit";
ap = "add --patch";
b = "branch";
bd = "branch -d";
bdd = "branch -D";
c = "commit -S";
ca = "commit -Sa";
can = "commit -Sa --no-edit";
cm = "commit -Sm";
cam = "commit -Sam";
co = "checkout";
cob = "checkout -b";
cod = "checkout develop";
cl = "clone";
cl1 = "clone --depth 1";
f = "fetch";
fp = "fetch --prune";
ps = "push";
psf = "push --force-with-lease";
pso = "push origin";
psfo = "push --force-with-lease origin";
pushall = "!git remote \vert{} xargs -L1 git push";
psl = "!git remote \vert{} xargs -L1 git push";
pullall = "!git remote \vert{} xargs -L1 git pull";
pll = "!git remote \vert{} xargs -L1 git pull";
pl = "pull";
pb = "pull --rebase";
r = "rebase";
ra = "rebase --abort";
rc = "rebase --continue";
rd = "rebase develop";
ri = "rebase -i";
rmf = "rm -f";
rmd = "rm -r";
rmdf = "rm -rf";
sm = "submodule";
sms = "submodule status";
sma = "submodule add";
smu = "submodule update";
smui = "submodule update --init";
smuir = "submodule update --init --recursive";
st = "stash";
stc = "stash clear";
stp = "stash pop";
stw = "stash show";
u = "reset --";
d = "diff -w";
l = "log --all --oneline --graph --decorate --pretty=format':%C(magenta)%h %C(white) %an %ar%C(auto) %D%n%s%n'";
s = "status";
staged = "diff --cached";
upstream = "!git push -u origin HEAD";
unstage = "reset --";
};
};
};
}

View File

@@ -0,0 +1,55 @@
{
lib,
config,
pkgs,
...
}:
with lib; let
cfg = config.modules.jj;
in {
options.modules.jj = {
enable = mkEnableOption "enables jj";
name = mkOption {
type = types.str;
default = "Lucien Cartier-Tilet";
};
email = mkOption {
type = types.str;
default = "lucien@phundrak.com";
};
editor = mkOption {
type = types.str;
default = "${pkgs.emacs}/bin/emacsclient -c -a ${pkgs.emacs}/bin/emacs";
};
signing = {
enable = mkEnableOption "enables signing jj commits";
sshKey = mkOption {
type = with types; nullOr (either path str);
example = "~/.ssh/id_ed25519.pub";
default = "~/.ssh/id_ed25519.pub";
description = "Path to the public SSH key or its content.";
};
};
};
config.programs.jujutsu = mkIf cfg.enable {
enable = true;
settings = {
user = {
inherit (cfg) name email;
};
ui = {
default-command = "st";
pager = ":builtin";
inherit (cfg) editor;
};
signing = mkIf cfg.signing.enable {
behavior = "own";
backend = "ssh";
key = cfg.signing.sshKey;
backends."ssh.allowed-signers" = "~/.ssh/allowed_signers";
backends."ssh.program" = "${pkgs.openssh}/bin/ssh-keygen";
};
};
};
}

68
users/modules/wofi.nix Normal file
View File

@@ -0,0 +1,68 @@
{
programs.wofi = {
enable = true;
settings = {
modi = "ssh,drun,combi";
sidebar-mode = false;
width = 30;
line-margin = 10;
lines = 6;
columns = 2;
display-ssh = "";
display-run = "";
display-drun = "";
display-window = "";
display-combi = "";
show-icons = true;
};
# from https://github.com/alxndr13/wofi-nord-theme
style = ''
* {
font-family: "Hack", monospace;
}
window {
background-color: #3B4252;
}
#input {
margin: 5px;
border-radius: 0px;
border: none;
background-color: #3B4252;
color: white;
}
#inner-box {
background-color: #383C4A;
}
#outer-box {
margin: 2px;
padding: 10px;
background-color: #383C4A;
}
#scroll {
margin: 5px;
}
#text {
padding: 4px;
color: white;
}
#entry:nth-child(even){
background-color: #404552;
}
#entry:selected {
background-color: #4C566A;
}
#text:selected {
background: transparent;
}
'';
};
}

10
users/modules/yt-dlp.nix Normal file
View File

@@ -0,0 +1,10 @@
{
programs.yt-dlp = {
enable = true;
settings = {
embed-thumbnail = true;
embed-subs = true;
sub-langs = "all";
};
};
}

View File

@@ -0,0 +1,249 @@
env = XCURSOR_SIZE,24
env = SDL_VIDEODRIVER,wayland
input {
kb_layout = fr
kb_variant = bepo_afnor
kb_model =
kb_options = caps:ctrl_modifier
kb_rules =
numlock_by_default = true
follow_mouse = 1
touchpad {
natural_scroll = false
}
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
}
monitor = HDMI-A-1, 2560x1080, 0x0, 1
monitor = eDP-1, 1920x1080@120, 2560x0, 1
general {
gaps_in = 5
gaps_out = 20
border_size = 2
col.active_border = rgb(81a1c1) rgb(a3be8c) 45deg
col.inactive_border = rgb(4c566a)
layout = dwindle
}
decoration {
rounding = 5
blur {
enabled = true
size = 9
passes = 1
}
shadow {
enabled = true
color = rgba(2e3440aa)
range = 4
render_power = 3
}
}
animations {
enabled = true
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
animation = windows, 1, 7, myBezier
animation = windowsOut, 1, 7, default, popin 80%
animation = border, 1, 10, default
animation = borderangle, 1, 8, default
animation = fade, 1, 7, default
animation = workspaces, 1, 6, default
}
dwindle {
pseudotile = true
preserve_split = true
}
exec-once = wpaperd
exec-once = waybar
exec-once = pactl load-module module-switch-on-connect
exec-once = mpc stop
exec-once = xfce-polkit
exec-once = swaync
exec-once = wlsunset -l 48.5 -L 2.2 -d 1500
exec-once = nm-applet
exec-once = blueman-applet
$left = c
$right = r
$up = s
$down = t
$menu = rofi -combi-modi drun -show combi
bind = SUPER, Return, exec, kitty
bind = SUPER, Space, submap, leader
bind = , Print, submap, screenshot
submap = leader
bind = , l, exec, plock
bind = , l, submap, reset
bind = , a, submap, apps
bind = , b, submap, buffers
bind = , w, submap, windows
bind = , escape, submap, reset
bind = CTRL, g, submap, reset
submap = apps
bind = , b, exec, zen-browser
bind = , b, submap, reset
bind = SHIFT, b, exec, qutebrowser
bind = SHIFT, b, submap, reset
bind = , d, exec, vesktop
bind = , d, submap, reset
bind = , e, exec, emacsclient -c -n
bind = , e, submap, reset
bind = , g, exec, gimp
bind = , g, submap, reset
bind = , n, exec, nemo
bind = , n, submap, reset
bind = , r, submap, rofi
bind = , u, exec, $menu
bind = , u, submap, reset
bind = , escape, submap, reset
bind = CTRL, g, submap, reset
submap = buffers
bind = , d, killactive,
bind = , d, submap, reset
bind = , escape, submap, reset
bind = CTRL, g, submap, reset
submap = resize
binde = , $left, resizeactive, -10 0
binde = , $right, resizeactive, 10 0
binde = , $up, resizeactive, 0 -10
binde = , $down, resizeactive, 0 10
bind = , q, submap, reset
bind = , escape, submap, reset
bind = CTRL, g, submap, reset
submap = rofi
bind = , a, exec, awiki
bind = , a, submap, reset
bind = , b, exec, bluetooth-connect
bind = , b, submap, reset
bind = , e, exec, rofi-emoji
bind = , e, submap, reset
bind = , r, exec, $menu
bind = , r, submap, reset
bind = , s, exec, rofi -show ssh
bind = , s, submap, reset
bind = , y, exec, ytplay
bind = , y, submap, reset
bind = SHIFT, y, exec, rofi-ytdl
bind = SHIFT, y, submap, reset
bind = , escape, submap, reset
bind = CTRL, g, submap, reset
submap = screenshot
bind = , Print, exec, screenshot
bind = , Print, submap, reset
bind = , d, exec, screenshot -d 3
bind = , d, submap, reset
bind = Shift, d, exec, screenshot -sced 3
bind = Shift, d, submap, reset
bind = , e, exec, screenshot -sec
bind = , e, submap, reset
bind = , s, exec, screenshot -s
bind = , s, submap, reset
bind = Shift, s, exec, screenshot -sc
bind = Shift, s, submap, reset
bind = , escape, submap, reset
bind = CTRL, g, submap, reset
submap = windows
bind = , period, submap, resize
bind = , $left, movefocus, l
bind = , $left, submap, reset
bind = , $right, movefocus, r
bind = , $right, submap, reset
bind = , $up, movefocus, u
bind = , $up, submap, reset
bind = , $down, movefocus, d
bind = , $down, submap, reset
bind = SHIFT, $left, movewindow, l
bind = SHIFT, $left, submap, reset
bind = SHIFT, $right, movewindow, r
bind = SHIFT, $right, submap, reset
bind = SHIFT, $up, movewindow, u
bind = SHIFT, $up, submap, reset
bind = SHIFT, $down, movewindow, d
bind = SHIFT, $down, submap, reset
bind = CTRL_SHIFT, $left, moveworkspacetomonitor, e+0 +1
bind = CTRL_SHIFT, $left, submap, reset
bind = CTRL_SHIFT, $right, moveworkspacetomonitor, e+0 -1
bind = CTRL_SHIFT, $right, submap, reset
bind = , d, killactive,
bind = , d, submap, reset
bind = , f, fullscreen,
bind = , f, submap, reset
bind = SHIFT, f, togglefloating,
bind = SHIFT, f, submap, reset
bind = , escape, submap, reset
bind = CTRL, g, submap, reset
submap = reset
bindl = , XF86AudioPlay, exec, playerctl play-pause
bindl = , XF86AudioPause, exec, playerctl pause
bindl = , XF86AudioStop, exec, playerctl stop
bindl = , XF86AudioPrev, exec, playerctl previous
bindl = , XF86AudioNext, exec, playerctl next
bindl = , XF86AudioForward, exec, playerctl position +1
bindl = , XF86AudioRewind, exec, playerctl position -1
bindl = , XF86AudioRaiseVolume, exec, pamixer -i 2
bindl = , XF86AudioLowerVolume, exec, pamixer -d 2
bindl = , XF86MonBrightnessUp, exec, xbacklight -perceived -inc 2
bindl = , XF86MonBrightnessDown, exec, xbacklight -perceived -dec 2
bindl = , XF86KbdBrightnessUp, exec, xbacklight -perceived -inc 2
bindl = , XF86KbdBrightnessDown, exec, xbacklight -perceived -dec 2
bind = SUPER, $left, movefocus, l
bind = SUPER, $right, movefocus, r
bind = SUPER, $up, movefocus, u
bind = SUPER, $down, movefocus, d
bind = SUPER_SHIFT, $left, movewindow, l
bind = SUPER_SHIFT, $left, submap, reset
bind = SUPER_SHIFT, $right, movewindow, r
bind = SUPER_SHIFT, $right, submap, reset
bind = SUPER_SHIFT, $up, movewindow, u
bind = SUPER_SHIFT, $up, submap, reset
bind = SUPER_SHIFT, $down, movewindow, d
bind = SUPER_SHIFT, $down, submap, reset
bind = SUPER_CTRL_SHIFT, $left, moveworkspacetomonitor, e+0 +1
bind = SUPER_CTRL_SHIFT, $left, submap, reset
bind = SUPER_CTRL_SHIFT, $right, moveworkspacetomonitor, e+0 -1
bind = SUPER_CTRL_SHIFT, $right, submap, reset
bind = SUPER, Tab, cyclenext,
bind = SUPER_SHIFT, Tab, cyclenext, prev
bindm = SUPER, mouse:272, movewindow
bindm = SUPER, mouse:273, resizewindow
bind = SUPER, quotedbl, workspace, 1
bind = SUPER, guillemotleft, workspace, 2
bind = SUPER, guillemotright, workspace, 3
bind = SUPER, parenleft, workspace, 4
bind = SUPER, parenright, workspace, 5
bind = SUPER, at, workspace, 6
bind = SUPER, plus, workspace, 7
bind = SUPER, minus, workspace, 8
bind = SUPER, slash, workspace, 9
bind = SUPER, asterisk, workspace, 10
bind = SUPER, mouse_down, workspace, e+1
bind = SUPER, mouse_up, workspace, e-1
bind = SUPER_SHIFT, quotedbl, movetoworkspace, 1
bind = SUPER_SHIFT, guillemotleft, movetoworkspace, 2
bind = SUPER_SHIFT, guillemotright, movetoworkspace, 3
bind = SUPER_SHIFT, parenleft, movetoworkspace, 4
bind = SUPER_SHIFT, parenright, movetoworkspace, 5
bind = SUPER_SHIFT, at, movetoworkspace, 6
bind = SUPER_SHIFT, plus, movetoworkspace, 7
bind = SUPER_SHIFT, minus, movetoworkspace, 8
bind = SUPER_SHIFT, slash, movetoworkspace, 9
bind = SUPER_SHIFT, asterisk, movetoworkspace, 10
windowrulev2 = float,class:^(xfce-polkit)$

View File

@@ -0,0 +1,167 @@
// -*- mode: js-json -*-
{
// "layer": "top", // Waybar at top layer
// "position": "bottom", // Waybar position (top|bottom|left|right)
"height": 24, // Waybar height (to be removed for auto height)
// "width": 1280, // Waybar width
"spacing": 2, // Gaps between modules (4px)
// Choose the order of the modules
"modules-left": ["hyprland/workspaces", "hyprland/submap", "hyprland/window"],
"modules-center": [],
"modules-right": ["idle_inhibitor", "mpd", "pulseaudio", "network", "cpu",
"memory", "temperature", "battery", "clock", "tray"],
// Modules configuration
// "sway/workspaces": {
// "disable-scroll": true,
// "all-outputs": true,
// "format": "{name}: {icon}",
// "format-icons": {
// "1": "",
// "2": "",
// "3": "",
// "4": "",
// "5": "",
// "urgent": "",
// "focused": "",
// "default": ""
// }
// },
"keyboard-state": {
"numlock": true,
"capslock": true,
"format": "{name} {icon}",
"format-icons": {
"locked": "",
"unlocked": ""
}
},
"sway/mode": {
"format": "<span style=\"italic\">{}</span>"
},
"sway/scratchpad": {
"format": "{icon} {count}",
"show-empty": false,
"format-icons": ["", ""],
"tooltip": true,
"tooltip-format": "{app}: {title}"
},
"mpd": {
"format": "{stateIcon} {consumeIcon}{randomIcon}{repeatIcon}{singleIcon}{artist} - {album} - {title} ({elapsedTime:%M:%S}/{totalTime:%M:%S}) ⸨{songPosition}|{queueLength}⸩ {volume}% ",
"format-disconnected": "Disconnected ",
"format-stopped": "{consumeIcon}{randomIcon}{repeatIcon}{singleIcon}Stopped ",
"unknown-tag": "N/A",
"interval": 2,
"consume-icons": {
"on": " "
},
"random-icons": {
"off": "<span color=\"#f53c3c\"></span> ",
"on": " "
},
"repeat-icons": {
"on": " "
},
"single-icons": {
"on": "1 "
},
"state-icons": {
"paused": "",
"playing": ""
},
"tooltip-format": "MPD (connected)",
"tooltip-format-disconnected": "MPD (disconnected)"
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
},
"tray": {
// "icon-size": 21,
"spacing": 10
},
"clock": {
// "timezone": "America/New_York",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "{usage}% ",
"tooltip": false
},
"memory": {
"format": "{}% "
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""]
},
"backlight": {
// "device": "acpi_video1",
"format": "{percent}% {icon}",
"format-icons": ["", "", "", "", "", "", "", "", ""]
},
"battery": {
"states": {
// "good": 95,
"warning": 30,
"critical": 15
},
"format": "{capacity}% {icon}",
"format-charging": "{capacity}% ",
"format-plugged": "{capacity}% ",
"format-alt": "{time} {icon}",
// "format-good": "", // An empty format will hide the module
// "format-full": "",
"format-icons": ["", "", "", "", ""]
},
"battery#bat2": {
"bat": "BAT2"
},
"network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": "{essid} ({signalStrength}%) ",
"format-ethernet": "{ipaddr}/{cidr} ",
"tooltip-format": "{ifname} via {gwaddr} ",
"format-linked": "{ifname} (No IP) ",
"format-disconnected": "Disconnected ⚠",
"format-alt": "{ifname}: {ipaddr}/{cidr}"
},
"pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "{volume}% {icon} {format_source}",
"format-bluetooth": "{volume}% {icon} {format_source}",
"format-bluetooth-muted": " {icon} {format_source}",
"format-muted": " {format_source}",
"format-source": "{volume}% ",
"format-source-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
},
"on-click": "pavucontrol"
},
"custom/media": {
"format": "{icon} {}",
"return-type": "json",
"max-length": 40,
"format-icons": {
"spotify": "",
"default": "🎜"
},
"escape": true,
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
}
}

View File

@@ -0,0 +1,280 @@
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
}
window#waybar {
background-color: rgba(43, 48, 59, 0.5);
border-bottom: 3px solid rgba(100, 114, 125, 0.5);
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover {
background: inherit;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
}
#workspaces button.focused {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#wireplumber,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#scratchpad,
#mpd {
padding: 0 10px;
color: #ffffff;
}
#window,
#workspaces {
margin: 0 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
#clock {
background-color: #64727D;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging, #battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#disk {
background-color: #964B00;
}
#backlight {
background-color: #90b1b1;
}
#network {
background-color: #2980b9;
}
#network.disconnected {
background-color: #f53c3c;
}
#pulseaudio {
background-color: #f1c40f;
color: #000000;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#wireplumber {
background-color: #fff0f5;
color: #000000;
}
#wireplumber.muted {
background-color: #f53c3c;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #2980b9;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
#language {
background: #00b093;
color: #740864;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
padding: 0 0px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state > label {
padding: 0 5px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad.empty {
background-color: transparent;
}

7
users/phundrak/gampo.nix Normal file
View File

@@ -0,0 +1,7 @@
{
imports = [./home.nix];
home.phundrak.sshKey = {
content = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBPhP4p9KGk6jSOxJzBu+RzJPHI6baT0o+xrgPeNRwfq lucien@phundrak.com";
file = "/home/phundrak/.ssh/id_ed25519.pub";
};
}

99
users/phundrak/home.nix Normal file
View File

@@ -0,0 +1,99 @@
{
pkgs,
config,
inputs,
...
}: {
imports = [
./light-home.nix
./packages.nix
../modules/emacs.nix
../modules/kdeconnect.nix
../modules/kitty.nix
../modules/mbsync.nix
../modules/mpd.nix
../modules/mpv.nix
../modules/wofi.nix
../modules/yt-dlp.nix
../modules/emoji.nix
../modules/qt.nix
];
config = let
emacsPkg = with pkgs; ((emacsPackagesFor emacsNativeComp).emacsWithPackages (
epkgs: [
epkgs.vterm
epkgs.mu4e
epkgs.pdf-tools
]
));
askpass = import ../scripts/askpass.nix {inherit pkgs;};
launchWithEmacsclient = import ../scripts/launch-with-emacsclient.nix {
inherit pkgs;
emacsPackage = emacsPkg;
};
in {
sops.secrets = {
emailPassword = {};
"mopidy/bandcamp" = {};
"mopidy/spotify" = {};
};
home.sessionVariables = {
EDITOR = "${emacsPkg}/bin/emacsclient -c -a ${emacsPkg}/bin/emacs";
LAUNCH_EDITOR = "${launchWithEmacsclient}/bin/launch-with-emacsclient";
SUDO_ASKPASS = "${askpass}/bin/askpass";
LSP_USE_PLISTS = "true";
};
modules = {
emacs = {
enable = true;
service = true;
package = emacsPkg;
};
shell.starship.jjIntegration = true;
bat.extras = true;
packages.emacsPackage = emacsPkg;
mopidy.enable = true;
mbsync = {
enable = true;
passwordFile = config.sops.secrets.emailPassword.path;
};
ssh = {
enable = true;
hosts = config.sops.secrets."ssh/hosts".path;
};
vcs.git = {
browser = "${inputs.zen-browser.packages.${pkgs.system}.default}/bin/zen";
emacs = {
integration = true;
pkg = emacsPkg;
};
sendmail = {
enable = true;
passwordFile = config.sops.secrets.emailPassword.path;
};
};
};
programs = {
zsh.enableVteIntegration = true;
mu.enable = true;
obs-studio = {
enable = true;
plugins = with pkgs; [
obs-studio-plugins.input-overlay
obs-studio-plugins.obs-backgroundremoval
obs-studio-plugins.obs-mute-filter
obs-studio-plugins.obs-pipewire-audio-capture
obs-studio-plugins.obs-source-clone
obs-studio-plugins.obs-source-record
obs-studio-plugins.obs-tuna
];
};
};
manual.html.enable = true;
};
}

View File

@@ -0,0 +1,68 @@
{
lib,
pkgs,
config,
...
}:
with lib; let
cfg = config.home.phundrak;
in {
imports = [../modules];
options.home.phundrak = {
sshKey = {
content = mkOption {
type = types.nullOr types.str;
example = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGj+J6N6SO+4P8dOZqfR1oiay2yxhhHnagH52avUqw5h";
default = null;
};
file = mkOption {
type = with types; nullOr path;
default = "/home/phundrak/.ssh/id_ed25519.pub";
};
};
};
config = {
nixpkgs.config.allowUnfree = true;
sops = {
defaultSopsFile = ../../secrets/secrets.yaml;
defaultSopsFormat = "yaml";
secrets."ssh/hosts" = {};
age = {
# automatically import user SSH keys as age keys
sshKeyPaths = [
"/home/phundrak/.ssh/id_ed25519"
];
# this will use an age key that is expected to already be in the filesystem
# keyFile = "/home/phundrak/.config/sops/age/keys.txt";
keyFile = "/home/phundrak/.local/sops-nix/key.txt";
# generate a new key if the key specified above does not exist
generateKey = true;
};
};
home = {
username = "phundrak";
homeDirectory = "/home/phundrak";
packages = [pkgs.tree pkgs.ncdu];
stateVersion = "24.11"; # Please read the comment before changing.
};
modules = {
shell.starship.enable = true;
vcs = {
git.enable = true;
jj.enable = true;
publicKey = cfg.sshKey;
};
ssh = {
enable = true;
hosts = config.sops.secrets."ssh/hosts".path;
};
};
manual.manpages.enable = true;
};
}

7
users/phundrak/marpa.nix Normal file
View File

@@ -0,0 +1,7 @@
{
imports = [./home.nix];
home.phundrak.sshKey = {
content = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBPhP4p9KGk6jSOxJzBu+RzJPHI6baT0o+xrgPeNRwfq lucien@phundrak.com";
file = "/home/phundrak/.ssh/id_ed25519.pub";
};
}

110
users/phundrak/packages.nix Normal file
View File

@@ -0,0 +1,110 @@
{
pkgs,
inputs,
lib,
config,
...
}:
with lib; let
cfg = config.modules.packages;
in {
options.modules.packages.emacsPackage = mkOption {
type = types.package;
default = pkgs.emacs;
};
config.home.packages = with pkgs; let
scripts = import ../scripts/scripts.nix {
inherit pkgs;
config.emacsPkg = cfg.emacsPackage;
};
in
[
flatpak
# LSP server for Nix
nil
# Terminal stuff
duf
ffmpeg
ripgrep-all
unzip
# Fonts
#nerdfonts
noto-fonts-cjk-sans
noto-fonts-cjk-serif
tibetan-machine
# Browsers
amfora
# Media
ani-cli
audacity
plexamp
plex-media-player
spicetify-cli
spotify
spotify-tray
# Social
vesktop # Discord alternative that works well with wayland
element-desktop
signal-desktop-bin
# Misc
bitwarden
gplates
libnotify
nextcloud-client
onlyoffice-bin
scrcpy
syncthing
watchmate
inputs.zen-browser.packages.${system}.default
# Games
atlauncher
heroic
modrinth-app
openttd-jgrpp
moonlight-qt
# Emacs stuff
emacs-all-the-icons-fonts
# Gnome stuff
gnome-tweaks
gnomeExtensions.docker
gnomeExtensions.syncthing-indicator
gnomeExtensions.tray-icons-reloaded
gthumb
# Graphics
inkscape
gimp
gimpPlugins.fourier
gimpPlugins.farbfeld
# Dev
devenv
dive # A tool for exploring each layer in a docker image
grype # Vulnerability scanner for container images and filesystems
podman-desktop
podman-compose
python3 # for Emacs and LSP
tectonic # better LaTeX engine
virt-manager
zeal
# # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# Custom scripts
]
++ scripts;
}

View File

@@ -0,0 +1,12 @@
{
imports = [
../modules/emacs.nix
../modules/kdeconnect.nix
../modules/kitty.nix
../modules/mbsync.nix
../modules/mpd.nix
../modules/mpv.nix
../modules/wofi.nix
../modules/yt-dlp.nix
];
}

8
users/phundrak/tilo.nix Normal file
View File

@@ -0,0 +1,8 @@
{
imports = [./light-home.nix];
home.phundrak.sshKey = {
content = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILw9oiK8tZ5Vpz82RaRLpITU8qeJrT2hjvudGEDQu2QW lucien@phundrak.com";
file = "/home/phundrak/.ssh/id_ed25519.pub";
};
modules.nh.flake = "/tank/phundrak/nixos";
}

View File

@@ -0,0 +1,3 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "askpass" ''
${pkgs.wofi}/bin/wofi -d -P -L 1 -p "$(printf $1 | sed s/://)"''

3
users/scripts/backup.nix Normal file
View File

@@ -0,0 +1,3 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "backup" ''
cp -r "$1" "$1.bak.$(date +%Y%m%d%H%M%S)"''

View File

@@ -0,0 +1,4 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "hyprland-autostart" ''
${pkgs.waybar}/bin/waybar &
${pkgs.wlsunset}/bin/wlsunset -l 48.5 -L 2.2 -d 1500''

3
users/scripts/keygen.nix Normal file
View File

@@ -0,0 +1,3 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "keygen"
"tr -cd '[:alnum:]' < /dev/urandom | fold -w 64 | head -n 1 | tr -d '\n'"

View File

@@ -0,0 +1,10 @@
{
pkgs,
emacsPackage,
...
}:
pkgs.writeShellScriptBin "launch-with-emacsclient" ''
filename="$1"
line="$2"
column="$3"
${emacsPackage}/bin/emacsclient +$line:$column "$filename"''

View File

@@ -0,0 +1,3 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "mp42webm" ''
${pkgs.ffmpeg}/bin/ffmpeg -i "$1" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "$1".webm''

18
users/scripts/scripts.nix Normal file
View File

@@ -0,0 +1,18 @@
{
config,
pkgs,
...
}: let
askpass = import ./askpass.nix {inherit pkgs;};
in [
askpass
(import ./backup.nix {inherit pkgs;})
(import ./hyprland-autostart.nix {inherit pkgs;})
(import ./keygen.nix {inherit pkgs;})
(import ./launch-with-emacsclient.nix {
inherit pkgs;
emacsPackage = config.emacsPkg;
})
(import ./mp42webm.nix {inherit pkgs;})
(import ./sshbind.nix {inherit pkgs;})
]

View File

@@ -0,0 +1,3 @@
{pkgs, ...}:
pkgs.writeShellScriptBin "sshbind" ''
ssh -L "$1:$3:$1" "$2" -N''

18
users/scripts/ytplay.nix Normal file
View File

@@ -0,0 +1,18 @@
{pkgs, ...}: let
rofi = pkgs.rofi-wayland;
in
pkgs.writeShellScriptBin "ytplay" ''
URL=$(${rofi}/bin/rofi -dmenu -i -p "Video URL")
if [ -z "$URL" ]; then
echo "You need to provide a URL"
exit 1
fi
RESOLUTION_CHOICE=$(${pkgs.yt-dlp}/bin/yt-dlp --list-formats "$URL" | \
grep -E "webm.*[0-9]+x[0-9]" | \
awk '{print $3 " " $1}' | \
sort -gu | \
${rofi}/bin/rofi -dmenu -i -p "Resolution")
mapfile -t RESOLUTION <<< "$RESOLUTION_CHOICE"
RESOLUTION_CODE=''${RESOLUTION[0]}
${pkgs.mpv}/bin/mpv --ytdl-format="''${RESOLUTION_CODE}+bestaudio/best" "$URL"
''