mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-19 16:09:19 +03:00

Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase
).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
77 lines
1.5 KiB
Nix
77 lines
1.5 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.services.dwm-status;
|
|
|
|
order = lib.concatMapStringsSep "," (feature: ''"${feature}"'') cfg.order;
|
|
|
|
configFile = pkgs.writeText "dwm-status.toml" ''
|
|
order = [${order}]
|
|
|
|
${cfg.extraConfig}
|
|
'';
|
|
in
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.dwm-status = {
|
|
|
|
enable = lib.mkEnableOption "dwm-status user service";
|
|
|
|
package = lib.mkPackageOption pkgs "dwm-status" {
|
|
example = "dwm-status.override { enableAlsaUtils = false; }";
|
|
};
|
|
|
|
order = lib.mkOption {
|
|
type = lib.types.listOf (
|
|
lib.types.enum [
|
|
"audio"
|
|
"backlight"
|
|
"battery"
|
|
"cpu_load"
|
|
"network"
|
|
"time"
|
|
]
|
|
);
|
|
description = ''
|
|
List of enabled features in order.
|
|
'';
|
|
};
|
|
|
|
extraConfig = lib.mkOption {
|
|
type = lib.types.lines;
|
|
default = "";
|
|
description = ''
|
|
Extra config in TOML format.
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
###### implementation
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
services.upower.enable = lib.mkIf (lib.elem "battery" cfg.order) true;
|
|
|
|
systemd.user.services.dwm-status = {
|
|
description = "Highly performant and configurable DWM status service";
|
|
wantedBy = [ "graphical-session.target" ];
|
|
partOf = [ "graphical-session.target" ];
|
|
|
|
serviceConfig.ExecStart = "${cfg.package}/bin/dwm-status ${configFile}";
|
|
};
|
|
|
|
};
|
|
|
|
}
|