mirror of
https://github.com/nix-community/home-manager.git
synced 2025-03-09 18:26:54 +00:00
aerospace: cleanup
This commit is contained in:
parent
d963ed335b
commit
c621c26c4c
1 changed files with 19 additions and 11 deletions
|
@ -5,27 +5,29 @@ let
|
||||||
|
|
||||||
tomlFormat = pkgs.formats.toml { };
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
|
||||||
filterAttrsRecursive = pred: set:
|
# filterAttrsRecursive supporting lists, as well.
|
||||||
|
filterListAndAttrsRecursive = pred: set:
|
||||||
lib.listToAttrs (lib.concatMap (name:
|
lib.listToAttrs (lib.concatMap (name:
|
||||||
let v = set.${name};
|
let v = set.${name};
|
||||||
in if pred v then
|
in if pred v then
|
||||||
[
|
[
|
||||||
(lib.nameValuePair name (if lib.isAttrs v then
|
(lib.nameValuePair name (if lib.isAttrs v then
|
||||||
filterAttrsRecursive pred v
|
filterListAndAttrsRecursive pred v
|
||||||
else if lib.isList v then
|
else if lib.isList v then
|
||||||
(map (i: if lib.isAttrs i then filterAttrsRecursive pred i else i)
|
(map (i:
|
||||||
|
if lib.isAttrs i then filterListAndAttrsRecursive pred i else i)
|
||||||
(lib.filter pred v))
|
(lib.filter pred v))
|
||||||
else
|
else
|
||||||
v))
|
v))
|
||||||
]
|
]
|
||||||
else
|
else
|
||||||
[ ]) (lib.attrNames set));
|
[ ]) (lib.attrNames set));
|
||||||
filterNulls = filterAttrsRecursive (v: v != null);
|
filterNulls = filterListAndAttrsRecursive (v: v != null);
|
||||||
in {
|
in {
|
||||||
meta.maintainers = with lib.hm.maintainers; [ damidoug ];
|
meta.maintainers = with lib.hm.maintainers; [ damidoug ];
|
||||||
|
|
||||||
options.programs.aerospace = {
|
options.programs.aerospace = {
|
||||||
enable = lib.mkEnableOption "Whether to enable AeroSpace window manager.";
|
enable = lib.mkEnableOption "enable AeroSpace window manager";
|
||||||
|
|
||||||
package = lib.mkPackageOption pkgs "aerospace" { };
|
package = lib.mkPackageOption pkgs "aerospace" { };
|
||||||
|
|
||||||
|
@ -216,16 +218,22 @@ in {
|
||||||
'';
|
'';
|
||||||
description = ''
|
description = ''
|
||||||
AeroSpace configuration, see
|
AeroSpace configuration, see
|
||||||
<link xlink:href="https://nikitabobko.github.io/AeroSpace/guide#configuring-aerospace"/>
|
<https://nikitabobko.github.io/AeroSpace/guide#configuring-aerospace>
|
||||||
for supported values.
|
for supported values.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config.home = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
packages = [ cfg.package ];
|
assertions = [
|
||||||
file.".config/aerospace/aerospace.toml".source =
|
(lib.hm.assertions.assertPlatform "programs.aerospace" pkgs
|
||||||
tomlFormat.generate "aerospace" (filterNulls cfg.userSettings);
|
lib.platforms.darwin)
|
||||||
};
|
];
|
||||||
|
|
||||||
|
home = {
|
||||||
|
packages = [ cfg.package ];
|
||||||
|
file.".config/aerospace/aerospace.toml".source =
|
||||||
|
tomlFormat.generate "aerospace" (filterNulls cfg.userSettings);
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue