add os config

This commit is contained in:
ant 2025-05-21 22:58:44 +02:00
parent d8d692d313
commit 33bf5ec883
30 changed files with 271 additions and 5 deletions

View file

@ -0,0 +1,25 @@
{ lib, config, pkgs, variant, ... }: {
config = {
home.packages =
if variant == "default" then
with pkgs; [
qbittorrent
pipewire
discord
feather # monero wallet
# litecoin
librewolf
spotify
ungoogled-chromium
immich-cli
vesktop
]
else if variant == "allegro" then
with pkgs; [
aria2
pipewire
teams-for-linux
]
else [];
};
}

313
home/bar.nix Normal file
View file

@ -0,0 +1,313 @@
{ lib, config, pkgs, variant, ... }: {
home.packages = with pkgs; [
material-design-icons
jost
ncdu
playerctl
];
systemd.user.services.loopback = {
Unit = {
Description = "Simple audio loopback";
};
Install = {
WantedBy = [ ];
};
Service = {
ExecStart = "${pkgs.writeShellScript "start loopback" ''
${pkgs.pipewire}/bin/pw-loopback
''}";
};
};
programs.waybar = {
enable = true;
# systemd.enable = true;
settings = {
bar = let username = config.home.username; in {
"reload_style_on_change" = true;
layer = "top";
position = "bottom";
exclusive = true;
# height = 0;
"on-scroll-up" = "hyprctl dispatch workspace e+1";
"on-scroll-down" = "hyprctl dispatch workspace e-1";
"modules-left" = [
"group/controls"
"hyprland/submap"
"hyprland/window"
];
"modules-center" = [];
"modules-right" = [
"network"
"custom/nvidia-load"
"custom/nvidia-mem"
"group/disks"
"group/hardware"
"tray"
"clock"
];
"group/controls" = {
orientation = "inherit";
modules = [
"hyprland/workspaces"
"pulseaudio#speaker"
"pulseaudio#microphone"
"custom/loopback"
"idle_inhibitor"
"bluetooth"
"backlight"
"mpris"
];
};
"group/hardware" = {
orientation = "inherit";
modules = [ "cpu" "temperature" "memory" "battery" ];
};
"group/disks" = {
orientation = "inherit";
modules = [
"disk" # /
]
++
(if (variant == "default") then [
"disk#2"
"disk#3"
] else if (variant == "allegro") then [
"disk#home"
] else []);
};
backlight = {
device = "intel_backlight";
format = "{icon}";
# "on-click" = "${pkgs.light}/bin/light -S 100";
# "on-click-right" = "${pkgs.light}/bin/light -S 1";
"tooltip-format" = "{percent}%";
"format-icons" = [ "󰛩" "󱩎" "󱩏" "󱩐" "󱩑" "󱩒" "󱩓" "󱩔" "󱩕" "󱩖" "󰛨" ];
};
idle_inhibitor = {
format = "{icon}";
"format-icons" = {
activated = "󰈈";
deactivated = "󰈉";
};
tooltip-format-activated = "Lock when inactive is currently ON";
tooltip-format-deactivated = "Lock when inactive is currently OFF";
};
bluetooth = {
format = "󰂯";
"format-disabled" = "󰂲";
"on-click" = "${pkgs.util-linux}/bin/rfkill toggle bluetooth";
"on-click-right" = "$TERMINAL -c floating -e bluetuith";
"tooltip-format" = "{}";
};
mpris = {
format = "{player_icon} {title}";
"format-paused" = "{status_icon} <i>{title}</i>";
"player-icons" = {
default = "󰐊";
mpv = "󰐍";
spotify = "󰓇";
};
"status-icons" = {
paused = "󰏤";
};
};
disk = {
interval = 1;
format = "󰋊 {free}";
path = "/";
"on-click" = "$TERMINAL -c floating -e ${pkgs.ncdu}/bin/ncdu -x /";
};
"disk#2" = lib.attrsets.optionalAttrs (variant == "default") {
interval = 1;
format = "󰋊 {free}";
path = "/home/ant/disk1";
"on-click" = "$TERMINAL -c floating -e ${pkgs.ncdu}/bin/ncdu -x /home/${username}/disk1";
};
"disk#3" = lib.attrsets.optionalAttrs (variant == "default") {
interval = 1;
format = "󰋊 {free}";
path = "/home/ant/disk2";
"on-click" = "$TERMINAL -c floating -e ${pkgs.ncdu}/bin/ncdu -x /home/${username}/disk2";
};
"disk#home" = lib.attrsets.optionalAttrs (variant == "allegro") {
interval = 1;
format = "󰋊 {free}";
path = "/home/${username}";
"on-click" = "$TERMINAL -c floating -e ${pkgs.ncdu}/bin/ncdu -x /home/${username}";
};
memory = {
interval = 1;
format = "󰧑 {percentage:2}%";
"tooltip-format" = "{used:0.1f}G/{total:0.1f}G";
states = { low = 70; };
"on-click" = "notify-send \"$(printf \"%-20s %10s\\n\" \"COMMAND\" \"MEMORY USAGE\"; ps axo comm,rss | awk '{mem[$1]+=$2} END {for (cmd in mem) printf \"%-20s %5.2f MiB\\n\", cmd, mem[cmd]/1024}' | sort -k2nr | head -n10)\"";
};
network = {
interval = 1;
format = "󰌙";
"format-disconnected" = "󰌙";
"format-linked" = "󰛵";
"format-ethernet" = "󰓢 {bandwidthDownBytes:>} {bandwidthUpBytes:>}";
"format-wifi" = "󰖩 {bandwidthDownBytes:>} {bandwidthUpBytes:>}";
"on-click" = "wifi-toggle";
"on-right-click" = "$TERMINAL -c floating -e nmtui";
"tooltip-format-ethernet" = "{ipaddr}";
"tooltip-format-wifi" = "{ipaddr}\n{essid}\n{signalStrength}";
};
"hyprland/window" = {
format = "{}";
"on-scroll-up" = "hyprctl dispatch workspace e+1";
"on-scroll-down" = "hyprctl dispatch workspace e-1";
};
"hyprland/workspaces" = {
"on-scroll-up" = "hyprctl dispatch workspace e+1";
"on-scroll-down" = "hyprctl dispatch workspace e-1";
"all-outputs" = true;
"on-click" = "activate";
format = "{icon}";
"format-icons" = {
"1" = "0";
"2" = "1";
"3" = "2";
"4" = "3";
"5" = "4";
"6" = "5";
"7" = "6";
"8" = "7";
"9" = "8";
"10" = "9";
};
};
cpu = {
interval = 1;
format = "󰘚 {usage: 2}%";
"max-length" = 10;
"min-length" = 4;
"on-click" = "$TERMINAL -c floating -e htop";
};
temperature = {
hwmon-path = "/sys/class/hwmon/hwmon1/temp1_input";
};
battery = {
interval = 30;
states = {
warning = 30;
critical = 15;
};
"format-charging" = "󰂅 {capacity:2}%";
format = "{icon} {capacity:2}%";
"format-icons" = [ "󰂎" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹" ];
tooltip = true;
};
"custom/weather" = {
tooltip = true;
format = "{}";
"restart-interval" = 300;
exec = "~/.config/waybar/scripts/waybar-wttr.py";
"return-type" = "json";
};
tray = {
"icon-size" = 17;
# tooltip = false;
# spacing = 10;
};
clock = {
"min-length" = 10;
interval = 1;
format = "{:%d/%m %H:%M:%S}";
timezones = [ "Europe/Paris" ];
"tooltip-format" = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
actions = {
"on-scroll-up" = "tz_up";
"on-scroll-down" = "tz_down";
};
};
"pulseaudio#speaker" = {
format = "{icon} {volume}%";
tooltip = false;
"format-muted" = "󰖁";
"on-click" = "pamixer -t";
# "on-click-right" = "pamixer -t";
"on-scroll-up" = "pamixer -i 5";
"on-scroll-down" = "pamixer -d 5";
"scroll-step" = 5;
"format-icons" = {
headphone = "󰋋";
"hands-free" = "󰋋";
headset = "󰋋";
phone = "󰏲";
portable = "󰏲";
car = "󰄋";
default = [ "󰕿" "󰖀" "󰕾" ];
};
};
"pulseaudio#microphone" = {
format = "{format_source}";
tooltip = false;
"format-source" = "󰍬 {volume}%";
"format-source-muted" = "󰍭";
"on-click" = "pamixer --default-source -t";
"on-scroll-up" = "pamixer --default-source -i 5";
"on-scroll-down" = "pamixer --default-source -d 5";
"scroll-step" = 5;
};
"custom/loopback" = lib.attrsets.optionalAttrs (variant == "default") {
exec = "journalctl --user -f -u loopback | exec_on_stdin_newline 'if systemctl --user is-active --quiet loopback; then echo loopback ON; else echo loopback; fi'";
on-click = "if systemctl --user is-active --quiet loopback; then systemctl --user stop loopback; else systemctl --user start loopback; fi";
format = "{}";
};
"hyprland/submap" = {
format = "(l)ock, (d)pms, (e)xit, (s)uspend, (h)ibernate, (r)eboot, (S)hutdown";
};
"custom/nvidia-load" = {
exec = ".config/waybar/scripts/nvidia-load.py";
interval = 5;
"return-type" = "json";
format = "{}";
tooltip = "{tooltip}";
"on-click" = "$TERMINAL -c floating -e nvtop";
};
"custom/nvidia-mem" = {
exec = ".config/waybar/scripts/nvidia-mem.py";
interval = 5;
"return-type" = "json";
format = "{}";
tooltip = "{tooltip}";
"on-click" = "$TERMINAL -c floating -e nvtop";
};
};
};
style = ./waybar.css;
};
}

