From eb18a3628aef30660a9c370b6735854005ccbe5c Mon Sep 17 00:00:00 2001 From: Henro Veijer Date: Sun, 1 Mar 2026 18:24:47 +0100 Subject: [PATCH] Testing lib.mkForce --- henrovnix_ok/README.html | 1091 ++++++++--------- henrovnix_ok/README.org | 433 ++++--- .../configuration/apps/install_flatpaks.nix | 2 +- .../configuration/apps/install_packages.nix | 2 +- henrovnix_ok/flake.nix | 4 +- henrovnix_ok/home/apps/ollama.nix | 2 +- henrovnix_ok/home/desktop/hypridle.nix | 2 +- henrovnix_ok/home/desktop/hyprland.nix | 6 +- henrovnix_ok/home/desktop/hyprlock.nix | 4 +- henrovnix_ok/home/desktop/hyprscrolling.nix | 8 +- henrovnix_ok/home/desktop/hyprshell.nix | 2 +- .../home/desktop/rotating_wallpaper.nix | 47 +- henrovnix_ok/home/desktop/walker.nix | 2 +- .../home/desktop/workspace_wallpaper.nix | 341 +++--- henrovnix_ok/home/dev/alacritty.nix | 2 +- henrovnix_ok/home/dev/kitty.nix | 4 +- henrovnix_ok/home/dev/shells.nix | 2 +- henrovnix_ok/home/dev/starship.nix | 2 +- 18 files changed, 944 insertions(+), 1012 deletions(-) diff --git a/henrovnix_ok/README.html b/henrovnix_ok/README.html index 4bbd7b498..c340eeba6 100644 --- a/henrovnix_ok/README.html +++ b/henrovnix_ok/README.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + @@ -201,154 +201,154 @@

Table of Contents

-
-

1. Introduction

+
+

1. Introduction

Screenshot

@@ -400,8 +400,8 @@ Customization is designed to occur primarily through modular .conf files, allowi Before proceeding with installation, it is strongly recommended to read this documentation carefully. Understanding the structure and design philosophy will help ensure a smooth setup and provide the necessary context for extending the system effectively.

-
-

1.1. What do you get?

+
+

1.1. What do you get?

This repository delivers a reproducible foundation built on NixOS, Home-Manager, and Flakes. It assumes a clean NixOS installation as a starting point, preferably minimal or headless, onto which the configuration is applied. @@ -410,8 +410,8 @@ Core packages are installed as part of the base configuration. Additional softwa

-
-

1.2. What you do not get

+
+

1.2. What you do not get

This repository does not provide a fully polished, bug-free desktop system with every default preconfigured and validated across all hardware combinations. It is a structured foundation, not a turnkey end-user distribution. @@ -423,8 +423,8 @@ In short, this repository provides a coherent and extensible base, not a finishe

-
-

2. What Is a Literate System in the Context of NixOS?

+
+

2. What Is a Literate System in the Context of NixOS?

A literate system combines documentation and implementation into a single, coherent source. @@ -458,8 +458,8 @@ The README is not describing the system. The README is the system.

-
-

2.1. Two Types of Code Blocks

+
+

2.1. Two Types of Code Blocks

This literate system uses two different kinds of source blocks. @@ -471,7 +471,7 @@ These blocks exist purely for documentation purposes. They generate visible code blocks in the exported documentation, but they do not create files. Example:

-
+
 #+begin_src bash :tangle no
 <tekst>
 #+end_src
@@ -487,7 +487,7 @@ They are never tangled into the filesystem.
 These blocks generate real .nix files and insert the same code into the documentation.
 Example:
 

-
+
 ** install_packages.nix
 <tekst>
 #+begin_src nix :tangle configuration/apps/install_packages.nix :noweb tangle :mkdirp yes
@@ -515,8 +515,8 @@ This means:
 
 
-
-

2.2. The Two Core Commands

+
+

2.2. The Two Core Commands

There are exactly two commands that matter. @@ -564,8 +564,8 @@ Both come from the same source.

-
-

2.3. Editing Generated Files

+
+

2.3. Editing Generated Files

The directories: @@ -591,8 +591,8 @@ Generated directories are output, not source.

-
-

2.4. Recommended Workflow

+
+

2.4. Recommended Workflow

This workflow allows safe experimentation while preserving literate structure. @@ -633,15 +633,15 @@ If you are confident about your changes, you may skip steps 1–3 and edit READM

-
-

2.5. Folder Structure Explained

+
+

2.5. Folder Structure Explained

The repository separates generated system code from non-generated supporting files.

-
-

2.5.1. ./assets

+
+

2.5.1. ./assets

Contains non-generated assisting files such as: @@ -656,8 +656,8 @@ These files are safe to edit directly.

-
-

2.5.2. ./assets/conf

+
+

2.5.2. ./assets/conf

Contains non-generated assisting configuration files that influence several aspects of builds. @@ -665,8 +665,8 @@ Users are expected to modify these when needed.

-
-

2.5.3. ./configuration

+
+

2.5.3. ./configuration

Fully (re)generated by README.org. @@ -685,8 +685,8 @@ This directory is output.

-
-

2.5.4. ./hardware

+
+

2.5.4. ./hardware

Contains non-generated hardware.nix files detailing hardware-specific details. @@ -694,8 +694,8 @@ This directory will likely be deprecated in the future.

-
-

2.5.5. ./home

+
+

2.5.5. ./home

Fully (re)generated by README.org. @@ -711,8 +711,8 @@ Contains:

-
-

2.5.6. ./machines

+
+

2.5.6. ./machines

Contains one folder per machine you want to configure. @@ -730,8 +730,8 @@ These determine how shared modules apply to each system.

-
-

2.6. Final Principle

+
+

2.6. Final Principle

A literate NixOS system guarantees: @@ -750,8 +750,8 @@ You are maintaining a structured narrative that builds an operating system.

-
-

2.7. Base packages

+
+

2.7. Base packages

The baseline package set is defined explicitly within the repository to ensure reproducibility: @@ -825,8 +825,8 @@ The baseline package set is defined explicitly within the repository to ensure r

-
-

2.8. Additional packages

+
+

2.8. Additional packages

Additional software can be installed by extending the dedicated configuration files that define system and Flatpak packages: @@ -867,12 +867,12 @@ This separation maintains clarity between system-level packages and user-facing

-
-

3. Setting up your system manually

+
+

3. Setting up your system manually

-
-

3.1. Pre-requisites to build this setup

+
+

3.1. Pre-requisites to build this setup

- a NIXOS system installed with a user with sudo rights.
@@ -882,8 +882,8 @@ This separation maintains clarity between system-level packages and user-facing
 
-
-

3.2. Setup when Emacs not (yet) available

+
+

3.2. Setup when Emacs not (yet) available

  1. Copy the folder henrovnixok to your machine
  2. @@ -952,8 +952,8 @@ Run the build command to set up the system for the first time
-
-

4. Testing and generating builds

+
+

4. Testing and generating builds

At this stage, you should have a functional and reproducible system that can be edited, rebuilt, and extended according to your needs. The foundational structure is now in place, and further customization can occur incrementally through the modular configuration files. @@ -1016,46 +1016,46 @@ Other important files:

-
-

5. flake.lock for pinning input versions.

+
+

5. flake.lock for pinning input versions.

-
-

