Working on reshuffling
This commit is contained in:
+17
-24
@@ -1124,38 +1124,31 @@ in
|
||||
** =generated/modules/desktop/waybar.nix=
|
||||
This file installs and configures waybar
|
||||
#+BEGIN_SRC nix :tangle generated/modules/desktop/waybar.nix :noweb tangle :mkdirp yes :eval never-html
|
||||
{ lib, pkgs, config, flakeRoot, ... }:
|
||||
{ lib, ... }:
|
||||
|
||||
let
|
||||
username = "henrov";
|
||||
waybar-config = pkgs.writeText "waybar-config" (builtins.readFile (flakeRoot + "/assets/system/conf/waybar/config"));
|
||||
waybar-style = pkgs.writeText "waybar-style" (builtins.readFile (flakeRoot + "/assets/system/conf/waybar/style.css"));
|
||||
waybarAssets = ../../../assets/system/conf/waybar;
|
||||
waybarFiles = builtins.readDir waybarAssets;
|
||||
waybarConfs = lib.genAttrs (builtins.attrNames waybarFiles) (name: {
|
||||
src = "${waybarAssets}/${name}";
|
||||
});
|
||||
|
||||
enableWaybar = true;
|
||||
in
|
||||
{
|
||||
programs.waybar = {
|
||||
enable = true;
|
||||
package = pkgs.waybar;
|
||||
};
|
||||
# Declare a top-level module option
|
||||
options.enableWaybar = lib.mkEnableOption "Enable Waybar status bar";
|
||||
|
||||
systemd.user.services.waybar = {
|
||||
description = "Waybar (status bar for Wayland)";
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
after = [ "graphical-session.target" ];
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
ExecStart = "${config.programs.waybar.package}/bin/waybar -c ${waybar-config} -s ${waybar-style}";
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
# All actual module configuration wrapped safely
|
||||
config = lib.mkIf enableWaybar {
|
||||
waybar = {
|
||||
enable = true; # symbolic enable flag
|
||||
user = username;
|
||||
assetsDir = waybarAssets;
|
||||
files = waybarConfs; # contains "config" and "style.css" keys
|
||||
};
|
||||
};
|
||||
|
||||
# Create symlinks for config and style
|
||||
system.activationScripts.waybarSetup = lib.mkAfter ''
|
||||
mkdir -p /home/${username}/.config/waybar
|
||||
ln -sf ${waybar-config} /home/${username}/.config/waybar/config
|
||||
ln -sf ${waybar-style} /home/${username}/.config/waybar/style.css
|
||||
chown -R ${username}:users /home/${username}/.config/waybar
|
||||
'';
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
|
||||
Reference in New Issue
Block a user