35
home/bin/dark.fish Executable file
View file

@ -0,0 +1,35 @@
if test -e $XDG_STATE_HOME/darkmode
rm $XDG_STATE_HOME/darkmode
set LIGHT 1
else
echo > $XDG_STATE_HOME/darkmode
set LIGHT 0
end
if test $LIGHT = 1;
notify-send "Light mode"
rm -f ~/.config/kitty/colors.conf
ln -rs ~/.config/kitty/light.conf ~/.config/kitty/colors.conf
kill -SIGUSR1 $(pgrep kitty) # reload kitty config
rm -f ~/.local/share/bg/*
ln -rs ~/.local/share/bg-light.* ~/.local/share/bg/
hyprctl reload
rm -f ~/.config/rofi/colors-current.rasi
ln -rs ~/.config/rofi/colors-light.rasi ~/.config/rofi/colors-current.rasi
else
notify-send "Dark mode"
rm -f ~/.config/kitty/colors.conf
ln -rs ~/.config/kitty/dark.conf ~/.config/kitty/colors.conf
kill -SIGUSR1 $(pgrep kitty) # reload kitty config
rm -f ~/.local/share/bg/*
ln -rs ~/.local/share/bg-dark.* ~/.local/share/bg/
hyprctl reload
rm -f ~/.config/rofi/colors-current.rasi
ln -rs ~/.config/rofi/colors-dark.rasi ~/.config/rofi/colors-current.rasi
end

46
home/bin/dark.nix Executable file
View file

@ -0,0 +1,46 @@
{ pkgs, ... } :
pkgs.writers.writeFish "dark" ''
if test -e $XDG_STATE_HOME/darkmode
rm $XDG_STATE_HOME/darkmode
set LIGHT 1
else
echo > $XDG_STATE_HOME/darkmode
set LIGHT 0
end
if test $LIGHT = 1;
${pkgs.libnotify}/bin/notify-send "Light mode"
rm -f ~/.config/kitty/colors.conf
ln -rs ~/.config/kitty/light.conf ~/.config/kitty/colors.conf
kill -SIGUSR1 $(pgrep kitty) # reload kitty config
kill -SIGUSR1 $(pgrep st) # reload st config
rm -f ~/.local/share/bg/*
ln -rs ~/.local/share/bg-light.* ~/.local/share/bg/
${pkgs.hyprland}/bin/hyprctl reload
rm -f ~/.config/rofi/colors-current.rasi
ln -rs ~/.config/rofi/colors-light.rasi ~/.config/rofi/colors-current.rasi
${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'"
else
${pkgs.libnotify}/bin/notify-send "Dark mode"
rm -f ~/.config/kitty/colors.conf
ln -rs ~/.config/kitty/dark.conf ~/.config/kitty/colors.conf
kill -SIGUSR1 $(pgrep kitty) # reload kitty config
kill -SIGUSR1 $(pgrep st) # reload st config
rm -f ~/.local/share/bg/*
ln -rs ~/.local/share/bg-dark.* ~/.local/share/bg/
${pkgs.hyprland}/bin/hyprctl reload
rm -f ~/.config/rofi/colors-current.rasi
ln -rs ~/.config/rofi/colors-dark.rasi ~/.config/rofi/colors-current.rasi
${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
end
''

72
home/bin/notifications Executable file
View file

@ -0,0 +1,72 @@
#!/bin/env python
import os, sys
# take at most n elements
def take(it, n):
for i, x in enumerate(it):
if i == n:
break
yield x
# above an example of the format
def parse(s):
def split():
i, j = 0, 0
level = 0
while i < len(s):
if s[i] == '{':
if level == 0:
j = i
level += 1
elif s[i] == '}':
level -= 1
if level == 0:
yield s[j:i+1]
i += 1
def section_to_dict(section):
d = {}
for line in section.split('\n'):
line_stripped = line.strip()
if ':' in line_stripped:
k, v = line_stripped.split(':', 1)
if k in ['appname', 'summary', 'body', 'urgency']:
if k in ['appname', 'summary', 'body']:
d[k] = v.strip().strip("'")
if k == 'urgency':
d[k] = v.strip()
return d
return map(section_to_dict, reversed(list(split())))
def pretty_print(notification):
colors_from_urgency = { # posix escape codes
"NORMAL": (2, None),
"URGENT": (1, 7),
}
def enclose_color(s, fg, bg):
def color_code(c):
if c is not None:
return f"\033[38;5;{c}m"
return ""
return f"{color_code(fg)}{color_code(bg)}{s}\033[0m"
#]] nvim's python parser if fucked without this
fg, bg = colors_from_urgency[notification['urgency']]
return f"{enclose_color(notification['summary'], fg, bg)} :: {notification['body']}"
with open(os.path.expanduser("~/.local/state/notifications-history"), "r") as f:
s = f.read()
notifications = parse(s)
if len(sys.argv) == 2:
try:
notifications = take(notifications, int(sys.argv[1]))
except ValueError as e:
print("Argument must be the number of notifications to show", file=sys.stderr)
raise e
for notification in notifications:
print(pretty_print(notification))

3
home/bin/ocrzone Executable file
View file

@ -0,0 +1,3 @@
f=$(mktemp --suffix .png)
${pkgs.sway-contrib.grimshot}/bin/grimshot save area $f
${pkgs.tesseract}/bin/tesseract -l fra "$f" - | wl-copy

19
home/bin/quickrun.fish Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env nix-shell
#!nix-shell -i fish
#!nix-shell -p fish gcc
set file (realpath $argv[1])
set workdir (mktemp -d)
cd $workdir
set extension (string match -r '\.([a-z]+)$' $file | head -n 1)
switch $extension
case ".c"
gcc -o a.out $file
./a.out
case ".py"
python $file
end

1
home/bin/runmenu Executable file
View file

@ -0,0 +1 @@
${pkgs.rofi-wayland}/bin/rofi -matching normal -sort -show run

47
home/bin/screenshot.nix Executable file
View file

@ -0,0 +1,47 @@
{ pkgs, ... }:
pkgs.writers.writePython3 "screenshot" { flakeIgnore = [ "E501" ];} ''
import subprocess
import re
options = """\
a selected area (copy)
current window (copy)
full screen (copy)
a selected area
current window
full screen
viewer
"""
cmd = '${pkgs.rofi-wayland}/bin/rofi -dmenu -location 2 -l 7 -i -p "Screenshot which area?"'
result = subprocess.run(cmd,
input=options,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True,
text=True)
if result.returncode != 0:
exit(1)
choice = result.stdout.strip()
cmd = "${pkgs.pkgs.sway-contrib.grimshot}/bin/grimshot "
if choice == "viewer":
filename = subprocess.getoutput("mktemp")
cmd += f"save area {filename}"
else:
cmd += "copy " if re.match(".*(copy)", choice) else "save "
for k, v in {"a selected area.*": "area ",
"current window.*": "active ",
"current screen.*": "output ",
"all screens.*": "screen "}.items():
if re.match(k, choice):
cmd += v
subprocess.call(cmd,
shell=True)
if choice == "viewer":
subprocess.run(f"nsxiv -b {filename}", shell=True)
''

6
home/bin/window_dir Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
PID=$(hyprctl activewindow | grep pid | cut -d' ' -f 2)
PID=$(echo $(ps --ppid $PID -o pid | tail -n1))
cwd=$(readlink /proc/"$PID"/cwd)
echo "$cwd"

29
home/bin/wl Executable file
View file

@ -0,0 +1,29 @@
#!/bin/sh
cd ~
# Log WLR errors and logs to the hyprland log. Recommended
export HYPRLAND_LOG_WLR=1
# Tell XWayland to use a cursor theme
export XCURSOR_THEME=Bibata-Modern-Classic
# Set a cursor size
export XCURSOR_SIZE=24
# Example IME Support: fcitx
# export GTK_IM_MODULE=fcitx
# export QT_IM_MODULE=fcitx
# export XMODIFIERS=@im=fcitx
# export SDL_IM_MODULE=fcitx
# export GLFW_IM_MODULE=ibus
export WLR_NO_HARDWARE_CURSORS=1
if lsmod | grep nvidia; then
export LIBVA_DRIVER_NAME=nvidia
export XDG_SESSION_TYPE=wayland
# export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia
fi
exec Hyprland

View file

@ -0,0 +1,17 @@
[dmenu]
dmenu_command = rofi -i
[dmenu_passphrase]
nf = #222222
nb = #222222
rofi_obscure = True
[database]
database_1 = ~/.local/share/passdb/passdb.kdbx
keyfile_1 =
pw_cache_period_min = 360
autotype_default = {USERNAME}{TAB}{PASSWORD}
editor = nvim
terminal = alacritty
type_library = wtype

View file

@ -0,0 +1,21 @@
background #0d0f18
foreground #fffaf3
cursor #ff0017
selection_background #002a3a
color0 #222222
color8 #444444
color1 #ff000f
color9 #ff273f
color2 #8ce00a
color10 #abe05a
color3 #ffb900
color11 #ffd141
color4 #008df8
color12 #0092ff
color5 #6c43a5
color13 #9a5feb
color6 #00d7eb
color14 #67ffef
color7 #ffffff
color15 #ffffff
selection_foreground #0d0f18

View file

@ -0,0 +1,21 @@
background #f8f8f8
foreground #2a2b33
cursor #bbbbbb
selection_background #e5e5e6
color0 #000000
color8 #000000
color1 #de3d35
color9 #de3d35
color2 #3e953a
color10 #3e953a
color3 #d2b67b
color11 #d2b67b
color4 #2f5af3
color12 #2f5af3
color5 #950095
color13 #a00095
color6 #3e953a
color14 #3e953a
color7 #bbbbbb
color15 #ffffff
selection_foreground #2a2b33

View file

@ -0,0 +1,8 @@
* {
accent: #53BDFA;
warning: #EA6C73;
bg: #0A0E14;
fg: #B3B1AD;
alternate: #01060E;
transparent: #00000000;
}

View file

@ -0,0 +1,8 @@
* {
accent: #4196df;
warning: #FF7383;
bg: #F8F9FA;
fg: #26292f;
alternate: #eeeeee;
transparent: #00000000;
}

View file

@ -0,0 +1 @@
@theme "theme.rasi"

View file

@ -0,0 +1,122 @@
/**
* A floating box version of the paper theme.
*
* User: Qball
* Copyright: Dave Davenport
*/
@import "colors-current.rasi"
* {
spacing: 0;
background-color: @transparent;
border-color: @fg;
anchor: north;
location: center;
text-color: @fg;
}
window {
transparency: "real";
background-color: @transparent;
border: 0;
padding: 0% 0% 1em 0%;
x-offset: 0;
y-offset: -10%;
}
mainbox {
padding: 0px;
border: 0;
spacing: 1%;
}
inputbar {
spacing: 0;
border: 0;
padding: 0.4em 0.2em;
background-color: @bg;
index: 0;
children: [ prompt,textbox-prompt-colon,entry,case-indicator ];
}
textbox-prompt-colon {
expand: false;
str: ":";
margin: 0px 0.3em 0em 0em ;
}
prompt {
text-color: inherit;
}
entry {
text-color: inherit;
}
listview {
border: 0;
reverse: false;
columns: 1;
background-color: @bg;
/* fixed-height: false; */
/* dynamic: true; */
}
element {
border: 0;
padding: 2px;
highlight: bold ;
}
element-text {
background-color: inherit;
text-color: inherit;
}
element {
text-color: @fg;
background-color: @transparent;
}
element normal.urgent {
text-color: @warning;
}
element selected {
text-color: @bg;
background-color: @accent;
}
element selected.urgent {
text-color: @warning;
}
element alternate {
background-color: @alternate;
}
element alternate.urgent {
text-color: @warning;
}
scrollbar {
border: 0;
padding: 0;
}
mode-switcher {
border: 1px;
padding: 0.4em 1em;
background-color: @alternate;
index: 10;
}
message {
border: 1px;
padding: 1em;
background-color: @bg;
text-color: @fg;
}
textbox normal {
text-color: @fg;
padding: 0;
border: 0;
}
error-message {
border: 1px;
padding: 0.4em;
background-color: #FF8888;
text-color: @fg;
}

