diff --git a/flake.nix b/flake.nix index 912922a..e03b26c 100644 --- a/flake.nix +++ b/flake.nix @@ -39,7 +39,6 @@ extraSpecialArgs = { inherit pkgs-unstable; - variant = "allegro"; }; modules = [ @@ -49,6 +48,10 @@ { targets.genericLinux.enable = true; } { home.packages = [ inputs.st-flexipatch.packages.${system}.st ]; } ./home/syncthing.nix + ./home/allegro.nix + + ./home/ui.nix + ./home/gui-software.nix ]; }; @@ -57,7 +60,6 @@ extraSpecialArgs = { inherit pkgs-unstable; - variant = "hs"; }; modules = [ @@ -71,7 +73,6 @@ extraSpecialArgs = { inherit pkgs-unstable; - variant = "hs"; }; modules = [ @@ -85,7 +86,6 @@ extraSpecialArgs = { inherit pkgs-unstable; - variant = "default"; inherit inputs; }; @@ -94,6 +94,12 @@ ./home/base.nix { home.packages = [ inputs.st-flexipatch.packages.${system}.st ]; } ./home/syncthing.nix + ./home/basado.nix + + ./home/ui.nix + ./home/gui-software.nix + ./home/gaming.nix + { services.kdeconnect.enable = true; } ]; }; @@ -102,7 +108,6 @@ extraSpecialArgs = { inherit pkgs-unstable; - variant = "moon"; inherit inputs; }; @@ -111,6 +116,11 @@ ./home/base.nix { home.packages = [ inputs.st-flexipatch.packages.${system}.st ]; } ./home/syncthing.nix + ./home/moon.nix + + ./home/ui.nix + ./home/gui-software.nix + { services.kdeconnect.enable = true; } ]; }; diff --git a/home/additional-software.nix b/home/additional-software.nix deleted file mode 100644 index baea2af..0000000 --- a/home/additional-software.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ lib, config, pkgs, variant, ... }: { - config = { - home.packages = - if variant == "default" then - with pkgs; [ - qbittorrent - pipewire - discord - feather # monero wallet - # litecoin - librewolf - spotify - ungoogled-chromium - immich-cli - vesktop - ] - else if variant == "allegro" then - with pkgs; [ - aria2 - pipewire - teams-for-linux - ] - else []; - }; -} diff --git a/home/allegro.nix b/home/allegro.nix new file mode 100644 index 0000000..34f0bda --- /dev/null +++ b/home/allegro.nix @@ -0,0 +1,115 @@ +{ config, lib, pkgs, ... }: { + programs.fish = { + loginShellInit = '' + source ${pkgs.nix}/etc/profile.d/nix.fish + if test $(tty) = /dev/tty2 + nixGLIntel Hyprland + end + ''; + }; + + xdg = { + configFile."systemd/user/dbus-broker.service".source = + "${pkgs.dbus-broker}/share/systemd/user/dbus-broker.service"; + configFile."systemd/user/at-spi-dbus-bus.service".source = + "${pkgs.at-spi2-core}/lib/systemd/user/at-spi-dbus-bus.service"; + dataFile."dbus-1/services/org.a11y.Bus.service".source = + "${pkgs.at-spi2-core}/share/dbus-1/services/org.a11y.Bus.service"; + dataFile."dbus-1/accessibility-services/org.a11y.atspi.Registry.service".source = + "${pkgs.at-spi2-core}/share/dbus-1/accessibility-services/org.a11y.atspi.Registry.service"; + + configFile."systemd/user/xdg-desktop-portal.service".source = + "${pkgs.xdg-desktop-portal}/lib/systemd/user/xdg-desktop-portal.service"; + configFile."systemd/user/xdg-desktop-portal-gtk.service".source = + "${pkgs.xdg-desktop-portal-gtk}/lib/systemd/user/xdg-desktop-portal-gtk.service"; + configFile."systemd/user/xdg-desktop-portal-hyprland.service".source = + "${pkgs.xdg-desktop-portal-hyprland}/lib/systemd/user/xdg-desktop-portal-hyprland.service"; + dataFile."share/dbus-1/services/org.freedesktop.impl.portal.desktop.hyprland.service".source = + "${pkgs.xdg-desktop-portal-hyprland}share/dbus-1/services/org.freedesktop.impl.portal.desktop.hyprland.service"; + dataFile."systemd/user/pipewire.service".source = + "${pkgs.pipewire}/share/systemd/user/pipewire.service"; + dataFile."systemd/user/pipewire-pulse.service".source = + "${pkgs.pipewire}/share/systemd/user/pipewire-pulse.service"; + dataFile."systemd/user/filter-chain.service".source = + "${pkgs.pipewire}/share/systemd/user/filter-chain.service"; + + dataFile."systemd/user/pipewire.socket".source = + "${pkgs.pipewire}/share/systemd/user/pipewire.socket"; + dataFile."systemd/user/pipewire-pulse.socket".source = + "${pkgs.pipewire}/share/systemd/user/pipewire-pulse.socket"; + + portal = { + enable = true; + + # xdgOpenUsePortal = true; + extraPortals = + [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-hyprland ]; + configPackages = + [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-hyprland ]; + # config.common.default = "*"; + config = { + hyprland = { default = [ "gtk,hyprland" ]; }; + common = { default = [ "gtk,hyprland" ]; }; + }; + }; + }; + + wayland.windowManager.hyprland = { + extraConfig = '' + monitor= DP-4, 1920x1200@75, 3840x0, 1 + monitor= DP-3, 1920x1200@75, 1920x0, 1 + monitor=eDP-1, 1920x1080, 0x0, 1 + monitor=HDMI-1, 3440x1440, auto, 1 + monitor=HDMI-A-1, 3440x1440, auto, 1 + # monitor=HDMI-1, 1920x1080, auto, 1, mirror, eDP-1 + # monitor=HDMI-A-1, 1920x1080, auto, 1, mirror, eDP-1 + + env = WLR_DRM_DEVICES,/dev/dri/card0 + env = AQ_WLR_DEVICES,/dev/dri/card0 + env = AQ_DRM_DEVICES,/dev/dri/card0 + env = TERMINAL,st + + env = NIXOS_OZONE_WL,1 + env = GDK_BACKEND,wayland,x11 + env = QT_QPA_PLATFORM,wayland;xcb + env = CLUTTER_BACKEND,wayland + env = XDG_CURRENT_DESKTOP,Hyprland + env = XDG_SESSION_TYPE,wayland + env = XDG_SESSION_DESKTOP,Hyprland + env = QT_AUTO_SCREEN_SCALE_FACTOR,1 + env = WLR_NO_HARDWARE_CURSORS,1 + env = XCURSOR_SIZE,24 + ''; + }; + + programs.waybar.settings.bar = { + "group/disks".modules = [ + "disk#home" + ]; + + "disk#home" = { + interval = 1; + format = "󰋊 {free}"; + path = "/home/${config.home.username}"; + "on-click" = "$TERMINAL -c floating -e ${pkgs.ncdu}/bin/ncdu -x /home/${config.home.username}"; + }; + }; + + + home.file = { + ".bin/shutdown".source = pkgs.writeShellScript "usr_sbin_shutdown" "/usr/sbin/shutdown $@"; + ".bin/reboot".source = pkgs.writeShellScript "usr_sbin_reboot" "/usr/sbin/reboot $@"; + }; + + home.packages = with pkgs; [ + aria2 + pipewire + ]; + + home.sessionVariables = { + TMPDIR = "/home/${config.home.username}/tmp"; + GSETTINGS_SCHEMA_DIR = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas-47.1/glib-2.0/schemas"; + }; + + swaylock-bin = "/usr/bin/swaylock"; +} diff --git a/home/bar.nix b/home/bar.nix index fc9f82f..1c1bae6 100644 --- a/home/bar.nix +++ b/home/bar.nix @@ -1,4 +1,4 @@ -{ lib, config, pkgs, variant, ... }: { +{ lib, config, pkgs, ... }: { home.packages = with pkgs; [ material-design-icons @@ -71,15 +71,8 @@ "group/disks" = { orientation = "inherit"; modules = [ - "disk" # / - ] - ++ - (if (variant == "default") then [ - "disk#2" - "disk#3" - ] else if (variant == "allegro") then [ - "disk#home" - ] else []); + "disk" + ]; }; backlight = { @@ -130,27 +123,6 @@ }; - "disk#2" = lib.attrsets.optionalAttrs (variant == "default") { - interval = 1; - format = "󰋊 {free}"; - path = "/home/ant/disk1"; - "on-click" = "$TERMINAL -c floating -e ${pkgs.ncdu}/bin/ncdu -x /home/${username}/disk1"; - }; - - "disk#3" = lib.attrsets.optionalAttrs (variant == "default") { - interval = 1; - format = "󰋊 {free}"; - path = "/home/ant/disk2"; - "on-click" = "$TERMINAL -c floating -e ${pkgs.ncdu}/bin/ncdu -x /home/${username}/disk2"; - }; - - "disk#home" = lib.attrsets.optionalAttrs (variant == "allegro") { - interval = 1; - format = "󰋊 {free}"; - path = "/home/${username}"; - "on-click" = "$TERMINAL -c floating -e ${pkgs.ncdu}/bin/ncdu -x /home/${username}"; - }; - memory = { interval = 1; format = "󰧑 {percentage:2}%"; @@ -279,12 +251,6 @@ "scroll-step" = 5; }; - "custom/loopback" = lib.attrsets.optionalAttrs (variant == "default") { - exec = "journalctl --user -f -u loopback | exec_on_stdin_newline 'if systemctl --user is-active --quiet loopback; then echo loopback ON; else echo loopback; fi'"; - on-click = "if systemctl --user is-active --quiet loopback; then systemctl --user stop loopback; else systemctl --user start loopback; fi"; - format = "{}"; - }; - "hyprland/submap" = { format = "(l)ock, (d)pms, (e)xit, (s)uspend, (h)ibernate, (r)eboot, (S)hutdown"; }; diff --git a/home/basado.nix b/home/basado.nix new file mode 100644 index 0000000..4da42df --- /dev/null +++ b/home/basado.nix @@ -0,0 +1,47 @@ +{ config, lib, pkgs, ... }: { + wayland.windowManager.hyprland = { + extraConfig = '' + monitor=,highrr,auto,1 + ''; + }; + + home.packages = with pkgs; [ + qbittorrent + pipewire + discord + feather # monero wallet + # litecoin + librewolf + spotify + ungoogled-chromium + immich-cli + vesktop + ]; + + programs.waybar.settings.bar = { + "group/disks".modules = [ + "disk#2" + "disk#3" + ]; + + "disk#2" = { + interval = 1; + format = "󰋊 {free}"; + path = "/home/${config.home.username}/disk1"; + "on-click" = "$TERMINAL -c floating -e ${pkgs.ncdu}/bin/ncdu -x /home/${config.home.username}/disk1"; + }; + + "disk#3" = { + interval = 1; + format = "󰋊 {free}"; + path = "/home/${config.home.username}/disk2"; + "on-click" = "$TERMINAL -c floating -e ${pkgs.ncdu}/bin/ncdu -x /home/${config.home.username}/disk2"; + }; + + "custom/loopback" = { + exec = "journalctl --user -f -u loopback | exec_on_stdin_newline 'if systemctl --user is-active --quiet loopback; then echo loopback ON; else echo loopback; fi'"; + on-click = "if systemctl --user is-active --quiet loopback; then systemctl --user stop loopback; else systemctl --user start loopback; fi"; + format = "{}"; + }; + }; +} diff --git a/home/base.nix b/home/base.nix index fde5b09..292c3fe 100644 --- a/home/base.nix +++ b/home/base.nix @@ -1,18 +1,11 @@ -{ inputs, config, lib, pkgs, variant, ... }: +{ inputs, config, lib, pkgs, ... }: { imports = [ ./lf.nix ./fish.nix ./terminal-software.nix - ] ++ (if variant != "hs" then - [ - ./ui.nix - ./gui-software.nix - ./gaming.nix - ./additional-software.nix - ] - else []); + ]; # Home Manager needs a bit of information about you and the paths it should # manage. @@ -56,12 +49,8 @@ home.sessionVariables = { GOPATH = "${config.home.homeDirectory}/.local/share/go"; GOMODCACHE = "${config.home.homeDirectory}/.cache/go/pkg/mod"; - CCACHE_MAXSIZE = "100Gi"; - } // (if variant == "allegro" then { - TMPDIR = "/home/${config.home.username}/tmp"; - GSETTINGS_SCHEMA_DIR = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas-47.1/glib-2.0/schemas"; - } else {}); + }; home.keyboard.options = [ "caps:escape" diff --git a/home/fish.nix b/home/fish.nix index 86207d4..137ce46 100644 --- a/home/fish.nix +++ b/home/fish.nix @@ -1,16 +1,10 @@ -{ lib, pkgs, variant, ... }: +{ lib, pkgs, ... }: { programs.fish = { enable = true; loginShellInit = '' set -gx fish_greeting - '' + - (if variant == "allegro" then '' - source ${pkgs.nix}/etc/profile.d/nix.fish - if test $(tty) = /dev/tty2 - nixGLIntel Hyprland - end - '' else ""); + ''; interactiveShellInit = '' set -gx fish_greeting @@ -118,8 +112,6 @@ gdb_asan = "gdb -tui -ex='break __asan::ReportGenericError'"; gdb_ubsan = "gdb -tui -ex='break __ubsan::ScopedReport::~ScopedReport'"; gdb_msan = "gdb -tui -ex='break __sanitizer::Die'"; - } // lib.attrsets.optionalAttrs (variant == "allegro") { - d = "./run_in_container.sh docker/ci.Dockerfile.signature"; }; plugins = [ diff --git a/home/gaming.nix b/home/gaming.nix index 143cc9a..965e954 100644 --- a/home/gaming.nix +++ b/home/gaming.nix @@ -1,13 +1,12 @@ -{ lib, config, pkgs, variant, ... }: { +{ lib, config, pkgs, ... }: { nixpkgs.config = { allowUnfree = true; }; - home.packages = if variant == "default" then with pkgs; [ + home.packages = with pkgs; [ lutris prismlauncher gamemode mangohud heroic steam - ] - else []; + ]; } diff --git a/home/gui-software.nix b/home/gui-software.nix index 5f0796f..d8d07bb 100644 --- a/home/gui-software.nix +++ b/home/gui-software.nix @@ -1,13 +1,13 @@ -{ lib, config, variant, pkgs, pkgs-unstable, ... }: +{ lib, config, pkgs, pkgs-unstable, ... }: { - home.packages = (with pkgs; [ + home.packages = with pkgs; [ nsxiv libreoffice keepassxc thunderbird vieb gimp - ]) ++ (if variant != "allegro" then [ pkgs.warpinator ] else []); + ]; programs.mpv = { enable = true; diff --git a/home/hyprland.nix b/home/hyprland.nix index f3d0481..e5df864 100644 --- a/home/hyprland.nix +++ b/home/hyprland.nix @@ -1,50 +1,4 @@ -{ config, lib, pkgs, pkgs-unstable, pkgs-24_05, variant, ... }: { - xdg = lib.attrsets.optionalAttrs (variant == "allegro") { - configFile."systemd/user/dbus-broker.service".source = - "${pkgs.dbus-broker}/share/systemd/user/dbus-broker.service"; - configFile."systemd/user/at-spi-dbus-bus.service".source = - "${pkgs.at-spi2-core}/lib/systemd/user/at-spi-dbus-bus.service"; - dataFile."dbus-1/services/org.a11y.Bus.service".source = - "${pkgs.at-spi2-core}/share/dbus-1/services/org.a11y.Bus.service"; - dataFile."dbus-1/accessibility-services/org.a11y.atspi.Registry.service".source = - "${pkgs.at-spi2-core}/share/dbus-1/accessibility-services/org.a11y.atspi.Registry.service"; - - configFile."systemd/user/xdg-desktop-portal.service".source = - "${pkgs.xdg-desktop-portal}/lib/systemd/user/xdg-desktop-portal.service"; - configFile."systemd/user/xdg-desktop-portal-gtk.service".source = - "${pkgs.xdg-desktop-portal-gtk}/lib/systemd/user/xdg-desktop-portal-gtk.service"; - configFile."systemd/user/xdg-desktop-portal-hyprland.service".source = - "${pkgs.xdg-desktop-portal-hyprland}/lib/systemd/user/xdg-desktop-portal-hyprland.service"; - dataFile."share/dbus-1/services/org.freedesktop.impl.portal.desktop.hyprland.service".source = - "${pkgs.xdg-desktop-portal-hyprland}share/dbus-1/services/org.freedesktop.impl.portal.desktop.hyprland.service"; - dataFile."systemd/user/pipewire.service".source = - "${pkgs.pipewire}/share/systemd/user/pipewire.service"; - dataFile."systemd/user/pipewire-pulse.service".source = - "${pkgs.pipewire}/share/systemd/user/pipewire-pulse.service"; - dataFile."systemd/user/filter-chain.service".source = - "${pkgs.pipewire}/share/systemd/user/filter-chain.service"; - - dataFile."systemd/user/pipewire.socket".source = - "${pkgs.pipewire}/share/systemd/user/pipewire.socket"; - dataFile."systemd/user/pipewire-pulse.socket".source = - "${pkgs.pipewire}/share/systemd/user/pipewire-pulse.socket"; - - portal = { - enable = true; - - # xdgOpenUsePortal = true; - extraPortals = - [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-hyprland ]; - configPackages = - [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-hyprland ]; - # config.common.default = "*"; - config = { - hyprland = { default = [ "gtk,hyprland" ]; }; - common = { default = [ "gtk,hyprland" ]; }; - }; - }; - }; - +{ config, lib, pkgs, ... }: { home.sessionVariables = { NIXOS_OZONE_WL = "1"; GDK_BACKEND = "wayland,x11"; @@ -342,57 +296,8 @@ # -p pkgs.rubyPackages.gdk_pixbuf2 \ # --run "${pkgs.swaybg}/bin/swaybg -m fill -i $bg" ''); - monitors = if (variant == "default") then '' - monitor=,highrr,auto,1 - '' - else if variant == "moon" then '' - monitor=,preferred,auto,1 - monitor=HDMI-1, 1920x1080, auto, 1, mirror, eDP-1 - monitor=HDMI-A-1, 1920x1080, auto, 1, mirror, eDP-1 - '' - else if variant == "allegro" then '' - monitor= DP-4, 1920x1200@75, 3840x0, 1 - monitor= DP-3, 1920x1200@75, 1920x0, 1 - monitor=eDP-1, 1920x1080, 0x0, 1 - monitor=HDMI-1, 3440x1440, auto, 1 - monitor=HDMI-A-1, 3440x1440, auto, 1 - # monitor=HDMI-1, 1920x1080, auto, 1, mirror, eDP-1 - # monitor=HDMI-A-1, 1920x1080, auto, 1, mirror, eDP-1 - '' - else '' - ''; in '' - ${monitors} - - ${ # system specific configs - if variant == "default" then '' - #env = GBM_BACKEND,nvidia-drm - #env = __GLX_VENDOR_LIBRARY_NAME,nvidia - # env = WLR_DRM_DEVICES,/dev/dri/card1 - # env = AQ_WLR_DEVICES,/dev/dri/card1 - # env = AQ_DRM_DEVICES,/dev/dri/card1 - '' - else if variant == "allegro" then '' - env = WLR_DRM_DEVICES,/dev/dri/card0 - env = AQ_WLR_DEVICES,/dev/dri/card0 - env = AQ_DRM_DEVICES,/dev/dri/card0 - env = TERMINAL,st - - env = NIXOS_OZONE_WL,1 - env = GDK_BACKEND,wayland,x11 - env = QT_QPA_PLATFORM,wayland;xcb - env = CLUTTER_BACKEND,wayland - env = XDG_CURRENT_DESKTOP,Hyprland - env = XDG_SESSION_TYPE,wayland - env = XDG_SESSION_DESKTOP,Hyprland - env = QT_AUTO_SCREEN_SCALE_FACTOR,1 - env = WLR_NO_HARDWARE_CURSORS,1 - env = XCURSOR_SIZE,24 - '' else '' - '' - } - env = HYPRCURSOR_THEME,Hackneyed env = HYPRCURSOR_SIZE,24 @@ -425,7 +330,7 @@ bind = ,s, exec, systemctl suspend bind = ,s, submap, reset - bind = SHIFT,S,exec, ${if variant == "allegro" then "/usr/sbin/shutdown" else "shutdown"} now + bind = SHIFT,S,exec, shutdown now bind = ,S, submap, reset bind = ,h, exec, systemctl hibernate @@ -434,7 +339,7 @@ bind = ,e, exit bind = ,e, submap, reset - bind = ,r, exec, ${if variant == "allegro" then "/usr/sbin/reboot" else "reboot"} + bind = ,r, exec, reboot bind = ,r, submap, reset bind = ,l, exec, swaylock diff --git a/home/moon.nix b/home/moon.nix new file mode 100644 index 0000000..21c6922 --- /dev/null +++ b/home/moon.nix @@ -0,0 +1,9 @@ +{ config, lib, pkgs, ... }: { + wayland.windowManager.hyprland = { + extraConfig = '' + monitor=,preferred,auto,1 + monitor=HDMI-1, 1920x1080, auto, 1, mirror, eDP-1 + monitor=HDMI-A-1, 1920x1080, auto, 1, mirror, eDP-1 + ''; + }; +} diff --git a/home/terminal-software.nix b/home/terminal-software.nix index d81f156..2b91256 100644 --- a/home/terminal-software.nix +++ b/home/terminal-software.nix @@ -1,4 +1,4 @@ -{ lib, config, pkgs, variant, pkgs-unstable, ... }: { +{ lib, config, pkgs, pkgs-unstable, ... }: { home.packages = with pkgs; [ entr trash-cli @@ -21,7 +21,7 @@ viAlias = true; defaultEditor = true; package = pkgs-unstable.neovim-unwrapped; - extraPackages = (with pkgs; [ + extraPackages = with pkgs; [ nodejs_24 ocamlPackages.lsp ocamlPackages.ocamlformat @@ -33,7 +33,8 @@ ocamlPackages.ocaml-lsp pyright ripgrep - ]) ++ (if variant != "allegro" then [ pkgs.gcc ] else [] ); + gcc + ]; }; xdg.mimeApps.defaultApplications = { "text/plain" = "nvim.desktop"; }; diff --git a/home/ui.nix b/home/ui.nix index 0463cc4..0560f9b 100644 --- a/home/ui.nix +++ b/home/ui.nix @@ -1,4 +1,4 @@ -{ lib, config, pkgs, variant, ... }: +{ lib, config, options, pkgs, ... }: let defaultTerminal = "st"; alacrittyLightTheme = "${pkgs.alacritty-theme}/night_owlish_light.toml"; @@ -11,422 +11,423 @@ in ./gui-software.nix ]; - home.file = { - ".config/kitty/light.conf".source = dotfiles/kitty/light.conf; - ".config/kitty/dark.conf".source = dotfiles/kitty/dark.conf; + options = { + swaylock-bin = lib.mkOption { + default = "${config.programs.swaylock.package}/bin/swaylock"; + }; + }; - ".config/rofi/colors-dark.rasi".source = dotfiles/rofi/colors-dark.rasi; - ".config/rofi/colors-light.rasi".source = dotfiles/rofi/colors-light.rasi; - ".config/rofi/theme.rasi".source = dotfiles/rofi/theme.rasi; + config = { + home.file = { + ".config/kitty/light.conf".source = dotfiles/kitty/light.conf; + ".config/kitty/dark.conf".source = dotfiles/kitty/dark.conf; - ".config/keepmenu/config.ini".source = dotfiles/keepmenu.ini; + ".config/rofi/colors-dark.rasi".source = dotfiles/rofi/colors-dark.rasi; + ".config/rofi/colors-light.rasi".source = dotfiles/rofi/colors-light.rasi; + ".config/rofi/theme.rasi".source = dotfiles/rofi/theme.rasi; - ".bin/runmenu".source = pkgs.writers.writeBash "runmenu" '' - ${config.programs.rofi.package}/bin/rofi -matching normal -sort -show run - ''; + ".config/keepmenu/config.ini".source = dotfiles/keepmenu.ini; - ".bin/notifications".source = bin/notifications; - - ".bin/window_dir".source = pkgs.writers.writeBash "window_dir" '' - PID=$(${pkgs.hyprland}/bin/hyprctl activewindow | grep pid | cut -d' ' -f 2) - PID=$(echo $(ps --ppid $PID -o pid | tail -n1)) - cwd=$(readlink /proc/"$PID"/cwd) - echo "$cwd" - ''; - - ".bin/exec_on_stdin_newline".source = pkgs.writers.writePython3 "exec_on_stdin_newline" {} '' - # run command whjen a newline is added to stdin - import subprocess - from sys import stdin, argv - cmd = argv[1:] - subprocess.call(cmd, shell=True) - while stdin.readline(): - subprocess.call(cmd, shell=True) + ".bin/runmenu".source = pkgs.writers.writeBash "runmenu" '' + ${config.programs.rofi.package}/bin/rofi -matching normal -sort -show run ''; - ".bin/screenshot".source = (import ./bin/screenshot.nix) pkgs; + ".bin/notifications".source = bin/notifications; - ".bin/ocrzone".source = pkgs.writers.writeBash "ocrzone" '' - ${pkgs.pkgs.sway-contrib.grimshot}/bin/grimshot save area - | \ - ${pkgs.tesseract}/bin/tesseract -l fra - - | \ - ${pkgs.wl-clipboard}/bin/wl-copy - ''; + ".bin/window_dir".source = pkgs.writers.writeBash "window_dir" '' + PID=$(${pkgs.hyprland}/bin/hyprctl activewindow | grep pid | cut -d' ' -f 2) + PID=$(echo $(ps --ppid $PID -o pid | tail -n1)) + cwd=$(readlink /proc/"$PID"/cwd) + echo "$cwd" + ''; - ".bin/wifi-toggle".source = pkgs.writers.writeBash "wifi-toggle" '' - if [[ $(nmcli radio wifi) == "enabled" ]]; then - nmcli radio wifi off - else - nmcli radio wifi on - fi - ''; + ".bin/exec_on_stdin_newline".source = pkgs.writers.writePython3 "exec_on_stdin_newline" {} '' + # run command whjen a newline is added to stdin + import subprocess + from sys import stdin, argv + cmd = argv[1:] + subprocess.call(cmd, shell=True) + while stdin.readline(): + subprocess.call(cmd, shell=True) + ''; - ".bin/rofi-udisk".source = pkgs.writers.writeBash "rofi-udisk" '' - device=$(${pkgs.udiskie}/bin/udiskie-info -a -o "{ui_label} {in_use}" -f is_filesystem | \ - ${pkgs.gnused}/bin/sed 's/True$/[Mounted]/' | \ - ${pkgs.gnused}/bin/sed 's/False$//' | \ - ${config.programs.rofi.package}/bin/rofi -dmenu | \ - ${pkgs.coreutils}/bin/cut -d':' -f1) + ".bin/screenshot".source = (import ./bin/screenshot.nix) pkgs; - if [ -n "$device" ] ; then - if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep "$device" ; then - ${pkgs.libnotify}/bin/notify-send "Unmounting $device..." - output=$(${pkgs.udisks}/bin/udisksctl unmount -b $device 2>&1) - if [ $? -eq 0 ] ; then - ${pkgs.libnotify}/bin/notify-send "Device successfully unmounted." - else - ${pkgs.libnotify}/bin/notify-send "Failed to unmount device" "$output" - fi + ".bin/ocrzone".source = pkgs.writers.writeBash "ocrzone" '' + ${pkgs.pkgs.sway-contrib.grimshot}/bin/grimshot save area - | \ + ${pkgs.tesseract}/bin/tesseract -l fra - - | \ + ${pkgs.wl-clipboard}/bin/wl-copy + ''; + + ".bin/wifi-toggle".source = pkgs.writers.writeBash "wifi-toggle" '' + if [[ $(nmcli radio wifi) == "enabled" ]]; then + nmcli radio wifi off else - ${pkgs.libnotify}/bin/notify-send "Mounting $device..." - output=$(${pkgs.udisks}/bin/udisksctl mount -b $device 2>&1) - if [ $? -eq 0 ] ; then - ${pkgs.libnotify}/bin/notify-send "Device successfully mounted." + nmcli radio wifi on + fi + ''; + + ".bin/rofi-udisk".source = pkgs.writers.writeBash "rofi-udisk" '' + device=$(${pkgs.udiskie}/bin/udiskie-info -a -o "{ui_label} {in_use}" -f is_filesystem | \ + ${pkgs.gnused}/bin/sed 's/True$/[Mounted]/' | \ + ${pkgs.gnused}/bin/sed 's/False$//' | \ + ${config.programs.rofi.package}/bin/rofi -dmenu | \ + ${pkgs.coreutils}/bin/cut -d':' -f1) + + if [ -n "$device" ] ; then + if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep "$device" ; then + ${pkgs.libnotify}/bin/notify-send "Unmounting $device..." + output=$(${pkgs.udisks}/bin/udisksctl unmount -b $device 2>&1) + if [ $? -eq 0 ] ; then + ${pkgs.libnotify}/bin/notify-send "Device successfully unmounted." + else + ${pkgs.libnotify}/bin/notify-send "Failed to unmount device" "$output" + fi else - ${pkgs.libnotify}/bin/notify-send "Failed to mount device" "$output" + ${pkgs.libnotify}/bin/notify-send "Mounting $device..." + output=$(${pkgs.udisks}/bin/udisksctl mount -b $device 2>&1) + if [ $? -eq 0 ] ; then + ${pkgs.libnotify}/bin/notify-send "Device successfully mounted." + else + ${pkgs.libnotify}/bin/notify-send "Failed to mount device" "$output" + fi fi fi - fi - ''; + ''; - ".bin/mount-android".source = pkgs.writers.writeBash "mount-android" '' - if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep $(realpath ~/android); then - umount $(realpath ~/android) - ${pkgs.libnotify}/bin/notify-send "Android unmounted" - elif ${pkgs.simple-mtpfs}/bin/simple-mtpfs $(realpath ~/android); then - ${pkgs.libnotify}/bin/notify-send "Android mounted in ~/android" - else - ${pkgs.libnotify}/bin/notify-send "Can't find Android device" - fi - ''; + ".bin/mount-android".source = pkgs.writers.writeBash "mount-android" '' + if ${pkgs.mount}/bin/mount | ${pkgs.gnugrep}/bin/grep $(realpath ~/android); then + umount $(realpath ~/android) + ${pkgs.libnotify}/bin/notify-send "Android unmounted" + elif ${pkgs.simple-mtpfs}/bin/simple-mtpfs $(realpath ~/android); then + ${pkgs.libnotify}/bin/notify-send "Android mounted in ~/android" + else + ${pkgs.libnotify}/bin/notify-send "Can't find Android device" + fi + ''; - ".bin/dark".source = (import ./bin/dark.nix) pkgs; # deprecated, prefer darkman - }; - - home.sessionVariables = { - TERMINAL = defaultTerminal; - }; - - home.packages = with pkgs; [ - gentium - nerd-fonts.noto - nerd-fonts.hack - nerd-fonts.jetbrains-mono - nerd-fonts.caskaydia-cove - cascadia-code - inter - emojione - - bluetuith - keepmenu - rofimoji - ydotool - libnotify - wtype - wl-clipboard - - pamixer - pulsemixer - - (catppuccin-gtk.override { - accents = [ "pink" ]; - size = "compact"; - tweaks = [ "black" ]; - variant = "mocha"; - }) - ]; - - xsession.enable = true; - - fonts.fontconfig.enable = true; - fonts.fontconfig.defaultFonts = { - serif = [ "Gentium Plus" ]; - sansSerif = [ "Inter" ]; - monospace = [ "CaskaydiaCove Nerd Font Mono" ]; - # monospace = [ "CascadiaCode" ]; - # monospace = [ "Hack Nerd Font Mono" ]; - emoji = [ "Noto Color Emoji" "OpenMoji Color" ]; - }; - - services.gnome-keyring.enable = true; - - services.kdeconnect.enable = variant != "allegro"; - - programs.kitty = { - enable = true; - font.name = "CaskaydiaCove NFM Regular"; - font.size = 12; - settings = { - cursor_shape = "block"; - default_pointer_shape = "arrow"; - pointer_shape_when_dragging = "arrow"; - enable_audio_bell = false; - placement_strategy = "top-left"; - remember_window_size = false; - initial_window_width = 1300; - initial_window_height = 800; - confirm_os_window_close = 0; - resize_debounce_time = "0.1 0.1"; + ".bin/dark".source = (import ./bin/dark.nix) pkgs; # deprecated, prefer darkman }; - keybindings = { - "ctrl+shift+equal" = "change_font_size all +0.5"; - "ctrl+shift+plus" = "change_font_size all +0.5"; - "ctrl+shift+kp_add" = "change_font_size all +0.5"; - "ctrl+shift+minus" = "change_font_size all -0.5"; - "ctrl+shift+kp_subtract" = "change_font_size all -0.5"; - }; - shellIntegration.enableFishIntegration = true; - shellIntegration.mode = "no-cursor"; - extraConfig = '' - include colors.conf - bold_font CaskaydiaCove NFM Bold - italic_font CaskaydiaCove NFM Italic - bold_italic_font CaskaydiaCove NFM Bold Italic - text_composition_strategy 1.4 4 - font_features CaskaydiaCoveNF-Italic +calt +ss01 - ''; - }; - programs.alacritty = { - enable = true; - settings = { - font = { - size = 12.0; + home.sessionVariables = { + TERMINAL = defaultTerminal; + }; + + home.packages = with pkgs; [ + gentium + nerd-fonts.noto + nerd-fonts.hack + nerd-fonts.jetbrains-mono + nerd-fonts.caskaydia-cove + cascadia-code + inter + emojione + + bluetuith + keepmenu + rofimoji + ydotool + libnotify + wtype + wl-clipboard + + pamixer + pulsemixer + + (catppuccin-gtk.override { + accents = [ "pink" ]; + size = "compact"; + tweaks = [ "black" ]; + variant = "mocha"; + }) + ]; + + xsession.enable = true; + + fonts.fontconfig.enable = true; + fonts.fontconfig.defaultFonts = { + serif = [ "Gentium Plus" ]; + sansSerif = [ "Inter" ]; + monospace = [ "CaskaydiaCove Nerd Font Mono" ]; + # monospace = [ "CascadiaCode" ]; + # monospace = [ "Hack Nerd Font Mono" ]; + emoji = [ "Noto Color Emoji" "OpenMoji Color" ]; + }; + + services.gnome-keyring.enable = true; + + programs.kitty = { + enable = true; + font.name = "CaskaydiaCove NFM Regular"; + font.size = 12; + settings = { + cursor_shape = "block"; + default_pointer_shape = "arrow"; + pointer_shape_when_dragging = "arrow"; + enable_audio_bell = false; + placement_strategy = "top-left"; + remember_window_size = false; + initial_window_width = 1300; + initial_window_height = 800; + confirm_os_window_close = 0; + resize_debounce_time = "0.1 0.1"; }; + keybindings = { + "ctrl+shift+equal" = "change_font_size all +0.5"; + "ctrl+shift+plus" = "change_font_size all +0.5"; + "ctrl+shift+kp_add" = "change_font_size all +0.5"; + "ctrl+shift+minus" = "change_font_size all -0.5"; + "ctrl+shift+kp_subtract" = "change_font_size all -0.5"; + }; + shellIntegration.enableFishIntegration = true; + shellIntegration.mode = "no-cursor"; + extraConfig = '' + include colors.conf + bold_font CaskaydiaCove NFM Bold + italic_font CaskaydiaCove NFM Italic + bold_italic_font CaskaydiaCove NFM Bold Italic + text_composition_strategy 1.4 4 + font_features CaskaydiaCoveNF-Italic +calt +ss01 + ''; + }; - general.import = [ - alacrittyLightTheme # default to white - "~/.config/alacritty/colors.toml" + programs.alacritty = { + enable = true; + settings = { + font = { + size = 12.0; + }; + + general.import = [ + alacrittyLightTheme # default to white + "~/.config/alacritty/colors.toml" + ]; + }; + }; + + xdg = { + mimeApps.defaultApplications."TerminalEmulator" = "Alacritty.desktop"; + }; + + services.swayidle = + { + enable = true; + events = [ + { + event = "before-sleep"; + command = "${config.swaylock-bin} -defF"; + } + { + event = "after-resume"; + command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; + } + { + event = "lock"; + command = "${config.swaylock-bin} -defF"; + } + ]; + + timeouts = [ + { + timeout = 900; + command = "${config.swaylock-bin} -defF"; + } + { + timeout = 900; + command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off"; + } ]; }; - }; - xdg = { - mimeApps.defaultApplications."TerminalEmulator" = "Alacritty.desktop"; - }; + programs.swaylock = { + enable = (config.swaylock-bin == options.swaylock-bin.default); + package = pkgs.swaylock-effects; + settings = { + screenshots = true; + # clock = true; + font = "Sans:bold"; + disable-caps-lock-text = true; + effect-blur = "7x5"; + text-color = "ffffff"; + layout-text-color = "ffffff"; - services.swayidle = - let swaylock-bin = (if variant == "allegro" - then "/usr/bin/swaylock" - else "${config.programs.swaylock.package}/bin/swaylock"); - in - { - enable = true; - events = [ - { - event = "before-sleep"; - command = "${swaylock-bin} -defF"; - } - { - event = "after-resume"; - command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms on"; - } - { - event = "lock"; - command = "${swaylock-bin} -defF"; - } - ]; + ring-color = "000000"; + key-hl-color = "dddddd"; + line-color = "00000000"; + inside-color = "00000088"; + separator-color = "00000000"; - timeouts = [ - { - timeout = 900; - command = "${swaylock-bin} -defF"; - } - { - timeout = 900; - command = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl dispatch dpms off"; - } - ]; - }; - - programs.swaylock = { - enable = (variant != "allegro"); - package = pkgs.swaylock-effects; - settings = { - screenshots = true; - # clock = true; - font = "Sans:bold"; - disable-caps-lock-text = true; - effect-blur = "7x5"; - text-color = "ffffff"; - layout-text-color = "ffffff"; - - ring-color = "000000"; - key-hl-color = "dddddd"; - line-color = "00000000"; - inside-color = "00000088"; - separator-color = "00000000"; - - ring-clear-color = "00000000"; - line-clear-color = "00000000"; - inside-clear-color = "00000000"; - text-clear-color = "00000000"; - }; - }; - - services.dunst.enable = true; - services.dunst.settings = { - global = { - width = "(0, 1000)"; - height = "(0, 1000)"; - offset = "(20,20)"; - horizontal_padding = 8; - indicate_hidden = true; - shrink = true; - transparency = 20; - separator_height = 2; - frame_width = 3; - frame_color = "#000000"; - font = "Monospace 11"; - alignment = "left"; - show_age_threshold = 60; - background = "#ffffff"; - foreground = "#000000"; + ring-clear-color = "00000000"; + line-clear-color = "00000000"; + inside-clear-color = "00000000"; + text-clear-color = "00000000"; + }; }; + services.dunst.enable = true; + services.dunst.settings = { + global = { + width = "(0, 1000)"; + height = "(0, 1000)"; + offset = "(20,20)"; + horizontal_padding = 8; + indicate_hidden = true; + shrink = true; + transparency = 20; + separator_height = 2; + frame_width = 3; + frame_color = "#000000"; + font = "Monospace 11"; + alignment = "left"; + show_age_threshold = 60; + background = "#ffffff"; + foreground = "#000000"; + }; - urgency_critical = { - background = "#ff9999"; + + urgency_critical = { + background = "#ff9999"; + }; }; - }; - programs.rofi = { - enable = true; - package = pkgs.rofi-wayland; - plugins = [ pkgs.rofi-calc pkgs.rofi-emoji ]; - theme = "theme.rasi"; - }; - - qt = { - enable = true; - platformTheme.name = "kde"; - }; - - gtk = { - enable = true; - font = { - package = pkgs.inter; - name = "Inter"; + programs.rofi = { + enable = true; + package = pkgs.rofi-wayland; + plugins = [ pkgs.rofi-calc pkgs.rofi-emoji ]; + theme = "theme.rasi"; }; - # theme = { - # name = "Catppuccin-Latte-Compact-Pink-Light"; - # # name = "Catppuccin-Mocha-Compact-Pink-Dark"; - # package = pkgs.catppuccin-gtk.override { - # accents = [ "pink" ]; - # size = "compact"; - # tweaks = [ ]; - # variant = "latte"; - # }; - # }; - # iconTheme = { - # name = "Adwaita"; - # package = pkgs.adwaita-icon-theme; - # }; - cursorTheme = { - name = "Hackneyed"; - package = pkgs.hackneyed; - }; - }; - services.darkman = let - reload-hyprland = '' - ${pkgs.hyprland}/bin/hyprctl reload - ''; - reload-st = '' - kill -SIGUSR1 $(pgrep st) # reload st config - ''; - reload-neovim = '' - kill -SIGUSR1 $(pgrep nvim) - ''; - in { - enable = true; - lightModeScripts = { - gtk-theme = '' - ${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'" - ''; - set-background = '' - rm -f ~/.local/share/bg/* - ln -rs ~/.local/share/bg-light.* ~/.local/share/bg/ + qt = { + enable = true; + platformTheme.name = "kde"; + }; + + gtk = { + enable = true; + font = { + package = pkgs.inter; + name = "Inter"; + }; + # theme = { + # name = "Catppuccin-Latte-Compact-Pink-Light"; + # # name = "Catppuccin-Mocha-Compact-Pink-Dark"; + # package = pkgs.catppuccin-gtk.override { + # accents = [ "pink" ]; + # size = "compact"; + # tweaks = [ ]; + # variant = "latte"; + # }; + # }; + # iconTheme = { + # name = "Adwaita"; + # package = pkgs.adwaita-icon-theme; + # }; + cursorTheme = { + name = "Hackneyed"; + package = pkgs.hackneyed; + }; + }; + + services.darkman = let + reload-hyprland = '' ${pkgs.hyprland}/bin/hyprctl reload ''; - set-rofi-colors = '' - rm -f ~/.config/rofi/colors-current.rasi - ln -rs ~/.config/rofi/colors-light.rasi ~/.config/rofi/colors-current.rasi + reload-st = '' + kill -SIGUSR1 $(pgrep st) # reload st config ''; - set-kitty-colors = '' - rm -f ~/.config/kitty/colors.conf - ln -rs ~/.config/kitty/light.conf ~/.config/kitty/colors.conf - kill -SIGUSR1 $(pgrep kitty) + reload-neovim = '' + kill -SIGUSR1 $(pgrep nvim) ''; - set-alacritty-colors = '' - rm -f ~/.config/alacritty/colors.toml - ln -s ${alacrittyLightTheme} ~/.config/alacritty/colors.toml - ''; - notify = "${pkgs.libnotify}/bin/notify-send \"Light mode\""; - inherit reload-hyprland; - inherit reload-st; - inherit reload-neovim; - }; - - darkModeScripts = { - gtk-theme = '' - ${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'" + in { + enable = true; + lightModeScripts = { + gtk-theme = '' + ${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'" ''; - set-background = '' - rm -f ~/.local/share/bg/* - ln -rs ~/.local/share/bg-dark.* ~/.local/share/bg/ - ${pkgs.hyprland}/bin/hyprctl reload - ''; - set-rofi-colors = '' - rm -f ~/.config/rofi/colors-current.rasi - ln -rs ~/.config/rofi/colors-dark.rasi ~/.config/rofi/colors-current.rasi - ''; - set-kitty-colors = '' - rm -f ~/.config/kitty/colors.conf - ln -rs ~/.config/kitty/dark.conf ~/.config/kitty/colors.conf - kill -SIGUSR1 $(pgrep kitty) - ''; - set-alacritty-colors = '' - rm -f ~/.config/alacritty/colors.toml - ln -s ${alacrittyDarkTheme} ~/.config/alacritty/colors.toml - ''; - notify = "${pkgs.libnotify}/bin/notify-send \"Dark mode\""; - inherit reload-hyprland; - inherit reload-st; - inherit reload-neovim; - }; - }; - - systemd.user.services = { - battery-notify = { - Unit = { - Description = "Send notification when battery is low"; - Wants = "battery-timer.timer"; + set-background = '' + rm -f ~/.local/share/bg/* + ln -rs ~/.local/share/bg-light.* ~/.local/share/bg/ + ${pkgs.hyprland}/bin/hyprctl reload + ''; + set-rofi-colors = '' + rm -f ~/.config/rofi/colors-current.rasi + ln -rs ~/.config/rofi/colors-light.rasi ~/.config/rofi/colors-current.rasi + ''; + set-kitty-colors = '' + rm -f ~/.config/kitty/colors.conf + ln -rs ~/.config/kitty/light.conf ~/.config/kitty/colors.conf + kill -SIGUSR1 $(pgrep kitty) + ''; + set-alacritty-colors = '' + rm -f ~/.config/alacritty/colors.toml + ln -s ${alacrittyLightTheme} ~/.config/alacritty/colors.toml + ''; + notify = "${pkgs.libnotify}/bin/notify-send \"Light mode\""; + inherit reload-hyprland; + inherit reload-st; + inherit reload-neovim; }; - Service = { - Type = "oneshot"; - ExecStart = "${pkgs.writers.writeBash "battery-notify" '' - if [[ $(${pkgs.coreutils}/bin/cat /sys/class/power_supply/BAT0/capacity) -lt 10 ]]; then - ${pkgs.libnotify}/bin/notify-send -u critical "Battery is low" - fi - '' }"; + + darkModeScripts = { + gtk-theme = '' + ${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'" + ''; + set-background = '' + rm -f ~/.local/share/bg/* + ln -rs ~/.local/share/bg-dark.* ~/.local/share/bg/ + ${pkgs.hyprland}/bin/hyprctl reload + ''; + set-rofi-colors = '' + rm -f ~/.config/rofi/colors-current.rasi + ln -rs ~/.config/rofi/colors-dark.rasi ~/.config/rofi/colors-current.rasi + ''; + set-kitty-colors = '' + rm -f ~/.config/kitty/colors.conf + ln -rs ~/.config/kitty/dark.conf ~/.config/kitty/colors.conf + kill -SIGUSR1 $(pgrep kitty) + ''; + set-alacritty-colors = '' + rm -f ~/.config/alacritty/colors.toml + ln -s ${alacrittyDarkTheme} ~/.config/alacritty/colors.toml + ''; + notify = "${pkgs.libnotify}/bin/notify-send \"Dark mode\""; + inherit reload-hyprland; + inherit reload-st; + inherit reload-neovim; + }; + }; + + systemd.user.services = { + battery-notify = { + Unit = { + Description = "Send notification when battery is low"; + Wants = "battery-timer.timer"; + }; + Service = { + Type = "oneshot"; + ExecStart = "${pkgs.writers.writeBash "battery-notify" '' + if [[ $(${pkgs.coreutils}/bin/cat /sys/class/power_supply/BAT0/capacity) -lt 10 ]]; then + ${pkgs.libnotify}/bin/notify-send -u critical "Battery is low" + fi + '' }"; + }; + }; + }; + + systemd.user.timers = { + battery-timer = { + Unit = { + Description = "Execute battery-notify every minute"; + }; + Install = { + # enable the service + # WantedBy = [ "default.target" ]; + }; + Timer = { + Unit = "battery-notify.service"; + OnCalendar = "*-*-* *:*:00"; + }; }; }; }; - - systemd.user.timers = { - battery-timer = { - Unit = { - Description = "Execute battery-notify every minute"; - }; - Install = { - # enable the service - # WantedBy = [ "default.target" ]; - }; - Timer = { - Unit = "battery-notify.service"; - OnCalendar = "*-*-* *:*:00"; - }; - }; - }; - }