From 0699de3cbee569d64c26d1a5021809de84f962ba Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 21 Jun 2024 02:15:38 +0200 Subject: [PATCH 1/4] Enable numlock in initrd --- system/shared/boot/default.nix | 1 + system/shared/boot/numlock.nix | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 system/shared/boot/numlock.nix diff --git a/system/shared/boot/default.nix b/system/shared/boot/default.nix index d6a59b9..7c9f5cd 100644 --- a/system/shared/boot/default.nix +++ b/system/shared/boot/default.nix @@ -4,6 +4,7 @@ _: { ./generic.nix ./secure-boot.nix ./initrd.nix + ./numlock.nix ./plymouth.nix ]; } diff --git a/system/shared/boot/numlock.nix b/system/shared/boot/numlock.nix new file mode 100644 index 0000000..64bb6e7 --- /dev/null +++ b/system/shared/boot/numlock.nix @@ -0,0 +1,32 @@ +{ pkgs, ... }: { + boot.initrd.systemd = { + # Include setleds binary in the initrd + # (the nix store doesn't exists in there yet, so we need to include + # all of the necessary binaries ahead of time here) + extraBin = { + setleds = "${pkgs.kbd}/bin/setleds"; + }; + + # Enable numlock in the early userspace (initrd) + # This will happen before we're asked for the disk decryption password + services."numlock" = { + enable = true; + description = "Activate Numlock"; + wantedBy = [ "initrd.target" ]; + # Delay disk decryption until this unit is started + before = [ "systemd-cryptsetup@cryptfs.service" ]; + unitConfig.DefaultDependencies = "no"; + serviceConfig.Type = "oneshot"; + # This is essentially runs the same code as present in the + # mkinitcpio-numlock hook on Arch Linux (AUR). + script = '' + #!/bin/bash + + for tty in /dev/tty{1..6} + do + /bin/setleds -D +num < "$tty"; + done + ''; + }; + }; +} From 1440de471347a0334c8f6599b04b4b460cf678fa Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 21 Jun 2024 02:23:12 +0200 Subject: [PATCH 2/4] Split preserved files into categories and add comments --- hosts/voyager/default.nix | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hosts/voyager/default.nix b/hosts/voyager/default.nix index ece3ddb..c24707f 100644 --- a/hosts/voyager/default.nix +++ b/hosts/voyager/default.nix @@ -54,23 +54,36 @@ enable = true; persistentMountPoint = "/persist/home"; extraDirectories = [ + # Nixos flake + "dots" + + # Personal data "Downloads" "Personal" "Media" - "dots" + # Browsers ".mozilla" ".mullvad" ".config/chromium" + + # Applications ".config/spotify" ".config/vesktop" + ".local/share/Smart Code ltd/Stremio" + + # Tools ".local/share/gnupg" ".local/share/zoxide" ".local/share/wakatime" ".local/share/nvim" ".local/state/nvim" ".local/share/zsh" - ".local/share/Smart Code ltd/Stremio" + + # Services + ".local/state/wireplumber" + + # Language package managers ".local/share/cargo" ".local/share/go" ]; From 2acdfac532188fe7eaaa2302aa20067e5920d545 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 21 Jun 2024 02:26:22 +0200 Subject: [PATCH 3/4] Only preserve zsh_history file, not whole dir --- hosts/voyager/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hosts/voyager/default.nix b/hosts/voyager/default.nix index c24707f..bc26a3c 100644 --- a/hosts/voyager/default.nix +++ b/hosts/voyager/default.nix @@ -78,10 +78,9 @@ ".local/share/wakatime" ".local/share/nvim" ".local/state/nvim" - ".local/share/zsh" # Services - ".local/state/wireplumber" + ".local/state/wireplumber" # volume settings # Language package managers ".local/share/cargo" @@ -90,6 +89,7 @@ extraFiles = [ ".config/git/git-credentials" ".cache/walker/history.gob" + ".local/share/zsh/zsh_history" ]; }; From 47d070ce5edcc3134e18082e3d74aa95cf7300d8 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 21 Jun 2024 02:39:01 +0200 Subject: [PATCH 4/4] Update remap rules for windowname script --- .../bars/eww/config/scripts/window_name.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/home/programs/graphical/bars/eww/config/scripts/window_name.py b/home/programs/graphical/bars/eww/config/scripts/window_name.py index acc5376..be87b65 100755 --- a/home/programs/graphical/bars/eww/config/scripts/window_name.py +++ b/home/programs/graphical/bars/eww/config/scripts/window_name.py @@ -7,6 +7,7 @@ the window names. Window name and class are obtained from piped stdin, to preven needlessly keep restarting this program, which takes a while due to the interpreter starting overhead. """ + import json import re import sys @@ -50,9 +51,9 @@ class RemapRule: # Rules will be applied in specified order REMAP_RULES: list[RemapRule] = [ RemapRule(r"", "", ""), - RemapRule(r"(.*) — Mozilla Firefox", " {}", "firefox"), - RemapRule(r"Mozilla Firefox", " Mozilla Firefox", "firefox"), - RemapRule(r"Alacritty", " Alacritty", "Alacritty"), + RemapRule(r"(.*) — Mozilla Firefox", " {}", "firefox"), + RemapRule(r"Mozilla Firefox", " Mozilla Firefox", "firefox"), + RemapRule(r"Alacritty", " Alacritty", "Alacritty"), RemapRule( r"zsh;#toggleterm#1 - \(term:\/\/(.+)\/\/(\d+):(.+)\) - N?VIM", " Terminal: {0}", @@ -63,13 +64,13 @@ REMAP_RULES: list[RemapRule] = [ RemapRule(r"(.+) - Discord", " {}", "discord"), RemapRule(r"(?:\(\d+\) )?Discord \| (.+)", " {}", "vesktop"), RemapRule(r"(.+) - mpv", " {}", "mpv"), - RemapRule(r"Stremio - (.+)", " Stremio - {}", r"(Stremio)|(com.stremio.stremio)"), - RemapRule(r"Spotify", " Spotify", "Spotify"), - RemapRule(r"pulsemixer", " Pulsemixer"), + RemapRule(r"Stremio - (.+)", " Stremio - {}", r"(Stremio)|(com.stremio.stremio)"), + RemapRule(r"Spotify((?: Premium)?)", " Spotify{}", "[Ss]potify"), + RemapRule(r"pulsemixer", " Pulsemixer"), RemapRule(r"(.*)", " {}", "Pcmanfm"), RemapRule(r"(.*)", " {}", "pcmanfm-qt"), # Needs to be last - RemapRule(r"(.*)", " {}", "kitty"), + RemapRule(r"(.*)", " {}", "kitty"), ] MAX_LENGTH = 65 @@ -81,7 +82,9 @@ def iter_window() -> Iterator[tuple[str, str]]: line = line.removesuffix("\n") els = line.split(",", maxsplit=1) if len(els) != 2: - raise ValueError(f"Expected 2 arguments from stdin line (name, class), but got {len(els)}") + raise ValueError( + f"Expected 2 arguments from stdin line (name, class), but got {len(els)}" + ) yield els[1], els[0]