diff --git a/modules/applications/hyprland.nix b/modules/applications/hyprland.nix index e8a01b5..b628811 100644 --- a/modules/applications/hyprland.nix +++ b/modules/applications/hyprland.nix @@ -35,75 +35,73 @@ _: { services.xserver.enable = true; }; flake.homeModules.hyprland-laptop = { - home.file.".config/hypr/host.lua" = { - text = '' - hl.on("hyprland.start", function() - hl.exec_cmd("qtbatticon") - hl.exec_cmd("source /run/agenix/ntfy && nixpkgs-notifier listen") - end) - - hl.monitor({ - output = "eDP-1", - mode = "highres@highrr", - position = "0x0", - scale = 1, - }) - ''; - enable = true; - force = true; - }; -}; -flake.homeModules.hyprland-desktop = { - home.file.".config/hypr/host.lua" = { - text = '' - hl.monitor({ - output = "", - mode = "preferred", - position = "auto", - scale = 0.75, - }) - ''; - enable = true; - force = true; - }; -}; -flake.homeModules.hyprland = {pkgs-unstable, ... }: -let - wallpaper1 = ../../assets/wallpaper1.jpg; - wallpaper2 = ../../assets/wallpaper2.jpg; - wallpaper3 = ../../assets/wallpaper3.jpg; - wallpaper4 = ../../assets/wallpaper4.jpg; - wallpaper5 = ../../assets/wallpaper5.jpg; + home.file.".config/hypr/host.lua" = { + text = '' + hl.on("hyprland.start", function() + hl.exec_cmd("qtbatticon") + hl.exec_cmd("source /run/agenix/ntfy && nixpkgs-notifier listen") + end) - hyprlandLua = builtins.replaceStrings - [ - "WALLPAPER1/PATH/PLACEHOLDER" - "WALLPAPER2/PATH/PLACEHOLDER" - "WALLPAPER3/PATH/PLACEHOLDER" - "WALLPAPER4/PATH/PLACEHOLDER" - "WALLPAPER5/PATH/PLACEHOLDER" - ] - [ - (toString wallpaper1) - (toString wallpaper2) - (toString wallpaper3) - (toString wallpaper4) - (toString wallpaper5) - ] - (builtins.readFile ../../other/hyprland/hyprland.lua); -in - { + hl.monitor({ + output = "eDP-1", + mode = "highres@highrr", + position = "0x0", + scale = 1, + }) + ''; + enable = true; + force = true; + }; + }; + flake.homeModules.hyprland-desktop = { + home.file.".config/hypr/host.lua" = { + text = '' + hl.monitor({ + output = "", + mode = "preferred", + position = "auto", + scale = 0.75, + }) + ''; + enable = true; + force = true; + }; + }; + flake.homeModules.hyprland = {pkgs-unstable, ...}: let + wallpaper1 = ../../assets/wallpaper1.jpg; + wallpaper2 = ../../assets/wallpaper2.jpg; + wallpaper3 = ../../assets/wallpaper3.jpg; + wallpaper4 = ../../assets/wallpaper4.jpg; + wallpaper5 = ../../assets/wallpaper5.jpg; - #refer to https://wiki.hypr.land/Nix/Hyprland-on-Home-Manager/ - wayland.windowManager.hyprland.enable = true; - wayland.windowManager.hyprland.package = pkgs-unstable.hyprland; - #hint Electron apps to use on wayland; - home.sessionVariables.NIXOS_OZONE_WL = "1"; - wayland.windowManager.hyprland.plugins = [ - #pkgs-unstable.hyprlandPlugins.hyprspace # currently broken - #pkgs-unstable.hyprlandPlugins.hypr-dynamic-cursors - ]; - wayland.windowManager.hyprland.configType = "lua"; - wayland.windowManager.hyprland.extraConfig = hyprlandLua; + hyprlandLua = + builtins.replaceStrings + [ + "WALLPAPER1/PATH/PLACEHOLDER" + "WALLPAPER2/PATH/PLACEHOLDER" + "WALLPAPER3/PATH/PLACEHOLDER" + "WALLPAPER4/PATH/PLACEHOLDER" + "WALLPAPER5/PATH/PLACEHOLDER" + ] + [ + (toString wallpaper1) + (toString wallpaper2) + (toString wallpaper3) + (toString wallpaper4) + (toString wallpaper5) + ] + (builtins.readFile ../../other/hyprland/hyprland.lua); + in { + #refer to https://wiki.hypr.land/Nix/Hyprland-on-Home-Manager/ + wayland.windowManager.hyprland.enable = true; + wayland.windowManager.hyprland.package = pkgs-unstable.hyprland; + #hint Electron apps to use on wayland; + home.sessionVariables.NIXOS_OZONE_WL = "1"; + wayland.windowManager.hyprland.plugins = [ + #pkgs-unstable.hyprlandPlugins.hyprspace # currently broken + #pkgs-unstable.hyprlandPlugins.hypr-dynamic-cursors + ]; + wayland.windowManager.hyprland.configType = "lua"; + wayland.windowManager.hyprland.extraConfig = hyprlandLua; }; } diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix index 011164e..3c7d3ca 100644 --- a/modules/applications/neovim.nix +++ b/modules/applications/neovim.nix @@ -333,7 +333,7 @@ _: { } }) vim.lsp.config("texlab", { cmd = { "texlab" }, filetypes = { "tex" }, on_attach = on_attach }) - + -- i remove ltex from being enable bellow as it's too anoying and doesn't really help as sometime i write in french and other times in english/spanish or even german vim.lsp.config("ltex", { cmd = { "ltex-ls-plus" }, diff --git a/modules/applications/zsh.nix b/modules/applications/zsh.nix index 84ca787..a131736 100644 --- a/modules/applications/zsh.nix +++ b/modules/applications/zsh.nix @@ -51,7 +51,7 @@ _: { command cat "$@" fi } - + custom-eza() { # behaves differently if we just call it or if we pipe initContent if [[ -t 1 ]]; then eza -hlF -aa --color=always --hyperlink --group-directories-first --show-symlinks --icons=always --git --no-permissions "$@" diff --git a/modules/hardware/battery.nix b/modules/hardware/battery.nix index 271c408..944dd3f 100644 --- a/modules/hardware/battery.nix +++ b/modules/hardware/battery.nix @@ -1,8 +1,4 @@ -{ - self, - inputs, - ... -}: { +{self, ...}: { flake.nixosModules.battery-laptop = {pkgs, ...}: # https://discourse.nixos.org/t/what-is-the-best-option-for-power-management/63406/2 # we just activate tlp unconditonally diff --git a/modules/utilities/vpn.nix b/modules/utilities/vpn.nix index b005dfb..00c232a 100644 --- a/modules/utilities/vpn.nix +++ b/modules/utilities/vpn.nix @@ -1,6 +1,6 @@ # config for openconnect is in ./epfl.nix {self, ...}: { - flake.nixosModules.vpn = {pkgs,...}: { + flake.nixosModules.vpn = {pkgs, ...}: { services.mullvad-vpn = { enable = true; }; @@ -10,12 +10,11 @@ age.secrets.epfl = { file = ../../secrets/epfl.age; }; - }; perSystem = {pkgs, ...}: { packages.custom-vpn-picker = pkgs.writeShellApplication { name = "custom-vpn-picker"; - + runtimeInputs = with pkgs; [ fzf mullvad-compass @@ -25,14 +24,14 @@ wl-clipboard cliphist ]; - + text = '' mullvad_connect () { mullvad disconnect mullvad relay set location "$1" mullvad connect } - + profiles=( "mullvad-best" "mullvad-zurich" @@ -41,12 +40,12 @@ "epfl" "disconnect" ) - + selected=$(printf "%s\n" "''${profiles[@]}" | fzf --height 8 --reverse --prompt="Select vpn:") - + [[ -z "$selected" ]] && exit 0 - + if [[ "$selected" == "mullvad-best" ]]; then mullvad_connect "$( mullvad-compass | @@ -56,42 +55,42 @@ print a[1] }' )" - + elif [[ "$selected" == "mullvad-zurich" ]]; then mullvad_connect ch - + elif [[ "$selected" == "mullvad-tirana" ]]; then mullvad_connect al - + elif [[ "$selected" == "mullvad-bogota" ]]; then mullvad_connect co - + elif [[ "$selected" == "epfl" ]]; then # shellcheck disable=SC1091 source /run/agenix/epfl - + # Put password in clipboard so it can be pasted into openconnect. printf '%s' "$EPFL_VPN_PASSWORD" | wl-copy - + sudo openconnect \ --background \ --pid-file="$HOME/.local/state/epfl-openconnect.pid" \ --server="$EPFL_VPN_SERVER" \ --user="$EPFL_VPN_USER" - + # Remove the password from cliphist and clear the current clipboard. cliphist delete-query "$EPFL_VPN_PASSWORD" || true wl-copy --clear - + elif [[ "$selected" == "disconnect" ]]; then if [[ -f "$HOME/.local/state/epfl-openconnect.pid" ]]; then sudo kill "$(cat "$HOME/.local/state/epfl-openconnect.pid")" 2>/dev/null || true fi - + mullvad disconnect rm "$HOME/.local/state/epfl-openconnect.pid" fi - + pkill -f "kitty.*Select vpn option" || true exit '';