Skip to content

Commit 1855827

Browse files
committed
feat(wrapperModules.quickshell): add 'configDir' option (#552)
1 parent 8c90cbe commit 1855827

1 file changed

Lines changed: 39 additions & 21 deletions

File tree

wrapperModules/q/quickshell/module.nix

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ in
3030
It is used by quickshell using `--path`.
3131
'';
3232
};
33+
configDir = mkOption {
34+
type = types.nullOr wlib.types.linkable;
35+
default = null;
36+
description = ''
37+
The full quickshell configuration including the shell.qml file.
38+
39+
Use either this option or 'configFile' and 'components'
40+
'';
41+
};
3342
components = mkOption {
3443
type = types.attrsOf (types.either wlib.types.linkable types.lines);
3544
default = { };
@@ -56,32 +65,41 @@ in
5665
}/${config.binName}-config";
5766

5867
config.constructFiles =
59-
mapAttrs' (
60-
name: val:
61-
let
62-
firstChar = builtins.substring 0 1 name;
63-
rest = builtins.substring 1 (-1) name;
64-
capitalizedName = (lib.toUpper firstChar) + rest;
65-
linkable = isLinkable val;
66-
in
68+
if config.configDir != null then
6769
{
68-
name = "${name}Component";
69-
value = {
70-
content = mkIf (!linkable) val;
71-
builder = mkIf linkable ''ln -s ${val} "$2"'';
70+
generatedConfig = {
71+
builder = ''ln -s ${config.configDir} "$2"'';
7272
output = makeForce config.generated.output;
73-
relPath = makeForce "${config.binName}-config/${capitalizedName}.qml";
73+
relPath = makeForce "${config.binName}-config";
7474
};
7575
}
76-
) config.components
77-
// {
78-
generatedConfig = {
79-
content = mkIf (!isLinkable config.configFile) config.configFile;
80-
builder = mkIf (isLinkable config.configFile) ''ln -s ${config.configFile} "$2"'';
81-
output = makeForce config.generated.output;
82-
relPath = makeForce "${config.binName}-config/shell.qml";
76+
else
77+
mapAttrs' (
78+
name: val:
79+
let
80+
firstChar = builtins.substring 0 1 name;
81+
rest = builtins.substring 1 (-1) name;
82+
capitalizedName = (lib.toUpper firstChar) + rest;
83+
linkable = isLinkable val;
84+
in
85+
{
86+
name = "${name}Component";
87+
value = {
88+
content = mkIf (!linkable) val;
89+
builder = mkIf linkable ''ln -s ${val} "$2"'';
90+
output = makeForce config.generated.output;
91+
relPath = makeForce "${config.binName}-config/${capitalizedName}.qml";
92+
};
93+
}
94+
) config.components
95+
// {
96+
generatedConfig = {
97+
content = mkIf (!isLinkable config.configFile) config.configFile;
98+
builder = mkIf (isLinkable config.configFile) ''ln -s ${config.configFile} "$2"'';
99+
output = makeForce config.generated.output;
100+
relPath = makeForce "${config.binName}-config/shell.qml";
101+
};
83102
};
84-
};
85103

86104
config.meta.maintainers = [ wlib.maintainers.ormoyo ];
87105
config.meta.platforms = lib.platforms.linux;

0 commit comments

Comments
 (0)