1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-14 21:11:08 +01:00

Apply nixfmt on many files

This commit is contained in:
Robert Helgesson 2020-02-02 00:39:17 +01:00
parent 9799d3de2d
commit 45abf3d38a
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
177 changed files with 2850 additions and 3565 deletions

View file

@ -9,12 +9,9 @@ let
getLuaPath = lib: dir: "${lib}/${dir}/lua/${pkgs.luaPackages.lua.luaversion}";
makeSearchPath = lib.concatMapStrings (path:
" --search ${getLuaPath path "share"}"
+ " --search ${getLuaPath path "lib"}"
);
+ " --search ${getLuaPath path "lib"}");
in
{
in {
options = {
xsession.windowManager.awesome = {
enable = mkEnableOption "Awesome window manager.";
@ -27,31 +24,29 @@ in
};
luaModules = mkOption {
default = [];
type = types.listOf types.package;
description = ''
List of lua packages available for being
used in the Awesome configuration.
'';
example = literalExample "[ luaPackages.oocairo ]";
default = [ ];
type = types.listOf types.package;
description = ''
List of lua packages available for being
used in the Awesome configuration.
'';
example = literalExample "[ luaPackages.oocairo ]";
};
noArgb = mkOption {
default = false;
type = types.bool;
description = ''
Disable client transparency support, which can be greatly
detrimental to performance in some setups
'';
default = false;
type = types.bool;
description = ''
Disable client transparency support, which can be greatly
detrimental to performance in some setups
'';
};
};
};
config = mkIf cfg.enable {
home.packages = [ awesome ];
xsession.windowManager.command =
"${awesome}/bin/awesome "
+ optionalString cfg.noArgb "--no-argb "
+ makeSearchPath cfg.luaModules;
xsession.windowManager.command = "${awesome}/bin/awesome "
+ optionalString cfg.noArgb "--no-argb " + makeSearchPath cfg.luaModules;
};
}

View file

