Unified home and system modules!
This commit is contained in:
56
modules/desktop/polybar.nix
Normal file
56
modules/desktop/polybar.nix
Normal file
@@ -0,0 +1,56 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.desktop.polybar;
|
||||
polybar_pkg = pkgs.polybar.override {
|
||||
i3Support = true;
|
||||
pulseSupport = true;
|
||||
};
|
||||
script = ''
|
||||
polybar top &
|
||||
polybar bottom &
|
||||
'';
|
||||
# Paths
|
||||
paths = {
|
||||
config = ../../config/.config/polybar/config.ini;
|
||||
bars = ../../config/.config/polybar/bars;
|
||||
scripts = ../../config/.config/polybar/scripts;
|
||||
};
|
||||
in {
|
||||
|
||||
options.samfelag.modules.desktop.polybar = {
|
||||
enable = lib.mkEnableOption "polybar";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
# - Configuration ----------------------------
|
||||
|
||||
environment.systemPackages = [
|
||||
polybar_pkg
|
||||
];
|
||||
|
||||
hm.xdg.configFile."polybar/config.ini".source = paths.config;
|
||||
hm.xdg.configFile."polybar/bars".source = paths.bars;
|
||||
hm.xdg.configFile."polybar/scripts".source = paths.scripts;
|
||||
|
||||
hm.systemd.user.services.polybar = {
|
||||
Unit = {
|
||||
Description = "Polybar status bar";
|
||||
PartOf = [ "tray.target" ];
|
||||
X-Restart-Triggers = [ "${paths.config}" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "forking";
|
||||
PassEnvironment = "PATH";
|
||||
ExecStart =
|
||||
let scriptPkg = pkgs.writeShellScriptBin "polybar-start" script;
|
||||
in "${scriptPkg}/bin/polybar-start";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
Install = { WantedBy = [ "tray.target" ]; };
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user