135
home/fish.nix Normal file
View file

@ -0,0 +1,135 @@
{ lib, pkgs, variant, ... }:
{
programs.fish = {
enable = true;
loginShellInit = ''
set -gx fish_greeting
'' +
(if variant == "allegro" then ''
source ${pkgs.nix}/etc/profile.d/nix.fish
if test $(tty) = /dev/tty2
nixGLIntel Hyprland
end
'' else "");
interactiveShellInit = ''
set -gx fish_greeting
set -x DIRENV_LOG_FORMAT ""
bind \ef forward-word
bind \eF accept-autosuggestion
'';
functions = {
# use "e" to open the text editor. if e job is paused, return to it
e.body = ''
jobs -c | grep $EDITOR \
|| $EDITOR $argv \
&& fg 2>/dev/null; commandline -f repaint
'';
lfcd.body = ''
set tmp (mktemp)
# `command` is needed in case `lfcd` is aliased to `lf`
command lf -last-dir-path=$tmp $argv
if test -f "$tmp"
set dir (cat $tmp)
rm -f $tmp
if test -d "$dir"
if test "$dir" != (pwd)
cd $dir
end
end
end
'';
fish_prompt.body = ''
set -l last_pipestatus $pipestatus
set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
set -l normal (set_color normal)
set -q fish_color_status
or set -g fish_color_status red
# Color the prompt differently when we're root
set -l color_cwd $fish_color_cwd
set -l suffix '>'
if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
end
set suffix '#'
end
# Write pipestatus
# If the status was carried over (if no command is issued or if `set` leaves the status untouched), don't bold it.
set -l bold_flag --bold
set -q __fish_prompt_status_generation; or set -g __fish_prompt_status_generation $status_generation
if test $__fish_prompt_status_generation = $status_generation
set bold_flag
end
set __fish_prompt_status_generation $status_generation
set -l status_color (set_color $fish_color_status)
set -l statusb_color (set_color $bold_flag $fish_color_status)
set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)
# direnv status TODO fix this if condition
# if which direnv >/dev/null
set -l direnv_status (direnv status | grep -q "Found RC path" && echo " direnv")
# end
if set -q SSH_CLIENT
set login_str (prompt_login)
else
set login_str ""
end
# echo -n -s (prompt_login)' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) \
echo -n -s $login_str " " (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) \
(set_color -i yellow) $direnv_status $normal " "$prompt_status " "$suffix " "
'';
# run $argv when a file tracked by git is updated.
gitentr.body = ''
${pkgs.git}/bin/git ls-tree -r HEAD --name-only | ${pkgs.entr}/bin/entr $argv
'';
ffsum.body = ''
${pkgs.ffmpeg}/bin/ffmpeg -hide_banner -v error $argv[..-2] -i $argv[-1] -map 0:v -f md5 -
'';
};
shellAliases = {
ls = "ls -hN --color=auto --group-directories-first";
grep = "grep --color=auto";
diff = "diff --color=auto";
bt = "bluetuith";
hm = "home-manager";
hms = "nh home switch ~/home-manager";
dev = "nix develop -c fish";
gparted = "nix-shell -p pkgs.gparted --run 'sudo -E gparted'";
ns = "nix-shell";
nsp = "nix shell nixpkgs#";
f = "lfcd";
sxiv = "nsxiv";
del = "trash -rf";
rsyncp = "rsync --info=progress2 --no-inc-recursive";
ffmpeg = "ffmpeg -hide_banner";
ffprobe = "ffprobe -hide_banner";
co = "git checkout";
stash = "git stash";
popstash = "git stash pop";
pull = "git pull";
m = "meson";
n = "ninja";
gdb_asan = "gdb -tui -ex='break __asan::ReportGenericError'";
gdb_ubsan = "gdb -tui -ex='break __ubsan::ScopedReport::~ScopedReport'";
};
plugins = [
{
name = "fish-lf-icons";
src = pkgs.fetchFromGitHub {
owner = "joshmedeski";
repo = "fish-lf-icons";
rev = "d1c47b2088e0ffd95766b61d2455514274865b4f";
sha256 = "sha256-6po/PYvq4t0K8Jq5/t5hXPLn80iyl3Ymx2Whme/20kc=";
};
}
];
};
}

