dotfiles/user-modules/desktop/default.nix

70 lines
1.3 KiB
Nix
Raw Permalink Normal View History

2024-07-19 12:00:55 +00:00
{
lib,
pkgs,
config,
...
}:
2024-07-18 04:08:27 +00:00
with lib;
let
cfg = config.modules.desktop;
2024-07-19 12:00:55 +00:00
in
{
2024-07-18 04:08:27 +00:00
imports = [
# Import desktop environment modules
2024-07-20 04:10:56 +00:00
./background/glpaper/default.nix
2024-07-19 01:34:42 +00:00
./bar/waybar.nix
2024-07-18 04:08:27 +00:00
./lock-screen/waylock.nix
./window-manager/river.nix
];
options.modules.desktop = {
wayland = mkEnableOption "wayland";
2024-07-18 04:08:27 +00:00
initScript = mkOption {
type = types.lines;
default = "${pkgs.bash}/bin/bash";
description = "Bash script to execute after logging in.";
};
reloadScript = mkOption {
type = types.lines;
default = "";
description = "Shell script to execute after reload/rebuild.";
};
2024-07-18 04:08:27 +00:00
};
config = {
2024-07-19 19:54:41 +00:00
# Ensure desktop related systemd services (xdg) have access to session variables.
systemd.user.sessionVariables = config.home.sessionVariables;
2024-07-19 12:00:55 +00:00
home.packages = optionals cfg.wayland (
with pkgs;
[
wl-clipboard
wtype
grim
slurp
2024-07-19 12:00:55 +00:00
]
);
home.activation = {
customReloadScript = lib.hm.dag.entryAfter [ "writeBoundary" ] (
''
#!${pkgs.bash}/bin/bash
''
+ cfg.reloadScript
);
};
2024-07-18 04:08:27 +00:00
home.file.".initrc" = {
enable = true;
executable = true;
2024-07-19 12:00:55 +00:00
text =
''
#!${pkgs.bash}/bin/bash
2024-07-18 04:08:27 +00:00
2024-07-19 12:00:55 +00:00
''
+ cfg.initScript;
2024-07-18 04:08:27 +00:00
};
};
}