diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2025-08-29 23:06:55 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2025-08-29 23:06:55 +0200 |
commit | c3a8a171734bfeced58f4611365e85a6daed7db9 (patch) | |
tree | 235296a43af10ce96b5dd74e0523e59f4c1a8b12 /home-modules/quickshell.nix | |
parent | 218ac55d86ee49d151c0ba2dfbca6da104c66703 (diff) | |
download | nixos-c3a8a171734bfeced58f4611365e85a6daed7db9.tar nixos-c3a8a171734bfeced58f4611365e85a6daed7db9.tar.gz nixos-c3a8a171734bfeced58f4611365e85a6daed7db9.tar.bz2 nixos-c3a8a171734bfeced58f4611365e85a6daed7db9.tar.xz nixos-c3a8a171734bfeced58f4611365e85a6daed7db9.zip |
...quickshell
Diffstat (limited to 'home-modules/quickshell.nix')
-rw-r--r-- | home-modules/quickshell.nix | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/home-modules/quickshell.nix b/home-modules/quickshell.nix new file mode 100644 index 00000000..dac7089f --- /dev/null +++ b/home-modules/quickshell.nix | |||
@@ -0,0 +1,68 @@ | |||
1 | { config, pkgs, lib, ... }: | ||
2 | |||
3 | let | ||
4 | cfg = config.programs.quickshell; | ||
5 | in { | ||
6 | disabledModules = ["programs/quickshell.nix"]; | ||
7 | |||
8 | options = { | ||
9 | programs.quickshell = { | ||
10 | enable = lib.mkEnableOption "quickshell"; | ||
11 | package = lib.mkPackageOption pkgs "quickshell" { nullable = true; }; | ||
12 | config.src = lib.mkOption { | ||
13 | type = lib.types.path; | ||
14 | }; | ||
15 | config.replacements = lib.mkOption { | ||
16 | type = lib.types.attrsOf lib.types.str; | ||
17 | default = {}; | ||
18 | }; | ||
19 | }; | ||
20 | }; | ||
21 | |||
22 | config = lib.mkIf cfg.enable { | ||
23 | home.packages = [ cfg.package ]; | ||
24 | |||
25 | xdg.configFile."quickshell".source = pkgs.stdenvNoCC.mkDerivation { | ||
26 | name = "quickshell"; | ||
27 | preferLocalBuild = true; | ||
28 | allowSubstitutes = false; | ||
29 | dontUnpack = true; | ||
30 | inherit (cfg.config) src; | ||
31 | buildPhase = '' | ||
32 | runHook preBuild | ||
33 | |||
34 | while IFS= read -r -d $'\0' file <&3; do | ||
35 | [[ -z $file ]] && continue | ||
36 | |||
37 | mkdir -p "$out"/"$(dirname "$file")" | ||
38 | substitute "$src"/"$file" "$out"/"$file" \ | ||
39 | ${lib.concatStringsSep " " ( | ||
40 | lib.concatLists (lib.mapAttrsToList (name: value: [ | ||
41 | "--replace-quiet" (lib.escapeShellArg "@${name}@") (lib.escapeShellArg value) | ||
42 | ]) cfg.config.replacements) | ||
43 | )} | ||
44 | done 3< <(find "$src" -type f -printf '%P\0') | ||
45 | |||
46 | runHook postBuild | ||
47 | ''; | ||
48 | }; | ||
49 | |||
50 | systemd.user.services.quickshell = { | ||
51 | Unit = { | ||
52 | Description = "quickshell"; | ||
53 | Documentation = "https://quickshell.org/docs/v${cfg.package.version}"; | ||
54 | PartOf = [ "graphical-session.target" ]; | ||
55 | After = [ "graphical-session-pre.target" ]; | ||
56 | }; | ||
57 | |||
58 | Service = { | ||
59 | ExecStart = lib.getExe cfg.package; | ||
60 | Restart = "always"; | ||
61 | }; | ||
62 | |||
63 | Install = { | ||
64 | WantedBy = [ "graphical-session.target" ]; | ||
65 | }; | ||
66 | }; | ||
67 | }; | ||
68 | } | ||