91 lines
No EOL
2.4 KiB
Nix
91 lines
No EOL
2.4 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 -s wttr.in/?format=%S > /tmp/wttr.sunrise
|
|
curl -s wttr.in/?format=%s > /tmp/wttr.sunset
|
|
'';
|
|
after = [ "networking-online.target" ];
|
|
serviceConfig.Type = "oneshot";
|
|
onSuccess = [
|
|
"light-theme.service"
|
|
"dark-theme.service"
|
|
];
|
|
};
|
|
light-theme = {
|
|
enable = true;
|
|
script = ''
|
|
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
|
|
plasma-apply-colorscheme -platform offscreen Arc
|
|
fi
|
|
'';
|
|
serviceConfig.Type = "oneshot";
|
|
};
|
|
dark-theme = {
|
|
enable = true;
|
|
script = ''
|
|
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
|
|
plasma-apply-colorscheme -platform offscreen ArcDark
|
|
fi
|
|
'';
|
|
serviceConfig.Type = "oneshot";
|
|
};
|
|
};
|
|
|
|
systemd.user.timers = {
|
|
"get-theme-times" = {
|
|
enable = true;
|
|
partOf = [ "get-theme-times.service" ];
|
|
timerConfig.OnCalendar = ["1 hour"];
|
|
};
|
|
"light-theme" = {
|
|
enable = true;
|
|
partOf = [ "light-theme.service" ];
|
|
timerConfig.OnCalendar = [ "*-*-* *:*:*" ];
|
|
};
|
|
"dark-theme" = {
|
|
enable = true;
|
|
partOf = [ "dark-theme.service" ];
|
|
timerConfig.OnCalendar = [ "*-*-* *:*:*" ];
|
|
};
|
|
};
|
|
} |