From 83a672b3a9d8fa25946026aa805de8514934a7d0 Mon Sep 17 00:00:00 2001 From: nydragon Date: Mon, 24 Feb 2025 19:45:04 +0100 Subject: [PATCH] feat: declarative wallpapers1 --- flake.lock | 18 +++++++++++++++++- flake.nix | 2 ++ home/graphical/swww.nix | 14 +++++--------- home/hyprpaper/default.nix | 4 ++-- hosts/marr/default.nix | 1 - modules/env.nix | 3 ++- modules/sddm.nix | 4 ++-- 7 files changed, 30 insertions(+), 16 deletions(-) diff --git a/flake.lock b/flake.lock index 30aabe5..33785f6 100644 --- a/flake.lock +++ b/flake.lock @@ -389,7 +389,8 @@ "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_2", "nur": "nur", - "nysh": "nysh" + "nysh": "nysh", + "wallpapers": "wallpapers" } }, "snowfall-lib": { @@ -445,6 +446,21 @@ "repo": "default", "type": "github" } + }, + "wallpapers": { + "locked": { + "lastModified": 1740422160, + "narHash": "sha256-nHQOBJU/ZXnhHeOIv1InIjCKeFjnHZshGj/BcCdRjnQ=", + "ref": "refs/heads/main", + "rev": "f7857fa316d70847b02dc266099ce2b4eb10f5ea", + "revCount": 3, + "type": "git", + "url": "https://git.ccnlc.eu/nydragon/wallpapers.git" + }, + "original": { + "type": "git", + "url": "https://git.ccnlc.eu/nydragon/wallpapers.git" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 270fee3..fe3a500 100644 --- a/flake.nix +++ b/flake.nix @@ -45,6 +45,8 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.hjem.follows = "hjem"; }; + + wallpapers.url = "git+https://git.ccnlc.eu/nydragon/wallpapers.git"; }; outputs = diff --git a/home/graphical/swww.nix b/home/graphical/swww.nix index 8aeea25..53050f7 100644 --- a/home/graphical/swww.nix +++ b/home/graphical/swww.nix @@ -1,24 +1,20 @@ { - self, lib, pkgs, config, ... }: +let + inherit (lib.my) getExe'; +in { systemd.user.services.swww = { Install.WantedBy = [ "graphical-session.target" ]; + Unit.After = [ "graphical-session.target" ]; - Unit = { - After = [ "graphical-session.target" ]; - }; Service = { Type = "simple"; - ExecStart = "${pkgs.swww}/bin/swww-daemon"; - ExecStartPost = "${pkgs.swww}/bin/swww img ${ - self + "/assets/landscape-pink-pastel.jpg" - } -t wipe --transition-fps 144"; - + ExecStart = getExe' pkgs.swww "swww-daemon"; Restart = "on-failure"; BindPaths = "/run/user /home/${config.home.username}/.cache/swww"; TemporaryFileSystem = "/home /run/user /root"; diff --git a/home/hyprpaper/default.nix b/home/hyprpaper/default.nix index 3c9aff4..f861ff2 100644 --- a/home/hyprpaper/default.nix +++ b/home/hyprpaper/default.nix @@ -1,10 +1,10 @@ -{ self, ... }: +{ inputs, ... }: { services.hyprpaper = { enable = false; settings = let - wp = "${self}/assets/wallpapers/nix-flake-pastel.jpg"; + wp = inputs.wallpapers.wallpapers.pastel.nix-flake-pastel.path; in { ipc = "on"; diff --git a/hosts/marr/default.nix b/hosts/marr/default.nix index ea5a5b7..53b013a 100644 --- a/hosts/marr/default.nix +++ b/hosts/marr/default.nix @@ -87,7 +87,6 @@ fish.enable = true; firefox.enable = true; thunderbird.enable = true; - sway.enable = true; hyprland.enable = true; pulseview.enable = true; gnupg.agent = { diff --git a/modules/env.nix b/modules/env.nix index 79d1547..f0a61c3 100644 --- a/modules/env.nix +++ b/modules/env.nix @@ -1,7 +1,8 @@ -{ pkgs, ... }: +{ pkgs, inputs, ... }: { environment.sessionVariables = { MANROFFOPT = "-c"; MANPAGER = "sh -c 'col -bx | ${pkgs.bat}/bin/bat -l man -p'"; + WALLPAPERS = "${inputs.wallpapers}"; }; } diff --git a/modules/sddm.nix b/modules/sddm.nix index 01758eb..65fa0aa 100644 --- a/modules/sddm.nix +++ b/modules/sddm.nix @@ -1,8 +1,8 @@ { - self, pkgs, lib, config, + inputs, ... }: lib.mkIf config.services.displayManager.sddm.enable { @@ -18,7 +18,7 @@ lib.mkIf config.services.displayManager.sddm.enable { flavor = "mocha"; font = "Noto Sans"; fontSize = "9"; - background = "${self}/assets/wallpapers/nix-flake-pastel.jpg"; + background = inputs.wallpapers.wallpapers.pastel.nix-flake-pastel.path; loginBackground = true; }) ];