nix/nixos/common/desktops/plasma6/default.nix

86 lines
2.3 KiB
Nix
Raw Normal View History

2024-01-02 14:05:33 +01:00
{ lib, inputs, config, pkgs, username, hostname, gpu, ... }: {
2024-01-01 00:59:07 +01:00
imports = [ inputs.kde2nix.nixosModules.plasma6 ];
2023-12-31 16:25:53 +01:00
# 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;
};
2024-01-01 06:42:36 +01:00
environment.systemPackages = with pkgs; [
arc-kde-theme
2024-01-01 08:31:11 +01:00
arc-theme
2024-01-01 06:56:07 +01:00
papirus-icon-theme
2024-01-01 06:42:36 +01:00
plasma-theme-switcher
2024-01-01 08:31:11 +01:00
tailscale-systray
];
2024-01-02 13:33:57 +01:00
2024-01-02 14:05:33 +01:00
systemd.user.services = {
"get-theme-times" = {
enable = true;
path = [ pkgs.curl ];
2024-01-02 14:06:41 +01:00
script = "curl wttr.in?format=j1 > /tmp/wttr.in";
after = [ "networking-online.target" ];
2024-01-02 15:20:11 +01:00
serviceConfig.Type = "oneshot";
2024-01-02 14:03:20 +01:00
onSuccess = [
"light-theme.service"
"dark-theme.service"
];
};
light-theme = {
enable = true;
2024-01-02 15:29:29 +01:00
path = [ pkgs.at pkgs.fx pkgs.nodejs pkgs.bash ];
2024-01-02 14:45:26 +01:00
script = ''
2024-01-03 01:11:47 +01:00
# Also need to do checks of what the current theme is and apply it if it isn't already set
2024-01-03 01:08:23 +01:00
SUNRISE=`fx /tmp/wttr.in .weather[0].astronomy[0].sunrise`
NOW=`date +'%I:%M %p'`
if [[ $SUNRISE == $NOW ]] ; then
2024-01-03 01:10:42 +01:00
echo "Setting Arc colorscheme"
plasma-apply-colorscheme -platform offscreen Arc
2024-01-03 01:08:23 +01:00
fi
2024-01-02 14:45:26 +01:00
'';
2024-01-02 15:20:11 +01:00
serviceConfig.Type = "oneshot";
};
dark-theme = {
enable = true;
2024-01-02 15:29:29 +01:00
path = [ pkgs.at pkgs.fx pkgs.nodejs pkgs.bash ];
2024-01-02 14:45:26 +01:00
script = ''
2024-01-03 01:08:23 +01:00
SUNSET=`fx /tmp/wttr.in .weather[0].astronomy[0].sunset`
2024-01-03 01:10:42 +01:00
NOW=`date +'%I:%M %p'`
if [[ $SUNSET == $NOW ]] ; then
2024-01-03 01:08:23 +01:00
echo "Setting ArcDark colorscheme"
plasma-apply-colorscheme -platform offscreen ArcDark
fi
2024-01-02 14:45:26 +01:00
'';
2024-01-02 15:20:11 +01:00
serviceConfig.Type = "oneshot";
};
};
2024-01-02 14:05:33 +01:00
systemd.user.timers = {
"light-theme" = {
2024-01-02 15:01:24 +01:00
enable = false;
partOf = [ "light-theme.service" ];
2024-01-03 01:10:42 +01:00
timerConfig.OnCalendar = [ "*-*-* *:*:*" ];
};
"dark-theme" = {
2024-01-02 15:01:24 +01:00
enable = false;
partOf = [ "dark-theme.service" ];
2024-01-03 01:10:42 +01:00
timerConfig.OnCalendar = [ "*-*-* *:*:*" ];
};
2024-01-02 13:26:44 +01:00
};
2024-01-02 14:45:26 +01:00
}