Moved from xdg.config to home.file lib.mkForce
This commit is contained in:
+305
-327
File diff suppressed because it is too large
Load Diff
+15
-39
@@ -1605,7 +1605,6 @@ This module will import all necessities.
|
||||
{
|
||||
imports = [
|
||||
./apps/ollama.nix
|
||||
#./apps/default-apps.nix
|
||||
./apps/theme.nix
|
||||
./desktop/hypridle.nix
|
||||
./desktop/hyprland.nix
|
||||
@@ -1665,7 +1664,7 @@ in
|
||||
{
|
||||
# Ensure script exists in ~/.config/hypr/scripts/
|
||||
home.file."${targetRel}" = {
|
||||
source = repoScript;
|
||||
source = lib.mkForce repoScript;
|
||||
executable = true;
|
||||
};
|
||||
}
|
||||
@@ -1689,7 +1688,7 @@ in
|
||||
];
|
||||
# Sync repo wallpapers (including videos/) into ~/nixos_conf/wallpaperstuff
|
||||
home.file."${userRelRoot}" = {
|
||||
source = repoWallpaperDir;
|
||||
source = lib.mkForce repoWallpaperDir;
|
||||
recursive = true;
|
||||
};
|
||||
systemd.user.services.mpvpaper-wallpaper = {
|
||||
@@ -1738,7 +1737,7 @@ in
|
||||
home.packages = [ pkgs.wpaperd ];
|
||||
# Sync everything *except* wallpaper.conf into ~/nixos_conf/wallpaperstuff
|
||||
home.file."${userRelRoot}" = {
|
||||
source = repoWallpapersOnly;
|
||||
source = lib.mkForce repoWallpapersOnly;
|
||||
recursive = true;
|
||||
};
|
||||
# Now safely overwrite the config every activation (no HM collision)
|
||||
@@ -1778,7 +1777,7 @@ in
|
||||
programs.waybar.enable = true;
|
||||
programs.waybar.style = lib.mkForce ""; # Schakel standaardstijl uit
|
||||
home.file.".config/waybar/config" = {
|
||||
source = "${repoWaybarDir}/config.jsonc";
|
||||
source = lib.mkForce "${repoWaybarDir}/config.jsonc";
|
||||
};
|
||||
# Overschrijf style.css handmatig na alle andere stappen
|
||||
home.activation.waybarStyle = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
@@ -1803,10 +1802,10 @@ in
|
||||
home.packages = [ pkgs.hyprlock ];
|
||||
# Gebruik home.file voor echte bestanden (geen symlinks)
|
||||
home.file.".config/hypr/lock.png" = {
|
||||
source = lockPngSrc;
|
||||
source = lib.mkForce lockPngSrc;
|
||||
};
|
||||
home.file.".config/hypr/hyprlock.conf" = {
|
||||
source = hyprlockConf;
|
||||
source = lib.mkForce hyprlockConf;
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
@@ -1821,7 +1820,7 @@ in
|
||||
{
|
||||
home.packages = [ pkgs.hypridle ];
|
||||
home.file.".config/hypr/hypridle.conf" = {
|
||||
source = hypridleConf;
|
||||
source = lib.mkForce hypridleConf;
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
@@ -1855,18 +1854,18 @@ in
|
||||
};
|
||||
# Copy repo configs/scripts into ~/.config (als echte bestanden)
|
||||
home.file."${targetRel}" = {
|
||||
source = repoConf;
|
||||
source = lib.mkForce repoConf;
|
||||
};
|
||||
home.file."${targetOverflowRel}" = {
|
||||
source = repoOverflowScript;
|
||||
source = lib.mkForce repoOverflowScript;
|
||||
executable = true;
|
||||
};
|
||||
home.file."${targetPerMonitor}" = {
|
||||
source = repoPerMonitorScript;
|
||||
source = lib.mkForce repoPerMonitorScript;
|
||||
executable = true;
|
||||
};
|
||||
home.file."${targetSwitchScript}" = {
|
||||
source = repoSwitchScript;
|
||||
source = lib.mkForce repoSwitchScript;
|
||||
executable = true;
|
||||
};
|
||||
}
|
||||
@@ -1887,10 +1886,10 @@ in
|
||||
home.packages = [ pkgs.hyprshell ];
|
||||
# Gebruik home.file voor echte bestanden (geen symlinks)
|
||||
home.file.".config/hyprshell/config.ron" = {
|
||||
source = cfgRon;
|
||||
source = lib.mkForce cfgRon;
|
||||
};
|
||||
home.file.".config/hyprshell/styles.css" = {
|
||||
source = cssFile;
|
||||
source = lib.mkForce cssFile;
|
||||
};
|
||||
# Autostart (systemd user service)
|
||||
systemd.user.services.hyprshell = {
|
||||
@@ -1908,7 +1907,6 @@ in
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
|
||||
@@ -1938,7 +1936,7 @@ in
|
||||
};
|
||||
# Gebruik home.file voor echte bestanden (geen symlinks)
|
||||
home.file.".config/hypr/scripts/lid-lock.sh" = {
|
||||
source = lidLockScript;
|
||||
source = lib.mkForce lidLockScript;
|
||||
executable = true;
|
||||
};
|
||||
xdg.portal = {
|
||||
@@ -2017,20 +2015,6 @@ You'll notice the color values in multiple places outside this as well.
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** Default-apps
|
||||
This is where you can set defaults
|
||||
#+begin_src nix :tangle home/apps/defaults-apps.nix :noweb tangle :mkdirp yes.
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
xdg.mimeApps.enable = true;
|
||||
xdg.mimeApps.defaultApplications = {
|
||||
"x-scheme-handler/http" = [ "app.zen_browser.zen.desktop" ];
|
||||
"x-scheme-handler/https" = [ "app.zen_browser.zen.desktop" ];
|
||||
"text/html" = [ "app.zen_browser.zen.desktop" ];
|
||||
};
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** Hyperexpo
|
||||
hyprexpo gets installed and configured
|
||||
#+begin_src nix :tangle home/desktop/hyprexpo.nix :noweb tangle :mkdirp yes.
|
||||
@@ -2062,7 +2046,6 @@ hyprexpo gets installed and configured
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
#+end_src
|
||||
|
||||
** Alacritty
|
||||
@@ -2409,27 +2392,22 @@ Zsh gets installed and configured
|
||||
The configuration mentioned in ./assets/conf/dev/terminal/starship.toml will be added to enabled shells
|
||||
#+begin_src nix :tangle home/dev/starship.nix :noweb tangle :mkdirp yes
|
||||
{ config, pkgs, lib, flakeRoot, ... }:
|
||||
|
||||
let
|
||||
repoStarshipToml = flakeRoot.outPath + "/assets/conf/dev/terminal/starship.toml";
|
||||
|
||||
# The exact key that appears in the error:
|
||||
targetKey = "${config.home.homeDirectory}/.config/starship.toml";
|
||||
in
|
||||
{
|
||||
xdg.enable = true;
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
enableBashIntegration = true;
|
||||
enableFishIntegration = true;
|
||||
};
|
||||
|
||||
# Force the *actual conflicting option* (home.file."<abs path>".source)
|
||||
home.file."${targetKey}".source = lib.mkForce repoStarshipToml;
|
||||
}
|
||||
|
||||
#+end_src
|
||||
|
||||
** Other Settings
|
||||
@@ -2619,7 +2597,6 @@ These are listed here.
|
||||
|
||||
** Initialization
|
||||
Now starts the main emacs configuration.
|
||||
|
||||
#+begin_src emacs-lisp :tangle home/dev/emacs/init.el :mkdirp yes
|
||||
;;; package --- Summary - My minimal Emacs init file -*- lexical-binding: t -*-
|
||||
|
||||
@@ -3028,8 +3005,7 @@ Only a few more things left. Specifically the machine level extra settings.
|
||||
** Traveldroid
|
||||
The configuration for the laptop does not change much. Most changes are because the hardware is different.
|
||||
*** System Level
|
||||
Nothing specific for the laptop.
|
||||
|
||||
Anything specific for the laptop.
|
||||
#+begin_src nix :tangle machines/traveldroid/configuration.nix :noweb tangle :mkdirp yes
|
||||
{ user, ... } : {
|
||||
imports =
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
{ config, pkgs, lib, flakeRoot, ... }:
|
||||
|
||||
let
|
||||
# Path to environment file
|
||||
AiRepoEnv = flakeRoot + "/assets/conf/apps/ai/ai.env";
|
||||
|
||||
# Environment file parser
|
||||
parseEnv = lines:
|
||||
lib.foldl' (acc: line:
|
||||
let
|
||||
trimmed = builtins.trim line;
|
||||
in
|
||||
if trimmed == "" || (builtins.stringLength trimmed) > 0 && (builtins.substr 0 1 trimmed) == "#"
|
||||
then acc
|
||||
else
|
||||
let parts = builtins.split "=" trimmed;
|
||||
in
|
||||
if builtins.length parts >= 2
|
||||
then builtins.add (builtins.elemAt parts 0) (builtins.elemAt parts 1) acc
|
||||
else acc
|
||||
) { } (builtins.split "\n" (builtins.readFile (toString AiRepoEnv)));
|
||||
|
||||
envVars = parseEnv;
|
||||
in
|
||||
{
|
||||
# Install required packages
|
||||
home.packages = [
|
||||
pkgs.ollama-vulkan
|
||||
pkgs.zed-editor
|
||||
];
|
||||
|
||||
# Set environment variables
|
||||
home.sessionVariables = {
|
||||
OLLAMA_HOST = envVars.OLLAMA_HOST or "http://127.0.0.1:11434";
|
||||
MISTRAL_API_KEY = envVars.MISTRAL_API_KEY or "";
|
||||
};
|
||||
|
||||
# Configure Ollama service using the correct Home Manager syntax
|
||||
systemd.user.services.ollama = {
|
||||
Unit = {
|
||||
Description = "Ollama service for local AI models";
|
||||
After = [ "network.target" ];
|
||||
Wants = [ "network.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "forking";
|
||||
ExecStart = "${pkgs.ollama-vulkan}/bin/ollama serve";
|
||||
ExecStartPost = ''
|
||||
sleep 5
|
||||
${pkgs.ollama-vulkan}/bin/ollama pull codellama:70b
|
||||
${pkgs.ollama-vulkan}/bin/ollama pull mixtral:8x7b
|
||||
'';
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "default.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
# ZED configuration
|
||||
home.file.".config/zed/settings.json".text = lib.mkForce (
|
||||
builtins.toJSON {
|
||||
mistral = {
|
||||
apiKey = envVars.MISTRAL_API_KEY or "";
|
||||
defaultModel = "mistral-pro";
|
||||
};
|
||||
ollama = {
|
||||
endpoint = envVars.OLLAMA_HOST or "http://127.0.0.1:11434";
|
||||
defaultModel = "codellama:70b";
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
# --- Usage Notes ---
|
||||
# 1. Pulling Additional Models:
|
||||
# To add more models later, run:
|
||||
# ollama pull <model-name>
|
||||
# Example: ollama pull llama3:8b
|
||||
#
|
||||
# 2. Switching GPU Backends:
|
||||
# - For NVIDIA: Replace all `ollama-vulkan` with `ollama` (uses CUDA)
|
||||
# - For AMD: Use `ollama-rocm` and ensure ROCm is installed
|
||||
#
|
||||
# 3. ZED Plugin Setup:
|
||||
# - Install the Ollama and Mistral plugins in ZED via the plugin marketplace
|
||||
# - The Ollama plugin will use the local models pulled above
|
||||
# - The Mistral plugin will use the MISTRAL_API_KEY for cloud access
|
||||
#
|
||||
# 4. Security:
|
||||
# - Never commit ./assets/conf/apps/ai.env to version control
|
||||
# - For extra security, encrypt ai.env using sops-nix or age
|
||||
#
|
||||
# 5. Persistent Service:
|
||||
# To keep Ollama running after logout, enable lingering:
|
||||
# loginctl enable-linger $(whoami)
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
xdg.mimeApps.enable = true;
|
||||
xdg.mimeApps.defaultApplications = {
|
||||
"x-scheme-handler/http" = [ "app.zen_browser.zen.desktop" ];
|
||||
"x-scheme-handler/https" = [ "app.zen_browser.zen.desktop" ];
|
||||
"text/html" = [ "app.zen_browser.zen.desktop" ];
|
||||
};
|
||||
}
|
||||
@@ -2,7 +2,6 @@
|
||||
{
|
||||
imports = [
|
||||
./apps/ollama.nix
|
||||
#./apps/default-apps.nix
|
||||
./apps/theme.nix
|
||||
./desktop/hypridle.nix
|
||||
./desktop/hyprland.nix
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
{ config, pkgs, lib, flakeRoot, ... }:
|
||||
let
|
||||
repoConf = flakeRoot + "/assets/conf/desktop/notifications/swaync/config.json";
|
||||
repoStyle = flakeRoot + "/assets/conf/desktop/notifications/swaync/style.css";
|
||||
in
|
||||
{
|
||||
home.packages = [
|
||||
pkgs.swaynotificationcenter
|
||||
pkgs.libnotify
|
||||
];
|
||||
# Ensure config directory exists in ~/.config
|
||||
xdg.configFile."swaync/config.json".source = repoConf;
|
||||
xdg.configFile."swaync/style.css".source = repoStyle;
|
||||
# Start swaync automatically (systemd user service)
|
||||
systemd.user.services.swaync = {
|
||||
Unit = {
|
||||
Description = "Sway Notification Center";
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${pkgs.swaynotificationcenter}/bin/swaync";
|
||||
Restart = "always";
|
||||
};
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,201 +0,0 @@
|
||||
{ config, lib, pkgs, flakeRoot, ... }:
|
||||
|
||||
let
|
||||
userRelRoot = "nixos_conf/wallpaperstuff";
|
||||
userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}";
|
||||
picturesDir = "${userAbsRoot}/pictures";
|
||||
repoWallpaperDir = flakeRoot.outPath + "/assets/conf/desktop/wallpaper";
|
||||
repoWallpapersOnly = lib.cleanSourceWith {
|
||||
src = repoWallpaperDir;
|
||||
filter = path: type: true;
|
||||
};
|
||||
daemonRel = ".config/hypr/scripts/hyprpaper-ws-daemon.sh";
|
||||
setRel = ".config/hypr/scripts/set-wallpaper.sh";
|
||||
in
|
||||
{
|
||||
home.packages = [
|
||||
pkgs.hyprpaper
|
||||
pkgs.socat
|
||||
pkgs.jq
|
||||
pkgs.findutils
|
||||
pkgs.coreutils
|
||||
pkgs.gnused
|
||||
pkgs.gawk
|
||||
];
|
||||
|
||||
# Sync wallpapers into a writable directory
|
||||
home.file."${userRelRoot}" = {
|
||||
source = repoWallpapersOnly;
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
# Hyprpaper config
|
||||
home.file.".config/hypr/hyprpaper.conf" = {
|
||||
text = ''
|
||||
ipc = true
|
||||
splash = false
|
||||
'';
|
||||
};
|
||||
|
||||
# Workspace wallpaper daemon
|
||||
home.file."${daemonRel}" = {
|
||||
executable = true;
|
||||
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}}" # $1 = eerste argument, ${picturesDir} = default (Bash-variabele)
|
||||
FIT_MODE="fill"
|
||||
HYPR_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/hypr" # Gebruik $HOME als fallback
|
||||
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
|
||||
f="$(map_file_for_monitor "$mon")"
|
||||
mkdir -p "$(dirname "$f")"
|
||||
if [[ ! -f "$f" ]]; then
|
||||
{
|
||||
for i in 1 2 3 4 5 6 7 8 9; do
|
||||
seed="$(ls -1 "${PICTURES_DIR}/${i}."* 2>/dev/null | head -n 1 || true)"
|
||||
echo "w-${i}=${seed}"
|
||||
done
|
||||
} > "$f"
|
||||
fi
|
||||
echo "$f"
|
||||
}
|
||||
|
||||
get_wall_for_ws() {
|
||||
local mon="$1"
|
||||
local wsid="$2"
|
||||
local f key val
|
||||
f="$(ensure_map_file "$mon")"
|
||||
key="w-${wsid}"
|
||||
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
|
||||
hyprctl hyprpaper wallpaper "$mon, $file, $FIT_MODE" >/dev/null
|
||||
}
|
||||
|
||||
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
|
||||
workspacev2* )
|
||||
payload="${line#*>>}"
|
||||
wsid="${payload%%,*}"
|
||||
mon="$(focused_monitor || true)"
|
||||
[[ -n "$mon" && -n "$wsid" ]] && apply_wallpaper "$mon" "$wsid"
|
||||
;;
|
||||
focusedmon* )
|
||||
mon="$(focused_monitor || true)"
|
||||
wsid="$(hyprctl -j activeworkspace | jq -r '.id' | head -n 1 || true)"
|
||||
[[ -n "$mon" && -n "$wsid" ]] && apply_wallpaper "$mon" "$wsid"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
socat -U - UNIX-CONNECT:"$SOCK" | while read -r line; do
|
||||
handle "$line" || true
|
||||
done
|
||||
'';
|
||||
};
|
||||
|
||||
# CLI setter
|
||||
home.file."${setRel}" = {
|
||||
executable = true;
|
||||
text = ''
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
HYPR_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/hypr"
|
||||
MAP_ROOT="${HYPR_DIR}/hyprpaper/config"
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 <workspace_id> <monitor> [wallpaper_path]"
|
||||
}
|
||||
|
||||
wsid="${1:-}"
|
||||
mon="${2:-}"
|
||||
wp="${3:-}"
|
||||
|
||||
[[ -n "$wsid" ]] || { usage; exit 1; }
|
||||
[[ -n "$mon" ]] || { usage; exit 1; }
|
||||
|
||||
cfg="${MAP_ROOT}/${mon}/defaults.conf"
|
||||
mkdir -p "$(dirname "$cfg")"
|
||||
[[ -f "$cfg" ]] || touch "$cfg"
|
||||
|
||||
if [[ -z "$wp" ]]; then
|
||||
wp="$(find "${XDG_CONFIG_HOME:-$HOME/.config}/wallpapers/defaults" -type f 2>/dev/null | shuf -n 1 || true)"
|
||||
[[ -n "$wp" ]] || { echo "No wallpaper found (random). Provide a path as arg 3."; exit 1; }
|
||||
fi
|
||||
|
||||
key="w-${wsid}"
|
||||
if ! grep -q "^${key}=" "$cfg"; then
|
||||
echo "${key}=" >> "$cfg"
|
||||
fi
|
||||
|
||||
sed -i "s|^${key}=.*|${key}= ${wp}|g" "$cfg"
|
||||
|
||||
curws="$(hyprctl -j monitors | jq -r --arg m "$mon" '.[] | select(.name==$m) | .activeWorkspace.id' | head -n 1 || true)"
|
||||
if [[ "$curws" == "$wsid" ]]; then
|
||||
hyprctl hyprpaper wallpaper "$mon, $wp, fill" >/dev/null
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
# Services
|
||||
systemd.user.services.hyprpaper = {
|
||||
Unit = {
|
||||
Description = "hyprpaper wallpaper daemon";
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${pkgs.hyprpaper}/bin/hyprpaper";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 1;
|
||||
};
|
||||
Install = { WantedBy = [ "graphical-session.target" ]; };
|
||||
};
|
||||
|
||||
systemd.user.services.hyprpaper-ws-daemon = {
|
||||
Unit = {
|
||||
Description = "Workspace->wallpaper mapping daemon (hyprpaper + socket2)";
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
After = [ "graphical-session.target" "hyprpaper.service" ];
|
||||
};
|
||||
Service = {
|
||||
ExecStart = "${pkgs.bash}/bin/bash ${config.home.homeDirectory}/${daemonRel} ${picturesDir}";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 1;
|
||||
};
|
||||
Install = { WantedBy = [ "graphical-session.target" ]; };
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user