1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

feat: stylix is my new best friend

This commit is contained in:
2023-07-26 07:38:52 +02:00
parent 92bf5ab0ee
commit a8940bf667
27 changed files with 401 additions and 944 deletions

View File

@@ -361,7 +361,7 @@ in {
# "text/html" =
# "${pkgs.aerc}/share/aerc/filters/html | ${pkgs.aerc}/share/aerc/filters/colorize";
# "text/*" =
# ''${pkgs.bat}/bin/bat -fP --file-name="$AERC_FILENAME "'';
# ''${pkgs.bat}/bin/bat -fP --theme=ansi --file-name="$AERC_FILENAME "'';
"message/delivery-status" = "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/colorize";
"message/rfc822" = "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/colorize";
"application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh";

View File

@@ -6,7 +6,6 @@
}: let
alacritty-cfg = theme:
(pkgs.formats.yaml {}).generate "alacritty.yml" {
window.opacity = 0.99;
bell = {
animation = "EaseOut";
duration = 100;
@@ -57,12 +56,28 @@
in {
environment.variables.TERMINAL = "alacritty";
environment.systemPackages = [
alacritty-pkg
];
environment.etc = {
"themes/dark/alacritty.yml".source = alacritty-cfg (import ../lib/colours/owickstrom-dark.nix);
"themes/light/alacritty.yml".source = alacritty-cfg (import ../lib/colours/owickstrom-light.nix);
home-manager.users.me = {
programs.alacritty = {
enable = true;
settings = {
key_bindings = [
{
key = "Plus";
mods = "Control";
action = "IncreaseFontSize";
}
{
key = "Minus";
mods = "Control";
action = "DecreaseFontSize";
}
{
key = "Key0";
mods = "Control";
action = "ResetFontSize";
}
];
};
};
};
}

View File

@@ -56,7 +56,6 @@ in {
enable = true;
options = {
selection-clipboard = "clipboard";
recolor-keephue = true;
# first-page-column = "1:1"; # makes side-by-side mode start on the left side
};
};
@@ -100,7 +99,7 @@ in {
swallow = command: "${niveumPackages.swallow}/bin/swallow ${command}";
in {
"ß" = "${pkgs.util-linux}/bin/setsid";
cat = "${pkgs.bat}/bin/bat --style=plain";
cat = "${pkgs.bat}/bin/bat --theme=ansi --style=plain";
chromium-incognito = "chromium --user-data-dir=$(mktemp -d /tmp/chr.XXXXXX) --no-first-run --incognito";
cp = "cp --interactive";
ip = "${pkgs.iproute2}/bin/ip -c";
@@ -226,6 +225,7 @@ in {
};
}
./android.nix
./stylix.nix
./alacritty.nix
./backup.nix
./bash.nix
@@ -247,6 +247,7 @@ in {
./htop.nix
./hu-berlin.nix
./i3.nix
./i3status-rust.nix
./keyboard.nix
./lb.nix
./mpv.nix
@@ -261,18 +262,14 @@ in {
./polkit.nix
./power-action.nix
./printing.nix
# ./openweathermap.nix
./wallpaper.nix
./redshift.nix
./retiolum.nix
./rofi.nix
./spacetime.nix
# ./seafile.nix
./ssh.nix
./sshd.nix
./sound.nix
./sudo.nix
./themes.nix
./tmux.nix
./traadfri.nix
./unclutter.nix

View File

@@ -3,7 +3,7 @@
pkgs,
...
}: let
inherit (import ../lib) defaultApplications colours theme;
inherit (import ../lib) defaultApplications theme;
in {
home-manager.users.me.services.dunst = {
enable = true;
@@ -11,16 +11,13 @@ in {
settings = {
global = {
transparency = 10;
font = "Monospace 8";
geometry = "200x5-30+20";
frame_color = colours.foreground;
follow = "mouse";
indicate_hidden = true;
notification_height = 0;
separator_height = 2;
padding = 8;
horizontal_padding = 8;
separator_color = "auto";
sort = true;
markup = "full";
format = "%a\\n<b>%s</b>\\n%b";
@@ -43,22 +40,13 @@ in {
mouse_right_click = "close_current";
mouse_middle_click = "close_all";
};
urgency_low = rec {
frame_color = background;
background = colours.foreground;
foreground = colours.background;
urgency_low = {
timeout = 5;
};
urgency_normal = rec {
frame_color = background;
background = colours.foreground;
foreground = colours.background;
urgency_normal = {
timeout = 10;
};
urgency_critical = rec {
frame_color = background;
background = colours.red.dark;
foreground = colours.background;
urgency_critical = {
timeout = 0;
};
};

View File

@@ -5,7 +5,7 @@
niveumPackages,
...
}: let
inherit (import ../lib) defaultApplications colours;
inherit (import ../lib) defaultApplications;
klem = niveumPackages.klem.override {
config.dmenu = "${pkgs.dmenu}/bin/dmenu -i -p klem";
config.scripts = {
@@ -110,14 +110,10 @@ in {
bindsym --release ${modifier}+Shift+w exec /run/wrappers/bin/slock
'';
config = rec {
fonts = {
names = ["Sans"];
size = 10.0;
};
inherit modifier;
window = {
titlebar = false;
border = 1;
border = 2;
hideEdgeBorders = "smart";
commands = [
{
@@ -128,10 +124,6 @@ in {
criteria = {class = "fzfmenu";};
command = "floating enable";
}
{
criteria = {class = ".*";};
command = "border pixel 2";
}
{
criteria = {class = "mpv";};
command = lib.strings.concatStringsSep ", " [
@@ -148,74 +140,31 @@ in {
titlebar = false;
border = 1;
};
colors = let
scheme = {
background = colours.background;
text = colours.foreground;
};
in rec {
focused =
scheme
// {
border = colours.blue.bright;
indicator = colours.blue.bright;
childBorder = colours.blue.bright;
};
unfocused =
scheme
// {
border = colours.background;
indicator = colours.background;
childBorder = colours.background;
};
focusedInactive = unfocused;
urgent =
scheme
// {
border = colours.red.bright;
indicator = colours.red.bright;
childBorder = colours.red.bright;
};
placeholder =
scheme
// {
border = colours.green.bright;
indicator = colours.green.bright;
childBorder = colours.green.bright;
};
};
bars = [
{
workspaceButtons = false;
fonts = {
names = ["Monospace" "Font Awesome 6 Free"];
size = 8.0;
};
mode = "dock"; # "hide";
position = "bottom";
colors = rec {
background = colours.background;
separator = background;
statusline = colours.foreground;
bindingMode = {
background = colours.red.bright;
border = colours.background;
text = colours.foreground;
(config.home-manager.users.me.lib.stylix.i3.bar
// rec {
workspaceButtons = false;
mode = "dock"; # "hide";
position = "bottom";
statusCommand = toString (pkgs.writers.writeDash "i3status-rust" ''
export I3RS_GITHUB_TOKEN="$(cat ${config.age.secrets.github-token-i3status-rust.path})"
export OPENWEATHERMAP_API_KEY="$(cat ${config.age.secrets.openweathermap-api-key.path})"
${config.home-manager.users.me.programs.i3status-rust.package}/bin/i3status-rs ${config.home-manager.users.me.home.homeDirectory}/.config/i3status-rust/config-${position}.toml
'');
fonts = {
names = ["${config.stylix.fonts.sansSerif.name}" "FontAwesome 6 Free"];
size = config.stylix.fonts.sizes.desktop * 0.8;
};
};
statusCommand = toString (pkgs.writers.writeDash "i3status-rust" ''
export I3RS_GITHUB_TOKEN="$(cat ${config.age.secrets.github-token-i3status-rust.path})"
export OPENWEATHERMAP_API_KEY="$(cat ${config.age.secrets.openweathermap-api-key.path})"
${pkgs.i3status-rust}/bin/i3status-rs ${
(pkgs.formats.toml {}).generate "i3status-rust.toml" (import ../lib/i3status-rust.nix {
inherit (config.niveum) batteryName wirelessInterface;
inherit (config.home-manager.users.me.accounts.email) accounts;
inherit colours;
inherit pkgs;
})
}'');
}
})
];
colors = let
background = config.lib.stylix.colors.withHashtag.base00;
in {
unfocused = {
border = lib.mkForce background;
childBorder = lib.mkForce background;
};
};
modes.resize = {
"Escape" = ''mode "default"'';
"Return" = ''mode "default"'';
@@ -263,7 +212,6 @@ in {
notify-send --app-name="newsboat" "Finished updating."
''}";
# "${modifier}+Shift+y" = "exec ${pkgs.qutebrowser}/bin/qutebrowser";
"${modifier}+Return" = "exec ${(defaultApplications pkgs).terminal}";
"${modifier}+t" = "exec ${(defaultApplications pkgs).fileManager}";
"${modifier}+y" = "exec ${(defaultApplications pkgs).browser}";

174
configs/i3status-rust.nix Normal file
View File

@@ -0,0 +1,174 @@
{
pkgs,
config,
...
}: let
setsid = script:
pkgs.writers.writeDash "setsid-command" ''
${pkgs.util-linux}/bin/setsid ${script}
'';
in {
home-manager.users.me = {
programs.i3status-rust = {
enable = true;
bars.bottom = {
icons = "awesome6";
settings = {
theme.overrides = let
colours = config.lib.stylix.colors.withHashtag;
in rec {
idle_bg = colours.base00;
idle_fg = colours.base05;
good_bg = colours.base00;
good_fg = colours.base0B;
warning_bg = colours.base00;
warning_fg = colours.base0A;
critical_bg = colours.base00;
critical_fg = colours.base09;
info_bg = colours.base00;
info_fg = colours.base04;
separator_bg = colours.base00;
separator = " ";
};
};
blocks = [
{
block = "weather";
autolocate = true;
format = "$icon $location: $temp";
service = {
name = "openweathermap";
city_id = "2950159";
units = "metric";
};
}
{
block = "custom";
interval = 60 * 5;
command = let
spacetime = import ../configs/spacetime.nix;
in
pkgs.writers.writePython3 "sun.py" {
libraries = [pkgs.python3Packages.astral];
flakeIgnore = ["E121" "E501"];
}
''
import astral
import astral.moon
import astral.sun
current_phase = astral.moon.phase()
city = astral.LocationInfo("Berlin", "Germany", "${spacetime.time.timeZone}", ${toString spacetime.location.latitude}, ${toString spacetime.location.longitude})
sun = astral.sun.sun(city.observer, date=astral.today(), tzinfo=city.timezone)
print("{} {} {}{}".format(sun["sunrise"].strftime("%R"), sun["sunset"].strftime("%R"), "" if current_phase < 14 else "", round(current_phase, 1)))
'';
}
{
block = "github";
info = ["total"];
warning = ["mention" "review_requested" "team_mention" "manual" "invitation" "assign" "subscribed"];
}
{
block = "custom";
interval = 10;
command = pkgs.writers.writeDash "todo" ''
${pkgs.todoman}/bin/todo --porcelain | ${pkgs.jq}/bin/jq -r '
map(select(.due != null))
| (map(select(.due < now)) | length) as $overdue
| (map(select(.due >= now and .due < now + (60 * 60 * 24))) | length) as $dueToday
| {
icon: "tasks",
text: (($overdue + $dueToday) as $sum | if $sum > 0 then $sum | tostring else "" end),
state: (
if $overdue > 0 then
"Critical"
elif $dueToday > 0 then
"Warning"
else
"Idle"
end
)
}
'
'';
json = true;
hide_when_empty = true;
}
{
block = "custom";
interval = 60;
command = pkgs.writers.writeDash "weechat" ''
ssh -o ConnectTimeout=1 makanek cat /var/lib/weechat/hotlist.txt | sed 's/,/\n/g' | wc -l | jq '{
text: (if . > 0 then . | tostring else "" end),
state: (if . > 0 then "Info" else "Idle" end),
icon: "bell"
}'
'';
json = true;
hide_when_empty = true;
}
{
block = "net";
format = " $icon HU";
missing_format = "";
device = "ppp0";
}
{
block = "net";
device = config.niveum.wirelessInterface;
format = "$icon $ssid $signal_strength";
}
{
block = "battery";
device = config.niveum.batteryName;
}
{
block = "sound";
}
{
block = "disk_space";
format = "$icon $available";
}
{
block = "memory";
format = "$icon $mem_used.eng(prefix:G)";
}
{block = "load";}
{
block = "custom";
interval = 10;
json = true;
command = pkgs.writers.writeDash "time" ''
${pkgs.jq}/bin/jq -n \
--arg now "$(${pkgs.coreutils}/bin/date +'%Y-%m-%d (%W %a) %H:%M')" \
--argjson nextEvent "$(
${pkgs.khal}/bin/khal list --format "{start}" --day-format "" $(${pkgs.coreutils}/bin/date +'%Y-%m-%d %H:%M') 2>/dev/null \
| ${pkgs.gnugrep}/bin/grep -E '[0-9]{2}:[0-9]{2}' \
| ${pkgs.coreutils}/bin/head -1 \
| ${pkgs.coreutils}/bin/date --date="$(cat)" +%s
)" \
'{
text: $now,
icon: "time",
state: (
($nextEvent - now) as $deltaT
| if $deltaT < (5 * 60) then
"Critical"
elif $deltaT < (15 * 60) then
"Warning"
elif $deltaT < (60 * 60) then
"Info"
else
"Idle"
end
)
}'
'';
}
];
};
};
};
}

View File

@@ -1,14 +1,6 @@
{
config,
pkgs,
...
}: let
inherit (import <niveum/lib>) colours;
in {
{pkgs, ...}: {
home-manager.users.me.programs.rofi = {
enable = true;
font = "Monospace 10";
theme = "${pkgs.rofi}/share/rofi/themes/Arc.rasi";
pass = {
enable = true;
extraConfig = ''

37
configs/stylix.nix Normal file
View File

@@ -0,0 +1,37 @@
{
pkgs,
inputs,
...
}: {
# https://danth.github.io/stylix/tricks.html
stylix.image = inputs.wallpapers.outPath + "/vaporwave/1432599578099.png";
stylix.polarity = "either";
stylix.fonts = {
serif = {
package = pkgs.noto-fonts;
name = "Noto Serif";
};
sansSerif = {
package = pkgs.noto-fonts;
name = "Noto Sans";
};
monospace = {
package = pkgs.noto-fonts;
name = "Noto Sans Mono";
};
emoji = {
package = pkgs.noto-fonts-emoji;
name = "Noto Color Emoji";
};
sizes = {
terminal = 6;
applications = 10;
};
};
}

View File

@@ -1,89 +0,0 @@
{
config,
lib,
pkgs,
...
}: let
switch-theme = pkgs.writers.writeDashBin "switch-theme" ''
set -efux
if [ "$1" = toggle ]; then
if [ "$(${pkgs.coreutils}/bin/cat /var/theme/current_theme)" = dark ]; then
${placeholder "out"}/bin/switch-theme light
else
${placeholder "out"}/bin/switch-theme dark
fi
elif test -e "/etc/themes/$1"; then
mkdir -p /var/theme/config
${pkgs.rsync}/bin/rsync --chown=${config.users.users.me.name}:users -a --delete "/etc/themes/$1/" /var/theme/config/
echo "$1" > /var/theme/current_theme
${pkgs.coreutils}/bin/chown ${config.users.users.me.name}:users /var/theme/current_theme
${pkgs.xorg.xrdb}/bin/xrdb -merge /var/theme/config/xresources
${pkgs.procps}/bin/pkill -HUP xsettingsd
${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface gtk-theme "$(cat /var/theme/config/gtk-theme)" || :
else
echo "theme $1 not found"
fi
'';
in {
systemd.services.xsettingsd = {
wantedBy = ["multi-user.target"];
after = ["display-manager.service"];
environment.DISPLAY = ":0";
serviceConfig = {
ExecStart = "${pkgs.xsettingsd}/bin/xsettingsd -c /var/theme/config/xsettings.conf";
User = config.users.users.me.name;
Restart = "always";
RestartSec = "15s";
};
};
systemd.tmpfiles.rules = [
"d /var/theme/ 755 ${config.users.users.me.name} users"
];
environment.systemPackages = [
switch-theme
pkgs.capitaine-cursors
];
home-manager.users.me = {
home.pointerCursor = {
name = "capitaine-cursors-white";
package = pkgs.capitaine-cursors;
size = 16;
};
};
environment.etc = {
"themes/light/gtk-theme".text = ''
Adwaita
'';
"themes/light/xsettings.conf".text = ''
Net/ThemeName "Adwaita"
'';
"themes/light/xresources".text = ''
*background: #ffffff
*foreground: #000000
'';
"themes/dark/gtk-theme".text = ''
Dracula
'';
"themes/dark/xsettings.conf".text = ''
Net/ThemeName "Dracula"
'';
"themes/dark/xresources".text = ''
*background: #000000
*foreground: #ffffff
'';
};
system.activationScripts.theme.text = ''
export DISPLAY=:0
if test -e /var/theme/current_theme; then
${switch-theme}/bin/switch-theme "$(cat /var/theme/current_theme)" ||
${switch-theme}/bin/switch-theme dark
else
${switch-theme}/bin/switch-theme dark
fi
'';
}

View File

@@ -1,33 +0,0 @@
{
lib,
config,
pkgs,
...
}: let
theme = (import <niveum/lib>).theme pkgs;
in {
environment.systemPackages = [theme.gtk.package theme.icon.package theme.cursor.package];
services.xserver.displayManager.lightdm.greeters.gtk = {
theme = {inherit (theme.gtk) name package;};
iconTheme = {inherit (theme.icon) name package;};
};
home-manager.users.me = {
gtk = {
enable = true;
iconTheme = theme.icon;
theme = theme.gtk;
};
qt = {
enable = true;
platformTheme = "gtk";
};
home.pointerCursor =
theme.cursor
// {
size = 16;
x11.enable = true;
};
};
}