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 =
|
||||
do
|
||||
let workdir = "${workdir}"
|
||||
${lib.concatStringsSep "\n" (map mkXmonadProjectSpawnProgram spawnPrograms)}
|
||||
${lib.concatStringsSep "\n" (map mkXmonadProjectTerminalCommand terminalCommands)}
|
||||
${lib.concatMapStringsSep "\n" mkXmonadProjectSpawnProgram spawnPrograms}
|
||||
${lib.concatMapStringsSep "\n" mkXmonadProjectTerminalCommand terminalCommands}
|
||||
replicateM_ ${toString windowCount} $ spawn $ terminal workdir
|
||||
}
|
||||
'';
|
||||
|
||||
xmonadProjects = lib.concatStringsSep " , " (map mkXmonadProject cfg.projects);
|
||||
xmonadProjects = lib.concatMapStringsSep " , " mkXmonadProject cfg.projects;
|
||||
in
|
||||
{
|
||||
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
|
||||
lanMouseConfig = pkgs.writeText "config.toml" (
|
||||
let
|
||||
# List[str] -> str
|
||||
listOfStr = l: concatStringsSep "," (map (val: "\"${val}\"") l);
|
||||
listOfStr = lib.concatMapStringsSep "," (val: "\"${val}\"");
|
||||
in
|
||||
''
|
||||
port = ${toString cfg.settings.port}
|
||||
|
@ -39,10 +37,8 @@ let
|
|||
+ lib.optionalString (cfg.settings.releaseBind != [ ]) ''
|
||||
release_bind = [${listOfStr cfg.settings.releaseBind}]
|
||||
''
|
||||
+ (concatStringsSep "\n"
|
||||
(lib.attrValues
|
||||
(lib.mapAttrs
|
||||
(key: value: ''
|
||||
+ (builtins.concatStringsSep "\n"
|
||||
(lib.flip lib.mapAttrstoList cfg.settings.connections (key: value: ''
|
||||
[${key}]
|
||||
ips = [${listOfStr value.ips}]
|
||||
${lib.optionalString (value.hostname != "") ''
|
||||
|
@ -51,10 +47,7 @@ let
|
|||
port = ${toString value.port}
|
||||
activate_on_startup = ${if value.activateOnStartup then "true" else "false"}
|
||||
''
|
||||
)
|
||||
cfg.settings.connections
|
||||
)
|
||||
)
|
||||
))
|
||||
)
|
||||
);
|
||||
in
|
||||
|
|
Loading…
Reference in a new issue