From a8940bf66703fa0b36043633504f1c63b9f53cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Wed, 26 Jul 2023 07:38:52 +0200 Subject: [PATCH] feat: stylix is my new best friend --- configs/aerc.nix | 2 +- configs/alacritty.nix | 31 +++-- configs/default.nix | 9 +- configs/dunst.nix | 20 +-- configs/i3.nix | 100 ++++---------- configs/i3status-rust.nix | 174 ++++++++++++++++++++++++ configs/rofi.nix | 10 +- configs/stylix.nix | 37 ++++++ configs/themes.nix | 89 ------------- configs/theming.nix | 33 ----- flake.lock | 130 +++++++++++++++++- flake.nix | 6 + lib/colours/antares.nix | 37 ------ lib/colours/apprentice.nix | 37 ------ lib/colours/ayu-dark.nix | 37 ------ lib/colours/ayu-light.nix | 37 ------ lib/colours/connermcd.nix | 37 ------ lib/colours/ibm-3270.nix | 37 ------ lib/colours/mac-os.nix | 37 ------ lib/colours/owickstrom-dark.nix | 38 ------ lib/colours/owickstrom-light.nix | 37 ------ lib/colours/papercolor-dark.nix | 37 ------ lib/colours/papercolor-light.nix | 37 ------ lib/colours/solarized-dark.nix | 37 ------ lib/colours/solarized-light.nix | 37 ------ lib/default.nix | 2 - lib/i3status-rust.nix | 220 ------------------------------- 27 files changed, 401 insertions(+), 944 deletions(-) create mode 100644 configs/i3status-rust.nix create mode 100644 configs/stylix.nix delete mode 100644 configs/themes.nix delete mode 100644 configs/theming.nix delete mode 100644 lib/colours/antares.nix delete mode 100644 lib/colours/apprentice.nix delete mode 100644 lib/colours/ayu-dark.nix delete mode 100644 lib/colours/ayu-light.nix delete mode 100644 lib/colours/connermcd.nix delete mode 100644 lib/colours/ibm-3270.nix delete mode 100644 lib/colours/mac-os.nix delete mode 100644 lib/colours/owickstrom-dark.nix delete mode 100644 lib/colours/owickstrom-light.nix delete mode 100644 lib/colours/papercolor-dark.nix delete mode 100644 lib/colours/papercolor-light.nix delete mode 100644 lib/colours/solarized-dark.nix delete mode 100644 lib/colours/solarized-light.nix delete mode 100644 lib/i3status-rust.nix diff --git a/configs/aerc.nix b/configs/aerc.nix index 7cb4083..887bb6d 100644 --- a/configs/aerc.nix +++ b/configs/aerc.nix @@ -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"; diff --git a/configs/alacritty.nix b/configs/alacritty.nix index d69ff27..108deab 100644 --- a/configs/alacritty.nix +++ b/configs/alacritty.nix @@ -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"; + } + ]; + }; + }; }; } diff --git a/configs/default.nix b/configs/default.nix index af615c2..d1ef041 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -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 diff --git a/configs/dunst.nix b/configs/dunst.nix index 5ff7cb7..223a0c6 100644 --- a/configs/dunst.nix +++ b/configs/dunst.nix @@ -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%s\\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; }; }; diff --git a/configs/i3.nix b/configs/i3.nix index 296812e..2aef555 100644 --- a/configs/i3.nix +++ b/configs/i3.nix @@ -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}"; diff --git a/configs/i3status-rust.nix b/configs/i3status-rust.nix new file mode 100644 index 0000000..c2a2312 --- /dev/null +++ b/configs/i3status-rust.nix @@ -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 + ) + }' + ''; + } + ]; + }; + }; + }; +} diff --git a/configs/rofi.nix b/configs/rofi.nix index 41ca353..c7c9d3b 100644 --- a/configs/rofi.nix +++ b/configs/rofi.nix @@ -1,14 +1,6 @@ -{ - config, - pkgs, - ... -}: let - inherit (import ) 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 = '' diff --git a/configs/stylix.nix b/configs/stylix.nix new file mode 100644 index 0000000..43d05c1 --- /dev/null +++ b/configs/stylix.nix @@ -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; + }; + }; +} diff --git a/configs/themes.nix b/configs/themes.nix deleted file mode 100644 index 0567d19..0000000 --- a/configs/themes.nix +++ /dev/null @@ -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 - ''; -} diff --git a/configs/theming.nix b/configs/theming.nix deleted file mode 100644 index 13a0c41..0000000 --- a/configs/theming.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: let - theme = (import ).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; - }; - }; -} diff --git a/flake.lock b/flake.lock index 6ddc2f3..f52a640 100644 --- a/flake.lock +++ b/flake.lock @@ -24,6 +24,24 @@ "type": "github" } }, + "base16": { + "inputs": { + "fromYaml": "fromYaml" + }, + "locked": { + "lastModified": 1689633990, + "narHash": "sha256-iwvQg2Vx0IIDWZaKo8Xmzxlv1YPHg+Kp/QSv8dRv0RY=", + "owner": "SenchoPens", + "repo": "base16.nix", + "rev": "dddf2e1c04845d43c89a8e9e37d574519649a404", + "type": "github" + }, + "original": { + "owner": "SenchoPens", + "repo": "base16.nix", + "type": "github" + } + }, "blessings": { "flake": false, "locked": { @@ -62,6 +80,22 @@ "type": "github" } }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -95,6 +129,22 @@ "type": "github" } }, + "fromYaml": { + "flake": false, + "locked": { + "lastModified": 1689549921, + "narHash": "sha256-iX0pk/uB019TdBGlaJEWvBCfydT6sRq+eDcGPifVsCM=", + "owner": "SenchoPens", + "repo": "fromYaml", + "rev": "11fbbbfb32e3289d3c631e0134a23854e7865c84", + "type": "github" + }, + "original": { + "owner": "SenchoPens", + "repo": "fromYaml", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -116,6 +166,27 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "stylix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1689134369, + "narHash": "sha256-0G9dutIvhS/WUr3Awcnqw71g8EVVvvkOhVDnDDbY4Fw=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "e42fb59768f0305085abde0dd27ab5e0cc15420c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "menstruation-backend": { "inputs": { "flake-utils": [ @@ -303,6 +374,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1689261696, + "narHash": "sha256-LzfUtFs9MQRvIoQ3MfgSuipBVMXslMPH/vZ+nM40LkA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "df1eee2aa65052a18121ed4971081576b25d6b5c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1659446231, "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", @@ -437,10 +524,12 @@ "retiolum": "retiolum", "rust-overlay": "rust-overlay", "scripts": "scripts", + "stylix": "stylix", "telebots": "telebots", "tinc-graph": "tinc-graph", "traadfri": "traadfri", - "voidrice": "voidrice" + "voidrice": "voidrice", + "wallpapers": "wallpapers" } }, "rust-overlay": { @@ -492,6 +581,27 @@ "type": "github" } }, + "stylix": { + "inputs": { + "base16": "base16", + "flake-compat": "flake-compat", + "home-manager": "home-manager_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1690028952, + "narHash": "sha256-r/1ywiJzbyXq2OQEHs8tYFlcViL0IOruxovrYqO08y4=", + "owner": "danth", + "repo": "stylix", + "rev": "34a6d389f34b2548b3ae9fad77508620a0358817", + "type": "github" + }, + "original": { + "owner": "danth", + "repo": "stylix", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -510,7 +620,7 @@ "telebots": { "inputs": { "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1677156381, @@ -590,6 +700,22 @@ "repo": "voidrice", "type": "github" } + }, + "wallpapers": { + "flake": false, + "locked": { + "lastModified": 1589319718, + "narHash": "sha256-2NruGq3z37vY3uAH8S4sLqHvFAGi8gaDJAgEzMIvM/4=", + "owner": "kmein", + "repo": "wallpapers", + "rev": "7c553bc6bd78afa6dbf2824691466bbad0d8e6e9", + "type": "github" + }, + "original": { + "owner": "kmein", + "repo": "wallpapers", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index d43d498..fd174f8 100644 --- a/flake.nix +++ b/flake.nix @@ -17,10 +17,12 @@ retiolum.url = "git+https://git.thalheim.io/Mic92/retiolum"; rust-overlay.url = "github:oxalica/rust-overlay"; scripts.url = "github:kmein/scripts"; + stylix.url = "github:danth/stylix"; telebots.url = "github:kmein/telebots"; tinc-graph.url = "github:kmein/tinc-graph"; traadfri.url = "github:kmein/traadfri"; voidrice.url = "github:Lukesmithxyz/voidrice"; + wallpapers.url = "github:kmein/wallpapers"; agenix.inputs.home-manager.follows = "home-manager"; agenix.inputs.nixpkgs.follows = "nixpkgs"; @@ -47,6 +49,7 @@ traadfri.inputs.flake-utils.follows = "flake-utils"; traadfri.inputs.nixpkgs.follows = "nixpkgs-old"; voidrice.flake = false; + wallpapers.flake = false; }; outputs = inputs @ { @@ -60,6 +63,7 @@ retiolum, flake-utils, nix-on-droid, + stylix, ... }: { @@ -234,6 +238,7 @@ retiolum.nixosModules.retiolum home-manager.nixosModules.home-manager nur.nixosModules.nur + stylix.nixosModules.stylix ]; }; kabsa = nixpkgs.lib.nixosSystem rec { @@ -254,6 +259,7 @@ retiolum.nixosModules.retiolum home-manager.nixosModules.home-manager nur.nixosModules.nur + stylix.nixosModules.stylix ]; }; }; diff --git a/lib/colours/antares.nix b/lib/colours/antares.nix deleted file mode 100644 index 3be862b..0000000 --- a/lib/colours/antares.nix +++ /dev/null @@ -1,37 +0,0 @@ -rec { - black = { - bright = "#151515"; - dark = "#000000"; - }; - red = { - bright = "#de575c"; - dark = "#de575c"; - }; - yellow = { - bright = "#ebe971"; - dark = "#ebe971"; - }; - green = { - bright = "#00b853"; - dark = "#00b853"; - }; - blue = { - bright = "#90d0f0"; - dark = "#7fc6f0"; - }; - magenta = { - bright = "#cf9ffa"; - dark = "#cf9ffa"; - }; - cyan = { - bright = "#4ae5e8"; - dark = "#4ae5e8"; - }; - white = { - bright = "#ffffff"; - dark = "#bbbbbb"; - }; - background = black.dark; - foreground = white.dark; - cursor = green.bright; -} diff --git a/lib/colours/apprentice.nix b/lib/colours/apprentice.nix deleted file mode 100644 index 9863b6e..0000000 --- a/lib/colours/apprentice.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - black = { - bright = "#444444"; - dark = "#1c1c1c"; - }; - red = { - bright = "#ff8700"; - dark = "#af5f5f"; - }; - green = { - bright = "#87af87"; - dark = "#5f875f"; - }; - yellow = { - bright = "#ffffaf"; - dark = "#87875f"; - }; - blue = { - bright = "#8fafd7"; - dark = "#5f87af"; - }; - magenta = { - bright = "#8787af"; - dark = "#5f5f87"; - }; - cyan = { - bright = "#5fafaf"; - dark = "#5f8787"; - }; - white = { - bright = "#999999"; - dark = "#6c6c6c"; - }; - background = "#262626"; - foreground = "#bcbcbc"; - cursor = "#bcbcbc"; -} diff --git a/lib/colours/ayu-dark.nix b/lib/colours/ayu-dark.nix deleted file mode 100644 index 370296c..0000000 --- a/lib/colours/ayu-dark.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - black = { - dark = "#000000"; - bright = "#323232"; - }; - red = { - dark = "#ff3333"; - bright = "#ff6565"; - }; - green = { - dark = "#b8cc52"; - bright = "#e9fe83"; - }; - yellow = { - dark = "#e6c446"; - bright = "#fff778"; - }; - blue = { - dark = "#36a3d9"; - bright = "#68d4ff"; - }; - magenta = { - dark = "#f07078"; - bright = "#ffa3aa"; - }; - cyan = { - dark = "#95e5cb"; - bright = "#c7fffc"; - }; - white = { - dark = "#ffffff"; - bright = "#ffffff"; - }; - background = "#0e1419"; - foreground = "#e5e1cf"; - cursor = "#f19618"; -} diff --git a/lib/colours/ayu-light.nix b/lib/colours/ayu-light.nix deleted file mode 100644 index da858bc..0000000 --- a/lib/colours/ayu-light.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - black = { - dark = "#000000"; - bright = "#323232"; - }; - red = { - dark = "#ff3333"; - bright = "#ff6565"; - }; - green = { - dark = "#86b200"; - bright = "#b8e532"; - }; - yellow = { - dark = "#f19618"; - bright = "#ffc849"; - }; - blue = { - dark = "#41a6d9"; - bright = "#73d7ff"; - }; - magenta = { - dark = "#f07078"; - bright = "#ffa3aa"; - }; - cyan = { - dark = "#4cbe99"; - bright = "#7ff0cb"; - }; - white = { - dark = "#ffffff"; - bright = "#ffffff"; - }; - background = "#fafafa"; - foreground = "#5b6673"; - cursor = "#ff6900"; -} diff --git a/lib/colours/connermcd.nix b/lib/colours/connermcd.nix deleted file mode 100644 index d584e55..0000000 --- a/lib/colours/connermcd.nix +++ /dev/null @@ -1,37 +0,0 @@ -rec { - black = { - bright = "#454545"; - dark = "#222222"; - }; - red = { - bright = "#FA8072"; - dark = "#B22222"; - }; - green = { - bright = "#779A3E"; - dark = "#556B2F"; - }; - yellow = { - bright = "#DAA520"; - dark = "#B8860B"; - }; - blue = { - bright = "#6495ED"; - dark = "#4682B4"; - }; - magenta = { - bright = "#DA70D6"; - dark = "#9932CC"; - }; - cyan = { - bright = "#B0E0E6"; - dark = "#87CEEB"; - }; - white = { - bright = "#FFFFFF"; - dark = "#C0C0C0"; - }; - background = "#000000"; - foreground = "#AAAAAA"; - cursor = green.bright; -} diff --git a/lib/colours/ibm-3270.nix b/lib/colours/ibm-3270.nix deleted file mode 100644 index 7dba6c4..0000000 --- a/lib/colours/ibm-3270.nix +++ /dev/null @@ -1,37 +0,0 @@ -rec { - black = { - bright = "#888888"; - dark = "#222222"; - }; - red = { - bright = "#ef8383"; - dark = "#f01818"; - }; - yellow = { - bright = "#efe28b"; - dark = "#f8d824"; - }; - green = { - bright = "#23d830"; - dark = "#7ed684"; - }; - blue = { - bright = "#b3bfef"; - dark = "#7890f0"; - }; - magenta = { - bright = "#efb3e3"; - dark = "#f078d8"; - }; - cyan = { - bright = "#9ce2e2"; - dark = "#54e4e4"; - }; - white = { - bright = "#ffffff"; - dark = "#a5a5a5"; - }; - background = "#000000"; - foreground = "#bbbbbb"; - cursor = green.bright; -} diff --git a/lib/colours/mac-os.nix b/lib/colours/mac-os.nix deleted file mode 100644 index b9737e6..0000000 --- a/lib/colours/mac-os.nix +++ /dev/null @@ -1,37 +0,0 @@ -rec { - black = { - bright = "#818383"; - dark = "#000000"; - }; - red = { - bright = "#fc391f"; - dark = "#c23621"; - }; - yellow = { - bright = "#eaec23"; - dark = "#adad27"; - }; - green = { - bright = "#31e722"; - dark = "#25bc24"; - }; - blue = { - bright = "#5833ff"; - dark = "#492ee1"; - }; - magenta = { - bright = "#f935f8"; - dark = "#d338d3"; - }; - cyan = { - bright = "#14f0f0"; - dark = "#33bbc8"; - }; - white = { - bright = "#e9ebeb"; - dark = "#cbcccd"; - }; - background = black.dark; - foreground = white.dark; - cursor = green.bright; -} diff --git a/lib/colours/owickstrom-dark.nix b/lib/colours/owickstrom-dark.nix deleted file mode 100644 index 649b1a6..0000000 --- a/lib/colours/owickstrom-dark.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ - # all dark colours are 20% darker than the bright ones - black = { - bright = "#4c5363"; # "#282c34"; - dark = "#20232a"; - }; - red = { - bright = "#e68990"; #"#e06c75"; - dark = "#d43541"; - }; - green = { - bright = "#acce93"; #"#98c379"; - dark = "#77af4e"; - }; - yellow = { - bright = "#eacc95"; #"#e5c07b"; - dark = "#d9a440"; - }; - blue = { - bright = "#80bff2"; #"#61afef"; - dark = "#2490e9"; - }; - magenta = { - bright = "#d193e3"; #"#c678dd"; - dark = "#af42cf"; - }; - cyan = { - bright = "#77c4ce"; #"#56b6c2"; - dark = "#3b99a5"; - }; - white = { - bright = "#e3e5e9"; #"#dcdfe4"; - dark = "#a9b1bd"; - }; - background = "#282c34"; #black.dark; - foreground = "#dcdfe4"; #white.bright; - cursor = "#a3b3cc"; -} diff --git a/lib/colours/owickstrom-light.nix b/lib/colours/owickstrom-light.nix deleted file mode 100644 index ed5d92e..0000000 --- a/lib/colours/owickstrom-light.nix +++ /dev/null @@ -1,37 +0,0 @@ -rec { - black = { - bright = "#4b4b4b"; - dark = "#242424"; - }; - red = { - bright = "#fc1c18"; - dark = "#d71c15"; - }; - green = { - bright = "#6bc219"; - dark = "#5aa513"; - }; - yellow = { - bright = "#fec80e"; - dark = "#fdb40c"; - }; - blue = { - bright = "#0955ff"; - dark = "#063b8c"; - }; - magenta = { - bright = "#fb0050"; - dark = "#e40038"; - }; - cyan = { - bright = "#3ea8fc"; - dark = "#2595e1"; - }; - white = { - bright = "#8c00ec"; - dark = "#bfbfbf"; - }; - background = "#efefef"; - foreground = "#181818"; - cursor = "#a3b3cc"; -} diff --git a/lib/colours/papercolor-dark.nix b/lib/colours/papercolor-dark.nix deleted file mode 100644 index 9e4515b..0000000 --- a/lib/colours/papercolor-dark.nix +++ /dev/null @@ -1,37 +0,0 @@ -rec { - black = { - dark = "#1c1c1c"; - bright = "#585858"; - }; - red = { - dark = "#af005f"; - bright = "#5faf5f"; - }; - green = { - bright = "#afd700"; - dark = "#5faf00"; - }; - yellow = { - bright = "#af87d7"; - dark = "#d7af5f"; - }; - blue = { - dark = "#5fafd7"; - bright = "#ffaf00"; - }; - magenta = { - bright = "#ff5faf"; - dark = "#808080"; - }; - cyan = { - dark = "#d7875f"; - bright = "#00afaf"; - }; - white = { - dark = "#d0d0d0"; - bright = "#5f8787"; - }; - background = black.dark; - foreground = white.dark; - cursor = blue.bright; -} diff --git a/lib/colours/papercolor-light.nix b/lib/colours/papercolor-light.nix deleted file mode 100644 index e27ea64..0000000 --- a/lib/colours/papercolor-light.nix +++ /dev/null @@ -1,37 +0,0 @@ -rec { - black = { - dark = "#eeeeee"; - bright = "#bcbcbc"; - }; - red = { - dark = "#af0000"; - bright = "#d70000"; - }; - green = { - dark = "#008700"; - bright = "#d70087"; - }; - yellow = { - dark = "#5f8700"; - bright = "#8700af"; - }; - blue = { - dark = "#0087af"; - bright = "#d75f00"; - }; - magenta = { - bright = "#878787"; - dark = "#d75f00"; - }; - cyan = { - dark = "#005f87"; - bright = "#005faf"; - }; - white = { - dark = "#444444"; - bright = "#005f87"; - }; - background = black.dark; - foreground = white.dark; - cursor = blue.bright; -} diff --git a/lib/colours/solarized-dark.nix b/lib/colours/solarized-dark.nix deleted file mode 100644 index 3007bb9..0000000 --- a/lib/colours/solarized-dark.nix +++ /dev/null @@ -1,37 +0,0 @@ -rec { - black = { - dark = "#073642"; - bright = "#002b36"; - }; - red = { - dark = "#dc322f"; - bright = "#cb4b16"; - }; - yellow = { - dark = "#b58900"; - bright = "#657b83"; - }; - green = { - dark = "#859900"; - bright = "#586e75"; - }; - blue = { - dark = "#268bd2"; - bright = "#839496"; - }; - magenta = { - dark = "#d33682"; - bright = "#6c71c4"; - }; - cyan = { - dark = "#2aa198"; - bright = "#93a1a1"; - }; - white = { - dark = "#eee8d5"; - bright = "#fdf6e3"; - }; - background = black.bright; - foreground = blue.bright; - cursor = cyan.bright; -} diff --git a/lib/colours/solarized-light.nix b/lib/colours/solarized-light.nix deleted file mode 100644 index 290f960..0000000 --- a/lib/colours/solarized-light.nix +++ /dev/null @@ -1,37 +0,0 @@ -rec { - black = { - dark = "#073642"; - bright = "#002b36"; - }; - red = { - dark = "#dc322f"; - bright = "#cb4b16"; - }; - yellow = { - dark = "#b58900"; - bright = "#657b83"; - }; - green = { - dark = "#859900"; - bright = "#586e75"; - }; - blue = { - dark = "#268bd2"; - bright = "#839496"; - }; - magenta = { - dark = "#d33682"; - bright = "#6c71c4"; - }; - cyan = { - dark = "#2aa198"; - bright = "#93a1a1"; - }; - white = { - dark = "#eee8d5"; - bright = "#fdf6e3"; - }; - background = white.bright; - foreground = yellow.bright; - cursor = green.bright; -} diff --git a/lib/default.nix b/lib/default.nix index 0739ba1..8bbb0f0 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -40,8 +40,6 @@ sshPort = 22022; - colours = import ./colours/owickstrom-dark.nix; - theme = pkgs: { gtk = { name = "Adwaita-dark"; diff --git a/lib/i3status-rust.nix b/lib/i3status-rust.nix deleted file mode 100644 index 9b3bfdd..0000000 --- a/lib/i3status-rust.nix +++ /dev/null @@ -1,220 +0,0 @@ -{ - pkgs, - wirelessInterface, - colours, - batteryName, - accounts, -}: let - inherit (pkgs) lib; - - setsid = script: - pkgs.writers.writeDash "setsid-command" '' - ${pkgs.util-linux}/bin/setsid ${script} - ''; -in { - theme = { - theme = "plain"; - overrides = { - critical_fg = colours.red.bright; - good_fg = colours.green.bright; - idle_fg = colours.foreground; - info_fg = colours.cyan.bright; - warning_fg = colours.yellow.bright; - warning_bg = colours.background; - critical_bg = colours.background; - good_bg = colours.background; - idle_bg = colours.background; - info_bg = colours.background; - separator = ""; - separator_bg = "auto"; - separator_fg = colours.black.bright; - }; - }; - icons.icons = "awesome6"; - icons.overrides.vpn = ""; - icons.overrides.irc = ""; - block = [ - { - 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 * 5; - command = let - query-account = name: account: "${pkgs.writers.writeDash "query-imap-${name}" '' - password=$(${toString account.passwordCommand}) - ${pkgs.coreutils}/bin/timeout 1 ${pkgs.curl}/bin/curl -sSL -u ${lib.escapeShellArg account.userName}:"$password" imaps://${account.imap.host} -X 'STATUS INBOX (UNSEEN)' \ - | ${pkgs.gnugrep}/bin/grep -Eo '[0-9]+' \ - | sed 's/^/{"${name}":/;s/$/}/' - ''} &"; - in - pkgs.writers.writeDash "unread-mail" '' - { - ${lib.concatStringsSep "\n" (lib.mapAttrsToList query-account accounts)} - wait - } | jq -s 'if length == 0 then {text: "", icon: "mail", state: "Idle"} else - add - | (values | add) as $sum - | { - text: (if $sum > 0 then $sum | tostring else "" end), - icon: "mail", - state: ( - if .["hu-student"] > 0 or .["hu-employee"] > 0 or .posteo > 0 then - "Warning" - elif $sum > 0 then - "Info" - else - "Idle" - end - ) - } 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: "irc" - }' - ''; - json = true; - hide_when_empty = true; - } - { - block = "service_status"; - service = "hu-vpn"; - active_format = "^icon_vpn"; - inactive_format = ""; - } - { - block = "custom"; - interval = 5; - command = pkgs.writers.writeDash "hu-berlin-vpn" '' - PATH=${lib.makeBinPath [pkgs.systemd]} - (systemctl is-active --quiet openvpn-hu-berlin.service && echo '{"state": "Good", "text": "OpenVPN", "icon": "vpn"}') \ - || (systemctl is-active --quiet hu-vpn.service && echo '{"state": "Good", "text": "PPP+SSL", "icon": "vpn"}') \ - || echo '{"state": "Idle", "icon": "vpn", "text": ""}' - ''; - json = true; - hide_when_empty = true; - } - { - block = "net"; - device = wirelessInterface; - format = "$icon $ssid $signal_strength"; - } - { - block = "battery"; - device = 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 - ) - }' - ''; - } - ]; -}