1
1
Fork 0

Compare commits

..

No commits in common. "6e2981cf221ea89e39b3b2b1529eaa113cc368a9" and "c361f1f7edf912cbbefca0149a44a458d794971b" have entirely different histories.

19 changed files with 260 additions and 458 deletions

View file

@ -157,42 +157,26 @@
inherit inputs; inherit inputs;
}; };
users = { users.${config.custom.username} = {
root = { programs.home-manager.enable = true;
# Inherit from user systemd.user.startServices = "sd-switch"; # Start/stop user services immediately
programs.home-manager.enable = config.home-manager.users.${config.custom.username}.programs.home-manager.enable;
systemd.user.startServices = config.home-manager.users.${config.custom.username}.systemd.user.startServices;
nixpkgs.config = config.home-manager.users.${config.custom.username}.nixpkgs.config;
nix.gc = config.home-manager.users.${config.custom.username}.nix.gc;
home = { # Inherit configuration.nix
username = "root"; nixpkgs.config = config.nixpkgs.config;
homeDirectory = "/root";
stateVersion = config.home-manager.users.${config.custom.username}.home.stateVersion; nix.gc = {
}; automatic = config.nix.gc.automatic;
frequency = config.nix.gc.dates;
options = config.nix.gc.options;
}; };
${config.custom.username} = { home = {
programs.home-manager.enable = true; username = config.custom.username;
systemd.user.startServices = "sd-switch"; # Start/stop user services immediately homeDirectory = "/home/${config.custom.username}";
# Inherit configuration.nix #!! DO NOT MODIFY ###
nixpkgs.config = config.nixpkgs.config; stateVersion = "23.11";
#!! ############# ###
nix.gc = {
automatic = config.nix.gc.automatic;
frequency = config.nix.gc.dates;
options = config.nix.gc.options;
};
home = {
username = config.custom.username;
homeDirectory = "/home/${config.custom.username}";
#!! DO NOT MODIFY ###
stateVersion = "23.11";
#!! ############# ###
};
}; };
}; };
}; };

View file