13
home/gaming.nix Normal file
View file

@ -0,0 +1,13 @@
{ lib, config, pkgs, variant, ... }: {
nixpkgs.config = { allowUnfree = true; };
home.packages = if variant == "default" then with pkgs; [
lutris
prismlauncher
gamemode
mangohud
heroic
steam
]
else [];
}

63
home/gui-software.nix Normal file
View file

@ -0,0 +1,63 @@
{ lib, config, variant, pkgs, pkgs-unstable, ... }:
{
home.packages = (with pkgs; [
nsxiv
libreoffice
keepassxc
thunderbird
vieb
]) ++ (if variant != "allegro" then [ pkgs.warpinator ] else []);
programs.mpv = {
enable = true;
config = {
keep-open = "yes";
osd-bar = "no";
};
scripts = with pkgs.mpvScripts; [
uosc
thumbfast
mpris
];
};
# programs.chromium = {
# enable = true;
# package = pkgs.ungoogled-chromium;
# dictioaries = [
# pkgs.hunspellDictsChromium.en_US
# pkgs.hunspellDictsChromium.fr_FR
# ];
# extensions = [
# { id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; } # ublock origin
# { id = "hfjbmagddngcpeloejdejnfgbamkjaeg"; } # vimium C
# ];
# };
programs.firefox.enable = true;
programs.zathura.enable = true;
xdg.mimeApps.defaultApplications = {
"application/pdf" = "zathura.desktop";
"WebBrowser" = "firefox.desktop";
"x-scheme-handler/http" = "firefox.desktop";
"x-scheme-handler/https" = "firefox.desktop";
"x-scheme-handler/chrome" = "firefox.desktop";
"text/html" = "firefox.desktop";
"application/x-extension-htm" = "firefox.desktop";
"application/x-extension-html" = "firefox.desktop";
"application/x-extension-shtml" = "firefox.desktop";
"application/xhtml+xml" = "firefox.desktop";
"application/x-extension-xhtml" = "firefox.desktop";
"application/x-extension-xht" = "firefox.desktop";
"image/webp" = "nsxiv.desktop";
"image/jpeg" = "nsxiv.desktop";
"image/png" = "nsxiv.desktop";
"image/gif" = "nsxiv.desktop";
"image/bmp" = "nsxiv.desktop";
"image/svg+xml" = "nsxiv.desktop";
};
home.sessionVariables = { BROWSER = "firefox"; };
}

205
home/home.nix Normal file
View file

@ -0,0 +1,205 @@
{ inputs, config, lib, pkgs, variant, ... }:
{
imports = [
./lf.nix
./fish.nix
./terminal-software.nix
] ++ (if variant != "hs" then
[
./ui.nix
./gui-software.nix
./gaming.nix
./additional-software.nix
]
else []);
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.homeDirectory = "/home/${config.home.username}";
home.stateVersion = "23.05"; # Please read the comment before changing.
home.packages = with pkgs; [
python3
python3Packages.virtualenv
python3Packages.numpy
python3Packages.matplotlib
# bluez
go-mtpfs
xdg-utils
davfs2
sshfs
ghc
yt-dlp
aria2
yazi
];
home.file = {
".config/kitty/light.conf".source = dotfiles/kitty/light.conf;
".config/kitty/dark.conf".source = dotfiles/kitty/dark.conf;
".config/rofi/colors-dark.rasi".source = dotfiles/rofi/colors-dark.rasi;
".config/rofi/colors-light.rasi".source = dotfiles/rofi/colors-light.rasi;
".config/rofi/theme.rasi".source = dotfiles/rofi/theme.rasi;
".config/keepmenu/config.ini".source = dotfiles/keepmenu.ini;
".bin/runmenu".source = pkgs.writers.writeBash "runmenu" ''
${config.programs.rofi.package}/bin/rofi -matching normal -sort -show run
'';
".bin/notifications".source = bin/notifications;
".bin/window_dir".source = pkgs.writers.writeBash "window_dir" ''
PID=$(${pkgs.hyprland}/bin/hyprctl activewindow | grep pid | cut -d' ' -f 2)
PID=$(echo $(ps --ppid $PID -o pid | tail -n1))
cwd=$(readlink /proc/"$PID"/cwd)
echo "$cwd"
'';
".bin/exec_on_stdin_newline".source = pkgs.writers.writePython3 "exec_on_stdin_newline" {} ''
# run command whjen a newline is added to stdin
import subprocess
from sys import stdin, argv
cmd = argv[1:]
subprocess.call(cmd, shell=True)
while stdin.readline():
subprocess.call(cmd, shell=True)
'';
".bin/screenshot".source = (import ./bin/screenshot.nix) pkgs;
".bin/ocrzone".source = pkgs.writers.writeBash "ocrzone" ''
${pkgs.pkgs.sway-contrib.grimshot}/bin/grimshot save area - | \
${pkgs.tesseract}/bin/tesseract -l fra - - | \
${pkgs.wl-clipboard}/bin/wl-copy
'';
".bin/wifi-toggle".source = pkgs.writers.writeBash "wifi-toggle" ''
if [[ $(nmcli radio wifi) == "enabled" ]]; then
nmcli radio wifi off
else
nmcli radio wifi on
fi
'';
".bin/rofi-udisk".source = pkgs.writers.writeBash "rofi-udisk" ''
device=$(${pkgs.udiskie}/bin/udiskie-info -a -o "{ui_label} {in_use}" -f is_filesystem | \
${pkgs.gnused}/bin/sed 's/True$/[Mounted]/' | \
${pkgs.gnused}/bin/sed 's/False$//' | \
${config.programs.rofi.package}/bin/rofi -dmenu | \
${pkgs.coreutils}/bin/cut -d':' -f1)
if [ -n "$device" ] ; then
if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep "$device" ; then
${pkgs.libnotify}/bin/notify-send "Unmounting $device..."
output=$(${pkgs.udisks}/bin/udisksctl unmount -b $device 2>&1)
if [ $? -eq 0 ] ; then
${pkgs.libnotify}/bin/notify-send "Device successfully unmounted."
else
${pkgs.libnotify}/bin/notify-send "Failed to unmount device" "$output"
fi
else
${pkgs.libnotify}/bin/notify-send "Mounting $device..."
output=$(${pkgs.udisks}/bin/udisksctl mount -b $device 2>&1)
if [ $? -eq 0 ] ; then
${pkgs.libnotify}/bin/notify-send "Device successfully mounted."
else
${pkgs.libnotify}/bin/notify-send "Failed to mount device" "$output"
fi
fi
fi
'';
".bin/mount-android".source = pkgs.writers.writeBash "mount-android" ''
if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep $(realpath ~/android); then
umount $(realpath ~/android)
${pkgs.libnotify}/bin/notify-send "Android unmounted"
elif ${pkgs.simple-mtpfs}/bin/simple-mtpfs $(realpath ~/android); then
${pkgs.libnotify}/bin/notify-send "Android mounted in ~/android"
else
${pkgs.libnotify}/bin/notify-send "Can't find Android device"
fi
'';
".bin/dark".source = (import ./bin/dark.nix) pkgs; # deprecated, prefer darkman
};
home.sessionPath = [
"$HOME/.local/bin"
"$HOME/.bin"
];
home.sessionVariables = {
GOPATH = "${config.home.homeDirectory}/.local/share/go";
GOMODCACHE = "${config.home.homeDirectory}/.cache/go/pkg/mod";
NIXOS_OZONE_WL = "1";
GDK_BACKEND = "wayland,x11";
QT_QPA_PLATFORM = "wayland;xcb";
CLUTTER_BACKEND = "wayland";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
XDG_SESSION_DESKTOP = "Hyprland";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
WLR_NO_HARDWARE_CURSORS = "0";
XCURSOR_SIZE = "24";
CCACHE_MAXSIZE = "40Gi";
} // (if variant == "allegro" then {
TMPDIR = "/home/${config.home.username}/tmp";
GSETTINGS_SCHEMA_DIR = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas-47.1/glib-2.0/schemas";
} else {});
home.keyboard.options = [
"caps:escape"
];
xdg = {
enable = true;
systemDirs.data = [ "${config.home.homeDirectory}/.local/share" ];
userDirs = {
enable = true;
createDirectories = false;
download = "${config.home.homeDirectory}/downloads";
templates = "${config.home.homeDirectory}/templates";
desktop = "${config.home.homeDirectory}";
documents = "${config.home.homeDirectory}";
music = "${config.home.homeDirectory}";
pictures = "${config.home.homeDirectory}";
publicShare = "${config.home.homeDirectory}";
videos = "${config.home.homeDirectory}";
};
mimeApps = {
enable = true;
};
};
services.darkman = {
enable = true;
lightModeScripts = {
rm-file-indicator = "rm $XDG_STATE_HOME/darkmode";
};
darkModeScripts = {
set-file-indicator = "touch $XDG_STATE_HOME/darkmode";
};
};
services.gnome-keyring.enable = true;
services.syncthing.enable = variant != "hs";
services.kdeconnect.enable = variant != "allegro";
programs.home-manager.enable = true;
programs.nh = {
enable = true;
flake = "${config.home.homeDirectory}/home-manager";
};
}

