2023-12-05 23:11:54 +01:00
{ pkgs , config , lib , . . . }:
2023-10-29 00:49:22 +02:00
let
2023-12-05 20:57:05 +01:00
# Currently last commit in https://github.com/danth/stylix/pull/194
stylix = builtins . fetchTarball " h t t p s : / / g i t h u b . c o m / w i l l e m m l / s t y l i x / a r c h i v e / 2 e d 2 b 0 0 8 6 b 4 1 d 5 8 2 a c a 2 6 e 0 8 3 c 1 9 c 0 e 4 7 c 8 9 9 1 e 3 . t a r . g z " ;
2023-12-05 23:11:54 +01:00
polarityFile = " ${ config . xdg . stateHome } / t h e m e _ p o l a r i t y " ;
polarity = if builtins . pathExists polarityFile then lib . strings . fileContents polarityFile else " l i g h t " ;
phases = [
{ command = " j o u r " ; polarity = " l i g h t " ; }
{ command = " c r e p u s c u l e " ; polarity = " d a r k " ; }
{ command = " n u i t " ; polarity = " d a r k " ; }
] ;
cfg = config . frogeye . desktop . phasesBrightness ;
2023-10-29 00:49:22 +02:00
in
{
imports = [ ( import stylix ) . homeManagerModules . stylix ] ;
stylix = {
2023-12-05 23:11:54 +01:00
base16Scheme = " ${ pkgs . base16-schemes } / s h a r e / t h e m e s / s o l a r i z e d - ${ polarity } . y a m l " ;
2023-10-29 00:49:22 +02:00
image = builtins . fetchurl {
url = " h t t p s : / / g e t . w a l l h e r e . c o m / p h o t o / s u n l i g h t - a b s t r a c t - m i n i m a l i s m - g r e e n - s i m p l e - c i r c l e - l i g h t - l e a f - w a v e - m a t e r i a l - l i n e - w i n g - c o m p u t e r - w a l l p a p e r - f o n t - c l o s e - u p - m a c r o - p h o t o g r a p h y - 1 2 4 3 5 0 . p n g " ;
sha256 = " s h a 2 5 6 : 1 z f q 3 f 3 v 3 4 i 4 5 m i 7 2 p k f q p h m 8 k b h c z s g 2 6 0 x j f l 6 d b y d y 9 1 d 7 y 9 3 " ;
} ;
2023-11-26 23:47:15 +01:00
# The background is set on some occasions, autorandr + feh do the rest
2023-10-29 12:15:56 +01:00
2023-11-12 21:53:52 +01:00
fonts = {
monospace = {
2023-11-21 21:01:56 +01:00
package = pkgs . nerdfonts . override {
fonts = [ " D e j a V u S a n s M o n o " ] ; # Choose from https://github.com/NixOS/nixpkgs/blob/6ba3207643fd27ffa25a172911e3d6825814d155/pkgs/data/fonts/nerdfonts/shas.nix
} ;
2023-11-12 21:53:52 +01:00
name = " D e j a V u S a n s M N e r d F o n t " ;
} ;
2023-11-02 21:57:06 +01:00
} ;
2023-10-29 12:15:56 +01:00
2023-11-20 22:09:28 +01:00
targets = {
2023-11-21 21:01:56 +01:00
i3 . enable = false ; # I prefer my own styles
tmux . enable = false ; # Using another theme
2023-11-20 22:09:28 +01:00
} ;
2023-10-29 00:49:22 +02:00
} ;
2023-12-05 23:11:54 +01:00
# Setting a custom base16 theme via nixvim:
# - Is required so nixvim works
# - For the rest only works on dark polarity, use the colorscheme otherwise... shrug
programs . nixvim . colorschemes . base16 . colorscheme = " s o l a r i z e d - ${ polarity } " ;
2023-10-29 00:49:22 +02:00
# Fix https://nix-community.github.io/home-manager/index.html#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal
2023-11-05 21:36:11 +01:00
# home.packages = [ pkgs.dconf ];
dconf . enable = false ; # Otherwise standalone home-manager complains it can't find /etc/dbus-1/session.conf on Arch.
# Symlinking it to /usr/share/dbus-1/session.conf goes further but not much.
2023-12-05 23:11:54 +01:00
# TODO Use xbacklight instead (pindakaas doesn't seem to support it OOTB)
home . packages = map
( phase : ( pkgs . writeShellApplication {
name = " ${ phase . command } " ;
text = ( lib . optionalString cfg . enable ''
echo $ { builtins . toString ( builtins . getAttr phase . command cfg ) } | sudo tee /sys/class/backlight / $ { cfg . backlight } /brightness
'' ) + ''
echo $ { phase . polarity } > $ { polarityFile }
if command - v home-manager
then
home-manager switch
else
sudo nixos-rebuild switch
fi
'' ;
} )
)
phases ;
2023-10-29 00:49:22 +02:00
}