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

89 lines
2.5 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-03 06:24:21 +01:00
script = ''
2024-01-05 12:38:54 +01:00
echo "Activating get-theme-times systemd service"
2024-01-03 06:24:21 +01:00
curl -s wttr.in/?format=%S > /tmp/wttr.sunrise
curl -s wttr.in/?format=%s > /tmp/wttr.sunset
2024-01-06 14:40:51 +01:00
chown albert:root /tmp/wttr.sunrise /tmp/wttr.sunset
2024-01-05 12:38:54 +01:00
echo "get-theme-times - complete"
2024-01-03 06:24:21 +01:00
'';
after = [ "networking-online.target" ];
2024-01-02 15:20:11 +01:00
serviceConfig.Type = "oneshot";
2024-01-03 10:03:56 +01:00
onSuccess = [ "set-theme.service" ];
};
2024-01-03 10:03:56 +01:00
set-theme = {
enable = true;
2024-01-02 14:45:26 +01:00
script = ''
2024-01-05 12:38:54 +01:00
echo "set-theme.service - Checking for theme settings"
2024-01-03 10:03:56 +01:00
if [ ! -f /tmp/wttr.sunrise ] ; then
systemctl --user start get-theme-times.service
fi
2024-01-03 06:24:21 +01:00
SUNRISE=`date -d \`cat /tmp/wttr.sunrise\` +%s`
SUNSET=`date -d \`cat /tmp/wttr.sunset\` +%s`
CURRENT=`date +%s`
if [ $CURRENT -gt $SUNRISE -a $CURRENT -lt $SUNSET ] ; then
2024-01-03 10:06:13 +01:00
/run/current-system/sw/bin/plasma-apply-colorscheme -platform offscreen Arc
2024-01-03 10:03:56 +01:00
else
2024-01-03 10:06:13 +01:00
/run/current-system/sw/bin/plasma-apply-colorscheme -platform offscreen ArcDark
2024-01-03 01:08:23 +01:00
fi
2024-01-05 12:38:54 +01:00
echo "set-theme.service - Complete"
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 = {
2024-01-03 06:27:00 +01:00
"get-theme-times" = {
enable = true;
2024-01-05 12:48:33 +01:00
wantedBy = [ "default.target" ];
timerConfig = {
Unit = "get-theme-times.service";
OnCalendar = [ "*:00" ];
OnBootSec = [ "2min" ];
};
2024-01-03 06:27:00 +01:00
};
2024-01-03 10:03:56 +01:00
"set-theme" = {
2024-01-03 06:27:00 +01:00
enable = true;
2024-01-05 12:48:33 +01:00
wantedBy = [ "default.target" ];
timerConfig = {
Unit = "set-theme.service";
OnCalendar = [ "*:0..59" ];
OnBootSec = [ "3min" ];
};
};
2024-01-02 13:26:44 +01:00
};
2024-01-02 14:45:26 +01:00
}