@ -13,59 +13,62 @@ let
formatConfig = n: v:
let
formatList = x:
if isList x
then throw "can not convert 2-dimensional lists to bspwm format"
else formatValue x;
if isList x then
throw "can not convert 2-dimensional lists to bspwm format"
else
formatValue x;
formatValue = v:
if isBool v then (if v then "true" else "false")
else if isList v then concatMapStringsSep ", " formatList v
else if isString v then "${lib.strings.escapeShellArg v}"
else toString v;
in
"bspc config ${n} ${formatValue v}";
if isBool v then
(if v then "true" else "false")
else if isList v then
concatMapStringsSep ", " formatList v
else if isString v then
"${lib.strings.escapeShellArg v}"
else
toString v;
in "bspc config ${n} ${formatValue v}";
formatMonitors = n: v: "bspc monitor ${n} -d ${concatStringsSep " " v}";
formatRules = target: directiveOptions:
let
formatDirective = n: v:
if isBool v then (if v then "${camelToSnake n}=on" else "${camelToSnake n}=off")
else if (n == "desktop" || n == "node") then "${camelToSnake n}='${v}'"
else "${camelToSnake n}=${lib.strings.escapeShellArg v}";
if isBool v then
(if v then "${camelToSnake n}=on" else "${camelToSnake n}=off")
else if (n == "desktop" || n == "node") then
"${camelToSnake n}='${v}'"
else
"${camelToSnake n}=${lib.strings.escapeShellArg v}";
directives = filterAttrs (n: v: v != null && !(lib.strings.hasPrefix "_" n)) directiveOptions;
directivesStr = builtins.concatStringsSep " " (mapAttrsToList formatDirective directives);
in
"bspc rule -a ${target} ${directivesStr}";
directives =
filterAttrs (n: v: v != null && !(lib.strings.hasPrefix "_" n))
directiveOptions;
directivesStr = builtins.concatStringsSep " "
(mapAttrsToList formatDirective directives);
in "bspc rule -a ${target} ${directivesStr}";
formatStartupPrograms = map (s: "${s} &");
in
{
options = import ./options.nix { inherit pkgs; inherit lib; };
in {
options = import ./options.nix {
inherit pkgs;
inherit lib;
};
config = mkIf cfg.enable {
home.packages = [ bspwm ];
xsession.windowManager.command =
let
configFile = pkgs.writeShellScript "bspwmrc" (
concatStringsSep "\n" (
(mapAttrsToList formatMonitors cfg.monitors)
++ (mapAttrsToList formatConfig cfg.settings)
++ (mapAttrsToList formatRules cfg.rules)
++ [ ''
# java gui fixes
export _JAVA_AWT_WM_NONREPARENTING=1
bspc rule -a sun-awt-X11-XDialogPeer state=floating
'' ]
++ [ cfg.extraConfig ]
++ (formatStartupPrograms cfg.startupPrograms)
)
);
configCmdOpt = optionalString (cfg.settings != null) "-c ${configFile}";
in
"${cfg.package}/bin/bspwm ${configCmdOpt}";
xsession.windowManager.command = let
configFile = pkgs.writeShellScript "bspwmrc" (concatStringsSep "\n"
((mapAttrsToList formatMonitors cfg.monitors)
++ (mapAttrsToList formatConfig cfg.settings)
++ (mapAttrsToList formatRules cfg.rules) ++ [''
# java gui fixes
export _JAVA_AWT_WM_NONREPARENTING=1
bspc rule -a sun-awt-X11-XDialogPeer state=floating
''] ++ [ cfg.extraConfig ]
++ (formatStartupPrograms cfg.startupPrograms)));
configCmdOpt = optionalString (cfg.settings != null) "-c ${configFile}";
in "${cfg.package}/bin/bspwm ${configCmdOpt}";
};
}

View file

@ -28,7 +28,8 @@ let
};
state = mkOption {
type = types.nullOr (types.enum [ "tiled" "pseudo_tiled" "floating" "fullscreen" ]);
type = types.nullOr
(types.enum [ "tiled" "pseudo_tiled" "floating" "fullscreen" ]);
default = null;
description = "The state in which a new window should spawn.";
example = "floating";
@ -61,7 +62,7 @@ let
hidden = mkOption {
type = types.nullOr types.bool;
default = null;
description = ''Whether the node should occupy any space.'';
description = "Whether the node should occupy any space.";
example = true;
};
@ -141,9 +142,7 @@ let
};
};
in
{
in {
xsession.windowManager.bspwm = {
enable = mkEnableOption "bspwm window manager.";
@ -156,11 +155,10 @@ in
};
settings = mkOption {
type = with types; let
primitive = either bool (either int (either float str));
in
attrsOf (either primitive (listOf primitive));
default = {};
type = with types;
let primitive = either bool (either int (either float str));
in attrsOf (either primitive (listOf primitive));
default = { };
description = "bspwm configuration";
example = {
"border_width" = 2;
@ -180,16 +178,14 @@ in
monitors = mkOption {
type = types.attrsOf (types.listOf types.str);
default = {};
default = { };
description = "bspc monitor configurations";
example = {
"HDMI-0" = [ "web" "terminal" "III" "IV" ];
};
example = { "HDMI-0" = [ "web" "terminal" "III" "IV" ]; };
};
rules = mkOption {
type = types.attrsOf rule;
default = {};
default = { };
description = "bspc rules";
example = literalExample ''
{
@ -210,12 +206,9 @@ in
startupPrograms = mkOption {
type = types.listOf types.str;
default = [];
default = [ ];
description = "Programs to be executed during startup.";
example = [
"numlockx on"
"tilda"
];
example = [ "numlockx on" "tilda" ];
};
};
}

View file

@ -9,15 +9,13 @@ let
xmonad = pkgs.xmonad-with-packages.override {
ghcWithPackages = cfg.haskellPackages.ghcWithPackages;
packages = self:
cfg.extraPackages self
++ optionals cfg.enableContribAndExtras [
self.xmonad-contrib self.xmonad-extras
cfg.extraPackages self ++ optionals cfg.enableContribAndExtras [
self.xmonad-contrib
self.xmonad-extras
];
};
in
{
in {
options = {
xsession.windowManager.xmonad = {
enable = mkEnableOption "xmonad window manager";
@ -35,7 +33,7 @@ in
};
extraPackages = mkOption {
default = self: [];
default = self: [ ];
defaultText = "self: []";
example = literalExample ''
haskellPackages: [