diff --git a/hosts/default.nix b/hosts/default.nix index 32730c4..69f0700 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -15,9 +15,9 @@ self.nixosModules.desktop-extended self.nixosModules.docker self.nixosModules.graphical - self.nixosModules.nextcloud self.nixosModules.office self.nixosModules.persistence + self.nixosModules.portable self.nixosModules.printing ]; }; @@ -33,8 +33,8 @@ self.nixosModules.desktop-extended self.nixosModules.docker self.nixosModules.graphical - self.nixosModules.nextcloud self.nixosModules.office + self.nixosModules.portable self.nixosModules.printing ]; }; @@ -51,7 +51,6 @@ self.nixosModules.docker self.nixosModules.gaming self.nixosModules.graphical - self.nixosModules.nextcloud self.nixosModules.office self.nixosModules.printing self.nixosModules.virtualisation diff --git a/modules/default.nix b/modules/default.nix index 30ec665..69a225d 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -18,9 +18,9 @@ graphical = import ./graphical; invoiceplane = import ./invoiceplane; nix = import ./nix; - nextcloud = import ./nextcloud; office = import ./office; persistence = import ./persistence; + portable = import ./portable; printing = import ./printing; terminal-life = import ./terminal-life; user = import ./user; diff --git a/modules/graphical/.config/mako/config b/modules/graphical/.config/mako/config deleted file mode 100644 index 73a16fa..0000000 --- a/modules/graphical/.config/mako/config +++ /dev/null @@ -1,22 +0,0 @@ -padding=10 -margin=5,5,0 -default-timeout=5000 - -## Base16 Burn -# Author: Benjamin Bädorf -# -# You can use these variables anywhere in the mako configuration file. - -background-color=#1a181a -text-color=#e3e1e4 -border-color=#ff5f5f - -[urgency=low] -background-color=#1a181a -text-color=#e3e1e4 -border-color=#ff5f5f - -[urgency=high] -background-color=#ff5f5f -text-color=#1a181a -border-color=#1a181a diff --git a/modules/graphical/.config/waybar/colorscheme.css b/modules/graphical/.config/waybar/colorscheme.css deleted file mode 100644 index 9cb06b3..0000000 --- a/modules/graphical/.config/waybar/colorscheme.css +++ /dev/null @@ -1,23 +0,0 @@ -/* -* -* Base16 Burn -* Author: Benjamin Bädorf -* -*/ - -@define-color base00 #1a181a; -@define-color base01 #2d2a2e; -@define-color base02 #303030; -@define-color base03 #949494; -@define-color base04 #d3d1d4; -@define-color base05 #e3e1e4; -@define-color base06 #303030; -@define-color base07 #ff5f5f; -@define-color base08 #f85e84; -@define-color base09 #df5923; -@define-color base0A #e5c463; -@define-color base0B #9ecd6f; -@define-color base0C #ef9062; -@define-color base0D #7accd7; -@define-color base0E #ab9df2; -@define-color base0F #d70000; diff --git a/modules/graphical/.config/waybar/config b/modules/graphical/.config/waybar/config deleted file mode 100644 index 5dead19..0000000 --- a/modules/graphical/.config/waybar/config +++ /dev/null @@ -1,116 +0,0 @@ -{ - "layer": "top", // Waybar at top layer - // "position": "bottom", // Waybar position (top|bottom|left|right) - - "height": 26, // Waybar height - "modules-left": ["sway/workspaces", "sway/mode"], - //"modules-center": ["mpd"], - "modules-right": ["sway/language", "pulseaudio", "network", "idle_inhibitor", "battery", "clock", "tray"], - "sway/workspaces": { - "disable-scroll": true - }, - "sway/mode": { - "tooltip": false, - "format": "{}" - }, - "sway/window": { - "tooltip": false, - "max-length": 96 - }, - "sway/language": { - "format": "{}", - "max-length": 50 - }, - "tray": { - "icon-size": 21, - "spacing": 10 - }, - "clock": { - "tooltip-format": "{calendar}", - "format-alt": "{:%a %d. %h %H:%M}", - //"on-scroll": { - // "calendar": 1 - //} - "calendar": { - "mode-mon-col" : 3, - "on-scroll": -1, - "on-click-right": "mode", - "format": { - "months": "{}", - "days": "{}", - "weekdays": "{}", - "today": "{}" - }, - }, - }, - "backlight": { - // "device": "acpi_video1", - "tooltip": true, - "tooltip-format": "Brightness: {percent}%", - "format": "{icon}", - "format-icons": ["", ""] - }, - "cpu": { - "format": "{}% " - }, - "memory": { - "format": "{}% " - }, - "idle_inhibitor": { - "format": "{icon} ", - "format-icons": { - "activated": "", - "deactivated": "" - } - }, - "battery": { - "tooltip": false, - "states": { - "critical": 25 - }, - "full-at": 84, - "format": "{icon} {capacity}%", - "format-full": "{icon}", - "format-icons": ["", "", "", "", ""], - }, - "network": { - "interval": 3, - "tooltip": true, - //"interface": "wlp4s0", // (Optional) To force the use of this interface   \uF2E7, - "format-wifi": " \uf062 {bandwidthUpBits} | \uf063 {bandwidthDownBits}", - "format-ethernet": " \uf062 {bandwidthUpBits} | \uf063 {bandwidthDownBits}", - "format-disconnected": "", - "tooltip-format-wifi": "{essid} ({signalStrength}%)  {ipaddr}", - "tooltip-format-ethernet": "{ifname}  {ipaddr}" - }, - //\ue04f{volume}% - "pulseaudio": { - "tooltip": false, - "format": "{volume}% {icon}", - "format-bluetooth": "{volume}% {icon}", - "format-muted": "", - "on-click": "pavucontrol", - "format-alt": "{volume}% {icon}", - "format-icons": { - "headphones": "", - "handsfree": "", - "headset": "", - "phone": "", - "portable": "", - "car": "", - "default": ["","", ""] - } - }, - "mpd": { - "format": "{artist} - {title} [{elapsedTime:%M:%S} / {totalTime:%M:%S}]", - "format-disconnected": "", - "format-stopped": "", - "interval": 1, - "state-icons": { - "paused": "", - "playing": "" - }, - "tooltip-format": "MPD (connected)", - "tooltip-format-disconnected": "MPD (disconnected)" - } -} diff --git a/modules/graphical/.config/waybar/style.css b/modules/graphical/.config/waybar/style.css index 31b2aab..1a6bb21 100644 --- a/modules/graphical/.config/waybar/style.css +++ b/modules/graphical/.config/waybar/style.css @@ -1,4 +1,19 @@ -@import "./colorscheme.css"; +@define-color base00 #1a181a; +@define-color base01 #2d2a2e; +@define-color base02 #303030; +@define-color base03 #949494; +@define-color base04 #d3d1d4; +@define-color base05 #e3e1e4; +@define-color base06 #303030; +@define-color base07 #ff5f5f; +@define-color base08 #f85e84; +@define-color base09 #df5923; +@define-color base0A #e5c463; +@define-color base0B #9ecd6f; +@define-color base0C #ef9062; +@define-color base0D #7accd7; +@define-color base0E #ab9df2; +@define-color base0F #d70000; * { min-height: 0; @@ -8,7 +23,7 @@ window#waybar { font-family: Hack, FontAwesome; font-weight: 500; - font-size: 14px; + font-size: 16px; background: rgba(11, 12, 13, 0.90); border-bottom: 1px solid rgba(0, 0, 2, 0.53); color: @base04; @@ -16,7 +31,7 @@ window#waybar { #workspaces button { - font-size: 14px; + font-size: 16px; box-shadow: none; text-shadow: none; padding: 0px 3px 0px 3px; @@ -36,18 +51,16 @@ window#waybar { } #clock, #backlight, #battery, #cpu, #memory, #network, #pulseaudio, #custom-spotify, #tray, #mode { - font-size: 14px; - margin: 0px 10px 0px 5px; + font-size: 16px; } #pulseaudio { /* border-top: 1px solid transparent; */ - font-size: 12px; - margin-left: 15px; + font-size: 16px; } #battery { - font-size: 12px; + font-size: 16px; } #battery.critical { @@ -65,13 +78,11 @@ window#waybar { border-top: 1px solid transparent; } #network.disconnected { - margin: 0px 0px 0px 0px; color: rgba(75, 81, 98, 0); } #pulseaudio.muted { - margin: 0px 0px 0px 0px; color: rgba(75, 81, 98, 0); } diff --git a/modules/graphical/default.nix b/modules/graphical/default.nix index ed8544b..ff38e00 100644 --- a/modules/graphical/default.nix +++ b/modules/graphical/default.nix @@ -19,6 +19,8 @@ with lib; let in { imports = [ ./sway + ./waybar.nix + ./mako.nix ]; options.pub-solar.graphical = { @@ -108,11 +110,7 @@ in { xdg.configFile."user-dirs.dirs".source = ./.config/user-dirs.dirs; xdg.configFile."user-dirs.locale".source = ./.config/user-dirs.locale; xdg.configFile."xsettingsd/xsettingsd.conf".source = ./.config/xsettingsd/xsettingsd.conf; - xdg.configFile."mako/config".source = ./.config/mako/config; xdg.configFile."libinput-gestures.conf".source = ./.config/libinput-gestures.conf; - xdg.configFile."waybar/config".source = ./.config/waybar/config; - xdg.configFile."waybar/style.css".source = ./.config/waybar/style.css; - xdg.configFile."waybar/colorscheme.css".source = ./.config/waybar/colorscheme.css; xdg.configFile."wallpaper.jpg".source = ./assets/wallpaper.jpg; gtk = { diff --git a/modules/graphical/mako.nix b/modules/graphical/mako.nix new file mode 100644 index 0000000..e569fed --- /dev/null +++ b/modules/graphical/mako.nix @@ -0,0 +1,32 @@ +{ + lib, + config, + pkgs, + ... +}: +with lib; let + psCfg = config.pub-solar; +in { + home-manager.users."${psCfg.user.name}" = { + services.mako = { + enable = true; + extraConfig = '' + padding=10 + margin=5,5,0 + default-timeout=5000 + + background-color=#1a181a + text-color=#e3e1e4 + border-color=#ff5f5f + font=Hack 14 + + [urgency=high] + background-color=#ff5f5f + text-color=#1a181a + border-color=#1a181a + layer=overlay + font=Hack 14 + ''; + }; + }; +} diff --git a/modules/graphical/sway/default.nix b/modules/graphical/sway/default.nix index b4c9384..7a5a336 100644 --- a/modules/graphical/sway/default.nix +++ b/modules/graphical/sway/default.nix @@ -51,9 +51,7 @@ in { sway grim kanshi - mako slurp - swayidle swaybg xwayland @@ -75,14 +73,8 @@ in { ]; home-manager.users."${psCfg.user.name}" = { - programs.waybar.enable = true; - #programs.waybar.systemd.enable = true; - - systemd.user.services.mako = import ./mako.service.nix {inherit pkgs psCfg;}; systemd.user.services.sway = import ./sway.service.nix {inherit pkgs psCfg;}; - systemd.user.services.swayidle = import ./swayidle.service.nix {inherit pkgs psCfg;}; systemd.user.services.xsettingsd = import ./xsettingsd.service.nix {inherit pkgs psCfg;}; - systemd.user.services.waybar = import ./waybar.service.nix {inherit pkgs psCfg;}; systemd.user.targets.sway-session = import ./sway-session.target.nix {inherit pkgs psCfg;}; xdg.configFile."sway/config".text = import ./config/config.nix {inherit config pkgs;}; @@ -93,6 +85,32 @@ in { xdg.configFile."sway/config.d/mode_system.conf".text = import ./config/config.d/mode_system.conf.nix {inherit pkgs psCfg;}; xdg.configFile."sway/config.d/applications.conf".source = ./config/config.d/applications.conf; xdg.configFile."sway/config.d/systemd.conf".source = ./config/config.d/systemd.conf; + + services.swayidle = with pkgs; { + enable = true; + events = [ + { + event = "before-sleep"; + command = "${systemd}/bin/systemctl hibernate"; + } + ]; + timeouts = [ + { + timeout = 120; + command = "${swaylock-bg}/bin/swaylock-bg"; + } + { + timeout = 130; + command = "${sway}/bin/swaymsg \"output * dpms off\""; + resumeCommand = "${sway}/bin/swaymsg \"output * dpms on\""; + } + { + timeout = 300; + command = "${systemd}/bin/systemctl hibernate"; + } + ]; + systemdTarget = "sway-session.target"; + }; }; }; } diff --git a/modules/graphical/sway/mako.service.nix b/modules/graphical/sway/mako.service.nix deleted file mode 100644 index 22524d3..0000000 --- a/modules/graphical/sway/mako.service.nix +++ /dev/null @@ -1,18 +0,0 @@ -{pkgs, ...}: { - Unit = { - Description = "Lightweight Wayland notification daemon"; - Documentation = ["man:mako(1)"]; - BindsTo = ["sway-session.target"]; - After = ["sway-session.target"]; - ConditionEnvironment = ["WAYLAND_DISPLAY"]; - }; - Service = { - Type = "dbus"; - BusName = "org.freedesktop.Notifications"; - ExecStart = "${pkgs.mako}/bin/mako"; - ExecReload = "${pkgs.mako}/bin/makoctl reload"; - }; - Install = { - WantedBy = ["sway-session.target"]; - }; -} diff --git a/modules/graphical/sway/swayidle.service.nix b/modules/graphical/sway/swayidle.service.nix deleted file mode 100644 index 99158e5..0000000 --- a/modules/graphical/sway/swayidle.service.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - pkgs, - psCfg, - ... -}: { - Unit = { - Description = "Idle manager for Wayland"; - Documentation = ["man:swayidle(1)"]; - BindsTo = ["graphical-session.target"]; - Wants = ["graphical-session-pre.target"]; - After = ["graphical-session-pre.target"]; - }; - Service = { - Type = "simple"; - Environment = "PATH=/run/current-system/sw/bin:${pkgs.sway}/bin:${pkgs.swayidle}/bin"; - ExecStart = with pkgs; '' - swayidle -w \ - before-sleep '${systemd}/bin/systemctl hibernate' \ - timeout 120 '${swaylock-bg}/bin/swaylock-bg' \ - timeout 130 '${sway}/bin/swaymsg "output * dpms off"' \ - resume '${sway}/bin/swaymsg "output * dpms on"' \ - timeout 300 '${systemd}/bin/systemctl hibernate' - ''; - }; - Install = { - WantedBy = ["sway-session.target"]; - }; -} diff --git a/modules/graphical/sway/waybar.service.nix b/modules/graphical/sway/waybar.service.nix deleted file mode 100644 index 4715fe8..0000000 --- a/modules/graphical/sway/waybar.service.nix +++ /dev/null @@ -1,21 +0,0 @@ -{pkgs, ...}: { - Unit = { - Description = "Highly customizable Wayland bar for Sway and Wlroots based compositors."; - Documentation = "https://github.com/Alexays/Waybar/wiki/"; - BindsTo = ["sway-session.target"]; - After = ["sway-session.target" "network-online.target"]; - Wants = ["graphical-session-pre.target" "network-online.target" "blueman-applet.service"]; - ConditionEnvironment = ["WAYLAND_DISPLAY"]; - }; - - Service = { - Type = "dbus"; - Environment = "PATH=${pkgs.bash}/bin:${pkgs.pavucontrol}/bin"; - BusName = "fr.arouillard.waybar"; - ExecStart = "${pkgs.waybar}/bin/waybar"; - }; - - Install = { - WantedBy = ["sway-session.target"]; - }; -} diff --git a/modules/graphical/waybar.nix b/modules/graphical/waybar.nix new file mode 100644 index 0000000..95ffc62 --- /dev/null +++ b/modules/graphical/waybar.nix @@ -0,0 +1,96 @@ +{ + lib, + config, + pkgs, + ... +}: +with lib; let + psCfg = config.pub-solar; +in { + home-manager.users."${psCfg.user.name}" = { + programs.waybar = { + enable = true; + settings.main = { + layer = "top"; + position = "top"; + + height = 32; + spacing = 12; + modules-left = ["sway/workspaces"]; + modules-center = ["sway/mode"]; + modules-right = ["network" "tray" "sway/language" "pulseaudio" "battery" "clock"]; + + "sway/workspaces".disable-scroll = true; + "sway/mode" = { + tooltip = false; + format = "{}"; + }; + "sway/window" = { + tooltip = false; + max-length = 96; + }; + "sway/language" = { + format = "{}"; + max-length = 2; + on-click = "${pkgs.toggle-kbd-layout}/bin/toggle-kbd-layout"; + }; + tray = { + icon-size = 16; + spacing = 12; + }; + clock = { + tooltip-format = "{calendar}"; + format-alt = "{:%a %d. %h %H:%M}"; + calendar = { + mode-mon-col = "3"; + on-scroll = "-1"; + on-click-right = "mode"; + format = { + months = "{}"; + days = "{}"; + weekdays = "{}"; + today = "{}"; + }; + }; + }; + battery = { + tooltip = false; + states = { + critical = 25; + }; + full-at = 90; + format = "{icon} {capacity}%"; + format-icons = ["" "" "" "" ""]; + }; + network = { + interval = 3; + tooltip = true; + format-wifi = "{bandwidthUpBits} up | {bandwidthDownBits} down"; + format-ethernet = "{bandwidthUpBits} up | {bandwidthDownBits} down"; + format-disconnected = "no network"; + tooltip-format-wifi = "{essid} ({signalStrength}%)  {ipaddr}"; + tooltip-format-ethernet = "{ifname}  {ipaddr}"; + }; + pulseaudio = { + tooltip = false; + format = "{icon} {volume}%"; + format-bluetooth = "{icon} {volume}%"; + format-muted = "{icon}x"; + on-click = "pavucontrol"; + format-icons = { + headphones = ""; + handsfree = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = ["" "" ""]; + }; + }; + }; + style = builtins.readFile ./.config/waybar/style.css; + systemd.enable = true; + systemd.target = "sway-session.target"; + }; + }; +} diff --git a/modules/nextcloud/default.nix b/modules/nextcloud/default.nix deleted file mode 100644 index 09fb840..0000000 --- a/modules/nextcloud/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: -with lib; let - psCfg = config.pub-solar; -in { - home-manager.users."${psCfg.user.name}" = { - systemd.user.services.nextcloud-client = import ./nextcloud.service.nix pkgs; - }; -} diff --git a/modules/nextcloud/nextcloud.service.nix b/modules/nextcloud/nextcloud.service.nix deleted file mode 100644 index f326797..0000000 --- a/modules/nextcloud/nextcloud.service.nix +++ /dev/null @@ -1,20 +0,0 @@ -pkgs: { - Unit = { - Description = "Nextcloud Client"; - BindsTo = ["sway-session.target"]; - Wants = ["graphical-session-pre.target"]; - After = ["graphical-session-pre.target"]; - # ConditionEnvironment requires systemd v247 to work correctly - ConditionEnvironment = ["WAYLAND_DISPLAY"]; - }; - Service = { - Type = "simple"; - ExecStart = "${pkgs.nextcloud-client}/bin/nextcloud --background"; - ExecReload = "/run/current-system/sw/bin/kill -HUP $MAINPID"; - KillMode = "process"; - Restart = "on-failure"; - }; - Install = { - WantedBy = ["sway-session.target"]; - }; -} diff --git a/modules/portable/default.nix b/modules/portable/default.nix new file mode 100644 index 0000000..0bd0bb9 --- /dev/null +++ b/modules/portable/default.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + services.cron = { + enable = true; + systemCronJobs = [ + "*/5 * * * * root ${pkgs.check-battery}/bin/check-battery" + ]; + }; +} diff --git a/pkgs/check-battery.nix b/pkgs/check-battery.nix new file mode 100644 index 0000000..5bccdf6 --- /dev/null +++ b/pkgs/check-battery.nix @@ -0,0 +1,12 @@ +self: +with self; '' +status=$(cat /sys/class/power_supply/BAT0/status) +if [ $status != "Discharging" ]; then + exit 0 +fi + +capacity=$(cat /sys/class/power_supply/BAT0/capacity) +if [ $capacity -lt 15 ]; then + ${libnotify}/bin/notify-send -u critical "Battery ''${capacity}%" +fi +'' diff --git a/pkgs/default.nix b/pkgs/default.nix index 4ef1df7..3b7ea5c 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -4,6 +4,7 @@ with prev; { sources = callPackage (import ./_sources/generated.nix) {}; # then, call packages with `final.callPackage` # caddy = callPackage (import ./caddy) {}; + check-battery = writeShellScriptBin "check-battery" (import ./check-battery.nix final); concourse = import ./concourse.nix final; fetch-hostingde-invoices = import ./fetch-hostingde-invoices final; import-gtk-settings = writeShellScriptBin "import-gtk-settings" (import ./import-gtk-settings.nix final); diff --git a/users/b12f/home.nix b/users/b12f/home.nix index df61763..f6013c3 100644 --- a/users/b12f/home.nix +++ b/users/b12f/home.nix @@ -11,11 +11,14 @@ with lib; let in { home-manager.users."${psCfg.user.name}" = { home.packages = [ - pkgs.zoom-us + # pkgs.zoom-us ]; programs.bash.initExtra = '' source ${config.age.secrets.b12f-env-secrets.path} ''; + + services.nextcloud-client.enable = true; + services.nextcloud-client.startInBackground = true; }; }