@ -16,9 +16,8 @@ with lib; let
jq = "${pkgs.jq}/bin/jq"; jq = "${pkgs.jq}/bin/jq";
kill = "${pkgs.procps}/bin/kill"; kill = "${pkgs.procps}/bin/kill";
kitty = "${config.home-manager.users.${config.custom.username}.programs.kitty.package}/bin/kitty"; kitty = "${config.home-manager.users.${config.custom.username}.programs.kitty.package}/bin/kitty";
left = config.home-manager.users.${config.custom.username}.home.file.".local/bin/left".source;
loginctl = "${pkgs.systemd}/bin/loginctl"; loginctl = "${pkgs.systemd}/bin/loginctl";
menu = config.home-manager.users.${config.custom.username}.home.file.".local/bin/menu".source; menu = "~/.local/bin/menu";
nautilus = "${pkgs.nautilus}/bin/nautilus"; nautilus = "${pkgs.nautilus}/bin/nautilus";
networkmanager_dmenu = "${pkgs.networkmanager_dmenu}/bin/networkmanager_dmenu"; networkmanager_dmenu = "${pkgs.networkmanager_dmenu}/bin/networkmanager_dmenu";
notify-send = "${pkgs.libnotify}/bin/notify-send"; notify-send = "${pkgs.libnotify}/bin/notify-send";
@ -27,7 +26,6 @@ with lib; let
pkill = "${pkgs.procps}/bin/pkill"; pkill = "${pkgs.procps}/bin/pkill";
playerctl = "${pkgs.playerctl}/bin/playerctl"; playerctl = "${pkgs.playerctl}/bin/playerctl";
rofi-rbw = "${pkgs.rofi-rbw}/bin/rofi-rbw"; rofi-rbw = "${pkgs.rofi-rbw}/bin/rofi-rbw";
rm = "${pkgs.coreutils}/bin/rm";
sleep = "${pkgs.coreutils}/bin/sleep"; sleep = "${pkgs.coreutils}/bin/sleep";
steam = "${config.programs.steam.package}/bin/steam"; steam = "${config.programs.steam.package}/bin/steam";
swayosd-client = "${pkgs.swayosd}/bin/swayosd-client"; swayosd-client = "${pkgs.swayosd}/bin/swayosd-client";
@ -128,7 +126,7 @@ in {
# TODO: Toggle trackball hand # TODO: Toggle trackball hand
#// (key "Delete" "Super" "exec" "left") #// (key "Delete" "Super" "exec" "left")
(key "Delete" "Super+Shift" "exec" "${left} kensington-orbit-wireless-tb-mouse") (key "Delete" "Super+Shift" "exec" "vrr")
(key "Down" "Super" "movewindow" "d") (key "Down" "Super" "movewindow" "d")
(key "Down" "Super+Shift" "movewindoworgroup" "d") (key "Down" "Super+Shift" "movewindoworgroup" "d")
(key "Equal" "Super" "exec" "audio Normalizer") (key "Equal" "Super" "exec" "audio Normalizer")
@ -230,8 +228,8 @@ in {
(key "T" "Super" "togglespecialworkspace" "terminal") (key "T" "Super" "togglespecialworkspace" "terminal")
(key "T" "Super+Shift" "movetoworkspacesilent" "terminal") (key "T" "Super+Shift" "movetoworkspacesilent" "terminal")
(key "T" "Super+Shift" "exec" kitty) (key "T" "Super+Shift" "exec" kitty)
(key "V" "Super" "exec" "${menu} --clipboard") (key "V" "Super" "exec" "${kitty} --app-id clipboard --override font_size=12 ${clipse}")
(key "V" "Super+Shift" "exec" "${rm} ~/.cache/walker/clipboard.gob; ${notify-send} walker 'Clipboard cleared' --urgency low") (key "V" "Super+Shift" "exec" "${clipse} -clear && ${notify-send} clipse 'Clipboard cleared' --urgency low")
(key "W" "Super" "togglespecialworkspace" "vm") (key "W" "Super" "togglespecialworkspace" "vm")
(key "W" "Super+Ctrl" "exec" "vm -x ${ (key "W" "Super+Ctrl" "exec" "vm -x ${
if config.custom.hidpi if config.custom.hidpi

View file

@ -9,7 +9,6 @@ with lib; let
firefox-esr = "${ firefox-esr = "${
config.home-manager.users.${config.custom.username}.programs.firefox.finalPackage config.home-manager.users.${config.custom.username}.programs.firefox.finalPackage
}/bin/firefox-esr"; }/bin/firefox-esr";
left = config.home-manager.users.${config.custom.username}.home.file.".local/bin/left".source;
pkill = "${pkgs.procps}/bin/pkill"; pkill = "${pkgs.procps}/bin/pkill";
rm = "${pkgs.coreutils}/bin/rm"; rm = "${pkgs.coreutils}/bin/rm";
sleep = "${pkgs.coreutils}/bin/sleep"; sleep = "${pkgs.coreutils}/bin/sleep";
@ -65,9 +64,10 @@ in {
# https://wiki.hyprland.org/Configuring/Keywords/#executing # https://wiki.hyprland.org/Configuring/Keywords/#executing
exec-once = exec-once =
[ [
"${rm} ~/.cache/walker/clipboard.gob" # Clear clipboard "${rm} ~/.config/qalculate/qalc.dmenu.history" # Clear calc history
"${clipse} -clear" # Clear clipboard history
"${clipse} -listen" # Monitor clipboard
sway-audio-idle-inhibit # Inhibit idle while audio is playing sway-audio-idle-inhibit # Inhibit idle while audio is playing
left # Left-handed at boot
# TODO: Remove when systemd service fixed # TODO: Remove when systemd service fixed
# https://github.com/Alexays/Waybar/issues/2882 # https://github.com/Alexays/Waybar/issues/2882

View file

@ -14,6 +14,112 @@ in {
programs.fish = { programs.fish = {
enable = true; enable = true;
shellAbbrs = {
c = "clear";
e = "exit";
m = "mosh";
s = "ssh";
i = "tailscale ip --4";
"/h" = "cd ~";
"/hd" = "cd ~/.dev";
"/e" = "cd /etc";
"/en" = "cd /etc/nixos";
"/n" = "cd /nix";
"/nv" = "cd /nix/var";
"/nvn" = "cd /nix/var/nix";
"/nvnp" = "cd /nix/var/nix/profiles";
"/nvnps" = "cd /nix/var/nix/profiles/system";
"/r" = "cd /run";
"/rc" = "cd /run/current-system";
f = "flakegen";
r = "rebuild";
rb = "rebuild boot";
rbp = "rebuild boot && poweroff";
rbr = "rebuild boot && reboot";
rs = "rebuild switch";
rt = "rebuild test";
t = "target";
u = "upgrade";
ub = "upgrade boot";
ubp = "upgrade boot && poweroff";
ubr = "upgrade boot && reboot";
nd = "nvd diff /run/current-system /nix/var/nix/profiles/system";
no = "nh os";
nb = "flakegen && nh os boot";
nbr = "flakegen && nh os boot && reboot";
nbp = "flakegen && nh os boot && poweroff";
ns = "flakegen && nh os switch";
nt = "flakegen && nh os test";
jc = "journalctl";
sc = "systemctl";
d = "docker";
dc = "docker compose";
dcd = "docker compose down";
dce = "docker compose exec";
dcl = "docker compose logs";
dcp = "docker compose pull";
dcu = "docker compose up";
dcuf = "docker compose up --force-recreate";
ds = "docker system";
g = "git";
gb = "git bisect";
gbb = "git bisect bad";
gbg = "git bisect good";
gc = "git clone";
gs = "git status";
ta = "tmux attach";
td = "tmux detach";
tk = "tmux kill-session";
tl = "tmux list-sessions";
k = "kitten";
ks = "kitten ssh";
};
interactiveShellInit = ''
# Default is brblack (bright0)
set -g fish_color_autosuggestion brgreen
function exit -d 'Always exit successfully when interactive'
builtin exit 0
end
# TODO: Pass flags properly
# TODO: Convert to bash
function run -d 'Run packages via nixpkg flakes'
for i in (seq (count $argv))
if ! string match -r '^-' -- $argv[$i]
set argv[$i] (string replace -r ^ nixpkgs# $argv[$i])
end
end
nix run $argv
end
function shell -d 'Open packages in new shell via nixpkg flakes'
for i in (seq (count $argv))
if ! string match -r '^-' -- $argv[$i]
set argv[$i] (string replace -r ^ nixpkgs# $argv[$i])
end
end
nix shell $argv
end
function activate -d 'Activate Python venv'
source .venv/bin/activate.fish
end
function arknights -d 'Launch Arknights'
waydroid app launch com.YoStarEN.Arknights
end
'';
promptInit = '' promptInit = ''
# Disable greeting # Disable greeting
set -g fish_greeting set -g fish_greeting
@ -51,193 +157,5 @@ in {
end end
''; '';
}; };
home-manager.users = {
# Inherit root abbreviations from user
root.programs.fish = {
enable = true;
shellAbbrs = config.home-manager.users.${config.custom.username}.programs.fish.shellAbbrs;
};
${config.custom.username}.programs.fish = let
any = expansion: {
inherit expansion;
position = "anywhere";
};
in {
enable = true;
shellAbbrs = {
# Expand abbreviations anywhere in the shell
#?? sudo ABBREVIATION
"/e" = any "/etc";
"/en" = any "/etc/nixos";
"/h" = any "~";
"/hd" = any "~/.dev";
"/n" = any "/nix";
"/nv" = any "/nix/var";
"/nvn" = any "/nix/var/nix";
"/nvnp" = any "/nix/var/nix/profiles";
"/nvnps" = any "/nix/var/nix/profiles/system";
"/r" = any "/run";
"/rc" = any "/run/current-system";
reboot = any "systemctl reboot";
restart = any "systemctl reboot";
poweroff = any "systemctl poweroff";
shutdown = any "systemctl poweroff";
backup = any "borgmatic -v 1 create --progress --stats";
extract = any "borgmatic -v 1 extract --progress";
init = any "borgmatic init -e repokey-blake2";
key = any "borgmatic key export";
list = any "borgmatic -v 1 list";
restore = any "borgmatic -v 1 restore";
rsync = any "rsync --info=progress2";
jc = any "journalctl";
jcs = any "journalctl --system";
jcse = any "journalctl --system --pager-end";
jcseu = any "journalctl --system --pager-end --unit";
jcsf = any "journalctl --system --follow";
jcsfu = any "journalctl --system --follow --unit";
jcsi = any "journalctl --system --identifier";
jcst = any "journalctl --system --target";
jcsu = any "journalctl --system --unit";
jcu = any "journalctl --user";
jcue = any "journalctl --user --pager-end";
jcueu = any "journalctl --user --pager-end --unit";
jcuf = any "journalctl --user --follow";
jcufu = any "journalctl --user --follow --unit";
jcui = any "journalctl --user --identifier";
jcut = any "journalctl --user --target";
jcuu = any "journalctl --user --unit";
sc = any "systemctl";
scp = any "systemctl poweroff";
scr = any "systemctl reboot";
scs = any "systemctl --system";
scsd = any "systemctl --system disable";
scsdn = any "systemctl --system disable --now";
scse = any "systemctl --system reenable";
scsen = any "systemctl --system reenable --now";
scsh = any "systemctl --system show";
scsl = any "systemctl --system list-unit-files";
scsm = any "systemctl --system mask";
scsr = any "systemctl --system restart";
scsrr = any "systemctl --system reload-or-restart";
scss = any "systemctl --system status";
scst = any "systemctl --system stop";
scsu = any "systemctl --system unmask";
scu = any "systemctl --user";
scud = any "systemctl --user disable";
scudn = any "systemctl --user disable --now";
scue = any "systemctl --user reenable";
scuen = any "systemctl --user reenable --now";
scuh = any "systemctl --user show";
scul = any "systemctl --user list-unit-files";
scum = any "systemctl --user mask";
scur = any "systemctl --user restart";
scurr = any "systemctl --user reload-or-restart";
scus = any "systemctl --user status";
scut = any "systemctl --user stop";
scuu = any "systemctl --user unmask";
d = any "docker";
dc = any "docker compose";
dcd = any "docker compose down";
dce = any "docker compose exec";
dcl = any "docker compose logs";
dcp = any "docker compose pull";
dcu = any "docker compose up";
dcuf = any "docker compose up --force-recreate";
de = any "docker exec";
dei = any "docker exec --interactive";
deit = any "docker exec --interactive --tty";
det = any "docker exec --tty";
di = any "docker images";
dk = any "docker kill";
dn = any "docker network";
dnl = any "docker network ls";
dp = any "docker pull";
dps = any "docker ps";
dpsa = any "docker ps --all --size";
dr = any "docker rm";
ds = any "docker system";
dsp = any "docker system prune";
dspav = any "docker system prune --all --volumes";
c = "clear";
e = "exit";
m = "mosh";
s = "ssh";
ip = "tailscale ip --4";
n = "nixos";
nb = "nixos build";
nbb = "nixos build boot";
nbs = "nixos build switch";
nbt = "nixos build test";
nd = "nixos diff";
ng = "nixos generate";
nl = "nixos list";
nr = "nixos repl";
g = "git";
gb = "git bisect";
gbb = "git bisect bad";
gbg = "git bisect good";
gc = "git clone";
gs = "git status";
ta = "tmux attach";
td = "tmux detach";
tk = "tmux kill-session";
tl = "tmux list-sessions";
k = "kitten";
ks = "kitten ssh";
};
interactiveShellInit = ''
# Default is brblack (bright0)
set -g fish_color_autosuggestion brgreen
function exit -d 'Always exit successfully when interactive'
builtin exit 0
end
# TODO: Pass flags properly
# TODO: Convert to bash
function run -d 'Run packages via nixpkg flakes'
for i in (seq (count $argv))
if ! string match -r '^-' -- $argv[$i]
set argv[$i] (string replace -r ^ nixpkgs# $argv[$i])
end
end
nix run $argv
end
function shell -d 'Open packages in new shell via nixpkg flakes'
for i in (seq (count $argv))
if ! string match -r '^-' -- $argv[$i]
set argv[$i] (string replace -r ^ nixpkgs# $argv[$i])
end
end
nix shell $argv
end
function activate -d 'Activate Python venv'
source .venv/bin/activate.fish
end
function arknights -d 'Launch Arknights'
waydroid app launch com.YoStarEN.Arknights
end
'';
};
};
}; };
} }

View file

@ -26,8 +26,6 @@ in {
inactive_tab_font_style = "normal"; inactive_tab_font_style = "normal";
confirm_os_window_close = 0; confirm_os_window_close = 0;
cursor_blink_interval = 0; cursor_blink_interval = 0;
cursor_shape = "beam";
cursor_shape_unfocused = "underline";
placement_strategy = "top-left"; # Partially fix padding placement_strategy = "top-left"; # Partially fix padding
scrollback_lines = -1; scrollback_lines = -1;
strip_trailing_spaces = "smart"; strip_trailing_spaces = "smart";

View file

@ -4,8 +4,6 @@
... ...
}: }:
with lib; let with lib; let
menu = config.home-manager.users.${config.custom.username}.home.file.".local/bin/menu".source;
cfg = config.custom.programs.networkmanager-dmenu; cfg = config.custom.programs.networkmanager-dmenu;
in { in {
options.custom.programs.networkmanager-dmenu.enable = mkOption {default = false;}; options.custom.programs.networkmanager-dmenu.enable = mkOption {default = false;};
@ -15,9 +13,11 @@ in {
# https://github.com/firecat53/networkmanager-dmenu/blob/main/config.ini.example # https://github.com/firecat53/networkmanager-dmenu/blob/main/config.ini.example
#!! Option not available, files written directly #!! Option not available, files written directly
# FIXME: active_chars does not take effect # FIXME: active_chars does not take effect
home.file.".config/networkmanager-dmenu/config.ini".text = '' home.file.".config/networkmanager-dmenu/config.ini".text = let
wofi = "${config.home-manager.users.${config.custom.username}.programs.wofi.package}/bin/wofi";
in ''
[dmenu] [dmenu]
dmenu_command = ${menu} --input dmenu_command = ${wofi} --dmenu --lines 11
active_chars = > active_chars = >
wifi_icons = 󰤯󰤟󰤢󰤥󰤨 wifi_icons = 󰤯󰤟󰤢󰤥󰤨
format = {icon} {name} format = {icon} {name}

View file

@ -24,51 +24,16 @@ in {
#?? systemctl --user restart walker.service #?? systemctl --user restart walker.service
runAsService = true; runAsService = true;
# https://github.com/abenz1267/walker/wiki/Basic-Configuration
# https://github.com/abenz1267/walker/blob/master/internal/config/config.default.json # https://github.com/abenz1267/walker/blob/master/internal/config/config.default.json
config = { config = {
activation_mode.disabled = true; # Key chords activation_mode.labels = ""; # Chord indicators
ignore_mouse = true; # Hover interrupts keyboard selections
search.placeholder = ""; search.placeholder = "";
# https://github.com/abenz1267/walker/wiki/Modules
# https://www.nerdfonts.com/cheat-sheet
builtins = { builtins = {
calculator.switcher_only = false;
clipboard.switcher_only = true;
commands.switcher_only = true;
custom_commands.switcher_only = true;
runner.switcher_only = true;
ssh.switcher_only = true;
windows.switcher_only = true;
applications = { applications = {
# BUG: Ghost entries are still visible actions = false; # Desktop file actions
#// actions = false; # Desktop file actions prioritize_new = false;
show_sub_when_single = false; # Subtext with one module
switcher_only = false;
weight = 10;
};
dmenu = {
keep_sort = true; # Disable sorting entries
placeholder = "Input";
switcher_only = true;
};
emojis = {
placeholder = "Unicode";
switcher_only = false;
};
finder = {
placeholder = "Files";
switcher_only = true;
};
websearch = {
placeholder = "Search";
switcher_only = true;
}; };
}; };
}; };
@ -77,24 +42,21 @@ in {
theme = { theme = {
style = builtins.readFile ./style.css; style = builtins.readFile ./style.css;
# https://github.com/abenz1267/walker/blob/master/internal/config/layout.default.json # https://github.com/abenz1267/walker/blob/master/internal/config/themes/bare.json
layout.ui.window.box = rec { layout.ui.window.box = rec {
height = 250 / config.custom.scale; height = 500 / config.custom.scale;
width = 1000 / config.custom.scale; width = 1000 / config.custom.scale;
scroll.list = { scroll.list = {
min_height = height;
max_height = height; max_height = height;
max_width = width; max_width = width;
min_width = width; min_width = width;
# Icon resolution # Icon resolution
item = { item.icon = {
text.sub.hide = true; # Subtext icon_size = "largest"; # 128px
pixel_size = 32;
icon = {
icon_size = "largest"; # 128px
pixel_size = 32; # Downscale
};
}; };
}; };
}; };

View file

@ -21,7 +21,6 @@ https://docs.gtk.org/gtk4/css-properties.html
/* Input box */ /* Input box */
#search entry { #search entry {
border-radius: 25px; border-radius: 25px;
margin-bottom: 4px;
padding: 4px; padding: 4px;
} }
@ -38,7 +37,7 @@ https://docs.gtk.org/gtk4/css-properties.html
/* List entry */ /* List entry */
#list child { #list child {
border-radius: 25px; border-radius: 25px;
margin: 2px 8px; margin: 4px 0;
padding: 8px; padding: 8px;
} }

View file

@ -13,16 +13,13 @@ with lib; let
hyprctl = "${ hyprctl = "${
config.home-manager.users.${config.custom.username}.wayland.windowManager.hyprland.finalPackage config.home-manager.users.${config.custom.username}.wayland.windowManager.hyprland.finalPackage
}/bin/hyprctl"; }/bin/hyprctl";
inhibit = config.home-manager.users.${config.custom.username}.home.file.".local/bin/inhibit".source;
jq = "${pkgs.jq}/bin/jq"; jq = "${pkgs.jq}/bin/jq";
loginctl = "${pkgs.systemd}/bin/loginctl"; loginctl = "${pkgs.systemd}/bin/loginctl";
network = config.home-manager.users.${config.custom.username}.home.file.".local/bin/network".source;
nm-connection-editor = "${pkgs.networkmanagerapplet}/bin/nm-connection-editor"; nm-connection-editor = "${pkgs.networkmanagerapplet}/bin/nm-connection-editor";
pgrep = "${pkgs.procps}/bin/pgrep"; pgrep = "${pkgs.procps}/bin/pgrep";
ping = "${pkgs.iputils}/bin/ping"; ping = "${pkgs.iputils}/bin/ping";
pkill = "${pkgs.procps}/bin/pkill"; pkill = "${pkgs.procps}/bin/pkill";
playerctl = "${pkgs.playerctl}/bin/playerctl"; playerctl = "${pkgs.playerctl}/bin/playerctl";
power = config.home-manager.users.${config.custom.username}.home.file.".local/bin/power".source;
rfkill = "${pkgs.util-linux}/bin/rfkill"; rfkill = "${pkgs.util-linux}/bin/rfkill";
sleep = "${pkgs.coreutils}/bin/sleep"; sleep = "${pkgs.coreutils}/bin/sleep";
swaync-client = "${ swaync-client = "${
@ -32,8 +29,6 @@ with lib; let
systemctl = "${pkgs.systemd}/bin/systemctl"; systemctl = "${pkgs.systemd}/bin/systemctl";
systemd-inhibit = "${pkgs.systemd}/bin/systemd-inhibit"; systemd-inhibit = "${pkgs.systemd}/bin/systemd-inhibit";
tailscale = "${pkgs.tailscale}/bin/tailscale"; tailscale = "${pkgs.tailscale}/bin/tailscale";
vm = config.home-manager.users.${config.custom.username}.home.file.".local/bin/vm".source;
vpn = config.home-manager.users.${config.custom.username}.home.file.".local/bin/vpn".source;
wttrbar = "${pkgs.wttrbar}/bin/wttrbar"; wttrbar = "${pkgs.wttrbar}/bin/wttrbar";
cfg = config.custom.programs.waybar; cfg = config.custom.programs.waybar;
@ -131,13 +126,13 @@ in {
"custom/inhibitor" = { "custom/inhibitor" = {
interval = 5; interval = 5;
exec = "~/.config/waybar/scripts/inhibitor.sh"; exec = "~/.config/waybar/scripts/inhibitor.sh";
on-click = inhibit; on-click = "~/.local/bin/inhibit";
}; };
"custom/vm" = { "custom/vm" = {
interval = 5; interval = 5;
exec = "~/.config/waybar/scripts/vm.sh"; exec = "~/.config/waybar/scripts/vm.sh";
on-click = "${vm} -x ${ on-click = "~/.local/bin/vm -x ${
if config.custom.hidpi if config.custom.hidpi
then "/scale:140" then "/scale:140"
else "" else ""
@ -147,7 +142,7 @@ in {
"custom/vpn" = { "custom/vpn" = {
interval = 5; interval = 5;
exec = "~/.config/waybar/scripts/vpn.sh"; exec = "~/.config/waybar/scripts/vpn.sh";
on-click = "${vpn} mypi3"; on-click = "~/.local/bin/vpn mypi3";
}; };
# https://github.com/Alexays/Waybar/wiki/Module:-Idle-Inhibitor # https://github.com/Alexays/Waybar/wiki/Module:-Idle-Inhibitor
@ -286,7 +281,7 @@ in {
}; };
on-click = nm-connection-editor; on-click = nm-connection-editor;
on-click-right = network; # Toggle networking on/off on-click-right = "~/.local/bin/network"; # Toggle networking on/off
}; };
# https://github.com/Alexays/Waybar/wiki/Module:-Battery # https://github.com/Alexays/Waybar/wiki/Module:-Battery
@ -311,7 +306,7 @@ in {
warning = 30; warning = 30;
}; };
on-click = power; # Toggle power-saver mode on-click = "~/.local/bin/power"; # Toggle power-saver mode
}; };
}; };
}; };

View file

@ -20,10 +20,6 @@ in {
".local/bin/${name}".source = ".local/bin/${name}".source =
pkgs.writeShellApplication { pkgs.writeShellApplication {
inherit name; inherit name;
# https://github.com/NixOS/nixpkgs/pull/261115
#// excludeShellChecks = ["SC2154"]; # argc evaluates variables at runtime
runtimeInputs = dependencies; runtimeInputs = dependencies;
text = builtins.readFile ./${name}.sh; text = builtins.readFile ./${name}.sh;
} }
@ -86,6 +82,11 @@ in {
fprintd fprintd
libnotify libnotify
]) ])
(bash "flakegen" [
git
libnotify
nix
])
(bash "inhibit" [ (bash "inhibit" [
coreutils coreutils
libnotify libnotify
@ -110,20 +111,18 @@ in {
libnotify libnotify
networkmanager networkmanager
]) ])
(bash "nixos" [
argc
coreutils
git
nh
nix
nixos-rebuild
nvd
systemd
])
(bash "power" [ (bash "power" [
libnotify libnotify
power-profiles-daemon power-profiles-daemon
]) ])
(bash "rebuild" [
libnotify
nixos-rebuild
])
(bash "repl" [
libnotify
nixos-rebuild
])
(bash "screenshot" [ (bash "screenshot" [
coreutils coreutils
grimblast grimblast
@ -131,12 +130,21 @@ in {
libnotify libnotify
swappy swappy
]) ])
(bash "target" [
libnotify
nixos-rebuild
])
(bash "toggle" [ (bash "toggle" [
gnugrep gnugrep
hyprland hyprland
jq jq
libnotify libnotify
]) ])
(bash "upgrade" [
libnotify
nix
nixos-rebuild
])
(bash "vm" [ (bash "vm" [
coreutils coreutils
freerdp3 freerdp3

View file

@ -0,0 +1,16 @@
#! /usr/bin/env bash
# Generate flake.nix via flakegen
# https://github.com/jorsn/flakegen
cd /etc/nixos || exit 1
if [[ "${1-}" == '-r' ]]; then
# Nuke and reinitialize
rm flake.nix
nix flake init --template github:jorsn/flakegen
else
# Generate and track all files
nix run .#genflake flake.nix
git add .
fi

View file

@ -1,27 +1,15 @@
#! /usr/bin/env bash #! /usr/bin/env bash
# Toggle left-handed mouse # Toggle left-handed mouse
#?? left DEVICE # TODO: Make device-specific when commit released
# https://github.com/hyprwm/hyprlang/commit/95471ec86f37acb8281062e54e2be99b24b50cd0
# BUG: New hyprctl syntax does not support per-device getoption left=$(("$(hyprctl getoption input:left_handed -j | jq '.int')" - 1))
# https://github.com/hyprwm/hyprlang/issues/43
# HACK: Condition based on file presence, requires creation at login to set state
#?? exec-once = left
FILE=/tmp/left
if (("$#" == 0)); then hyprctl keyword input:left_handed ${left#-}
touch "$FILE"
exit
fi
if [[ -f "$FILE" ]]; then if [[ "$(hyprctl getoption input:left_handed -j | jq '.int')" == 1 ]]; then
hyprctl keyword "device[$1]:left_handed" false notify-send '> left' 'Left-handed' --urgency low
hyprctl keyword "device[$1]:natural_scroll" false
rm --force "$FILE"
notify-send "> left" "Right-handed" --urgency low
else else
hyprctl keyword "device[$1]:left_handed" true notify-send '> left' 'Right-handed' --urgency low
hyprctl keyword "device[$1]:natural_scroll" true
touch "$FILE"
notify-send "> left" "Left-handed" --urgency low
fi fi

View file

@ -7,41 +7,35 @@ command=walker
while (("$#" > 0)); do while (("$#" > 0)); do
case "$1" in case "$1" in
--applications) -a | --applications)
command="walker --modules applications" command="walker --modules applications"
;; ;;
--calculator) -c | --calculator)
command="walker --modules calc" command="walker --modules calc"
;; ;;
--clipboard) -f | --files)
command="walker --modules clipboard"
;;
--files)
command="walker --modules finder" command="walker --modules finder"
;; ;;
--input) -i | --input)
command="walker --dmenu" command="walker --dmenu"
;; ;;
--networks) -n | --networks)
command="networkmanager_dmenu" command="networkmanager_dmenu"
;; ;;
--passwords) -p | --passwords)
command="rofi-rbw" command="rofi-rbw"
;; ;;
--runner) -r | --runner)
command="walker --modules runner" command="walker --modules runner"
;; ;;
--search) -s | --ssh)
command="walker --modules websearch"
;;
--ssh)
command="walker --modules ssh" command="walker --modules ssh"
;; ;;
--unicode) -u | --unicode)
command="walker --modules emojis" command="walker --modules emojis"
;; ;;
--windows) -w | --web)
command="walker --modules windows" command="walker --modules websearch"
;; ;;
--) --)
shift shift

