waybar: migrate all config to "sane.programs"
This commit is contained in:
parent
10feb319fe
commit
4a3d24be3f
|
@ -86,7 +86,7 @@
|
|||
./tor-browser.nix
|
||||
./tuba.nix
|
||||
./vlc.nix
|
||||
./waybar.nix
|
||||
./waybar
|
||||
./waylock.nix
|
||||
./wike.nix
|
||||
./wine.nix
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
{ config, ... }:
|
||||
let
|
||||
cfg = config.sane.programs.waybar;
|
||||
in
|
||||
{
|
||||
sane.programs.waybar = {
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.wrapperType = "wrappedDerivation";
|
||||
sandbox.net = "all"; #< to show net connection status and BW
|
||||
sandbox.whitelistDbus = [ "user" ];
|
||||
sandbox.whitelistWayland = true;
|
||||
sandbox.extraRuntimePaths = [ "/" ]; #< needs to talk to sway IPC. TODO: give the sway IPC a predictable name.
|
||||
sandbox.extraHomePaths = [ ".config/waybar" ]; #< TODO: migrate config files to this file and then safe to remove
|
||||
|
||||
services.waybar = {
|
||||
description = "sway header bar";
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
serviceConfig.ExecStart = "${cfg.package}/bin/waybar";
|
||||
serviceConfig.Type = "simple";
|
||||
serviceConfig.Restart = "on-failure";
|
||||
serviceConfig.RestartSec = "10s";
|
||||
# environment.G_MESSAGES_DEBUG = "all";
|
||||
};
|
||||
};
|
||||
}
|
74
hosts/common/programs/waybar/default.nix
Normal file
74
hosts/common/programs/waybar/default.nix
Normal file
|
@ -0,0 +1,74 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.sane.programs.waybar;
|
||||
in
|
||||
{
|
||||
sane.programs.waybar = {
|
||||
configOption = with lib; mkOption {
|
||||
type = types.submodule {
|
||||
options = {
|
||||
extra_style = mkOption {
|
||||
type = types.lines;
|
||||
default = ''
|
||||
/* default font-size is about 14px, which is good for moby, but not quite for larger displays */
|
||||
window#waybar {
|
||||
font-size: 16px;
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
extra CSS rules to append to ~/.config/waybar/style.css
|
||||
'';
|
||||
};
|
||||
top = mkOption {
|
||||
type = types.submodule {
|
||||
# `attrsOf types.anything` (v.s. plain `attrs`) causes merging of the toplevel items.
|
||||
# this allows for `waybar.top.x = lib.mkDefault a;` with `waybar.top.x = b;` to resolve to `b`.
|
||||
# but note that `waybar.top.x.y = <multiple assignment>` won't be handled as desired.
|
||||
freeformType = types.attrsOf types.anything;
|
||||
};
|
||||
default = {};
|
||||
description = ''
|
||||
Waybar configuration for the bar at the top of the display.
|
||||
see: <https://github.com/Alexays/Waybar/wiki/Configuration>
|
||||
example:
|
||||
```nix
|
||||
{
|
||||
height = 40;
|
||||
modules-left = [ "sway/workspaces" "sway/mode" ];
|
||||
...
|
||||
}
|
||||
```
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# default waybar
|
||||
config.top = import ./waybar-top.nix { inherit lib pkgs; };
|
||||
|
||||
sandbox.method = "bwrap";
|
||||
sandbox.wrapperType = "wrappedDerivation";
|
||||
sandbox.net = "all"; #< to show net connection status and BW
|
||||
sandbox.whitelistDbus = [ "user" ];
|
||||
sandbox.whitelistWayland = true;
|
||||
sandbox.extraRuntimePaths = [ "/" ]; #< needs to talk to sway IPC. TODO: give the sway IPC a predictable name.
|
||||
|
||||
fs.".config/waybar/config".symlink.target =
|
||||
(pkgs.formats.json {}).generate "waybar-config.json" [
|
||||
({ layer = "top"; } // cfg.config.top)
|
||||
];
|
||||
fs.".config/waybar/style.css".symlink.text =
|
||||
(builtins.readFile ./waybar-style.css) + cfg.config.extra_style;
|
||||
|
||||
services.waybar = {
|
||||
description = "sway header bar";
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
serviceConfig.ExecStart = "${cfg.package}/bin/waybar";
|
||||
serviceConfig.Type = "simple";
|
||||
serviceConfig.Restart = "on-failure";
|
||||
serviceConfig.RestartSec = "10s";
|
||||
# environment.G_MESSAGES_DEBUG = "all";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -121,40 +121,6 @@ in
|
|||
description = "command to run when user wants to take a screenshot";
|
||||
};
|
||||
};
|
||||
# TODO: move to hosts/common/programs/waybar.nix
|
||||
sane.gui.sway.waybar.extra_style = mkOption {
|
||||
type = types.lines;
|
||||
default = ''
|
||||
/* default font-size is about 14px, which is good for moby, but not quite for larger displays */
|
||||
window#waybar {
|
||||
font-size: 16px;
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
extra CSS rules to append to ~/.config/waybar/style.css
|
||||
'';
|
||||
};
|
||||
sane.gui.sway.waybar.top = mkOption {
|
||||
type = types.submodule {
|
||||
# `attrsOf types.anything` (v.s. plain `attrs`) causes merging of the toplevel items.
|
||||
# this allows for `waybar.top.x = lib.mkDefault a;` with `waybar.top.x = b;` to resolve to `b`.
|
||||
# but note that `waybar.top.x.y = <multiple assignment>` won't be handled as desired.
|
||||
freeformType = types.attrsOf types.anything;
|
||||
};
|
||||
default = {};
|
||||
description = ''
|
||||
Waybar configuration for the bar at the top of the display.
|
||||
see: <https://github.com/Alexays/Waybar/wiki/Configuration>
|
||||
example:
|
||||
```nix
|
||||
{
|
||||
height = 40;
|
||||
modules-left = [ "sway/workspaces" "sway/mode" ];
|
||||
...
|
||||
}
|
||||
```
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
|
@ -203,9 +169,6 @@ in
|
|||
|
||||
secrets.".config/sane-sway/snippets.txt" = ../../../../secrets/common/snippets.txt.bin;
|
||||
};
|
||||
|
||||
# default waybar
|
||||
sane.gui.sway.waybar.top = import ./waybar-top.nix { inherit lib pkgs; };
|
||||
}
|
||||
|
||||
(lib.mkIf cfg.enable {
|
||||
|
@ -354,13 +317,6 @@ in
|
|||
[preferred]
|
||||
default=wlr;gtk
|
||||
'';
|
||||
".config/waybar/config".symlink.target =
|
||||
(pkgs.formats.json {}).generate "waybar-config.json" [
|
||||
({ layer = "top"; } // cfg.waybar.top)
|
||||
];
|
||||
|
||||
".config/waybar/style.css".symlink.text =
|
||||
(builtins.readFile ./waybar-style.css) + cfg.waybar.extra_style;
|
||||
|
||||
".config/sway/config".symlink.target = pkgs.callPackage ./sway-config.nix {
|
||||
inherit config;
|
||||
|
|
|
@ -294,14 +294,16 @@ in
|
|||
|
||||
(lib.mkIf cfg.enable (lib.mkMerge [
|
||||
{
|
||||
sane.programs.waybar.config = {
|
||||
top = import ./waybar-top.nix { inherit pkgs; };
|
||||
# reset extra waybar style
|
||||
extra_style = "";
|
||||
};
|
||||
sane.gui.sway = {
|
||||
enable = true;
|
||||
# we manage the greeter ourselves (TODO: merge this into sway config as well)
|
||||
# EXCEPT for the unl0kr case, since that works well on both mobile and desktop!
|
||||
useGreeter = cfg.greeter == "unl0kr";
|
||||
waybar.top = import ./waybar-top.nix { inherit pkgs; };
|
||||
# reset extra waybar style
|
||||
waybar.extra_style = "";
|
||||
config = {
|
||||
# N.B. missing from upstream sxmo config here is:
|
||||
# - `bindsym $mod+g exec sxmo_hook_locker.sh`
|
||||
|
|
Loading…
Reference in New Issue
Block a user