modules: refac functions
This commit is contained in:
parent
e0ded86454
commit
001a2d909c
2 changed files with 15 additions and 22 deletions
|
@ -41,13 +41,13 @@ let
|
||||||
projectStartHook =
|
projectStartHook =
|
||||||
do
|
do
|
||||||
let workdir = "${workdir}"
|
let workdir = "${workdir}"
|
||||||
${lib.concatStringsSep "\n" (map mkXmonadProjectSpawnProgram spawnPrograms)}
|
${lib.concatMapStringsSep "\n" mkXmonadProjectSpawnProgram spawnPrograms}
|
||||||
${lib.concatStringsSep "\n" (map mkXmonadProjectTerminalCommand terminalCommands)}
|
${lib.concatMapStringsSep "\n" mkXmonadProjectTerminalCommand terminalCommands}
|
||||||
replicateM_ ${toString windowCount} $ spawn $ terminal workdir
|
replicateM_ ${toString windowCount} $ spawn $ terminal workdir
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
xmonadProjects = lib.concatStringsSep " , " (map mkXmonadProject cfg.projects);
|
xmonadProjects = lib.concatMapStringsSep " , " mkXmonadProject cfg.projects;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.local.window-manager.xmonad = with lib; {
|
options.local.window-manager.xmonad = with lib; {
|
||||||
|
|
|
@ -24,13 +24,11 @@ let
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
inherit (builtins) concatStringsSep;
|
|
||||||
|
|
||||||
# See: https://github.com/feschber/lan-mouse/blob/main/src/config.rs#L79
|
# See: https://github.com/feschber/lan-mouse/blob/main/src/config.rs#L79
|
||||||
lanMouseConfig = pkgs.writeText "config.toml" (
|
lanMouseConfig = pkgs.writeText "config.toml" (
|
||||||
let
|
let
|
||||||
# List[str] -> str
|
# List[str] -> str
|
||||||
listOfStr = l: concatStringsSep "," (map (val: "\"${val}\"") l);
|
listOfStr = lib.concatMapStringsSep "," (val: "\"${val}\"");
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
port = ${toString cfg.settings.port}
|
port = ${toString cfg.settings.port}
|
||||||
|
@ -39,10 +37,8 @@ let
|
||||||
+ lib.optionalString (cfg.settings.releaseBind != [ ]) ''
|
+ lib.optionalString (cfg.settings.releaseBind != [ ]) ''
|
||||||
release_bind = [${listOfStr cfg.settings.releaseBind}]
|
release_bind = [${listOfStr cfg.settings.releaseBind}]
|
||||||
''
|
''
|
||||||
+ (concatStringsSep "\n"
|
+ (builtins.concatStringsSep "\n"
|
||||||
(lib.attrValues
|
(lib.flip lib.mapAttrstoList cfg.settings.connections (key: value: ''
|
||||||
(lib.mapAttrs
|
|
||||||
(key: value: ''
|
|
||||||
[${key}]
|
[${key}]
|
||||||
ips = [${listOfStr value.ips}]
|
ips = [${listOfStr value.ips}]
|
||||||
${lib.optionalString (value.hostname != "") ''
|
${lib.optionalString (value.hostname != "") ''
|
||||||
|
@ -51,10 +47,7 @@ let
|
||||||
port = ${toString value.port}
|
port = ${toString value.port}
|
||||||
activate_on_startup = ${if value.activateOnStartup then "true" else "false"}
|
activate_on_startup = ${if value.activateOnStartup then "true" else "false"}
|
||||||
''
|
''
|
||||||
)
|
))
|
||||||
cfg.settings.connections
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
|
|
Loading…
Reference in a new issue