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

95 lines
2.8 KiB
Nix
Raw Normal View History

2024-03-30 15:27:21 +09:00
{ pkgs, ... }: {
2024-01-01 00:25:53 +09: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;
2024-04-25 20:20:08 +09:00
xkb.layout = "us";
xkb.variant = "";
2024-01-01 00:25:53 +09:00
autorun = true;
};
2024-04-24 11:23:26 +09:00
services.desktopManager.plasma6.enable = true;
2024-01-01 14:42:36 +09:00
environment.systemPackages = with pkgs; [
arc-kde-theme
2024-01-01 16:31:11 +09:00
arc-theme
2024-01-01 14:56:07 +09:00
papirus-icon-theme
2024-01-01 14:42:36 +09:00
plasma-theme-switcher
2024-01-01 16:31:11 +09:00
tailscale-systray
];
2024-01-02 21:33:57 +09:00
2024-03-22 11:37:18 +09:00
services.xrdp.defaultWindowManager = "startplasma-x11";
2024-04-25 20:20:08 +09:00
services.displayManager.sddm.settings.General.DisplayServer = "x11-user";
2024-03-22 11:37:18 +09:00
2024-01-02 22:05:33 +09:00
systemd.user.services = {
"get-theme-times" = {
enable = true;
2024-06-14 10:38:55 +09:00
path = [ pkgs.curl pkgs.fx ];
2024-01-03 14:24:21 +09:00
script = ''
2024-01-05 20:38:54 +09:00
echo "Activating get-theme-times systemd service"
2024-06-14 10:45:22 +09:00
curl -s "https://api.sunrise-sunset.org/json?lat=35.680&lng=135.03&tzid=Asia/Tokyo" | fx .results.sunrise > /tmp/wttr.sunrise
curl -s "https://api.sunrise-sunset.org/json?lat=35.680&lng=135.03&tzid=Asia/Tokyo" | fx .results.sunset > /tmp/wttr.sunset
2024-01-05 20:38:54 +09:00
echo "get-theme-times - complete"
2024-01-03 14:24:21 +09:00
'';
after = [ "networking-online.target" ];
2024-01-02 23:20:11 +09:00
serviceConfig.Type = "oneshot";
2024-01-03 18:03:56 +09:00
onSuccess = [ "set-theme.service" ];
};
2024-01-03 18:03:56 +09:00
set-theme = {
enable = true;
2024-01-02 22:45:26 +09:00
script = ''
2024-01-05 20:38:54 +09:00
echo "set-theme.service - Checking for theme settings"
2024-01-03 18:03:56 +09:00
if [ ! -f /tmp/wttr.sunrise ] ; then
systemctl --user start get-theme-times.service
2024-06-13 19:59:35 +09:00
fi
echo "Getting dates:"
2024-06-14 10:59:23 +09:00
SUNRISE=`cat /tmp/wttr.sunrise | date +%s`
2024-06-13 19:59:35 +09:00
echo "Sunrise: $SUNRISE"
2024-06-14 10:59:23 +09:00
SUNSET=`cat /tmp/wttr.sunset | date +%s`
2024-06-13 19:59:35 +09:00
echo "Sunset: $SUNSET"
2024-01-03 14:24:21 +09:00
CURRENT=`date +%s`
2024-06-13 19:59:35 +09:00
echo "Current: $CURRENT"
2024-01-03 14:24:21 +09:00
if [ $CURRENT -gt $SUNRISE -a $CURRENT -lt $SUNSET ] ; then
2024-06-13 14:27:02 +09:00
# /run/current-system/sw/bin/plasma-apply-colorscheme -system offscreen Arc
/run/current-system/sw/bin/plasma-apply-colorscheme Arc
2024-01-03 18:03:56 +09:00
else
2024-06-13 14:27:02 +09:00
# /run/current-system/sw/bin/plasma-apply-colorscheme -system offscreen ArcDark
/run/current-system/sw/bin/plasma-apply-colorscheme ArcDark
2024-01-03 09:08:23 +09:00
fi
2024-01-05 20:38:54 +09:00
echo "set-theme.service - Complete"
2024-01-02 22:45:26 +09:00
'';
2024-01-02 23:20:11 +09:00
serviceConfig.Type = "oneshot";
};
};
2024-01-02 22:05:33 +09:00
systemd.user.timers = {
2024-01-03 14:27:00 +09:00
"get-theme-times" = {
enable = true;
2024-01-05 20:48:33 +09:00
wantedBy = [ "default.target" ];
timerConfig = {
Unit = "get-theme-times.service";
OnCalendar = [ "*:00" ];
OnBootSec = [ "2min" ];
};
2024-01-03 14:27:00 +09:00
};
2024-01-03 18:03:56 +09:00
"set-theme" = {
2024-01-03 14:27:00 +09:00
enable = true;
2024-01-05 20:48:33 +09:00
wantedBy = [ "default.target" ];
timerConfig = {
Unit = "set-theme.service";
OnCalendar = [ "*:0..59" ];
OnBootSec = [ "3min" ];
};
};
2024-01-02 21:26:44 +09:00
};
2024-03-15 22:08:53 +09:00
}