Added and tested script to prepare henrovnix_ok for publishing

This commit is contained in:
2026-02-27 23:05:46 +01:00
parent 8b19518697
commit 33618c1b07
8908 changed files with 3277 additions and 5430 deletions
+13 -33
View File
@@ -167,7 +167,7 @@ Commands:
#+begin_src bash :tangle no block
git add .
git commit -m "experiment: local change"
sudo nixos-rebuild test --flake .#your_hostname
sudo nixos-rebuild test --flake .#YOUR_HOSTNAME
#+end_src
After confirming the change:
@@ -175,7 +175,7 @@ After confirming the change:
emacs README.org --batch -f org-babel-tangle && emacs --batch -l org -l ox-html README.org -f org-html-export-to-html --kill
git add .
git commit -m "literate: structural update"
sudo nixos-rebuild test --flake .#your_hostname
sudo nixos-rebuild test --flake .#YOUR_HOSTNAME
#+end_src
If you are confident about your changes, you may skip steps 13 and edit README.org directly.
@@ -333,12 +333,12 @@ This separation maintains clarity between system-level packages and user-facing
#+begin_src bash :tangle no block
- a NIXOS system installed with a user with sudo rights.
- an internet connection
- the folder henrovnix as you find it here
- the folder henrovnix_ok as you find it here
#+end_src
** Setup when Emacs not (yet) available
1. Copy the folder *henrovnix* to your machine
1. Copy the folder *henrovnix_ok* to your machine
2. First setup an internet connection
#+begin_src bash :tangle no block
# Check if NetworkManager service is running
@@ -356,31 +356,31 @@ This separation maintains clarity between system-level packages and user-facing
# Optional: show device status
nmcli device status
#+end_src
3. Replace *<defaultUser>* in all files with =your_user=
3. Replace *<defaultUser>* in all files with =YOUR_USER=
#+begin_src bash :tangle no block
find ~/Repos/nixos/henrovnix \
find ~/Repos/nixos/henrovnix_ok \
-type d -name ".*" -prune -o \
-type f -print0 \
| xargs -0 sed -i 's/=<defaultUser>=/your_user/g'
| xargs -0 sed -i 's/=<defaultUser>=/YOUR_USER/g'
#+end_src
4. Replace *machine1* in all files with =your_hostname=
4. Replace *machine1* in all files with =YOUR_HOSTNAME=
#+begin_src bash :tangle no block
find ~/Repos/nixos/henrovnix \
find ~/Repos/nixos/henrovnix_ok \
-type d -name ".*" -prune -o \
-type f -print0 \
| xargs -0 sed -i 's/machine1/your_hostname/g'
| xargs -0 sed -i 's/machine1/YOUR_HOSTNAME/g'
#+end_src
5. Rename the folder ./machines/machine1 to your hostname
#+begin_src bash :tangle no block
mv ./machines/machine1 ./machines/your_hostname
mv ./machines/machine1 ./machines/YOUR_HOSTNAME
#+end_src
6. Create a hardware-configuration.nix and copy it into the folder =./machines/your_hostname= overwriting any existing file
6. Create a hardware-configuration.nix and copy it into the folder =./machines/YOUR_HOSTNAME= overwriting any existing file
#+begin_src bash :tangle no block
nixos-generate-config
#+end_src
7. Run the build command to set up the system for the first time
#+begin_src bash :tangle no block
sudo nixos-rebuild switch --flake .#your_hostname
sudo nixos-rebuild switch --flake .#YOUR_HOSTNAME
#+end_src
* Testing and generating builds
@@ -1833,20 +1833,17 @@ in
** Workspace Wallpaper
#+begin_src nix :tangle home/desktop/workspace_wallpaper.nix :noweb tangle :mkdirp yes
{ config, lib, pkgs, flakeRoot, ... }:
let
# Where your numbered wallpapers live (1.*, 2.*, ... 9.*)
userRelRoot = "nixos_conf/wallpaperstuff";
userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}";
picturesDir = "${userAbsRoot}/pictures";
# (Optional) still sync your repo wallpapers/scripts into ~/nixos_conf/wallpaperstuff
repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper";
repoWallpapersOnly = lib.cleanSourceWith {
src = repoWallpaperDir;
filter = path: type: true;
};
daemonRel = "hypr/scripts/hyprpaper-ws-daemon.sh";
setRel = "hypr/scripts/set-wallpaper.sh";
in
@@ -1860,20 +1857,17 @@ in
pkgs.gnused
pkgs.gawk
];
# Keep your existing "sync wallpapers into a writable dir" pattern
home.file."${userRelRoot}" = {
source = repoWallpapersOnly;
recursive = true;
};
# Hyprpaper config (hyprpaper reads this; it does NOT need to write it)
# `ipc = true` enables `hyprctl hyprpaper ...` commands. :contentReference[oaicite:0]{index=0}
xdg.configFile."hypr/hyprpaper.conf".text = ''
ipc = true
splash = false
'';
# Workspace wallpaper daemon: listens to socket2, applies w-<id>=... mapping
# Uses workspacev2 to get numeric workspace id. :contentReference[oaicite:1]{index=1}
xdg.configFile."${daemonRel}" = {
@@ -1881,28 +1875,21 @@ in
text = ''
#!/usr/bin/env bash
set -euo pipefail
: "''${XDG_RUNTIME_DIR:?XDG_RUNTIME_DIR not set}"
: "''${HYPRLAND_INSTANCE_SIGNATURE:?HYPRLAND_INSTANCE_SIGNATURE not set}"
SOCK="''${XDG_RUNTIME_DIR}/hypr/''${HYPRLAND_INSTANCE_SIGNATURE}/.socket2.sock"
[[ -S "$SOCK" ]] || { echo "Hyprland socket not found: $SOCK" >&2; exit 1; }
PICTURES_DIR="''${1:-${picturesDir}}"
FIT_MODE="fill" # hyprpaper fit_mode: contain|cover|tile|fill :contentReference[oaicite:2]{index=2}
HYPR_DIR="''${XDG_CONFIG_HOME:-$HOME/.config}/hypr"
MAP_ROOT="''${HYPR_DIR}/hyprpaper/config"
focused_monitor() {
hyprctl -j monitors | jq -r '.[] | select(.focused==true) | .name' | head -n 1
}
map_file_for_monitor() {
local mon="''${1}"
echo "''${MAP_ROOT}/''${mon}/defaults.conf"
}
ensure_map_file() {
local mon="''${1}"
local f
@@ -1919,7 +1906,6 @@ in
fi
echo "''${f}"
}
get_wall_for_ws() {
local mon="''${1}"
local wsid="''${2}"
@@ -1930,26 +1916,21 @@ in
val="$(awk -F= -v k="''${key}" '$1==k {sub(/^[[:space:]]+/, "", $2); print $2; exit}' "''${f}" || true)"
echo "''${val}"
}
apply_wallpaper() {
local mon="''${1}"
local wsid="''${2}"
local file
file="$(get_wall_for_ws "''${mon}" "''${wsid}")"
[[ -n "''${file}" ]] || return 0
[[ -f "''${file}" ]] || return 0
# Apply via IPC
# hyprpaper wallpaper { monitor path fit_mode } model is per monitor. :contentReference[oaicite:3]{index=3}
hyprctl hyprpaper wallpaper "''${mon}, ''${file}, ''${FIT_MODE}" >/dev/null
}
# Initial apply on startup
mon="$(focused_monitor || true)"
wsid="$(hyprctl -j activeworkspace | jq -r '.id' | head -n 1 || true)"
[[ -n "''${mon}" && -n "''${wsid}" ]] && apply_wallpaper "''${mon}" "''${wsid}"
handle() {
local line="''${1}"
case "''${line}" in
@@ -1970,7 +1951,6 @@ in
;;
esac
}
socat -U - UNIX-CONNECT:"''${SOCK}" | while read -r line; do
handle "''${line}" || true
done