From ec66fd03777fe493900fa85688fc0f984c42a52a Mon Sep 17 00:00:00 2001 From: kat witch Date: Sun, 3 Oct 2021 01:02:53 +0100 Subject: [PATCH] hosts/koishi: v330-14arr -> x270 --- config/hosts/goliath.nix | 391 ++++++++++++----------- config/hosts/koishi.nix | 71 ++-- config/profiles/base/profiles.nix | 4 + config/profiles/hardware/default.nix | 8 + config/profiles/hardware/ryzen.nix | 55 ++-- config/profiles/hardware/x270.nix | 45 +++ config/profiles/light.nix | 19 ++ config/users/kat/dev/emacs.nix | 2 +- config/users/kat/gui/gtk.nix | 4 +- config/users/kat/sway/gammastep.nix | 1 + config/users/kat/sway/sway.nix | 3 +- config/users/kat/sway/waybar/default.nix | 32 +- config/users/kat/sway/waybar/waybar.sass | 18 +- nix/sources.json | 12 +- overlays/exprs | 2 +- 15 files changed, 380 insertions(+), 287 deletions(-) create mode 100644 config/profiles/hardware/x270.nix create mode 100644 config/profiles/light.nix diff --git a/config/hosts/goliath.nix b/config/hosts/goliath.nix index 4bdcfbf3..7626beac 100644 --- a/config/hosts/goliath.nix +++ b/config/hosts/goliath.nix @@ -1,5 +1,4 @@ { meta, tf, config, pkgs, lib, sources, ... }: with lib; { - imports = with meta; [ profiles.hardware.ms-7b86 profiles.hardware.razer @@ -18,232 +17,234 @@ services.zfs ]; - deploy.tf = { - resources.goliath = { - provider = "null"; - type = "resource"; - connection = { - port = head config.services.openssh.ports; - host = config.network.addresses.private.nixos.ipv4.address; + + config = { + deploy.tf = { + resources.goliath = { + provider = "null"; + type = "resource"; + connection = { + port = head config.services.openssh.ports; + host = config.network.addresses.private.nixos.ipv4.address; + }; }; }; - }; - boot.supportedFilesystems = [ "zfs" "xfs" ]; + boot.supportedFilesystems = [ "zfs" "xfs" ]; - fileSystems = { - "/" = { - device = "rpool/ephemeral/root"; - fsType = "zfs"; + fileSystems = { + "/" = { + device = "rpool/ephemeral/root"; + fsType = "zfs"; + }; + "/nix" = { + device = "rpool/local/nix"; + fsType = "zfs"; + }; + "/home" = { + device = "rpool/ephemeral/home"; + fsType = "zfs"; + }; + "/persist/root" = { + device = "rpool/persist/root"; + fsType = "zfs"; + neededForBoot = true; + }; + "/persist/home" = { + device = "rpool/persist/home"; + fsType = "zfs"; + neededForBoot = true; + }; + "/boot" = { + device = "/dev/disk/by-uuid/AED6-D0D1"; + fsType = "vfat"; + }; + "/mnt/xstore" = { + device = "/dev/disk/by-uuid/64269102-a278-4919-9118-34e37f4afdb0"; + fsType = "xfs"; + }; }; - "/nix" = { - device = "rpool/local/nix"; - fsType = "zfs"; - }; - "/home" = { - device = "rpool/ephemeral/home"; - fsType = "zfs"; - }; - "/persist/root" = { - device = "rpool/persist/root"; - fsType = "zfs"; - neededForBoot = true; - }; - "/persist/home" = { - device = "rpool/persist/home"; - fsType = "zfs"; - neededForBoot = true; - }; - "/boot" = { - device = "/dev/disk/by-uuid/AED6-D0D1"; - fsType = "vfat"; - }; - "/mnt/xstore" = { - device = "/dev/disk/by-uuid/64269102-a278-4919-9118-34e37f4afdb0"; - fsType = "xfs"; - }; - }; - boot.initrd.postDeviceCommands = mkIf (config.fileSystems."/".fsType == "zfs") (mkAfter '' - zfs rollback -r ${config.fileSystems."/".device}@blank - zfs rollback -r ${config.fileSystems."/home".device}@blank - ''); + boot.initrd.postDeviceCommands = mkIf (config.fileSystems."/".fsType == "zfs") (mkAfter '' + zfs rollback -r ${config.fileSystems."/".device}@blank + zfs rollback -r ${config.fileSystems."/home".device}@blank + ''); - programs.fuse.userAllowOther = true; + programs.fuse.userAllowOther = true; - environment.persistence."/persist/root" = { - directories = [ - "/var/log" - "/var/lib/systemd/coredump" - "/var/lib/acme" - "/var/lib/yggdrasil" - "/var/lib/kat/secrets" - ]; - files = [ - "/etc/machine-id" - "/etc/nix/id_rsa" - "/etc/ssh/ssh_host_rsa_key" - "/etc/ssh/ssh_host_rsa_key.pub" - "/etc/ssh/ssh_host_ed25519_key" - "/etc/ssh/ssh_host_ed25519_key.pub" - ]; - }; - - secrets.persistentRoot = mkForce "/persist/root/var/lib/kat/secrets"; - - home-manager.users.kat = { - secrets.persistentRoot = mkForce "/persist/home/.cache/kat/secrets"; - - home.persistence."/persist/home" = { - allowOther = true; + environment.persistence."/persist/root" = { directories = [ - ".cache/kat/secrets" - ".cache/rbw" - ".cache/nix" - ".local/share/z" - ".local/share/vim" - ".local/share/nvim" - ".local/share/task" - ".local/share/dino" - ".local/share/weechat" - ".local/share/Mumble" - ".local/share/direnv" - ".config/Mumble" - ".config/Element" - ".config/hedgedoc" - ".ApacheDirectoryStudio" - ".gnupg" - ".mozilla" - "neorg" - "docs" - "media" - "mail" - "projects" - "shared" + "/var/log" + "/var/lib/systemd/coredump" + "/var/lib/acme" + "/var/lib/yggdrasil" + "/var/lib/kat/secrets" ]; files = [ - ".ssh/known_hosts" - ".zsh_history" + "/etc/machine-id" + "/etc/nix/id_rsa" + "/etc/ssh/ssh_host_rsa_key" + "/etc/ssh/ssh_host_rsa_key.pub" + "/etc/ssh/ssh_host_ed25519_key" + "/etc/ssh/ssh_host_ed25519_key.pub" ]; }; - }; - swapDevices = [ - { device = "/dev/disk/by-uuid/89831a0f-93e6-4d30-85e4-09061259f140"; } - { device = "/dev/disk/by-uuid/8f944315-fe1c-4095-90ce-50af03dd5e3f"; } - ]; + secrets.persistentRoot = mkForce "/persist/root/var/lib/kat/secrets"; - boot.loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; - }; + home-manager.users.kat = { + secrets.persistentRoot = mkForce "/persist/home/.cache/kat/secrets"; - deploy.profile.hardware.acs-override = true; - - users.users.kat.extraGroups = singleton "openrazer"; - - hardware = { - displays = { - "HDMI-A-1" = { - res = "1920x1080"; - pos = "0 0"; - }; - "DVI-D-1" = { - res = "1920x1200"; - pos = "1920 0"; - }; - "DP-1" = { - res = "1920x1080"; - pos = "3840 0"; - }; - }; - bamboo.display = "HDMI-A-1"; - openrazer.enable = true; - }; - - environment.systemPackages = [ - pkgs.razergenie - ]; - - boot.modprobe.modules = { - vfio-pci = - let - vfio-pci-ids = [ - "1002:67df" - "1002:aaf0" # RX 580 - "1912:0014" # Renesas USB 3 - "1022:149c" # CPU USB 3 + home.persistence."/persist/home" = { + allowOther = true; + directories = [ + ".cache/kat/secrets" + ".cache/rbw" + ".cache/nix" + ".local/share/z" + ".local/share/vim" + ".local/share/nvim" + ".local/share/task" + ".local/share/dino" + ".local/share/weechat" + ".local/share/Mumble" + ".local/share/direnv" + ".config/Mumble" + ".config/Element" + ".config/hedgedoc" + ".ApacheDirectoryStudio" + ".gnupg" + ".mozilla" + "neorg" + "docs" + "media" + "mail" + "projects" + "shared" + ]; + files = [ + ".ssh/known_hosts" + ".zsh_history" ]; - in - mkIf (vfio-pci-ids != [ ]) { - options.ids = concatStringsSep "," vfio-pci-ids; }; - }; + }; - services.udev.extraRules = '' - SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="1532", ATTRS{idProduct}=="0067", GROUP="vfio" - SUBSYSTEM=="block", ACTION=="add", ATTRS{model}=="HFS256G32TNF-N3A", ATTRS{wwid}=="t10.ATA HFS256G32TNF-N3A0A MJ8BN15091150BM1Z ", OWNER="kat" - ''; + swapDevices = [ + { device = "/dev/disk/by-uuid/89831a0f-93e6-4d30-85e4-09061259f140"; } + { device = "/dev/disk/by-uuid/8f944315-fe1c-4095-90ce-50af03dd5e3f"; } + ]; - networking = { - hostId = "617050fc"; - useDHCP = false; - /*useNetworkd = true;*/ - interfaces = { - enp34s0.ipv4.addresses = singleton { - inherit (config.network.addresses.private.nixos.ipv4) address; - prefixLength = 24; + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + deploy.profile.hardware.acs-override = true; + + users.users.kat.extraGroups = singleton "openrazer"; + + hardware = { + displays = { + "HDMI-A-1" = { + res = "1920x1080"; + pos = "0 0"; + }; + "DVI-D-1" = { + res = "1920x1200"; + pos = "1920 0"; + }; + "DP-1" = { + res = "1920x1080"; + pos = "3840 0"; }; }; - defaultGateway = config.network.privateGateway; - firewall.allowPing = true; - }; + bamboo.display = "HDMI-A-1"; + openrazer.enable = true; + }; - /*systemd.network = { - networks.enp34s0 = { - matchConfig.Name = "enp34s0"; - bridge = singleton "br"; + environment.systemPackages = [ + pkgs.razergenie + ]; + + boot.modprobe.modules = { + vfio-pci = + let + vfio-pci-ids = [ + "1002:67df" + "1002:aaf0" # RX 580 + "1912:0014" # Renesas USB 3 + "1022:149c" # CPU USB 3 + ]; + in + mkIf (vfio-pci-ids != [ ]) { + options.ids = concatStringsSep "," vfio-pci-ids; + }; }; - networks.br = { - matchConfig.Name = "br"; - address = singleton "${config.network.addresses.private.nixos.ipv4.address}/24"; - gateway = singleton config.network.privateGateway; + + services.udev.extraRules = '' + SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="1532", ATTRS{idProduct}=="0067", GROUP="vfio" + SUBSYSTEM=="block", ACTION=="add", ATTRS{model}=="HFS256G32TNF-N3A", ATTRS{wwid}=="t10.ATA HFS256G32TNF-N3A0A MJ8BN15091150BM1Z ", OWNER="kat" + ''; + + networking = { + hostId = "617050fc"; + useDHCP = false; + /*useNetworkd = true;*/ + interfaces = { + enp34s0.ipv4.addresses = singleton { + inherit (config.network.addresses.private.nixos.ipv4) address; + prefixLength = 24; + }; + }; + defaultGateway = config.network.privateGateway; + firewall.allowPing = true; }; - netdevs.br = { - netdevConfig = { - Name = "br"; - Kind = "bridge"; - MACAddress = "00:d8:61:c7:f4:9d"; + + /*systemd.network = { + networks.enp34s0 = { + matchConfig.Name = "enp34s0"; + bridge = singleton "br"; }; - }; - };*/ + networks.br = { + matchConfig.Name = "br"; + address = singleton "${config.network.addresses.private.nixos.ipv4.address}/24"; + gateway = singleton config.network.privateGateway; + }; + netdevs.br = { + netdevConfig = { + Name = "br"; + Kind = "bridge"; + MACAddress = "00:d8:61:c7:f4:9d"; + }; + }; + };*/ - services.avahi.enable = true; + services.avahi.enable = true; - network = { - addresses = { - private = { + network = { + addresses = { + private = { + enable = true; + nixos = { + ipv4.address = "192.168.1.1"; + }; + }; + }; + yggdrasil = { enable = true; - nixos = { - ipv4.address = "192.168.1.1"; + pubkey = "a7110d0a1dc9ec963d6eb37bb6922838b8088b53932eae727a9136482ce45d47"; + listen.enable = false; + listen.endpoints = [ "tcp://0.0.0.0:0" ]; + }; + firewall = { + public.interfaces = [ "br" "enp34s0" ]; + private = { + interfaces = singleton "yggdrasil"; }; }; }; - yggdrasil = { - enable = true; - pubkey = "a7110d0a1dc9ec963d6eb37bb6922838b8088b53932eae727a9136482ce45d47"; - listen.enable = false; - listen.endpoints = [ "tcp://0.0.0.0:0" ]; - }; - firewall = { - public.interfaces = [ "br" "enp34s0" ]; - private = { - interfaces = singleton "yggdrasil"; - }; - }; + + system.stateVersion = "21.11"; }; - - system.stateVersion = "21.11"; } - diff --git a/config/hosts/koishi.nix b/config/hosts/koishi.nix index 2d4d0579..20b8f1e4 100644 --- a/config/hosts/koishi.nix +++ b/config/hosts/koishi.nix @@ -1,22 +1,11 @@ { meta, config, pkgs, lib, ... }: with lib; { - options.home-manager.users = let - userBase16Extend = { config, nixos, ... }: { - base16.alias.default = "atelier.atelier-cave-light"; - }; - in mkOption { - type = types.attrsOf (types.submoduleWith { - modules = singleton userBase16Extend; - }); - }; - imports = with meta; [ - profiles.hardware.v330-14arr + profiles.hardware.x270 profiles.gui + profiles.light profiles.network users.kat.guiFull - services.nginx - services.restic - services.zfs + services.dnscrypt-proxy ]; config = { @@ -31,41 +20,29 @@ }; }; - boot.supportedFilesystems = singleton "zfs"; - - fileSystems = { - "/" = { - device = "rpool/safe/root"; - fsType = "zfs"; - }; - "/home" = { - device = "rpool/safe/home"; - fsType = "zfs"; - }; - "/nix" = { - device = "rpool/local/nix"; - fsType = "zfs"; - }; - "/boot" = { - device = "/dev/disk/by-uuid/2552-18F2"; - fsType = "vfat"; - }; + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/31bfd91b-bdba-47a9-81bf-c96e0adc88e3"; + fsType = "xfs"; }; + "/boot" = { + device = "/dev/disk/by-uuid/89A2-ED28"; + fsType = "vfat"; + }; + }; - swapDevices = [{ device = "/dev/disk/by-uuid/87ff4f68-cc00-494e-8eba-050469c3bf03"; }]; + swapDevices = + [ { device = "/dev/disk/by-uuid/96952382-7f56-46b5-8c84-1f0130f68b63"; } + ]; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; boot = { + supportedFilesystems = singleton "xfs"; + initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/8dd300d3-c432-47b6-8466-55682cd1c1a1"; loader = { systemd-boot.enable = true; efi.canTouchEfiVariables = true; }; - modprobe.modules = { - iwlwifi = { - options = { - wd_disable = 1; - }; - }; - }; }; hardware.displays = { @@ -78,9 +55,13 @@ networking = { hostId = "dddbb888"; useDHCP = false; - wireless.interfaces = singleton "wlp2s0"; + wireless = { + enable = true; + userControlled.enable = true; + interfaces = singleton "wlp3s0"; + }; interfaces = { - wlp2s0.ipv4.addresses = singleton { + wlp3s0.ipv4.addresses = singleton { inherit (config.network.addresses.private.nixos.ipv4) address; prefixLength = 24; }; @@ -104,12 +85,12 @@ listen.endpoints = [ "tcp://0.0.0.0:0" ]; }; firewall = { - public.interfaces = [ "enp1s0" "wlp2s0" ]; + public.interfaces = [ "enp1s0" "wlp3s0" ]; private.interfaces = singleton "yggdrasil"; }; }; - system.stateVersion = "20.09"; + system.stateVersion = "21.11"; }; } diff --git a/config/profiles/base/profiles.nix b/config/profiles/base/profiles.nix index 0a5c495a..83a55d37 100644 --- a/config/profiles/base/profiles.nix +++ b/config/profiles/base/profiles.nix @@ -9,6 +9,7 @@ with lib; vfio = mkEnableOption "VFIO"; shared = mkEnableOption "Shared System"; trusted = mkEnableOption "Trusted Submodule"; + light = mkEnableOption "Light mode"; cross = { enable = mkEnableOption "cross/emulated compilation"; aarch64 = mkOption { @@ -42,6 +43,7 @@ with lib; }; eeepc-1015pem = mkEnableOption "Asus Eee PC 1015PEM"; v330-14arr = mkEnableOption "Lenovo Ideapad v330-14ARR"; + x270 = mkEnableOption "Lenovo Thinkpad x270"; }; }; home-manager.users = mkOption { @@ -55,6 +57,7 @@ with lib; trusted = mkEnableOption "Trusted Submodule" // { default = meta.trusted ? secrets; }; + light = mkEnableOption "Light mode"; cross = { enable = mkEnableOption "cross/emulated compilation"; aarch64 = mkOption { @@ -88,6 +91,7 @@ with lib; }; eeepc-1015pem = mkEnableOption "Asus Eee PC 1015PEM"; v330-14arr = mkEnableOption "Lenovo Ideapad v330-14ARR"; + x270 = mkEnableOption "Lenovo Thinkpad x270"; }; }; config = { diff --git a/config/profiles/hardware/default.nix b/config/profiles/hardware/default.nix index e2fb66e6..7abe2551 100644 --- a/config/profiles/hardware/default.nix +++ b/config/profiles/hardware/default.nix @@ -26,6 +26,14 @@ wifi ]; }; + x270 = { + imports = [ + x270 + intel + laptop + wifi + ]; + }; eeepc-1015pem = { imports = [ eeepc-1015pem diff --git a/config/profiles/hardware/ryzen.nix b/config/profiles/hardware/ryzen.nix index b4992adb..064c1109 100644 --- a/config/profiles/hardware/ryzen.nix +++ b/config/profiles/hardware/ryzen.nix @@ -1,26 +1,45 @@ -{ config, pkgs, ... }: - +{ config, pkgs, lib, ... }: with lib; { /* This hardware profile corresponds to any machine which has an AMD Ryzen processor. */ -{ - deploy.profile.hardware.ryzen = true; - - boot = { - kernelModules = [ - "msr" - "ryzen_smu" - "kvm-amd" - ]; - kernelParams = [ "amd_iommu=on" ]; + options.home-manager.users = let + waybarExtend = { config, ... }: { + options = { + programs.waybar.settings = mkOption { + type = with types; listOf (submodule waybarExtend2); + }; + }; + }; + waybarExtend2 = { config, ... }: { + config = { + modules.temperature.hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp2_input"; + }; + }; + in mkOption { + type = types.attrsOf (types.submoduleWith { + modules = singleton waybarExtend; + }); }; - hardware.cpu.amd.updateMicrocode = true; + config = { + deploy.profile.hardware.ryzen = true; - environment.systemPackages = with pkgs; [ - lm_sensors - ryzen-smu-monitor_cpu - ryzen-monitor - ]; + boot = { + kernelModules = [ + "msr" + "ryzen_smu" + "kvm-amd" + ]; + kernelParams = [ "amd_iommu=on" ]; + }; + + hardware.cpu.amd.updateMicrocode = true; + + environment.systemPackages = with pkgs; [ + lm_sensors + ryzen-smu-monitor_cpu + ryzen-monitor + ]; + }; } diff --git a/config/profiles/hardware/x270.nix b/config/profiles/hardware/x270.nix new file mode 100644 index 00000000..4c4eb101 --- /dev/null +++ b/config/profiles/hardware/x270.nix @@ -0,0 +1,45 @@ +{ config, lib, ... }: with lib; + +/* + This hardware profile corresponds to the Lenovo Thinkpad x270. +*/ + +{ + options.home-manager.users = let + userTouchpadExtend = { config, nixos, ... }: { + wayland.windowManager.sway.config.input."2:7:SynPS/2_Synaptics_TouchPad" = { + dwt = "enabled"; + tap = "enabled"; + natural_scroll = "enabled"; + middle_emulation = "enabled"; + click_method = "clickfinger"; + }; + }; + waybarExtend = { config, ... }: { + options = { + programs.waybar.settings = mkOption { + type = with types; listOf (submodule waybarExtend2); + }; + }; + }; + waybarExtend2 = { config, ... }: { + config = { + modules.temperature.hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp2_input"; + }; + }; + in mkOption { + type = types.attrsOf (types.submoduleWith { + modules = [ userTouchpadExtend waybarExtend ]; + }); + }; + + config = { + deploy.profile.hardware.x270 = true; + + boot = { + initrd.availableKernelModules = + [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "sr_mod" "rtsx_usb_sdmmc" ]; + kernelModules = [ "kvm-intel" ]; + }; + }; +} diff --git a/config/profiles/light.nix b/config/profiles/light.nix new file mode 100644 index 00000000..75275ea4 --- /dev/null +++ b/config/profiles/light.nix @@ -0,0 +1,19 @@ +{ config, lib, ... }: with lib; { + options.home-manager.users = let + lightModeExtend = { config, nixos, ... }: { + gtk.iconTheme.name = mkForce "Papirus-Light"; + base16 = { + alias.default = "atelier.atelier-cave-light"; + defaultSchemeName = "atelier.atelier-cave-light"; + }; + }; + in mkOption { + type = types.attrsOf (types.submoduleWith { + modules = singleton lightModeExtend; + }); + }; + + config = { + deploy.profile.light = true; + }; +} diff --git a/config/users/kat/dev/emacs.nix b/config/users/kat/dev/emacs.nix index b1932ace..86a627ea 100644 --- a/config/users/kat/dev/emacs.nix +++ b/config/users/kat/dev/emacs.nix @@ -15,7 +15,7 @@ let }; }; in -optionalAttrs (builtins.getEnv "CI_PLATFORM" == "") { +optionalAttrs (builtins.getEnv "CI_PLATFORM" == "impure") { home.packages = [ doom-emacs pkgs.sqlite ]; home.file.".emacs.d/init.el".text = '' diff --git a/config/users/kat/gui/gtk.nix b/config/users/kat/gui/gtk.nix index a986fe6d..0c82172d 100644 --- a/config/users/kat/gui/gtk.nix +++ b/config/users/kat/gui/gtk.nix @@ -4,8 +4,8 @@ gtk = { enable = true; iconTheme = { - name = "Numix-Square"; - package = pkgs.numix-icon-theme-square; + name = "Papirus-Dark"; + package = pkgs.papirus-icon-theme; }; theme = { name = "Adementary-dark"; diff --git a/config/users/kat/sway/gammastep.nix b/config/users/kat/sway/gammastep.nix index ce3ba1c1..4a06b276 100644 --- a/config/users/kat/sway/gammastep.nix +++ b/config/users/kat/sway/gammastep.nix @@ -3,6 +3,7 @@ { services.gammastep = { enable = true; + tray = true; latitude = "51.5074"; longitude = "0.1278"; }; diff --git a/config/users/kat/sway/sway.nix b/config/users/kat/sway/sway.nix index 8d8301b7..27bf10b3 100644 --- a/config/users/kat/sway/sway.nix +++ b/config/users/kat/sway/sway.nix @@ -90,7 +90,8 @@ let lockCommand = config.programs.swaylock.script; in "Escape" = "mode default"; }; }; - bars = [{ command = "${pkgs.waybar}/bin/waybar"; }]; + # bars = [{ command = "${pkgs.waybar}/bin/waybar"; }]; + bars = []; input = { "*" = { diff --git a/config/users/kat/sway/waybar/default.nix b/config/users/kat/sway/waybar/default.nix index 925e4e20..cbbbf292 100644 --- a/config/users/kat/sway/waybar/default.nix +++ b/config/users/kat/sway/waybar/default.nix @@ -1,19 +1,24 @@ -{ config, lib, pkgs, kw, ... }: +{ config, lib, pkgs, kw, ... }: with lib; { xdg.configFile."waybar/style.css" = { inherit (kw.sassTemplate { name = "waybar-style"; src = ./waybar.sass; }) source; }; + systemd.user.services.waybar.Service.Environment = singleton "NOTMUCH_CONFIG=${config.home.sessionVariables.NOTMUCH_CONFIG}"; + programs.waybar = { enable = true; + systemd.enable = true; settings = [{ modules-left = [ "sway/workspaces" "sway/mode" "sway/window" ]; modules-center = [ "clock" "clock#s" "clock#arc" "clock#miku" "clock#hex" ]; modules-right = [ "pulseaudio" + "custom/mail" "cpu" "memory" "temperature" "battery" + "backlight" "network" "idle_inhibitor" "custom/konawall" @@ -30,6 +35,10 @@ icon-size = 12; spacing = 2; }; + backlight = { + format = "{icon} {percent}%"; + format-icons = ["" ""]; + }; "custom/gpg-status" = { format = "{}"; interval = 300; @@ -41,20 +50,26 @@ interval = "once"; return-type = "json"; exec = "${pkgs.waybar-konawall}/bin/konawall-status"; - exec-on-event = true; on-click = "${pkgs.waybar-konawall}/bin/konawall-toggle"; on-click-right = "systemctl --user restart konawall"; + signal = 8; + }; + "custom/mail" = { + format = " {}"; + interval = 30; + exec = "${pkgs.notmuch-arc}/bin/notmuch count tag:flagged OR tag:inbox AND NOT tag:killed"; }; cpu = { format = " {usage}%"; }; memory = { format = " {percentage}%"; }; temperature = { - format = " {temperatureC}°C"; - hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp2_input"; + format = "{icon} {temperatureC}°C"; + format-icons = ["" "" ""]; + critical-threshold = 80; }; idle_inhibitor = { format = "{icon}"; format-icons = { - activated = ""; + activated = ""; deactivated = ""; }; }; @@ -65,8 +80,8 @@ critical = 15; }; format = "{icon} {capacity}%"; - format-charging = " {capacity}%"; - format-plugged = " {capacity}%"; + format-charging = " {capacity}%"; + format-plugged = " {capacity}%"; format-alt = "{icon} {time}"; format-icons = [ "" "" "" "" "" ]; }; @@ -96,9 +111,6 @@ tooltip-format = "{:%A, %F %T %z (%Z)}"; timezones = [ "Europe/London" - "America/Vancouver" - "Europe/Berlin" - "Pacific/Auckland" ]; interval = 1; }; diff --git a/config/users/kat/sway/waybar/waybar.sass b/config/users/kat/sway/waybar/waybar.sass index a06da591..2c7de0a6 100644 --- a/config/users/kat/sway/waybar/waybar.sass +++ b/config/users/kat/sway/waybar/waybar.sass @@ -13,6 +13,12 @@ text-shadow: none box-shadow: none +tooltip + background: $base00t + border-radius: 1em + label + color: $base07 + #mode color: $base06 padding: 0 4px @@ -66,9 +72,9 @@ @extend %extend_1 background: $base0Ct -#custom-weather +#custom-mail @extend %extend_1 - background: $base00t + background: $base0Ft #custom-konawall @extend %extend_1 @@ -103,6 +109,8 @@ menu background: $base00t border-radius: 1em + color: $base07 + .modules-left margin: 2px 4px @@ -173,11 +181,5 @@ color: $base06 border-bottom: 2px solid transparent -tooltip - background: $base00t - border-radius: 1em - label - color: $base07 - window#waybar.empty #window opacity: 0 diff --git a/nix/sources.json b/nix/sources.json index 1325a14e..69b202f7 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -41,10 +41,10 @@ "homepage": "", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "aa581fc7bce89b3abc60124de8dcc3b7c7a9277c", - "sha256": "160v5hsswcvyai1hc6r0gs00z9gm30qgqlgy0sk1x8iwcqslx3wz", + "rev": "5fa26165cf34adbe693b159093ea15f24f7f7ea4", + "sha256": "137a51jmk2h9mrp959ds6n1gdgg7wmvwhjxjjd6njcs40k38rshj", "type": "tarball", - "url": "https://github.com/nix-community/emacs-overlay/archive/aa581fc7bce89b3abc60124de8dcc3b7c7a9277c.tar.gz", + "url": "https://github.com/nix-community/emacs-overlay/archive/5fa26165cf34adbe693b159093ea15f24f7f7ea4.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "hexchen": { @@ -89,10 +89,10 @@ "homepage": null, "owner": "kittywitch", "repo": "nixexprs", - "rev": "33418f835c61697569feb9d8753134f7c4143d5a", - "sha256": "023wma4xv5pshjfdvv9r67nbzwryh0m38vprnnf7ikl1g29a53wi", + "rev": "fc6a343976f4afa61850484ac2ace2202f7b9576", + "sha256": "0f1p8yqgbbp5jjkmsa1jbk78p1kr4x6slcx8bmzya65kcw9n2ajx", "type": "tarball", - "url": "https://github.com/kittywitch/nixexprs/archive/33418f835c61697569feb9d8753134f7c4143d5a.tar.gz", + "url": "https://github.com/kittywitch/nixexprs/archive/fc6a343976f4afa61850484ac2ace2202f7b9576.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "niv": { diff --git a/overlays/exprs b/overlays/exprs index 33418f83..fc6a3439 160000 --- a/overlays/exprs +++ b/overlays/exprs @@ -1 +1 @@ -Subproject commit 33418f835c61697569feb9d8753134f7c4143d5a +Subproject commit fc6a343976f4afa61850484ac2ace2202f7b9576