View file

@ -1,113 +0,0 @@
#! /usr/bin/env bash
cd /etc/nixos || exit 1
# @describe Wrapper for NixOS tools
# Assumes flakes and configuration in /etc/nixos/
#
# https://github.com/sigoden/argc
# https://github.com/jorsn/flakegen
# https://github.com/viperML/nh
# @meta combine-shorts
# @meta inherit-flag-options
# @cmd Build NixOS configuration
# @alias b,bu,bui,buil
# @option -b --builder[=nh|nixos] Use nh os (default) or nixos-rebuild to build
# @option -t --target Remote machine to build with root, only nixos-rebuild is supported
# @flag -n --no-generate Do not regenerate flake.nix before building
# @flag -p --poweroff Gracefully poweroff system after a successful build
# @flag -r --reboot Gracefully reboot system after a successful build
# @flag -u --update Update flake.lock before building
# @arg extra~ Pass extra arguments to builder
build() { :; }
# Internal wrapper for subcommands
_build() {
# Regenerate flake.nix and stage git files by default
if [[ ! "${argc_no_generate:-}" ]]; then
nix run .#genflake flake.nix
git add .
fi
# Update flake.lock
if [[ "${argc_update:-}" ]]; then
nix flake update
fi
# Build and send closures to remote machine
if [[ "${argc_target:-}" ]]; then
nixos-rebuild --flake ".#${argc_target}" --target-host "root@${argc_target}" "$1" ${argc_extra:+"${argc_extra[@]}"}
else
# Build current system
if [[ "${argc_builder:-}" == nh ]]; then
nh os "$1" ${argc_extra:+"${argc_extra[@]}"}
elif [[ "${argc_builder:-}" == nixos ]]; then
sudo nixos-rebuild "$1" ${argc_extra:+"${argc_extra[@]}"}
fi
fi
# Invoke systemd to shutdown system
# Assumes errexit shell option is set
if [[ "${argc_poweroff:-}" ]]; then
sudo systemctl poweroff
elif [[ "${argc_reboot:-}" ]]; then
sudo systemctl reboot
fi
}
# @cmd Build and boot NixOS configuration
# @alias b,bo,boo
build::boot() { _build boot; }
# @cmd Build and switch NixOS configuration
# @alias s,sw,swi,swit,switc
build::switch() { _build switch; }
# @cmd Build and test NixOS configuration
# @alias t,te,tes
build::test() { _build test; }
# @cmd Compare NixOS system generations
# @alias d,di,dif
# @arg path1=/run/current-system Store path to compare with (current system by default)
# @arg path2=/nix/var/nix/profiles/system Store path to compare against (built system by default)
diff() {
nvd diff "${argc_path1:-}" "${argc_path2:-}"
}
# @cmd Generate flake.nix from flake.in.nix with flakegen
# @alias g,ge,gen,gene,gener,genera,generat
# @flag -n --nuke Delete flake.nix and reinitialize
generate() {
if [[ "${argc_nuke:-}" ]]; then
rm --force flake.nix
nix flake init --template github:jorsn/flakegen
else
nix run .#genflake flake.nix
git add .
fi
}
# @cmd List NixOS generations
# @alias l,li,lis
# @arg extra~ Pass extra arguments to nixos-rebuild
list() {
nixos-rebuild list-generations ${argc_extra:+"${argc_extra[@]}"}
}
# @cmd Enter an interactive NixOS read-eval-print loop with the current configuration
# @alias r,re,rep
# @flag -n --no-generate Do not regenerate flake.nix before entering loop
# @arg extra~ Pass extra arguments to nixos-rebuild
repl() {
if [[ ! "${argc_no_generate:-}" ]]; then
nix run .#genflake flake.nix
git add .
fi
nixos-rebuild repl ${argc_extra:+"${argc_extra[@]}"}
}
eval "$(argc --argc-eval "$0" "$@")"