431
home/hyprland.nix Normal file
View file

@ -0,0 +1,431 @@
{ config, lib, pkgs, pkgs-unstable, pkgs-24_05, variant, ... }: {
xdg = lib.attrsets.optionalAttrs (variant == "allegro") {
configFile."systemd/user/dbus-broker.service".source =
"${pkgs.dbus-broker}/share/systemd/user/dbus-broker.service";
configFile."systemd/user/at-spi-dbus-bus.service".source =
"${pkgs.at-spi2-core}/lib/systemd/user/at-spi-dbus-bus.service";
dataFile."dbus-1/services/org.a11y.Bus.service".source =
"${pkgs.at-spi2-core}/share/dbus-1/services/org.a11y.Bus.service";
dataFile."dbus-1/accessibility-services/org.a11y.atspi.Registry.service".source =
"${pkgs.at-spi2-core}/share/dbus-1/accessibility-services/org.a11y.atspi.Registry.service";
configFile."systemd/user/xdg-desktop-portal.service".source =
"${pkgs.xdg-desktop-portal}/lib/systemd/user/xdg-desktop-portal.service";
configFile."systemd/user/xdg-desktop-portal-gtk.service".source =
"${pkgs.xdg-desktop-portal-gtk}/lib/systemd/user/xdg-desktop-portal-gtk.service";
configFile."systemd/user/xdg-desktop-portal-hyprland.service".source =
"${pkgs.xdg-desktop-portal-hyprland}/lib/systemd/user/xdg-desktop-portal-hyprland.service";
dataFile."share/dbus-1/services/org.freedesktop.impl.portal.desktop.hyprland.service".source =
"${pkgs.xdg-desktop-portal-hyprland}share/dbus-1/services/org.freedesktop.impl.portal.desktop.hyprland.service";
dataFile."systemd/user/pipewire.service".source =
"${pkgs.pipewire}/share/systemd/user/pipewire.service";
dataFile."systemd/user/pipewire-pulse.service".source =
"${pkgs.pipewire}/share/systemd/user/pipewire-pulse.service";
dataFile."systemd/user/filter-chain.service".source =
"${pkgs.pipewire}/share/systemd/user/filter-chain.service";
dataFile."systemd/user/pipewire.socket".source =
"${pkgs.pipewire}/share/systemd/user/pipewire.socket";
dataFile."systemd/user/pipewire-pulse.socket".source =
"${pkgs.pipewire}/share/systemd/user/pipewire-pulse.socket";
portal = {
enable = true;
# xdgOpenUsePortal = true;
extraPortals =
[ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-hyprland ];
configPackages =
[ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-hyprland ];
# config.common.default = "*";
config = {
hyprland = { default = [ "gtk,hyprland" ]; };
common = { default = [ "gtk,hyprland" ]; };
};
};
};
home.sessionVariables = {
NIXOS_OZONE_WL = "1";
GDK_BACKEND = "wayland,x11";
QT_QPA_PLATFORM = "wayland;xcb";
CLUTTER_BACKEND = "wayland";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_TYPE = "wayland";
XDG_SESSION_DESKTOP = "Hyprland";
QT_AUTO_SCREEN_SCALE_FACTOR = "1";
XCURSOR_SIZE = "24";
DXVK_FILTER_DEVICE_NAME = "NVIDIA";
SYSTEMD_PAGER = "";
};
wayland.windowManager.hyprland = {
enable = true;
systemd.enable = true;
xwayland.enable = true;
settings = {
debug = {
disable_logs = false;
};
input = {
kb_layout = "fr";
kb_variant = "";
kb_model = "pc105";
kb_options = "ctrl:nocaps";
kb_rules = "";
touchpad = {
natural_scroll = "no";
};
sensitivity = 0.0;
numlock_by_default = true;
repeat_delay = 200;
repeat_rate = 50;
force_no_accel = true;
follow_mouse = 2;
};
general = {
gaps_in = 2;
gaps_out = 2;
border_size = 0;
"col.active_border" = "rgb(000000)";
"col.inactive_border" = "rgba(00000000)";
layout = "dwindle";
};
decoration = {
blur = {
enabled = true;
};
rounding = 5;
};
animations = {
enabled = true;
bezier = "myBezier, 0, 0, .58, 1";
animation = "global, 1, 1, myBezier";
};
dwindle = {
pseudotile = true;
preserve_split = true;
force_split = 2;
# no_gaps_when_only = true;
};
gestures = {
workspace_swipe = "off";
};
misc = {
disable_hyprland_logo = true;
enable_swallow = true;
mouse_move_enables_dpms = true;
key_press_enables_dpms = true;
swallow_regex = "^st-256color$";
# swallow_regex = "^(Alacritty)(.*)$";
# swallow_regex = "^(kitty)(.*)$";
};
layerrule = "blur, waybar";
"$mod" = "SUPER";
bind =
let floating_terminal = "$TERMINAL -c floating"; in
[
"$mod, q, killactive"
"$mod SHIFT, q, exec, kill -9 $(hyprctl activewindow | grep pid | grep -E -o '[0-9]+$')"
"$mod, a, togglefloating"
"$mod SHIFT, a, workspaceopt, allfloat"
"$mod, Tab, togglesplit"
"$mod, P, pseudo"
"$mod, f, fullscreen"
"$mod, Return, exec, $TERMINAL"
"$mod SHIFT, e, exec, rofimoji --action copy"
"$mod SHIFT, g, exec, rofimoji --action copy --files greek"
"$mod SHIFT, b, exec, rofimoji --action copy --files arrows block_elements"
"$mod, c, exec, rofi -show calc -modi calc -no-show-match -no-sort"
"$mod, e, exec, $TERMINAL -e lf"
"$mod SHIFT, Return, exec, $TERMINAL --working-directory \"$(window_dir)\""
"$mod, w, exec, $BROWSER"
"$mod SHIFT, w, exec, firefox --private-window"
"$mod SHIFT, s, exec, TMP=$(rofi -dmenu -p \"nix search\" -l 0) && $BROWSER \"https://search.nixos.org/packages?channel=unstable&query=$TMP\""
# "$mod SHIFT, e, exec, $(rofi -dmenu -p \"command\" -l 0)"
"$mod, m, exec, ${floating_terminal} -e pulsemixer"
"$mod, d, exec, ~/.bin/runmenu"
"$mod, x, exec, keepmenu"
"$mod, z, exec, tmux new -spopup_terminal -d; ${floating_terminal} -e tmux a -t popup_terminal"
"$mod, f11, exec, ocrzone"
"$mod, f12, exec, ${floating_terminal} -e nmtui"
"$mod, f2, exec, darkman toggle"
"$mod, f3, exec, hyprctl reload"
"$mod, f4, exec, rofi-udisk"
"$mod, f5, exec, mount-android"
",XF86AudioRaiseVolume, exec, pamixer -i 5"
",XF86AudioLowerVolume, exec, pamixer -d 5"
",XF86AudioMute, exec, pamixer -t"
",XF86AudioMicMute, exec, pamixer -t --default-source"
",XF86AudioPlay, exec, playerctl play-pause"
",XF86AudioNext, exec, playerctl next"
",XF86AudioPrev, exec, playerctl previous"
",XF86MonBrightnessUp, exec, light -A 10"
",XF86MonBrightnessDown, exec, light -U 10"
"$mod,Print, exec, screenshot"
"$mod, agrave, submap, power"
"$mod, h, movefocus, l"
"$mod, l, movefocus, r"
"$mod, k, movefocus, u"
"$mod, j, movefocus, d"
"$mod, Left, movefocus, l"
"$mod, Right, movefocus, r"
"$mod, Up, movefocus, u"
"$mod, Down, movefocus, d"
"$mod SHIFT, h, movewindow, l"
"$mod SHIFT, l, movewindow, r"
"$mod SHIFT, k, movewindow, u"
"$mod SHIFT, j, movewindow, d"
# "$mod SHIFT, Left, movewindow, l"
# "$mod SHIFT, Right, movewindow, r"
# "$mod SHIFT, Up, movewindow, u"
# "$mod SHIFT, Down, movewindow, d"
"$mod, twosuperior, workspace, 1"
"$mod, ampersand, workspace, 2"
"$mod, eacute, workspace, 3"
"$mod, quotedbl, workspace, 4"
"$mod, apostrophe, workspace, 5"
"$mod, parenleft, workspace, 6"
"$mod, minus, workspace, 7"
"$mod, egrave, workspace, 8"
"$mod, underscore, workspace, 9"
"$mod, ccedilla, workspace, 10"
"$mod, rarenright, workspace, 11"
"$mod SHIFT, twosuperior, movetoworkspacesilent, 1"
"$mod SHIFT, ampersand, movetoworkspacesilent, 2"
"$mod SHIFT, eacute, movetoworkspacesilent, 3"
"$mod SHIFT, quotedbl, movetoworkspacesilent, 4"
"$mod SHIFT, apostrophe, movetoworkspacesilent, 5"
"$mod SHIFT, parenleft, movetoworkspacesilent, 6"
"$mod SHIFT, minus, movetoworkspacesilent, 7"
"$mod SHIFT, egrave, movetoworkspacesilent, 8"
"$mod SHIFT, underscore, movetoworkspacesilent, 9"
"$mod SHIFT, ccedilla, movetoworkspacesilent, 10"
"$mod SHIFT, rarenright, movetoworkspacesilent, 11"
"$mod ALT, twosuperior, focusworkspaceoncurrentmonitor, 1"
"$mod ALT, ampersand, focusworkspaceoncurrentmonitor, 2"
"$mod ALT, eacute, focusworkspaceoncurrentmonitor, 3"
"$mod ALT, quotedbl, focusworkspaceoncurrentmonitor, 4"
"$mod ALT, apostrophe, focusworkspaceoncurrentmonitor, 5"
"$mod ALT, parenleft, focusworkspaceoncurrentmonitor, 6"
"$mod ALT, minus, focusworkspaceoncurrentmonitor, 7"
"$mod ALT, egrave, focusworkspaceoncurrentmonitor, 8"
"$mod ALT, underscore, focusworkspaceoncurrentmonitor, 9"
"$mod ALT, ccedilla, focusworkspaceoncurrentmonitor, 10"
"$mod ALT, rarenright, focusworkspaceoncurrentmonitor, 11"
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
binde = [
"$mod CTRL SHIFT, h, moveactive, -60 0"
"$mod CTRL SHIFT, l, moveactive, 60 0"
"$mod CTRL SHIFT, k, moveactive, 0 -60"
"$mod CTRL SHIFT, j, moveactive, 0 60"
"$mod CTRL, h, resizeactive, -60 0"
"$mod CTRL, l, resizeactive, 60 0"
"$mod CTRL, k, resizeactive, 0 -60"
"$mod CTRL, j, resizeactive, 0 60"
"$mod SHIFT, Left, moveactive, -60 0"
"$mod SHIFT, Right, moveactive, 60 0"
"$mod SHIFT, Up, moveactive, 0 -60"
"$mod SHIFT, Down, moveactive, 0 60"
"$mod CTRL, Left, resizeactive, -60 0"
"$mod CTRL, Right, resizeactive, 60 0"
"$mod CTRL, Up, resizeactive, 0 -60"
"$mod CTRL, Down, resizeactive, 0 60"
];
# plugin:hyprfocus {
# enabled = no;
#
# keyboard_focus_animation = shrink
# mouse_focus_animation = flash
#
# bezier = bezIn, 0.5,0.0,1.0,0.5
# bezier = bezOut, 0.0,0.5,0.5,1.0
#
# flash {
# flash_opacity = 0.7
#
# in_bezier = bezIn
# in_speed = 0.5
#
# out_bezier = bezOut
# out_speed = 3
# }
#
# shrink {
# shrink_percentage = 0.8
#
# in_bezier = bezIn
# in_speed = 0.5
#
# out_bezier = bezOut
# out_speed = 3
# }
# }
# "plugin:hyprfocus" = {
# enabled = true;
# keyboard_focus_animation = "flash";
# mouse_focus_animation = "nothing";
# bezier = "bezIn, 0.5,0.0,1.0,0.5";
# # bezier = "bezOut, 0.0,0.5,0.5,1.0";
# flash = {
# shrink_percentage = 0.8;
# in_bezier = "bezIn";
# in_speed = 0.5;
# out_bezier = "bezIn";
# out_speed = 3;
# };
# shrink = {
# shrink_percentage = 0.8;
# in_bezier = "bezIn";
# in_speed = 0.5;
# out_bezier = "bezIn";
# out_speed = 3;
# };
# };
};
extraConfig =
let
swaybgScript = (pkgs.writers.writeFish "display-background" ''
# find background image: only file in ~/.local/share/bg
set -l bg (find ~/.local/share/bg -type l)
${pkgs.swaybg}/bin/swaybg -m fill -i $bg
# set background
# ${pkgs.nix}/bin/nix-shell \
# -p pkgs.rubyPackages.gdk_pixbuf2 \
# --run "${pkgs.swaybg}/bin/swaybg -m fill -i $bg"
'');
monitors = if (variant == "default") then ''
monitor=,highrr,auto,1
''
else if variant == "moon" then ''
monitor=,preferred,auto,1
monitor=HDMI-1, 1920x1080, auto, 1, mirror, eDP-1
monitor=HDMI-A-1, 1920x1080, auto, 1, mirror, eDP-1
''
else if variant == "allegro" then ''
monitor= DP-4, 1920x1200, 3840x0, 1
monitor= DP-3, 1920x1200, 1920x0, 1
monitor=eDP-1, 1920x1080, 0x0, 1
monitor=HDMI-1, 1920x1080, auto, 1, mirror, eDP-1
monitor=HDMI-A-1, 1920x1080, auto, 1, mirror, eDP-1
''
else ''
'';
in
''
${monitors}
${ # system specific configs
if variant == "default" then ''
#env = GBM_BACKEND,nvidia-drm
#env = __GLX_VENDOR_LIBRARY_NAME,nvidia
# env = WLR_DRM_DEVICES,/dev/dri/card1
# env = AQ_WLR_DEVICES,/dev/dri/card1
# env = AQ_DRM_DEVICES,/dev/dri/card1
''
else if variant == "allegro" then ''
env = WLR_DRM_DEVICES,/dev/dri/card0
env = AQ_WLR_DEVICES,/dev/dri/card0
env = AQ_DRM_DEVICES,/dev/dri/card0
env = TERMINAL,st
env = NIXOS_OZONE_WL,1
env = GDK_BACKEND,wayland,x11
env = QT_QPA_PLATFORM,wayland;xcb
env = CLUTTER_BACKEND,wayland
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_TYPE,wayland
env = XDG_SESSION_DESKTOP,Hyprland
env = QT_AUTO_SCREEN_SCALE_FACTOR,1
env = WLR_NO_HARDWARE_CURSORS,1
env = XCURSOR_SIZE,24
'' else ''
''
}
env = HYPRCURSOR_THEME,Hackneyed
env = HYPRCURSOR_SIZE,24
windowrule = float, class:floating
windowrule = tile, class:Nsxiv
exec = pkill swaybg; ${swaybgScript}
exec = pkill waybar; ${pkgs.waybar}/bin/waybar
exec = pkill dunst; ${pkgs.dunst}/bin/dunst -print >> ~/.local/state/notifications-history
exec-once = hyprctl setcursor Hackneyed 24
exec = setxkbmap -layout fr
submap = power
bind = ,s, exec, systemctl suspend
bind = ,s, submap, reset
bind = SHIFT,S,exec, ${if variant == "allegro" then "/usr/sbin/shutdown" else "shutdown"} now
bind = ,S, submap, reset
bind = ,h, exec, systemctl hibernate
bind = ,h, submap, reset
bind = ,e, exit
bind = ,e, submap, reset
bind = ,r, exec, ${if variant == "allegro" then "/usr/sbin/reboot" else "reboot"}
bind = ,r, submap, reset
bind = ,l, exec, swaylock
bind = ,l, submap, reset
bind = ,d, exec, sleep .1 && hyprctl dispatch dpms
bind = ,d, submap, reset
bind = ,escape, submap, reset
submap = reset
'';
};
}

192
home/lf.nix Normal file
View file

@ -0,0 +1,192 @@
{ config, pkgs, ... }:
{
programs.lf = {
enable = true;
commands = {
trash = ''''${{
set -f
${pkgs.trash-cli}/bin/trash $fx
}}'';
extract = ''''${{
set -f
${pkgs.dtrx}/bin/dtrx -n $fx
}}'';
compress_gzip = ''''${{
set -f
${pkgs.gnutar}/bin/tar Oc $(realpath --relative-to $PWD $f) | \
${pkgs.pigz}/bin/pigz -cv - > $f.tar.gz
}}'';
compress_zip = ''''${{
set -f
${pkgs.zip}/bin/zip -r $f.zip $(realpath --relative-to $PWD $f)
}}'';
compress_xz = ''''${{
set -f
${pkgs.gnutar}/bin/tar Oc $(realpath --relative-to $PWD $f) | \
${pkgs.pxz}/bin/pxz -cv - > $f.tar.xz
}}'';
compress_bzip2 = ''''${{
set -f
${pkgs.gnutar}/bin/tar Oc $(realpath --relative-to $PWD $f) | \
${pkgs.pbzip2}/bin/pbzip2 -cv - > $f.tar.bz2
}}'';
compress_zstd = ''''${{
set -f
${pkgs.gnutar}/bin/tar --zstd -cvf $f.tar.zst $(realpath --relative-to $PWD $f)
}}'';
compress_just_tar = ''''${{
set -f
${pkgs.gnutar}/bin/tar -cvf $f.tar $(realpath --relative-to $PWD $f)
}}'';
show_size = ''%{{
set -f
${pkgs.coreutils}/bin/du -sh $f
}}'';
ncdu = ''''${{
set -f
${pkgs.ncdu}/bin/ncdu $f
}}'';
# find = ''''${{
# set -f
# read -p
toggle_preview = ''%{{
if [ "$lf_preview" = "true" ]; then
lf -remote "send $id :set preview false; set ratios 1:5"
else
lf -remote "send $id :set preview true; set ratios 1:2:3"
fi
}}
'';
paste = ''&{{
set -- $(cat ~/.local/share/lf/files)
mode="$1"
shift
case "$mode" in
copy)
rsync -ah --ignore-existing --info=progress2 --no-inc-recursive -- "$@" . |
stdbuf -i0 -o0 -e0 tr '\r' '\n' |
while IFS= read -r line; do
lf -remote "send $id echo $line"
done
;;
move) mv -n -- "$@" .;;
esac
rm ~/.local/share/lf/files
lf -remote "send clear"
}}'';
bulk-rename = ''''${{
old="$(mktemp)"
new="$(mktemp)"
if [ -n "$fs" ]; then
fs="$(basename -a $fs)"
else
fs="$(ls -a)"
fi
printf '%s\n' "$fs" >"$old"
printf '%s\n' "$fs" >"$new"
$EDITOR "$new"
[ "$(wc -l < "$new")" -ne "$(wc -l < "$old")" ] && exit
paste "$old" "$new" | while IFS= read -r names; do
src="$(printf '%s' "$names" | cut -f1)"
dst="$(printf '%s' "$names" | cut -f2)"
if [ "$src" = "$dst" ] || [ -e "$dst" ]; then
continue
fi
mv -- "$src" "$dst"
done
rm -- "$old" "$new"
lf -remote "send $id unselect"
}}'';
alt-paste = ''&{{
if [ -n "$fs" ]; then
lf -remote "send $id $1; save-select"
fi
lf -remote "send $id paste"
}}'';
load-select = ''&{{
# skip if triggered via save-select from itself
if [ "$1" = "$id" ]; then
exit 0
fi
lf -remote "send $id unselect"
if [ -s ~/.local/share/lf/select ]; then
files=$(tr '\n' '\0' < ~/.local/share/lf/select | xargs -0 printf ' %q')
lf -remote "send $id toggle $files"
fi
}}'';
save-select = ''&{{
printf "%s" "$fs" > ~/.local/share/lf/select
lf -remote "send load-select $id"
}}'';
follow_link = ''%{{
lf -remote "send ''${id} select '$(readlink $f)'"
}}'';
open_folder_in_sxiv = ''%{{
nsxiv .
}}'';
};
keybindings = {
D = "trash";
x = "extract";
Xg = "compress_gzip";
Xz = "compress_zip";
Xx = "compress_xz";
Xb = "compress_bzip2";
Xs = "compress_zstd";
Xt = "compress_just_tar";
as = "show_size";
an = "ncdu";
ar = "bulk-rename";
af = "follow_link";
ai = "open_folder_in_sxiv";
E = "$nvim";
p = "alt-paste copy";
P = "alt-paste cut";
"<space>" = ":toggle; down; save-select";
u = ":unselect; save-select";
v = ":invert; save-select";
"<tab>" = "toggle_preview";
};
# previewer.source = "${pkgs.pistol}/bin/pistol";
previewer.source = pkgs.writers.writeBash "pistol" ''
file=$1
w=$2
h=$3
x=$4
y=$5
if [[ "$( ${pkgs.file}/bin/file -Lb --mime-type "$file")" =~ ^image ]]; then
kitty +kitten icat --silent --stdin no --transfer-mode file --place \
"''${w}x''${h}@''${x}x''${y}" "$file" < /dev/null > /dev/tty
exit 1
fi
${pkgs.pistol}/bin/pistol "$file"
'';
settings = {
icons = true;
ifs = "\\n";
cleaner =
let
cleaner = pkgs.writers.writeBash "cleaner" ''
kitty +kitten icat --clear --stdin no --silent --transfer-mode file < /dev/null > /dev/tty
'';
in
"${cleaner}";
};
extraConfig = ''
load-select
setlocal ${config.xdg.userDirs.download} sortby time
setlocal ${config.xdg.userDirs.download} reverse
setlocal ${config.xdg.userDirs.download} set info size:time
'';
};
}

View file

@ -0,0 +1,73 @@
{ lib, config, pkgs, variant, pkgs-unstable, ... }: {
home.packages = with pkgs; [
entr
trash-cli
nix-output-monitor
unzip
gnumake
pandoc
htop
ffmpeg-full
wget
dtrx
unzip
zip
glances
file
];
programs.neovim = {
enable = true;
viAlias = true;
defaultEditor = true;
package = pkgs-unstable.neovim-unwrapped;
extraPackages = (with pkgs; [
nodejs_23
ocamlPackages.lsp
ocamlPackages.ocamlformat
cargo
nixd
nixfmt-rfc-style
lua-language-server
ocaml
ocamlPackages.ocaml-lsp
pyright
ripgrep
]) ++ (if variant != "allegro" then [ pkgs.gcc ] else [] );
};
xdg.mimeApps.defaultApplications = { "text/plain" = "nvim.desktop"; };
programs.tmux = {
enable = true;
historyLimit = 60000;
escapeTime = 10;
keyMode = "vi";
mouse = true;
terminal = "tmux-256color";
extraConfig = ''
unbind-key 'Space'
bind-key 'Space' copy-mode
set -g status-right "#{net_speed} #{cpu_percentage}"
set -g default-terminal "tmux-256color"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
run-shell ${pkgs.tmuxPlugins.net-speed}/share/tmux-plugins/net-speed/net_speed.tmux
run-shell ${pkgs.tmuxPlugins.cpu}/share/tmux-plugins/cpu/cpu.tmux
'';
plugins = with pkgs.tmuxPlugins; [ net-speed ];
};
programs.git = {
enable = true;
userName = config.home.username;
userEmail = "${config.home.username}@domain.xyz";
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
};
programs.pistol.enable = true;
}

334
home/ui.nix Normal file
View file

@ -0,0 +1,334 @@
{ lib, config, pkgs, variant, ... }:
let
defaultTerminal = "st";
alacrittyLightTheme = "${pkgs.alacritty-theme}/night_owlish_light.toml";
alacrittyDarkTheme = "${pkgs.alacritty-theme}/monokai_charcoal.toml";
in
{
imports = [
./bar.nix
./hyprland.nix
./gui-software.nix
];
home.sessionVariables = {
TERMINAL = defaultTerminal;
};
home.packages = with pkgs; [
gentium
(nerdfonts.override { fonts = [ "CascadiaCode" "Noto" "Hack" "JetBrainsMono" ]; })
cascadia-code
inter
emojione
bluetuith
keepmenu
rofimoji
ydotool
libnotify
wtype
wl-clipboard
pamixer
pulsemixer
(catppuccin-gtk.override {
accents = [ "pink" ];
size = "compact";
tweaks = [ "black" ];
variant = "mocha";
})
];
xsession.enable = true;
fonts.fontconfig.enable = true;
fonts.fontconfig.defaultFonts = {
serif = [ "Gentium Plus" ];
sansSerif = [ "Inter" ];
monospace = [ "CaskaydiaCove Nerd Font Mono" ];
# monospace = [ "CascadiaCode" ];
# monospace = [ "Hack Nerd Font Mono" ];
emoji = [ "Noto Color Emoji" "OpenMoji Color" ];
};
programs.kitty = {
enable = true;
font.name = "CaskaydiaCove NFM Regular";
font.size = 12;
settings = {
cursor_shape = "block";
default_pointer_shape = "arrow";
pointer_shape_when_dragging = "arrow";
enable_audio_bell = false;
placement_strategy = "top-left";
remember_window_size = false;
initial_window_width = 1300;
initial_window_height = 800;
confirm_os_window_close = 0;
resize_debounce_time = "0.1 0.1";
};
keybindings = {
"ctrl+shift+equal" = "change_font_size all +0.5";
"ctrl+shift+plus" = "change_font_size all +0.5";
"ctrl+shift+kp_add" = "change_font_size all +0.5";
"ctrl+shift+minus" = "change_font_size all -0.5";
"ctrl+shift+kp_subtract" = "change_font_size all -0.5";
};
shellIntegration.enableFishIntegration = true;
shellIntegration.mode = "no-cursor";
extraConfig = ''
include colors.conf
bold_font CaskaydiaCove NFM Bold
italic_font CaskaydiaCove NFM Italic
bold_italic_font CaskaydiaCove NFM Bold Italic
text_composition_strategy 1.4 4
font_features CaskaydiaCoveNF-Italic +calt +ss01
'';
};
programs.alacritty = {
enable = true;
settings = {
font = {
size = 12.0;
};
general.import = [
alacrittyLightTheme # default to white
"~/.config/alacritty/colors.toml"
];
};
};
xdg = {
mimeApps.defaultApplications."TerminalEmulator" = "Alacritty.desktop";
};
services.swayidle =
let swaylock-bin = (if variant == "allegro"
then "/usr/bin/swaylock"
else "${config.programs.swaylock.package}/bin/swaylock");
in
{
enable = true;
events = [
{
event = "before-sleep";
command = "${swaylock-bin} -defF";
}
{
event = "after-resume";
command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on";
}
{
event = "lock";
command = "${swaylock-bin} -defF";
}
];
timeouts = [
{
timeout = 900;
command = "${swaylock-bin} -defF";
}
{
timeout = 900;
command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off";
}
];
};
programs.swaylock = {
enable = (variant != "allegro");
package = pkgs.swaylock-effects;
settings = {
screenshots = true;
# clock = true;
font = "Sans:bold";
disable-caps-lock-text = true;
effect-blur = "7x5";
text-color = "ffffff";
layout-text-color = "ffffff";
ring-color = "000000";
key-hl-color = "dddddd";
line-color = "00000000";
inside-color = "00000088";
separator-color = "00000000";
ring-clear-color = "00000000";
line-clear-color = "00000000";
inside-clear-color = "00000000";
text-clear-color = "00000000";
};
};
services.dunst.enable = true;
services.dunst.settings = {
global = {
width = "(0, 1000)";
height = "(0, 1000)";
offset = "(20,20)";
horizontal_padding = 8;
indicate_hidden = true;
shrink = true;
transparency = 20;
separator_height = 2;
frame_width = 3;
frame_color = "#000000";
font = "Monospace 11";
alignment = "left";
show_age_threshold = 60;
background = "#ffffff";
foreground = "#000000";
};
urgency_critical = {
background = "#ff9999";
};
};
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
plugins = [ pkgs.rofi-calc pkgs.rofi-emoji ];
theme = "theme.rasi";
};
qt = {
enable = true;
platformTheme.name = "kde";
};
gtk = {
enable = true;
font = {
package = pkgs.inter;
name = "Inter";
};
# theme = {
# name = "Catppuccin-Latte-Compact-Pink-Light";
# # name = "Catppuccin-Mocha-Compact-Pink-Dark";
# package = pkgs.catppuccin-gtk.override {
# accents = [ "pink" ];
# size = "compact";
# tweaks = [ ];
# variant = "latte";
# };
# };
# iconTheme = {
# name = "Adwaita";
# package = pkgs.adwaita-icon-theme;
# };
cursorTheme = {
name = "Hackneyed";
package = pkgs.hackneyed;
};
};
services.darkman = let
reload-hyprland = ''
${pkgs.hyprland}/bin/hyprctl reload
'';
reload-st = ''
kill -SIGUSR1 $(pgrep st) # reload st config
'';
reload-neovim = ''
kill -SIGUSR1 $(pgrep nvim)
'';
in {
lightModeScripts = {
gtk-theme = ''
${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'"
'';
set-background = ''
rm -f ~/.local/share/bg/*
ln -rs ~/.local/share/bg-light.* ~/.local/share/bg/
${pkgs.hyprland}/bin/hyprctl reload
'';
set-rofi-colors = ''
rm -f ~/.config/rofi/colors-current.rasi
ln -rs ~/.config/rofi/colors-light.rasi ~/.config/rofi/colors-current.rasi
'';
set-kitty-colors = ''
rm -f ~/.config/kitty/colors.conf
ln -rs ~/.config/kitty/light.conf ~/.config/kitty/colors.conf
kill -SIGUSR1 $(pgrep kitty)
'';
set-alacritty-colors = ''
rm -f ~/.config/alacritty/colors.toml
ln -s ${alacrittyLightTheme} ~/.config/alacritty/colors.toml
'';
notify = "${pkgs.libnotify}/bin/notify-send \"Light mode\"";
inherit reload-hyprland;
inherit reload-st;
inherit reload-neovim;
};
darkModeScripts = {
gtk-theme = ''
${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
'';
set-background = ''
rm -f ~/.local/share/bg/*
ln -rs ~/.local/share/bg-dark.* ~/.local/share/bg/
${pkgs.hyprland}/bin/hyprctl reload
'';
set-rofi-colors = ''
rm -f ~/.config/rofi/colors-current.rasi
ln -rs ~/.config/rofi/colors-dark.rasi ~/.config/rofi/colors-current.rasi
'';
set-kitty-colors = ''
rm -f ~/.config/kitty/colors.conf
ln -rs ~/.config/kitty/dark.conf ~/.config/kitty/colors.conf
kill -SIGUSR1 $(pgrep kitty)
'';
set-alacritty-colors = ''
rm -f ~/.config/alacritty/colors.toml
ln -s ${alacrittyDarkTheme} ~/.config/alacritty/colors.toml
'';
notify = "${pkgs.libnotify}/bin/notify-send \"Dark mode\"";
inherit reload-hyprland;
inherit reload-st;
inherit reload-neovim;
};
};
systemd.user.services = {
battery-notify = {
Unit = {
Description = "Send notification when battery is low";
Wants = "battery-timer.timer";
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.writers.writeBash "battery-notify" ''
if [[ $(${pkgs.coreutils}/bin/cat /sys/class/power_supply/BAT0/capacity) -lt 10 ]]; then
${pkgs.libnotify}/bin/notify-send -u critical "Battery is low"
fi
'' }";
};
};
};
systemd.user.timers = {
battery-timer = {
Unit = {
Description = "Execute battery-notify every minute";
};
Install = {
# enable the service
# WantedBy = [ "default.target" ];
};
Timer = {
Unit = "battery-notify.service";
OnCalendar = "*-*-* *:*:00";
};
};
};
}

50
home/waybar.css Normal file
View file

@ -0,0 +1,50 @@
* {
font-family: "Jost", "Material Design Icons", Monospace;
font-size: 16px;
font-weight: bold;
}
#tray,
label.module {
padding: 0px 8px;
}
window#waybar {
background: rgba(255, 255, 255, .0);
}
#controls,
#submap,
#network,
#disks,
#hardware,
#tray,
#clock {
background: rgba(0, 0, 0, .8);
color: white;
margin: 0px 5px;
border-radius: 0px;
}
#workspaces button {
padding: 0;
color: #888888;
}
#workspaces button.active {
color: #ffffff;
}
#submap {
background: #000000;
border: 1px solid #ffffff;
color: #ffffff;
}
#window {
color: #ffffff;
text-shadow: 1px 0 #000, -1px 0 #000, 0 1px #000, 0 -1px #000,
1px 1px #000, -1px -1px #000, 1px -1px #000, -1px 1px #000;
background: rgba(0, 0, 0, 0);
border: 0
}