nix/nixos/common/desktops/plasma6/default.nix
2024-01-02 22:49:53 +09:00

82 lines
No EOL
2.2 KiB
Nix

{ lib, inputs, config, pkgs, username, hostname, gpu, ... }: {
imports = [ inputs.kde2nix.nixosModules.plasma6 ];
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
# Configure keymap in X11
services.xserver = {
enable = true;
layout = "us";
xkbVariant = "";
autorun = true;
videoDrivers = [ ] ++ lib.optional (builtins.isString gpu) gpu;
};
services.xserver = {
# https://nixos.org/manual/nixos/stable/index.html#chap-gnome
# Enable the KDE Plasma 6 Desktop Environment.
desktopManager.plasma6.enable = true;
};
environment.systemPackages = with pkgs; [
arc-kde-theme
arc-theme
papirus-icon-theme
plasma-theme-switcher
tailscale-systray
];
systemd.user.services = {
"get-theme-times" = {
enable = true;
path = [ pkgs.curl ];
script = "curl wttr.in?format=j1 > /tmp/wttr.in";
after = [ "networking-online.target" ];
serviceConfig.Type = "oneshot";
onSuccess = [
"light-theme.service"
"dark-theme.service"
];
};
light-theme = {
enable = true;
path = [ pkgs.at pkgs.fx pkgs.nodejs ];
script = ''
source ~/.bashrc
echo "plasma-apply-colorscheme -platform offscreen Arc" | at `${pkgs.fx}/bin/fx /tmp/wttr.in .weather[0].astronomy[0].sunrise`
'';
serviceConfig.Type = "oneshot";
};
dark-theme = {
enable = true;
path = [ pkgs.at pkgs.fx pkgs.nodejs ];
script = ''
source ~/.bashrc
echo "plasma-apply-colorscheme -platform offscreen ArcDark" | at `${pkgs.fx}/bin/fx /tmp/wttr.in .weather[0].astronomy[0].sunset`
'';
serviceConfig.Type = "oneshot";
};
};
systemd.user.timers = {
"light-theme" = {
enable = true;
partOf = [ "light-theme.service" ];
timerConfig.OnCalendar = [ "*-*-* *:*:00" ];
};
"dark-theme" = {
enable = true;
partOf = [ "dark-theme.service" ];
timerConfig.OnCalendar = [ "*-*-* *:*:00" ];
};
};
}