View file

@ -0,0 +1,10 @@
#! /usr/bin/env bash
# Rebuild local flake configuration
cd /etc/nixos || exit 1
nix run .#genflake flake.nix &&
sleep 0.1 &&
git add . &&
sudo nixos-rebuild --show-trace "$@"

View file

@ -0,0 +1,10 @@
#! /usr/bin/env bash
# Nix repl with loaded configuration
cd /etc/nixos || exit 1
nix run .#genflake flake.nix &&
sleep 0.1 &&
git add . &&
nixos-rebuild repl "$@"

View file

@ -0,0 +1,10 @@
#! /usr/bin/env bash
# Rebuild and send closures to remote machine
cd /etc/nixos || exit 1
nix run .#genflake flake.nix &&
sleep 0.1 &&
git add . &&
nixos-rebuild --flake .#"$1" --target-host root@"$1" "$2" --show-trace "${@:3}"

View file

@ -0,0 +1,11 @@
#! /usr/bin/env bash
# Update flake.lock and rebuild
cd /etc/nixos || exit 1
nix run .#genflake flake.nix &&
sleep 0.1 &&
git add . &&
sudo nix flake update &&
sudo nixos-rebuild --show-trace "$@"

View file

@ -35,6 +35,20 @@ in {
}; };
shellAliases = { shellAliases = {
backup = "sudo borgmatic -v 1 create --progress --stats";
extract = "sudo borgmatic -v 1 extract --progress";
restore = "sudo borgmatic -v 1 restore";
list = "sudo borgmatic -v 1 list";
init = "sudo borgmatic init -e repokey-blake2";
key = "sudo borgmatic key export";
reboot = "sudo systemctl reboot";
restart = "sudo systemctl reboot";
poweroff = "sudo systemctl poweroff";
shutdown = "sudo systemctl poweroff";
rsync = "rsync --info=progress2";
# https://github.com/aksiksi/compose2nix?tab=readme-ov-file#usage # https://github.com/aksiksi/compose2nix?tab=readme-ov-file#usage
# https://github.com/aksiksi/compose2nix?tab=readme-ov-file#agenix # https://github.com/aksiksi/compose2nix?tab=readme-ov-file#agenix
compose2nix = concatStringsSep " " [ compose2nix = concatStringsSep " " [