nix/nixos/common/desktops/plasma6/default.nix
2024-01-03 09:11:47 +09:00

86 lines
No EOL
2.3 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;
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 pkgs.bash ];
script = ''
# Also need to do checks of what the current theme is and apply it if it isn't already set
SUNRISE=`fx /tmp/wttr.in .weather[0].astronomy[0].sunrise`
NOW=`date +'%I:%M %p'`
if [[ $SUNRISE == $NOW ]] ; then
echo "Setting Arc colorscheme"
plasma-apply-colorscheme -platform offscreen Arc
fi
'';
serviceConfig.Type = "oneshot";
};
dark-theme = {
enable = true;
path = [ pkgs.at pkgs.fx pkgs.nodejs pkgs.bash ];
script = ''
SUNSET=`fx /tmp/wttr.in .weather[0].astronomy[0].sunset`
NOW=`date +'%I:%M %p'`
if [[ $SUNSET == $NOW ]] ; then
echo "Setting ArcDark colorscheme"
plasma-apply-colorscheme -platform offscreen ArcDark
fi
'';
serviceConfig.Type = "oneshot";
};
};
systemd.user.timers = {
"light-theme" = {
enable = false;
partOf = [ "light-theme.service" ];
timerConfig.OnCalendar = [ "*-*-* *:*:*" ];
};
"dark-theme" = {
enable = false;
partOf = [ "dark-theme.service" ];
timerConfig.OnCalendar = [ "*-*-* *:*:*" ];
};
};
}