summaryrefslogtreecommitdiff
path: root/home-modules
diff options
context:
space:
mode:
Diffstat (limited to 'home-modules')
-rw-r--r--home-modules/quickshell.nix68
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
3let
4 cfg = config.programs.quickshell;
5in {
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}