6. assets/* for non-Nix-managed artifacts such as images and wallpapers.

+
+

6. assets/* for non-Nix-managed artifacts such as images and wallpapers.

Generated outputs should not be edited directly. A CI workflow can tangle and commit generated outputs when they differ.

-
-

6.1. Emacs + Org + Tangle

+
+

6.1. Emacs + Org + Tangle

-
-

7. [Emacs](https://www.gnu.org/software/emacs/][Emacs) is used as the editor and execution environment for this literate configuration.

+
+

7. [Emacs](https://www.gnu.org/software/emacs/][Emacs) is used as the editor and execution environment for this literate configuration.

-
-

8. [Org](https://orgmode.org/][Org) mode provides the document structure and the source block execution model used here.

+
+

8. [Org](https://orgmode.org/][Org) mode provides the document structure and the source block execution model used here.

-
-

9. Tangling exports source blocks from this Org document into the corresponding configuration files.

+
+

9. Tangling exports source blocks from this Org document into the corresponding configuration files.

  • References of the form <<code-id>> are noweb placeholders that are expanded from other blocks during tangling.
-
-

9.1. Nix & NixOS

+
+

9.1. Nix & NixOS

-
-

10. [Nix](https://nix.dev/][Nix) is used to define packages, environments, and configuration as pure expressions.

+
+

10. [Nix](https://nix.dev/][Nix) is used to define packages, environments, and configuration as pure expressions.

-
-

11. [NixOS](https://nixos.org/][NixOS) evaluates Nix expressions into a complete system configuration that can be applied by rebuild operations.

+
+

11. [NixOS](https://nixos.org/][NixOS) evaluates Nix expressions into a complete system configuration that can be applied by rebuild operations.

-
-

11.1. Repository layout and folder conventions

+
+

11.1. Repository layout and folder conventions

<p> @@ -1068,8 +1068,8 @@ Generated outputs should not be edited directly. A CI workflow can tangle and co

-
-

11.2. Shared domain folders

+
+

11.2. Shared domain folders

<ul> @@ -1083,8 +1083,8 @@ Generated outputs should not be edited directly. A CI workflow can tangle and co

-
-

11.3. Full tree (including unchanged parts)

+
+

11.3. Full tree (including unchanged parts)

The tree below shows the full repository layout, with the standardized internal structure applied only inside @@ -1219,8 +1219,8 @@ The tree below shows the full repository layout, with the standardized internal

-
-

11.4. Notes

+
+

11.4. Notes

<ul> @@ -1253,8 +1253,8 @@ This prevents unwanted and surprise updates when rebuilding without changing the

-
-

12. TLDR App List

+
+

12. TLDR App List

@@ -1328,8 +1328,8 @@ This prevents unwanted and surprise updates when rebuilding without changing the
-
-

13. Configuration Variables

+
+

13. Configuration Variables

I have a bunch of constant strings that I would rather put in a file. Thats what user.nix is. @@ -1346,8 +1346,8 @@ The values are imported at the beginning and are available to almost all the fun

-
-

14. Flake Inputs

+
+

14. Flake Inputs

The inputs for my system's configuration are very simple @@ -1388,8 +1388,8 @@ zen-browser = {

-
-

15. Flake Output

+
+

15. Flake Output

Now that the inputs are ready, the outputs define what the system will actually look like. I also define the machines that this configuration specifies early on. Finally, I iterate over the machines list and pull files from /.machines/${name} subdirectory. This allows me to have configuration that has machine specific configuration limited to those files while also keeping a modular reusable base. @@ -1397,7 +1397,7 @@ We also add a devshell that makes editing this repository easier in emacs.

-
outputs = inputs@{
+
outputs = inputs@{
 nixpkgs,
 home-manager,
 emacs-overlay,
@@ -1430,7 +1430,7 @@ in
     hostname = machine;
     inherit user;
     inherit inputs;
-    flakeRoot = inputs.self;
+    flakeRoot.outPath= inputs.self;
     };
   };
   }) machines
@@ -1458,7 +1458,7 @@ Overlays are a special nix way to override existing packages within a repository
 

-
({ ... }: {
+
({ ... }: {
 nixpkgs.overlays = [ emacs-overlay.overlays.default ];
 })
 
@@ -1468,7 +1468,7 @@ nixpkgs.overlays = [ emacs-overlay.overlays.default ]; Then the machine specific configuration, in this case, just "traveldroid".

-
./machines/${machine}/configuration.nix
+
./machines/${machine}/configuration.nix
 
@@ -1478,14 +1478,14 @@ This can be initialized and managed on its own but I'd rather use the nixo

-
home-manager.nixosModules.home-manager
+
home-manager.nixosModules.home-manager
 {
 home-manager.useGlobalPkgs = true;
 home-manager.useUserPackages = true;
 
 home-manager.extraSpecialArgs = {
   inherit user inputs;
-  flakeRoot = inputs.self;
+  flakeRoot.outPath= inputs.self;
 };
 
 <<flake-home-backup>>
@@ -1521,8 +1521,8 @@ imports =  [
 
-
-

15.1. Envrc + Direnv

+
+

15.1. Envrc + Direnv

Editing this file will be much nicer if we have the dev environment configured. @@ -1543,14 +1543,14 @@ fi

-
-

16. Machines

+
+

16. Machines

The individual machines subdirectory is configured as follows :-

-
+--machine
+
+--machine
 |  +--configuration.nix
 |  +--home.nix
 |  +--hardware-configuration.nix
@@ -1571,12 +1571,12 @@ This imported object (or function result) is just trivially merged into a common
 We can take a look at that the common hardware options I have for all my machines.
 

-
-

16.0.1. Other Utils

+
+

16.0.1. Other Utils

    -
  1. Updates
    +
  2. Updates

    To update the computer, I just need to update the flake.lock file to have references to the latest repository. This is done with :- @@ -1590,8 +1590,8 @@ To update the computer, I just need to update the flake.lock file t

-
-

17. Hardware

+
+

17. Hardware

I'll let the code comments explain the file here. @@ -1625,8 +1625,8 @@ hardware.enableAllFirmware = true; # enable all firmware regardless of license

-
-

18. Configuration

+
+

18. Configuration

This section describes the main system configuration for the computers that I have. Nix will look for a default.nix file if you give it a path to a folder to import. And default.nix looks as follows :- @@ -1669,21 +1669,21 @@ This section describes the main system configuration for the computers that I ha

-
-

18.1. Apps section

+
+

18.1. Apps section

This section describes a way of installing packages, either through nixpkgs orr flatpak. What apps to instal is decided in the files ./assets/conf/apps/packages.conf and flatpaks.conf

-
-

18.2. installpackages.nix

+
+

18.2. installpackages.nix

{ config, lib, pkgs, flakeRoot, inputs, ... }:
 let
-  packagesConfPath = flakeRoot + "/assets/conf/apps/packages.conf";
+  packagesConfPath = flakeRoot.outPath + "/assets/conf/apps/packages.conf";
   raw = builtins.readFile packagesConfPath;
   # IMPORTANT: explicit "\n" so we never accidentally split into characters
   rawLines = lib.splitString "\n" raw;
@@ -1728,14 +1728,14 @@ in
 
-
-

18.3. installflatpaks.nix

+
+

18.3. installflatpaks.nix

{ config, pkgs, lib, flakeRoot, ... }:
 let
   moduleName = "install-flatpaks";
-  flatpakConfPath = flakeRoot + "/assets/conf/apps/flatpaks.conf";
+  flatpakConfPath = flakeRoot.outPath + "/assets/conf/apps/flatpaks.conf";
   raw = builtins.readFile flatpakConfPath;
   # Explicit "\n" so we never accidentally split into characters
   rawLines = lib.splitString "\n" raw;
@@ -1841,8 +1841,8 @@ in
 
-
-

18.4. Nix Settings

+
+

18.4. Nix Settings

These are global nix settings that configure the settings for the actual tool. @@ -1891,8 +1891,8 @@ nh = {

-
-

18.5. Boot

+
+

18.5. Boot

This file has most of the settings the control how the computer boots up. @@ -1930,16 +1930,16 @@ This file has most of the settings the control how the computer boots up.

-
-

18.6. Login

+
+

18.6. Login

Here we control what the login screen would look like. In configuration/default.nix you can choose whether to use tuigreet (very minimalistic) or LightDM (nicer, themeable)

-
-

18.7. Tuigreet

+
+

18.7. Tuigreet

Doesn't match the rest of the aesthetic of the system (with hyprland), but I like its simplicity. @@ -1964,8 +1964,8 @@ settings = {

-
-

18.8. LightDM

+
+

18.8. LightDM

{ config, pkgs, lib, ... }:
@@ -2112,8 +2112,8 @@ in
 
-
-

18.9. Terminal (default system)

+
+

18.9. Terminal (default system)

This is the initial system level configuration for the terminal that I use on this machine. Its just zsh. @@ -2132,8 +2132,8 @@ This is the initial system level configuration for the terminal that I use on th

-
-

18.10. Files

+
+

18.10. Files

I use Thunar as the file explorer. Also setup a few plugins for Thunar in this config. @@ -2174,8 +2174,8 @@ Along with that, a few other utilities like zip and enabling services to automou

-
-

18.11. Locale

+
+

18.11. Locale

I live in Netherlands and would like all my locale and timezone settings to match. Except my default locale. @@ -2209,8 +2209,8 @@ LC_TIME = defaultLocale;

-
-

18.12. Networking

+
+

18.12. Networking

Not much to see here. I want networking to be enabled. I want firewall as well. @@ -2241,8 +2241,8 @@ Not much to see here. I want networking to be enabled. I want firewall as well.

-
-

18.13. Hyprland

+
+

18.13. Hyprland

This is a big one because the DE needs so much configuration. This section mostly installs Hyprland. @@ -2313,8 +2313,8 @@ The configuration is done in the home manager section.

-
-

18.14. Services

+
+

18.14. Services

These are some of the services that I enable at the system level. Explanation in the comments. @@ -2347,8 +2347,8 @@ users.users.${user.username}.extraGroups = [ "docker" ]; # add self to docker us

-
-

18.15. Audio

+
+

18.15. Audio

{ config, pkgs, lib, ... }:
@@ -2425,14 +2425,14 @@ users.users.${user.username}.extraGroups = [ "docker" ]; # add self to docker us
 
-
-

18.16. Fonts

+
+

18.16. Fonts

Nothing much to see here. I love Aporetic, and I use it everywhere.

-
fonts.packages = with pkgs; [
+
fonts.packages = with pkgs; [
 aporetic
 nerd-fonts.iosevka
 ];
@@ -2440,14 +2440,14 @@ nerd-fonts.iosevka
 
-
-

18.17. User Config

+
+

18.17. User Config

This creates the user profile that I login with. Initially created during install.

-
users.users.${user.username} = {
+
users.users.${user.username} = {
 isNormalUser = true;
 description = "henrov";
 extraGroups = [
@@ -2462,8 +2462,8 @@ extraGroups = [
 
-
-

19. Home

+
+

19. Home

I use home-manager to manage my user level dotfiles and configurations. @@ -2471,8 +2471,8 @@ Most of the "theme" of the system is decided here. I also use it to install programs that are okay with being installed at the user level instead of the system.

-
-

19.1. default.nix

+
+

19.1. default.nix

This module will import all necessities. @@ -2516,8 +2516,8 @@ This module will import all necessities.

-
-

19.2. Ollama

+
+

19.2. Ollama

This Home Manager Nix module (ai.nix) installs the Ollama package and configures it by reading a simple key-value configuration file (ollama.conf) for settings like the server host and default model. It sets environment variables (OLLAMAHOST and OLAMADEFAULTMODEL) for easy access in your shell or applications, with fallback defaults if the config file is missing or empty. Optionally, it also defines a user-level systemd service to automatically start the Ollama server on NixOS or systems with Home Manager’s systemd support enabled. @@ -2526,7 +2526,7 @@ This Home Manager Nix module (ai.nix) installs the Ollama package and configures

{ config, lib, pkgs, flakeRoot, ... }:
 let
-  ollamaConfPath = flakeRoot + "/assets/conf/apps/ai/ollama/ollama.conf";
+  ollamaConfPath = flakeRoot.outPath + "/assets/conf/apps/ai/ollama/ollama.conf";
   envVars = builtins.fromJSON (builtins.readFile ollamaConfPath);
 in
 {
@@ -2540,8 +2540,8 @@ in
 
-
-

19.3. Powermenu

+
+

19.3. Powermenu

Creates a script for a powermenu @@ -2564,8 +2564,8 @@ in

-
-

19.4. Animated Wallpaper

+
+

19.4. Animated Wallpaper

userRelRoot = "nixosconf/wallpaperstuff"; @@ -2615,8 +2615,8 @@ in

-
-

19.5. Rotating Wallpaper

+
+

19.5. Rotating Wallpaper

rotatingwallpaper.nix installs wpaperd and deploys your wallpaper files from the repo (./assets/conf/desktop/wallpaper/pictures/) into ~/conf/desktop/wallpaper/pictures. It also deploys the default wallpaper configuration from assets/conf/desktop/wallpaper/wallpaper.conf into ~/conf/desktop/wallpaper/wallpaper.conf, which is the file you can edit as a user override. @@ -2626,266 +2626,243 @@ Finally, it creates a systemd user service (wpaperd.service) that automatically

#+begin_src nix :tangle home/desktop/wallpaper.nix :noweb tangle :mkdirp yes
 { config, pkgs, lib, flakeRoot, ... }:
 let
-  repoWallpaperDir  = flakeRoot + "/assets/conf/desktop/wallpaper";
-  repoWallpaperConf = flakeRoot + "/assets/conf/desktop/wallpaper/wallpaper.conf";
+  repoWallpaperDir  = flakeRoot.outPath + "/assets/conf/desktop/wallpaper";
+  repoWallpaperConf = flakeRoot.outPath + "/assets/conf/desktop/wallpaper/wallpaper.conf";
   userRelRoot  = "nixos_conf/wallpaperstuff";
   userAbsRoot  = "${config.home.homeDirectory}/${userRelRoot}";
   userConfPath = "${userAbsRoot}/wallpaper.conf";
   # Exclude wallpaper.conf so HM does NOT manage it (avoids backup collisions)
   repoWallpapersOnly = lib.cleanSourceWith {
-  src = repoWallpaperDir;
-  filter = path: type:
-  (builtins.baseNameOf path) != "wallpaper.conf";
+    src = repoWallpaperDir;
+    filter = path: type: (builtins.baseNameOf path) != "wallpaper.conf";
   };
 in
 {
   home.packages = [ pkgs.wpaperd ];
   # Sync everything *except* wallpaper.conf into ~/nixos_conf/wallpaperstuff
   home.file."${userRelRoot}" = {
-  source = repoWallpapersOnly;
-  recursive = true;
+    source = repoWallpapersOnly;
+    recursive = true;
   };
   # Now safely overwrite the config every activation (no HM collision)
-  home.activation.wallpaperConfForce =
-  lib.hm.dag.entryAfter [ "writeBoundary" ] ''
-  set -euo pipefail
-  mkdir -p "${userAbsRoot}"
-  install -m 0644 "${repoWallpaperConf}" "${userConfPath}"
+  home.activation.wallpaperConfForce = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
+    set -euo pipefail
+    mkdir -p "${userAbsRoot}"
+    install -m 0644 "${repoWallpaperConf}" "${userConfPath}"
   '';
   systemd.user.services.wpaperd = {
-  Unit = {
-  Description = "wpaperd wallpaper daemon";
-  After = [ "default.target" ];
-  };
-  Service = {
-  Type = "simple";
-  ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${userConfPath}";
-  Restart = "on-failure";
-  RestartSec = 1;
-  };
-  Install.WantedBy = [ "default.target" ];
-  ;
-
-
-
-
-
-
-

19.6. Workspace Wallpaper

-
-
-
{ 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
-{
-  home.packages = [
-  pkgs.hyprpaper
-  pkgs.socat
-  pkgs.jq
-  pkgs.findutils
-  pkgs.coreutils
-  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 = lib.mkForce ''
-  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}" = {
-  executable = true;
-  text = lib.mkForce ''
-  #!/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
-    f="$(map_file_for_monitor "''${mon}")"
-    mkdir -p "$(dirname "''${f}")"
-    if [[ ! -f "''${f}" ]]; then
-    # Seed with 1..9 from picturesDir if present, else empty entries
-    {
-    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}"
-    # accept "w-1=/path" or "w-1= /path"
-    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
-    workspacev2* )
-    # workspacev2>>ID,NAME  :contentReference[oaicite:4]{index=4}
-    local payload wsid
-    payload="''${line#*>>}"
-    wsid="''${payload%%,*}"
-    mon="$(focused_monitor || true)"
-    [[ -n "''${mon}" && -n "''${wsid}" ]] && apply_wallpaper "''${mon}" "''${wsid}"
-    ;;
-    focusedmon* )
-    # focusedmon>>MON,WORKSPACENAME :contentReference[oaicite:5]{index=5}
-    # When monitor focus changes, re-apply for the active workspace id.
-    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 in the style of your inspiration script.
-  # Usage: set-wallpaper.sh <workspace_id> <monitor> [wallpaper]
-  xdg.configFile."${setRel}" = {
-  executable = true;
-  text = lib.mkForce ''
-  #!/usr/bin/env bash
-  set -euo pipefail
-
-  HYPR_DIR="''${XDG_CONFIG_HOME:-$HOME/.config}/hypr"
-  MAP_ROOT="''${HYPR_DIR}/hyprpaper/config"
-
-  usage() {
-    echo "Usage: set-wallpaper.sh <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
-    # Random pick from your defaults folder if you want; adjust path if needed:
-    wp="$(find "$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
-
-  # Ensure key exists; if not, append it
-  key="w-''${wsid}"
-  if ! grep -q "^''${key}=" "''${cfg}"; then
-    echo "''${key}=" >> "''${cfg}"
-  fi
-
-  # Set mapping
-  ${pkgs.gnused}/bin/sed -i "s|^''${key}=.*|''${key}= ''${wp}|g" "''${cfg}"
-
-  # If this monitor is currently showing that workspace id, apply immediately
-  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.xdg.configHome}/${daemonRel} ${picturesDir}";
-  Restart = "on-failure";
-  RestartSec = 1;
-  };
-  Install = { WantedBy = [ "graphical-session.target" ]; };
+    Unit = {
+      Description = "wpaperd wallpaper daemon";
+      After = [ "default.target" ];
+    };
+    Service = {
+      Type = "simple";
+      ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${userConfPath}";
+      Restart = "on-failure";
+      RestartSec = 1;
+    };
+    Install = {
+      WantedBy = [ "default.target" ];
+    };
   };
 }
 
-
-

19.7. Waybar

+
+

19.6. Workspace Wallpaper

+
+
+
{ 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}}"
+      FIT_MODE="fill" # hyprpaper fit_mode: contain|cover|tile|fill
+      HYPR_DIR="${config.xdg.configHome}/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
+        f="$(map_file_for_monitor "$mon")"
+        mkdir -p "$(dirname "$f")"
+        if [[ ! -f "$f" ]]; then
+          # Seed with 1..9 from picturesDir if present, else empty entries
+          {
+            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
+      }
+      # 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
+          workspacev2* )
+            # workspacev2>>ID,NAME
+            local payload wsid
+            payload="${line#*>>}"
+            wsid="${payload%%,*}"
+            mon="$(focused_monitor || true)"
+            [[ -n "$mon" && -n "$wsid" ]] && apply_wallpaper "$mon" "$wsid"
+            ;;
+          focusedmon* )
+            # focusedmon>>MON,WORKSPACENAME
+            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="${config.xdg.configHome}/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 "${config.home.homeDirectory}/.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
+      ${pkgs.gnused}/bin/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 ${daemonRel} ${picturesDir}";
+      Restart = "on-failure";
+      RestartSec = 1;
+    };
+    Install = { WantedBy = [ "graphical-session.target" ]; };
+  };
+}
+
+
+
+
+
+

19.7. Waybar

-
+

waybar.png

@@ -2913,8 +2890,8 @@ in
-
-

19.8. Lock Screen

+
+

19.8. Lock Screen

The lock screen configured using hyprlock. @@ -2924,8 +2901,8 @@ They are configured below.

{config, lib, pkgs, flakeRoot, ... }:
 let
-  lockPngSrc = flakeRoot + "/assets/lock.png";
-  hyprlockConf = flakeRoot + "/assets/conf/desktop/hypr/hyprlock.conf";
+  lockPngSrc = flakeRoot.outPath + "/assets/lock.png";
+  hyprlockConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprlock.conf";
 in
 {
   home.packages = [ pkgs.hyprlock ];
@@ -2936,8 +2913,8 @@ in
 
-
-

19.9. Idle Screen

+
+

19.9. Idle Screen

<henro: needs instruction> @@ -2945,7 +2922,7 @@ in

{ config, lib, pkgs, flakeRoot, ... }:
 let
-  hypridleConf = flakeRoot + "/assets/conf/desktop/hypr/hypridle.conf";
+  hypridleConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hypridle.conf";
 in
 {
   home.packages = [ pkgs.hypridle ];
@@ -2955,8 +2932,8 @@ in
 
-
-

19.10. hyprscrolling

+
+

19.10. hyprscrolling

This Nix module integrates the hyprscrolling plugin into a Home-Manager managed Hyprland setup in a declarative and reproducible way. It ensures the plugin is installed, optionally switches Hyprland to the scrolling layout, and renders user-defined plugin settings directly into the Hyprland configuration. The goal is to manage the scrolling workspace behavior entirely from Nix instead of maintaining manual edits inside hyprland.conf. @@ -2965,17 +2942,17 @@ This Nix module integrates the hyprscrolling plugin into a Home-Manager managed

{ config, lib, pkgs, flakeRoot,...}:
 let
   # Hyprscrolling drop-in config (repo -> ~/.config)
-  repoConf = flakeRoot + "/assets/conf/desktop/hypr/hyprscrolling.conf";
+  repoConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprscrolling.conf";
   targetRel = "hypr/conf.d/90-hyprscrolling.conf";
   # Overflow indicator script (repo -> ~/.config)
-  repoOverflowScript = flakeRoot + "/assets/conf/desktop/hypr/scripts/hyprscroll-overflow.sh";
+  repoOverflowScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscroll-overflow.sh";
   targetOverflowRel = "hypr/scripts/hyprscroll-overflow.sh";
   # Adapt columnsize to monitor
-  repoPerMonitorScript = flakeRoot + "/assets/conf/desktop/hypr/scripts/hyprscrolling-per-monitor.sh";
+  repoPerMonitorScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscrolling-per-monitor.sh";
   targetPerMonitor = "hypr/scripts/hyprscrolling-per-monitor.sh";
   # Facilitate switching between scrolling and dwindle
   repoSwitchScript =
-  flakeRoot + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh";
+  flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh";
   targetSwitchScript = "hypr/scripts/toggle-layout-scrolling-dwindle.sh";
 in
 {
@@ -3014,8 +2991,8 @@ in
 
-
-

19.11. Hyprshell

+
+

19.11. Hyprshell

For nice task-starting and -switching @@ -3024,7 +3001,7 @@ For nice task-starting and -switching

# home/desktop/hyprshell.nix  (Home-Manager module)
 { config, pkgs, lib, flakeRoot, ... }:
 let
-  repoDir = flakeRoot + "/assets/conf/desktop/hypr/hyprshell";
+  repoDir = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprshell";
   cfgRon  = repoDir + "/config.ron";
   cssFile = repoDir + "/styles.css";
 in
@@ -3055,8 +3032,8 @@ in
 
-
-

19.12. Hyprland

+
+

19.12. Hyprland

This configures the desktop environment along with the peripherals. The comments should explain whats happening. @@ -3064,8 +3041,8 @@ This configures the desktop environment along with the peripherals. The comments

{ config, lib, pkgs, flakeRoot, ... }:
 let
-  hyprConf   = flakeRoot + "/assets/conf/desktop/hypr/hyprland.conf";
-  bindingsConf = flakeRoot + "/assets/conf/desktop/hypr/bindings.conf";
+  hyprConf   = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprland.conf";
+  bindingsConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/bindings.conf";
 in
 {
   wayland.windowManager.hyprland = {
@@ -3083,7 +3060,7 @@ in
   };
   };
   xdg.configFile."hypr/scripts/lid-lock.sh" = {
-    source = lib.mkForce (flakeRoot + "/assets/conf/desktop/hypr/scripts/lid-lock.sh");
+    source = lib.mkForce (flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/lid-lock.sh");
     executable = true;
   };
   xdg.portal = {
@@ -3105,8 +3082,8 @@ in
 
-
-

19.13. Walker

+
+

19.13. Walker

This is how I launch applications. It is bound to Win+Space in the ./asstes/conf/desktop/hypr/bindings.conf. @@ -3124,7 +3101,7 @@ let else pkgs.elephant; sessionTarget = "graphical-session.target"; # All theme files now live here - repoThemesDir = flakeRoot + "/assets/conf/desktop/walker"; + repoThemesDir = flakeRoot.outPath + "/assets/conf/desktop/walker"; in { xdg.enable = true; @@ -3142,8 +3119,8 @@ in

-
-

19.14. Theme

+
+

19.14. Theme

I use the Catppuccin almost everywhere. The nix module integrates almost automatically everywhere (except gtk). @@ -3176,8 +3153,8 @@ catppuccin.cursors.enable = true;

-
-

19.15. Default-apps

+
+

19.15. Default-apps

This is where you can set defaults @@ -3196,8 +3173,8 @@ This is where you can set defaults

-
-

19.16. Hyperexpo

+
+

19.16. Hyperexpo

hyprexpo gets installed and configured @@ -3236,8 +3213,8 @@ hyprexpo gets installed and configured

-
-

19.17. Alacritty

+
+

19.17. Alacritty

Alacritty gets installed and configured @@ -3245,7 +3222,7 @@ Alacritty gets installed and configured

{ config, pkgs, lib, flakeRoot, ... }:
 let
-  repoAlacrittyConf = flakeRoot + "/assets/conf/dev/alacritty.toml";
+  repoAlacrittyConf = flakeRoot.outPath + "/assets/conf/dev/alacritty.toml";
 in
 {
   xdg.enable = true;
@@ -3259,8 +3236,8 @@ in
 
-
-

19.18. Dev Tools

+
+

19.18. Dev Tools

All the miscellaneous dev tools on this computer. @@ -3312,8 +3289,8 @@ All the miscellaneous dev tools on this computer.

-
-

19.19. Kitty

+
+

19.19. Kitty

Kitty gets installed and configured @@ -3322,10 +3299,10 @@ Kitty gets installed and configured

{ config, pkgs, lib, flakeRoot, ... }:
 let
   catppuccinMochaConf =
-  builtins.readFile (flakeRoot + "/assets/conf/dev/terminal/Catppuccin-Mocha.conf");
+  builtins.readFile (flakeRoot.outPath + "/assets/conf/dev/terminal/Catppuccin-Mocha.conf");
   # Your own keymaps / other settings (but we will NOT rely on it for opacity)
   repoKittyConfText =
-  builtins.readFile (flakeRoot + "/assets/conf/dev/terminal/kitty.conf");
+  builtins.readFile (flakeRoot.outPath + "/assets/conf/dev/terminal/kitty.conf");
 in
 {
   xdg.enable = true;
@@ -3352,8 +3329,8 @@ in
 
-
-

19.20. Shells

+
+

19.20. Shells

The aliases mentioned in ./assets/conf/dev/terminal/shells.conf will be added to enabled shells @@ -3376,7 +3353,7 @@ The aliases mentioned in ./assets/conf/dev/terminal/shells.conf will be added to # - Instead, we create/remove files via home.activation (create only if missing). { config, pkgs, lib, flakeRoot, ... }: let - terminalDir = flakeRoot + "/assets/conf/dev/terminal"; + terminalDir = flakeRoot.outPath + "/assets/conf/dev/terminal"; enabledFile = terminalDir + "/enabled_shells.conf"; aliasesFile = terminalDir + "/aliases.conf"; trim = lib.strings.trim; @@ -3569,8 +3546,8 @@ EOF

-
-

19.21. Zsh

+
+

19.21. Zsh

Zsh gets installed and configured @@ -3606,8 +3583,8 @@ Zsh gets installed and configured

-
-

19.22. Starship

+
+

19.22. Starship

The configuration mentioned in ./assets/conf/dev/terminal/starship.toml will be added to enabled shells @@ -3616,7 +3593,7 @@ The configuration mentioned in ./assets/conf/dev/terminal/starship.toml will be

{ config, pkgs, lib, flakeRoot, ... }:
 
 let
-  repoStarshipToml = flakeRoot + "/assets/conf/dev/terminal/starship.toml";
+  repoStarshipToml = flakeRoot.outPath + "/assets/conf/dev/terminal/starship.toml";
 
   # The exact key that appears in the error:
   targetKey = "${config.home.homeDirectory}/.config/starship.toml";
@@ -3639,18 +3616,18 @@ in
 
-
-

19.23. Other Settings

+
+

19.23. Other Settings

Some repeated info from the configuration.

-
-

19.23.1. Home User

+
+

19.23.1. Home User

-
home.username = "${user.username}";
+
home.username = "${user.username}";
 home.homeDirectory = pkgs.lib.mkDefault "/home/${user.username}";
 home.stateVersion = user.stateVersion;
 
@@ -3659,8 +3636,8 @@ home.stateVersion = user.stateVersion;
-
-

20. Emacs

+
+

20. Emacs

I practically live inside emacs. The configuration for it is a mix between init.el and the nix configuration. @@ -3739,8 +3716,8 @@ enable = true;

-
-

20.1. Early Initialization

+
+

20.1. Early Initialization

There are some emacs settings that can be configured before the gui shows up. @@ -3845,8 +3822,8 @@ package-archive-priorities '(("gnu" . 99)

-
-

20.2. Initialization

+
+

20.2. Initialization

Now starts the main emacs configuration. @@ -4258,22 +4235,22 @@ the top of the file."

-
-

21. Machines

+
+

21. Machines

Only a few more things left. Specifically the machine level extra settings.

-
-

21.1. Traveldroid

+
+

21.1. Traveldroid

The configuration for the laptop does not change much. Most changes are because the hardware is different.

-
-

21.1.1. System Level

+
+

21.1.1. System Level

Nothing specific for the laptop. @@ -4291,8 +4268,8 @@ Nothing specific for the laptop.

-
-

21.1.2. Hardware

+
+

21.1.2. Hardware

This is the most different. Mostly taken from hardware-configuration.nix setup at first install. @@ -4342,8 +4319,8 @@ hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistr

-
-

21.1.3. Home

+
+

21.1.3. Home

This is mostly about configuring the monitor. And laptop specific utilities. @@ -4370,18 +4347,18 @@ This is mostly about configuring the monitor. And laptop specific utilities.

-
-

22. README Utils

+
+

22. README Utils

-
-

22.0.1. Headers

+
+

22.0.1. Headers

This script adds a DO NOT MODIFY header to all the generated nix files.

-
(progn
+
(progn
 (defun add-tangle-headers ()
 (message "running in %s" (buffer-file-name))
 (when (string= (file-name-extension (buffer-file-name)) "nix")
@@ -4398,7 +4375,7 @@ This script adds a DO NOT MODIFY header to all the generated nix fi
 

Author: henrov

-

Created: 2026-03-01 zo 18:14

+

Created: 2026-03-01 zo 18:24

Validate

diff --git a/henrovnix_ok/README.org b/henrovnix_ok/README.org index 8e99fff87..b9e48029a 100755 --- a/henrovnix_ok/README.org +++ b/henrovnix_ok/README.org @@ -709,7 +709,7 @@ We also add a devshell that makes editing this repository easier in emacs. hostname = machine; inherit user; inherit inputs; - flakeRoot = inputs.self; + flakeRoot.outPath= inputs.self; }; }; }) machines @@ -755,7 +755,7 @@ Lets look at the individual modules home-manager.extraSpecialArgs = { inherit user inputs; - flakeRoot = inputs.self; + flakeRoot.outPath= inputs.self; }; <> @@ -897,7 +897,7 @@ This section describes a way of installing packages, either through nixpkgs orr #+begin_src nix :tangle configuration/apps/install_packages.nix :noweb tangle :mkdirp yes { config, lib, pkgs, flakeRoot, inputs, ... }: let - packagesConfPath = flakeRoot + "/assets/conf/apps/packages.conf"; + packagesConfPath = flakeRoot.outPath + "/assets/conf/apps/packages.conf"; raw = builtins.readFile packagesConfPath; # IMPORTANT: explicit "\n" so we never accidentally split into characters rawLines = lib.splitString "\n" raw; @@ -945,7 +945,7 @@ in { config, pkgs, lib, flakeRoot, ... }: let moduleName = "install-flatpaks"; - flatpakConfPath = flakeRoot + "/assets/conf/apps/flatpaks.conf"; + flatpakConfPath = flakeRoot.outPath + "/assets/conf/apps/flatpaks.conf"; raw = builtins.readFile flatpakConfPath; # Explicit "\n" so we never accidentally split into characters rawLines = lib.splitString "\n" raw; @@ -1643,7 +1643,7 @@ This Home Manager Nix module (ai.nix) installs the Ollama package and configures #+begin_src nix :tangle home/apps/ollama.nix :noweb tangle :mkdirp yes { config, lib, pkgs, flakeRoot, ... }: let - ollamaConfPath = flakeRoot + "/assets/conf/apps/ai/ollama/ollama.conf"; + ollamaConfPath = flakeRoot.outPath + "/assets/conf/apps/ai/ollama/ollama.conf"; envVars = builtins.fromJSON (builtins.readFile ollamaConfPath); in { @@ -1725,251 +1725,228 @@ Finally, it creates a systemd user service (wpaperd.service) that automatically #+begin_src nix :tangle home/desktop/wallpaper.nix :noweb tangle :mkdirp yes { config, pkgs, lib, flakeRoot, ... }: let - repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper"; - repoWallpaperConf = flakeRoot + "/assets/conf/desktop/wallpaper/wallpaper.conf"; + repoWallpaperDir = flakeRoot.outPath + "/assets/conf/desktop/wallpaper"; + repoWallpaperConf = flakeRoot.outPath + "/assets/conf/desktop/wallpaper/wallpaper.conf"; userRelRoot = "nixos_conf/wallpaperstuff"; userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}"; userConfPath = "${userAbsRoot}/wallpaper.conf"; # Exclude wallpaper.conf so HM does NOT manage it (avoids backup collisions) repoWallpapersOnly = lib.cleanSourceWith { - src = repoWallpaperDir; - filter = path: type: - (builtins.baseNameOf path) != "wallpaper.conf"; + src = repoWallpaperDir; + filter = path: type: (builtins.baseNameOf path) != "wallpaper.conf"; }; in { home.packages = [ pkgs.wpaperd ]; # Sync everything *except* wallpaper.conf into ~/nixos_conf/wallpaperstuff home.file."${userRelRoot}" = { - source = repoWallpapersOnly; - recursive = true; + source = repoWallpapersOnly; + recursive = true; }; # Now safely overwrite the config every activation (no HM collision) - home.activation.wallpaperConfForce = - lib.hm.dag.entryAfter [ "writeBoundary" ] '' - set -euo pipefail - mkdir -p "${userAbsRoot}" - install -m 0644 "${repoWallpaperConf}" "${userConfPath}" + home.activation.wallpaperConfForce = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + set -euo pipefail + mkdir -p "${userAbsRoot}" + install -m 0644 "${repoWallpaperConf}" "${userConfPath}" ''; systemd.user.services.wpaperd = { - Unit = { - Description = "wpaperd wallpaper daemon"; - After = [ "default.target" ]; + Unit = { + Description = "wpaperd wallpaper daemon"; + After = [ "default.target" ]; + }; + Service = { + Type = "simple"; + ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${userConfPath}"; + Restart = "on-failure"; + RestartSec = 1; + }; + Install = { + WantedBy = [ "default.target" ]; + }; }; - Service = { - Type = "simple"; - ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${userConfPath}"; - Restart = "on-failure"; - RestartSec = 1; - }; - Install.WantedBy = [ "default.target" ]; - ; - +} #+end_src ** 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"; + repoWallpaperDir = flakeRoot.outPath + "/assets/conf/desktop/wallpaper"; repoWallpapersOnly = lib.cleanSourceWith { - src = repoWallpaperDir; - filter = path: type: true; + src = repoWallpaperDir; + filter = path: type: true; }; - daemonRel = "hypr/scripts/hyprpaper-ws-daemon.sh"; - setRel = "hypr/scripts/set-wallpaper.sh"; + 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 + pkgs.hyprpaper + pkgs.socat + pkgs.jq + pkgs.findutils + pkgs.coreutils + pkgs.gnused + pkgs.gawk ]; - # Keep your existing "sync wallpapers into a writable dir" pattern + # Sync wallpapers into a writable directory home.file."${userRelRoot}" = { - source = repoWallpapersOnly; - recursive = true; + 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 = lib.mkForce '' - ipc = true - splash = false - ''; - # Workspace wallpaper daemon: listens to socket2, applies w-=... mapping - # Uses workspacev2 to get numeric workspace id. :contentReference[oaicite:1]{index=1} - xdg.configFile."${daemonRel}" = { - executable = true; - text = lib.mkForce '' - #!/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 - f="$(map_file_for_monitor "''${mon}")" - mkdir -p "$(dirname "''${f}")" - if [[ ! -f "''${f}" ]]; then - # Seed with 1..9 from picturesDir if present, else empty entries - { - 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}" - # accept "w-1=/path" or "w-1= /path" - 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 - workspacev2* ) - # workspacev2>>ID,NAME :contentReference[oaicite:4]{index=4} - local payload wsid - payload="''${line#*>>}" - wsid="''${payload%%,*}" - mon="$(focused_monitor || true)" - [[ -n "''${mon}" && -n "''${wsid}" ]] && apply_wallpaper "''${mon}" "''${wsid}" - ;; - focusedmon* ) - # focusedmon>>MON,WORKSPACENAME :contentReference[oaicite:5]{index=5} - # When monitor focus changes, re-apply for the active workspace id. - 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 - ''; + # Hyprpaper config + home.file.".config/hypr/hyprpaper.conf" = { + text = '' + ipc = true + splash = false + ''; }; - - # CLI setter in the style of your inspiration script. - # Usage: set-wallpaper.sh [wallpaper] - xdg.configFile."${setRel}" = { - executable = true; - text = lib.mkForce '' - #!/usr/bin/env bash - set -euo pipefail - - HYPR_DIR="''${XDG_CONFIG_HOME:-$HOME/.config}/hypr" - MAP_ROOT="''${HYPR_DIR}/hyprpaper/config" - - usage() { - echo "Usage: set-wallpaper.sh [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 - # Random pick from your defaults folder if you want; adjust path if needed: - wp="$(find "$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 - - # Ensure key exists; if not, append it - key="w-''${wsid}" - if ! grep -q "^''${key}=" "''${cfg}"; then - echo "''${key}=" >> "''${cfg}" - fi - - # Set mapping - ${pkgs.gnused}/bin/sed -i "s|^''${key}=.*|''${key}= ''${wp}|g" "''${cfg}" - - # If this monitor is currently showing that workspace id, apply immediately - 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 - ''; + # 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}}" + FIT_MODE="fill" # hyprpaper fit_mode: contain|cover|tile|fill + HYPR_DIR="${config.xdg.configHome}/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 + f="$(map_file_for_monitor "$mon")" + mkdir -p "$(dirname "$f")" + if [[ ! -f "$f" ]]; then + # Seed with 1..9 from picturesDir if present, else empty entries + { + 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 + } + # 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 + workspacev2* ) + # workspacev2>>ID,NAME + local payload wsid + payload="${line#*>>}" + wsid="${payload%%,*}" + mon="$(focused_monitor || true)" + [[ -n "$mon" && -n "$wsid" ]] && apply_wallpaper "$mon" "$wsid" + ;; + focusedmon* ) + # focusedmon>>MON,WORKSPACENAME + 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="${config.xdg.configHome}/hypr" + MAP_ROOT="${HYPR_DIR}/hyprpaper/config" + usage() { + echo "Usage: $0 [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 "${config.home.homeDirectory}/.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 + ${pkgs.gnused}/bin/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" ]; + 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" ]; }; }; - 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.xdg.configHome}/${daemonRel} ${picturesDir}"; - Restart = "on-failure"; - RestartSec = 1; - }; - Install = { WantedBy = [ "graphical-session.target" ]; }; + Unit = { + Description = "Workspace->wallpaper mapping daemon (hyprpaper + socket2)"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" "hyprpaper.service" ]; + }; + Service = { + ExecStart = "${pkgs.bash}/bin/bash ${daemonRel} ${picturesDir}"; + Restart = "on-failure"; + RestartSec = 1; + }; + Install = { WantedBy = [ "graphical-session.target" ]; }; }; } #+end_src @@ -2003,8 +1980,8 @@ They are configured below. #+begin_src nix :tangle home/desktop/hyprlock.nix :noweb tangle :mkdirp yes {config, lib, pkgs, flakeRoot, ... }: let - lockPngSrc = flakeRoot + "/assets/lock.png"; - hyprlockConf = flakeRoot + "/assets/conf/desktop/hypr/hyprlock.conf"; + lockPngSrc = flakeRoot.outPath + "/assets/lock.png"; + hyprlockConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprlock.conf"; in { home.packages = [ pkgs.hyprlock ]; @@ -2018,7 +1995,7 @@ in #+begin_src nix :tangle home/desktop/hypridle.nix :noweb tangle :mkdirp yes { config, lib, pkgs, flakeRoot, ... }: let - hypridleConf = flakeRoot + "/assets/conf/desktop/hypr/hypridle.conf"; + hypridleConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hypridle.conf"; in { home.packages = [ pkgs.hypridle ]; @@ -2032,17 +2009,17 @@ This Nix module integrates the hyprscrolling plugin into a Home-Manager managed { config, lib, pkgs, flakeRoot,...}: let # Hyprscrolling drop-in config (repo -> ~/.config) - repoConf = flakeRoot + "/assets/conf/desktop/hypr/hyprscrolling.conf"; + repoConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprscrolling.conf"; targetRel = "hypr/conf.d/90-hyprscrolling.conf"; # Overflow indicator script (repo -> ~/.config) - repoOverflowScript = flakeRoot + "/assets/conf/desktop/hypr/scripts/hyprscroll-overflow.sh"; + repoOverflowScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscroll-overflow.sh"; targetOverflowRel = "hypr/scripts/hyprscroll-overflow.sh"; # Adapt columnsize to monitor - repoPerMonitorScript = flakeRoot + "/assets/conf/desktop/hypr/scripts/hyprscrolling-per-monitor.sh"; + repoPerMonitorScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscrolling-per-monitor.sh"; targetPerMonitor = "hypr/scripts/hyprscrolling-per-monitor.sh"; # Facilitate switching between scrolling and dwindle repoSwitchScript = - flakeRoot + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh"; + flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh"; targetSwitchScript = "hypr/scripts/toggle-layout-scrolling-dwindle.sh"; in { @@ -2085,7 +2062,7 @@ For nice task-starting and -switching # home/desktop/hyprshell.nix (Home-Manager module) { config, pkgs, lib, flakeRoot, ... }: let - repoDir = flakeRoot + "/assets/conf/desktop/hypr/hyprshell"; + repoDir = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprshell"; cfgRon = repoDir + "/config.ron"; cssFile = repoDir + "/styles.css"; in @@ -2120,8 +2097,8 @@ This configures the desktop environment along with the peripherals. The comments #+begin_src nix :tangle home/desktop/hyprland.nix :noweb tangle :mkdirp yes. { config, lib, pkgs, flakeRoot, ... }: let - hyprConf = flakeRoot + "/assets/conf/desktop/hypr/hyprland.conf"; - bindingsConf = flakeRoot + "/assets/conf/desktop/hypr/bindings.conf"; + hyprConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprland.conf"; + bindingsConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/bindings.conf"; in { wayland.windowManager.hyprland = { @@ -2139,7 +2116,7 @@ in }; }; xdg.configFile."hypr/scripts/lid-lock.sh" = { - source = lib.mkForce (flakeRoot + "/assets/conf/desktop/hypr/scripts/lid-lock.sh"); + source = lib.mkForce (flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/lid-lock.sh"); executable = true; }; xdg.portal = { @@ -2174,7 +2151,7 @@ let else pkgs.elephant; sessionTarget = "graphical-session.target"; # All theme files now live here - repoThemesDir = flakeRoot + "/assets/conf/desktop/walker"; + repoThemesDir = flakeRoot.outPath + "/assets/conf/desktop/walker"; in { xdg.enable = true; @@ -2271,7 +2248,7 @@ Alacritty gets installed and configured #+begin_src nix :tangle home/dev/alacritty.nix :noweb tangle :mkdirp yes. { config, pkgs, lib, flakeRoot, ... }: let - repoAlacrittyConf = flakeRoot + "/assets/conf/dev/alacritty.toml"; + repoAlacrittyConf = flakeRoot.outPath + "/assets/conf/dev/alacritty.toml"; in { xdg.enable = true; @@ -2336,10 +2313,10 @@ Kitty gets installed and configured { config, pkgs, lib, flakeRoot, ... }: let catppuccinMochaConf = - builtins.readFile (flakeRoot + "/assets/conf/dev/terminal/Catppuccin-Mocha.conf"); + builtins.readFile (flakeRoot.outPath + "/assets/conf/dev/terminal/Catppuccin-Mocha.conf"); # Your own keymaps / other settings (but we will NOT rely on it for opacity) repoKittyConfText = - builtins.readFile (flakeRoot + "/assets/conf/dev/terminal/kitty.conf"); + builtins.readFile (flakeRoot.outPath + "/assets/conf/dev/terminal/kitty.conf"); in { xdg.enable = true; @@ -2384,7 +2361,7 @@ The aliases mentioned in ./assets/conf/dev/terminal/shells.conf will be added to # - Instead, we create/remove files via home.activation (create only if missing). { config, pkgs, lib, flakeRoot, ... }: let - terminalDir = flakeRoot + "/assets/conf/dev/terminal"; + terminalDir = flakeRoot.outPath + "/assets/conf/dev/terminal"; enabledFile = terminalDir + "/enabled_shells.conf"; aliasesFile = terminalDir + "/aliases.conf"; trim = lib.strings.trim; @@ -2612,7 +2589,7 @@ The configuration mentioned in ./assets/conf/dev/terminal/starship.toml will be { config, pkgs, lib, flakeRoot, ... }: let - repoStarshipToml = flakeRoot + "/assets/conf/dev/terminal/starship.toml"; + repoStarshipToml = flakeRoot.outPath + "/assets/conf/dev/terminal/starship.toml"; # The exact key that appears in the error: targetKey = "${config.home.homeDirectory}/.config/starship.toml"; diff --git a/henrovnix_ok/configuration/apps/install_flatpaks.nix b/henrovnix_ok/configuration/apps/install_flatpaks.nix index e109eb5af..6cfc4efea 100644 --- a/henrovnix_ok/configuration/apps/install_flatpaks.nix +++ b/henrovnix_ok/configuration/apps/install_flatpaks.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, flakeRoot, ... }: let moduleName = "install-flatpaks"; - flatpakConfPath = flakeRoot + "/assets/conf/apps/flatpaks.conf"; + flatpakConfPath = flakeRoot.outPath + "/assets/conf/apps/flatpaks.conf"; raw = builtins.readFile flatpakConfPath; # Explicit "\n" so we never accidentally split into characters rawLines = lib.splitString "\n" raw; diff --git a/henrovnix_ok/configuration/apps/install_packages.nix b/henrovnix_ok/configuration/apps/install_packages.nix index 8ece7c04c..da34283dd 100644 --- a/henrovnix_ok/configuration/apps/install_packages.nix +++ b/henrovnix_ok/configuration/apps/install_packages.nix @@ -1,6 +1,6 @@ { config, lib, pkgs, flakeRoot, inputs, ... }: let - packagesConfPath = flakeRoot + "/assets/conf/apps/packages.conf"; + packagesConfPath = flakeRoot.outPath + "/assets/conf/apps/packages.conf"; raw = builtins.readFile packagesConfPath; # IMPORTANT: explicit "\n" so we never accidentally split into characters rawLines = lib.splitString "\n" raw; diff --git a/henrovnix_ok/flake.nix b/henrovnix_ok/flake.nix index f3331e003..6e98b9a2e 100644 --- a/henrovnix_ok/flake.nix +++ b/henrovnix_ok/flake.nix @@ -53,7 +53,7 @@ in home-manager.extraSpecialArgs = { inherit user inputs; - flakeRoot = inputs.self; + flakeRoot.outPath= inputs.self; }; home-manager.backupFileExtension = "backup"; @@ -72,7 +72,7 @@ in hostname = machine; inherit user; inherit inputs; - flakeRoot = inputs.self; + flakeRoot.outPath= inputs.self; }; }; }) machines diff --git a/henrovnix_ok/home/apps/ollama.nix b/henrovnix_ok/home/apps/ollama.nix index d0165d0bc..77146f262 100644 --- a/henrovnix_ok/home/apps/ollama.nix +++ b/henrovnix_ok/home/apps/ollama.nix @@ -1,6 +1,6 @@ { config, lib, pkgs, flakeRoot, ... }: let - ollamaConfPath = flakeRoot + "/assets/conf/apps/ai/ollama/ollama.conf"; + ollamaConfPath = flakeRoot.outPath + "/assets/conf/apps/ai/ollama/ollama.conf"; envVars = builtins.fromJSON (builtins.readFile ollamaConfPath); in { diff --git a/henrovnix_ok/home/desktop/hypridle.nix b/henrovnix_ok/home/desktop/hypridle.nix index af2f3f1fb..b2a2edde6 100644 --- a/henrovnix_ok/home/desktop/hypridle.nix +++ b/henrovnix_ok/home/desktop/hypridle.nix @@ -1,6 +1,6 @@ { config, lib, pkgs, flakeRoot, ... }: let - hypridleConf = flakeRoot + "/assets/conf/desktop/hypr/hypridle.conf"; + hypridleConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hypridle.conf"; in { home.packages = [ pkgs.hypridle ]; diff --git a/henrovnix_ok/home/desktop/hyprland.nix b/henrovnix_ok/home/desktop/hyprland.nix index 67135269f..edfa419eb 100644 --- a/henrovnix_ok/home/desktop/hyprland.nix +++ b/henrovnix_ok/home/desktop/hyprland.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, flakeRoot, ... }: let - hyprConf = flakeRoot + "/assets/conf/desktop/hypr/hyprland.conf"; - bindingsConf = flakeRoot + "/assets/conf/desktop/hypr/bindings.conf"; + hyprConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprland.conf"; + bindingsConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/bindings.conf"; in { wayland.windowManager.hyprland = { @@ -19,7 +19,7 @@ in }; }; xdg.configFile."hypr/scripts/lid-lock.sh" = { - source = lib.mkForce (flakeRoot + "/assets/conf/desktop/hypr/scripts/lid-lock.sh"); + source = lib.mkForce (flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/lid-lock.sh"); executable = true; }; xdg.portal = { diff --git a/henrovnix_ok/home/desktop/hyprlock.nix b/henrovnix_ok/home/desktop/hyprlock.nix index f1be9c727..e24921faf 100644 --- a/henrovnix_ok/home/desktop/hyprlock.nix +++ b/henrovnix_ok/home/desktop/hyprlock.nix @@ -1,7 +1,7 @@ {config, lib, pkgs, flakeRoot, ... }: let - lockPngSrc = flakeRoot + "/assets/lock.png"; - hyprlockConf = flakeRoot + "/assets/conf/desktop/hypr/hyprlock.conf"; + lockPngSrc = flakeRoot.outPath + "/assets/lock.png"; + hyprlockConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprlock.conf"; in { home.packages = [ pkgs.hyprlock ]; diff --git a/henrovnix_ok/home/desktop/hyprscrolling.nix b/henrovnix_ok/home/desktop/hyprscrolling.nix index 5058a5cce..eb03c60ec 100644 --- a/henrovnix_ok/home/desktop/hyprscrolling.nix +++ b/henrovnix_ok/home/desktop/hyprscrolling.nix @@ -1,17 +1,17 @@ { config, lib, pkgs, flakeRoot,...}: let # Hyprscrolling drop-in config (repo -> ~/.config) - repoConf = flakeRoot + "/assets/conf/desktop/hypr/hyprscrolling.conf"; + repoConf = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprscrolling.conf"; targetRel = "hypr/conf.d/90-hyprscrolling.conf"; # Overflow indicator script (repo -> ~/.config) - repoOverflowScript = flakeRoot + "/assets/conf/desktop/hypr/scripts/hyprscroll-overflow.sh"; + repoOverflowScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscroll-overflow.sh"; targetOverflowRel = "hypr/scripts/hyprscroll-overflow.sh"; # Adapt columnsize to monitor - repoPerMonitorScript = flakeRoot + "/assets/conf/desktop/hypr/scripts/hyprscrolling-per-monitor.sh"; + repoPerMonitorScript = flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/hyprscrolling-per-monitor.sh"; targetPerMonitor = "hypr/scripts/hyprscrolling-per-monitor.sh"; # Facilitate switching between scrolling and dwindle repoSwitchScript = - flakeRoot + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh"; + flakeRoot.outPath + "/assets/conf/desktop/hypr/scripts/toggle-layout-scrolling-dwindle.sh"; targetSwitchScript = "hypr/scripts/toggle-layout-scrolling-dwindle.sh"; in { diff --git a/henrovnix_ok/home/desktop/hyprshell.nix b/henrovnix_ok/home/desktop/hyprshell.nix index 6732a97f5..777d20f19 100644 --- a/henrovnix_ok/home/desktop/hyprshell.nix +++ b/henrovnix_ok/home/desktop/hyprshell.nix @@ -1,7 +1,7 @@ # home/desktop/hyprshell.nix (Home-Manager module) { config, pkgs, lib, flakeRoot, ... }: let - repoDir = flakeRoot + "/assets/conf/desktop/hypr/hyprshell"; + repoDir = flakeRoot.outPath + "/assets/conf/desktop/hypr/hyprshell"; cfgRon = repoDir + "/config.ron"; cssFile = repoDir + "/styles.css"; in diff --git a/henrovnix_ok/home/desktop/rotating_wallpaper.nix b/henrovnix_ok/home/desktop/rotating_wallpaper.nix index e00b3bb4a..97498cc2f 100644 --- a/henrovnix_ok/home/desktop/rotating_wallpaper.nix +++ b/henrovnix_ok/home/desktop/rotating_wallpaper.nix @@ -1,42 +1,43 @@ #+begin_src nix :tangle home/desktop/wallpaper.nix :noweb tangle :mkdirp yes { config, pkgs, lib, flakeRoot, ... }: let - repoWallpaperDir = flakeRoot + "/assets/conf/desktop/wallpaper"; - repoWallpaperConf = flakeRoot + "/assets/conf/desktop/wallpaper/wallpaper.conf"; + repoWallpaperDir = flakeRoot.outPath + "/assets/conf/desktop/wallpaper"; + repoWallpaperConf = flakeRoot.outPath + "/assets/conf/desktop/wallpaper/wallpaper.conf"; userRelRoot = "nixos_conf/wallpaperstuff"; userAbsRoot = "${config.home.homeDirectory}/${userRelRoot}"; userConfPath = "${userAbsRoot}/wallpaper.conf"; # Exclude wallpaper.conf so HM does NOT manage it (avoids backup collisions) repoWallpapersOnly = lib.cleanSourceWith { - src = repoWallpaperDir; - filter = path: type: - (builtins.baseNameOf path) != "wallpaper.conf"; + src = repoWallpaperDir; + filter = path: type: (builtins.baseNameOf path) != "wallpaper.conf"; }; in { home.packages = [ pkgs.wpaperd ]; # Sync everything *except* wallpaper.conf into ~/nixos_conf/wallpaperstuff home.file."${userRelRoot}" = { - source = repoWallpapersOnly; - recursive = true; + source = repoWallpapersOnly; + recursive = true; }; # Now safely overwrite the config every activation (no HM collision) - home.activation.wallpaperConfForce = - lib.hm.dag.entryAfter [ "writeBoundary" ] '' - set -euo pipefail - mkdir -p "${userAbsRoot}" - install -m 0644 "${repoWallpaperConf}" "${userConfPath}" + home.activation.wallpaperConfForce = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + set -euo pipefail + mkdir -p "${userAbsRoot}" + install -m 0644 "${repoWallpaperConf}" "${userConfPath}" ''; systemd.user.services.wpaperd = { - Unit = { - Description = "wpaperd wallpaper daemon"; - After = [ "default.target" ]; + Unit = { + Description = "wpaperd wallpaper daemon"; + After = [ "default.target" ]; + }; + Service = { + Type = "simple"; + ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${userConfPath}"; + Restart = "on-failure"; + RestartSec = 1; + }; + Install = { + WantedBy = [ "default.target" ]; + }; }; - Service = { - Type = "simple"; - ExecStart = "${pkgs.wpaperd}/bin/wpaperd --config ${userConfPath}"; - Restart = "on-failure"; - RestartSec = 1; - }; - Install.WantedBy = [ "default.target" ]; - ; +} diff --git a/henrovnix_ok/home/desktop/walker.nix b/henrovnix_ok/home/desktop/walker.nix index e57becf6f..6d96227e8 100644 --- a/henrovnix_ok/home/desktop/walker.nix +++ b/henrovnix_ok/home/desktop/walker.nix @@ -10,7 +10,7 @@ let else pkgs.elephant; sessionTarget = "graphical-session.target"; # All theme files now live here - repoThemesDir = flakeRoot + "/assets/conf/desktop/walker"; + repoThemesDir = flakeRoot.outPath + "/assets/conf/desktop/walker"; in { xdg.enable = true; diff --git a/henrovnix_ok/home/desktop/workspace_wallpaper.nix b/henrovnix_ok/home/desktop/workspace_wallpaper.nix index 33d461e96..1b30112f0 100644 --- a/henrovnix_ok/home/desktop/workspace_wallpaper.nix +++ b/henrovnix_ok/home/desktop/workspace_wallpaper.nix @@ -1,203 +1,180 @@ { 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"; + repoWallpaperDir = flakeRoot.outPath + "/assets/conf/desktop/wallpaper"; repoWallpapersOnly = lib.cleanSourceWith { - src = repoWallpaperDir; - filter = path: type: true; + src = repoWallpaperDir; + filter = path: type: true; }; - daemonRel = "hypr/scripts/hyprpaper-ws-daemon.sh"; - setRel = "hypr/scripts/set-wallpaper.sh"; + 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 + pkgs.hyprpaper + pkgs.socat + pkgs.jq + pkgs.findutils + pkgs.coreutils + pkgs.gnused + pkgs.gawk ]; - # Keep your existing "sync wallpapers into a writable dir" pattern + # Sync wallpapers into a writable directory home.file."${userRelRoot}" = { - source = repoWallpapersOnly; - recursive = true; + 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 = lib.mkForce '' - ipc = true - splash = false - ''; - # Workspace wallpaper daemon: listens to socket2, applies w-=... mapping - # Uses workspacev2 to get numeric workspace id. :contentReference[oaicite:1]{index=1} - xdg.configFile."${daemonRel}" = { - executable = true; - text = lib.mkForce '' - #!/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 - f="$(map_file_for_monitor "''${mon}")" - mkdir -p "$(dirname "''${f}")" - if [[ ! -f "''${f}" ]]; then - # Seed with 1..9 from picturesDir if present, else empty entries - { - 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}" - # accept "w-1=/path" or "w-1= /path" - 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 - workspacev2* ) - # workspacev2>>ID,NAME :contentReference[oaicite:4]{index=4} - local payload wsid - payload="''${line#*>>}" - wsid="''${payload%%,*}" - mon="$(focused_monitor || true)" - [[ -n "''${mon}" && -n "''${wsid}" ]] && apply_wallpaper "''${mon}" "''${wsid}" - ;; - focusedmon* ) - # focusedmon>>MON,WORKSPACENAME :contentReference[oaicite:5]{index=5} - # When monitor focus changes, re-apply for the active workspace id. - 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 - ''; + # Hyprpaper config + home.file.".config/hypr/hyprpaper.conf" = { + text = '' + ipc = true + splash = false + ''; }; - - # CLI setter in the style of your inspiration script. - # Usage: set-wallpaper.sh [wallpaper] - xdg.configFile."${setRel}" = { - executable = true; - text = lib.mkForce '' - #!/usr/bin/env bash - set -euo pipefail - - HYPR_DIR="''${XDG_CONFIG_HOME:-$HOME/.config}/hypr" - MAP_ROOT="''${HYPR_DIR}/hyprpaper/config" - - usage() { - echo "Usage: set-wallpaper.sh [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 - # Random pick from your defaults folder if you want; adjust path if needed: - wp="$(find "$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 - - # Ensure key exists; if not, append it - key="w-''${wsid}" - if ! grep -q "^''${key}=" "''${cfg}"; then - echo "''${key}=" >> "''${cfg}" - fi - - # Set mapping - ${pkgs.gnused}/bin/sed -i "s|^''${key}=.*|''${key}= ''${wp}|g" "''${cfg}" - - # If this monitor is currently showing that workspace id, apply immediately - 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 - ''; + # 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}}" + FIT_MODE="fill" # hyprpaper fit_mode: contain|cover|tile|fill + HYPR_DIR="${config.xdg.configHome}/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 + f="$(map_file_for_monitor "$mon")" + mkdir -p "$(dirname "$f")" + if [[ ! -f "$f" ]]; then + # Seed with 1..9 from picturesDir if present, else empty entries + { + 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 + } + # 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 + workspacev2* ) + # workspacev2>>ID,NAME + local payload wsid + payload="${line#*>>}" + wsid="${payload%%,*}" + mon="$(focused_monitor || true)" + [[ -n "$mon" && -n "$wsid" ]] && apply_wallpaper "$mon" "$wsid" + ;; + focusedmon* ) + # focusedmon>>MON,WORKSPACENAME + 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="${config.xdg.configHome}/hypr" + MAP_ROOT="${HYPR_DIR}/hyprpaper/config" + usage() { + echo "Usage: $0 [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 "${config.home.homeDirectory}/.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 + ${pkgs.gnused}/bin/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" ]; + 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" ]; }; }; - 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.xdg.configHome}/${daemonRel} ${picturesDir}"; - Restart = "on-failure"; - RestartSec = 1; - }; - Install = { WantedBy = [ "graphical-session.target" ]; }; + Unit = { + Description = "Workspace->wallpaper mapping daemon (hyprpaper + socket2)"; + PartOf = [ "graphical-session.target" ]; + After = [ "graphical-session.target" "hyprpaper.service" ]; + }; + Service = { + ExecStart = "${pkgs.bash}/bin/bash ${daemonRel} ${picturesDir}"; + Restart = "on-failure"; + RestartSec = 1; + }; + Install = { WantedBy = [ "graphical-session.target" ]; }; }; } diff --git a/henrovnix_ok/home/dev/alacritty.nix b/henrovnix_ok/home/dev/alacritty.nix index 992189892..b0baabe8d 100644 --- a/henrovnix_ok/home/dev/alacritty.nix +++ b/henrovnix_ok/home/dev/alacritty.nix @@ -1,6 +1,6 @@ { config, pkgs, lib, flakeRoot, ... }: let - repoAlacrittyConf = flakeRoot + "/assets/conf/dev/alacritty.toml"; + repoAlacrittyConf = flakeRoot.outPath + "/assets/conf/dev/alacritty.toml"; in { xdg.enable = true; diff --git a/henrovnix_ok/home/dev/kitty.nix b/henrovnix_ok/home/dev/kitty.nix index bad52f43f..43be955af 100644 --- a/henrovnix_ok/home/dev/kitty.nix +++ b/henrovnix_ok/home/dev/kitty.nix @@ -1,10 +1,10 @@ { config, pkgs, lib, flakeRoot, ... }: let catppuccinMochaConf = - builtins.readFile (flakeRoot + "/assets/conf/dev/terminal/Catppuccin-Mocha.conf"); + builtins.readFile (flakeRoot.outPath + "/assets/conf/dev/terminal/Catppuccin-Mocha.conf"); # Your own keymaps / other settings (but we will NOT rely on it for opacity) repoKittyConfText = - builtins.readFile (flakeRoot + "/assets/conf/dev/terminal/kitty.conf"); + builtins.readFile (flakeRoot.outPath + "/assets/conf/dev/terminal/kitty.conf"); in { xdg.enable = true; diff --git a/henrovnix_ok/home/dev/shells.nix b/henrovnix_ok/home/dev/shells.nix index cd0d1bff5..3b82f7b5f 100644 --- a/henrovnix_ok/home/dev/shells.nix +++ b/henrovnix_ok/home/dev/shells.nix @@ -15,7 +15,7 @@ # - Instead, we create/remove files via home.activation (create only if missing). { config, pkgs, lib, flakeRoot, ... }: let - terminalDir = flakeRoot + "/assets/conf/dev/terminal"; + terminalDir = flakeRoot.outPath + "/assets/conf/dev/terminal"; enabledFile = terminalDir + "/enabled_shells.conf"; aliasesFile = terminalDir + "/aliases.conf"; trim = lib.strings.trim; diff --git a/henrovnix_ok/home/dev/starship.nix b/henrovnix_ok/home/dev/starship.nix index a3c75eae2..7aea3ae2b 100644 --- a/henrovnix_ok/home/dev/starship.nix +++ b/henrovnix_ok/home/dev/starship.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, flakeRoot, ... }: let - repoStarshipToml = flakeRoot + "/assets/conf/dev/terminal/starship.toml"; + repoStarshipToml = flakeRoot.outPath + "/assets/conf/dev/terminal/starship.toml"; # The exact key that appears in the error: targetKey = "${config.home.homeDirectory}/.config/starship.toml";