From 0022cf7d503da2b71f721caa6f0e9d93319289ef Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sun, 5 May 2024 22:12:18 +0200 Subject: [PATCH] added anyrun config --- flake.lock | 17 +++++ flake.nix | 5 +- hosts/vali/mars/hyprland/hyprland.nix | 4 +- modules/cli/fish.nix | 2 +- modules/gui/anyrun.nix | 97 --------------------------- modules/gui/anyrun/anyrun.nix | 48 +++++++++++++ modules/gui/anyrun/default.nix | 3 + modules/gui/anyrun/style.css | 69 +++++++++++++++++++ modules/gui/default.nix | 2 +- modules/gui/emacs/default.nix | 90 +++++++++++++++++++++++++ modules/gui/stylix.nix | 11 +-- modules/other/xdg.nix | 13 ++-- modules/services/pipewire.nix | 3 - 13 files changed, 242 insertions(+), 122 deletions(-) delete mode 100644 modules/gui/anyrun.nix create mode 100644 modules/gui/anyrun/anyrun.nix create mode 100644 modules/gui/anyrun/default.nix create mode 100644 modules/gui/anyrun/style.css create mode 100644 modules/gui/emacs/default.nix diff --git a/flake.lock b/flake.lock index 4e20c99..39dee29 100644 --- a/flake.lock +++ b/flake.lock @@ -178,6 +178,22 @@ "type": "github" } }, + "doomemacs": { + "flake": false, + "locked": { + "lastModified": 1713464448, + "narHash": "sha256-Fhir4WlcfEh70V8+oNS1LVAGBftiqtD2qaHzOC8BJUI=", + "owner": "doomemacs", + "repo": "doomemacs", + "rev": "9620bb45ac4cd7b0274c497b2d9d93c4ad9364ee", + "type": "github" + }, + "original": { + "owner": "doomemacs", + "repo": "doomemacs", + "type": "github" + } + }, "fenix": { "inputs": { "nixpkgs": [ @@ -962,6 +978,7 @@ "inputs": { "agenix": "agenix", "anyrun": "anyrun", + "doomemacs": "doomemacs", "fenix": "fenix", "home-manager": "home-manager_2", "hyprland": "hyprland", diff --git a/flake.nix b/flake.nix index 27cf670..38a3620 100644 --- a/flake.nix +++ b/flake.nix @@ -13,7 +13,10 @@ url = "github:hyprwm/hyprland-plugins"; inputs.hyprland.follows = "hyprland"; }; - + doomemacs = { + url = "github:doomemacs/doomemacs"; + flake = false; + }; nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland"; split-monitor-workspaces = { url = "github:Duckonaut/split-monitor-workspaces"; diff --git a/hosts/vali/mars/hyprland/hyprland.nix b/hosts/vali/mars/hyprland/hyprland.nix index 66027a5..0094c3e 100644 --- a/hosts/vali/mars/hyprland/hyprland.nix +++ b/hosts/vali/mars/hyprland/hyprland.nix @@ -137,8 +137,8 @@ in { enabled = true; animation = [ "windows, 1, 4, dupa, popin" - "windowsIn, 1, 4, fast, popin" - "windowsOut, 1, 4, fast, popin" + "windowsIn, 1, 4, dupa, popin" + "windowsOut, 1, 4, dupa, popin" "border, 1, 15, default" "fade, 1, 10, default" "workspaces, 1, 5, dupa, slidefadevert" diff --git a/modules/cli/fish.nix b/modules/cli/fish.nix index 52935ec..8c5ae32 100644 --- a/modules/cli/fish.nix +++ b/modules/cli/fish.nix @@ -55,7 +55,7 @@ in { cd = "z"; v = "nvim"; e = "emacs"; - update = "sudo nixos-rebuild switch --flake \"${gitPath}#${hostname}\" --log-format internal-json |& nom --json"; + update = "sudo nixos-rebuild switch --flake \"${gitPath}#${hostname}\""; flake = "cd '${gitPath}'"; } // cfg.extraAliases; }; diff --git a/modules/gui/anyrun.nix b/modules/gui/anyrun.nix deleted file mode 100644 index c909c97..0000000 --- a/modules/gui/anyrun.nix +++ /dev/null @@ -1,97 +0,0 @@ -{ config, pkgs, lib, inputs, ... }: - -with lib; -let - username = config.modules.other.system.username; - cfg = config.modules.programs.anyrun; -in { - options.modules.programs.anyrun.enable = mkEnableOption "anyrun"; - config = mkIf cfg.enable { - home-manager.users.${username} = { - imports = [ inputs.anyrun.homeManagerModules.default ]; - - programs.anyrun = { - enable = true; - config = { - plugins = with inputs.anyrun.packages.${pkgs.system}; [ - applications - dictionary - kidex - rink - symbols - translate - ]; - hideIcons = false; - ignoreExclusiveZones = false; - layer = "overlay"; - hidePluginInfo = true; - closeOnClick = true; - showResultsImmediately = true; - maxEntries = 50; - width.fraction = 0.5; - y.absolute = 15; - }; - - extraCss = '' - @define-color bg-col rgba(30, 30, 46, 0.7); - @define-color bg-col-light rgba(150, 220, 235, 0.7); - @define-color border-col rgba(30, 30, 46, 0.7); - @define-color selected-col rgba(150, 205, 251, 0.7); - @define-color fg-col #D9E0EE; - @define-color fg-col2 #F28FAD; - - * { - transition: 200ms ease; - font-family: "JetBrainsMono Nerd Font"; - font-size: 1.0rem; - } - - #window { - background: transparent; - } - - #plugin, - #main { - border: 3px solid @border-col; - color: @fg-col; - background-color: @bg-col; - } - /* anyrun's input window - Text */ - #entry { - color: @fg-col; - background-color: @bg-col; - } - - /* anyrun's ouput matches entries - Base */ - #match { - color: @fg-col; - background: @bg-col; - } - - /* anyrun's selected entry - Red */ - #match:selected { - color: @fg-col2; - background: @selected-col; - } - - #match { - padding: 3px; - border-radius: 16px; - } - - #entry, #plugin:hover { - border-radius: 16px; - } - - box#main { - background: rgba(30, 30, 46, 0.7); - border: 1px solid @border-col; - border-radius: 15px; - padding: 5px; - } - ''; - }; - }; - }; -} - diff --git a/modules/gui/anyrun/anyrun.nix b/modules/gui/anyrun/anyrun.nix new file mode 100644 index 0000000..d76bc2d --- /dev/null +++ b/modules/gui/anyrun/anyrun.nix @@ -0,0 +1,48 @@ +{ config, pkgs, lib, inputs, ... }: + +with lib; +let + username = config.modules.other.system.username; + cfg = config.modules.programs.anyrun; +in { + options.modules.programs.anyrun.enable = mkEnableOption "anyrun"; + config = mkIf cfg.enable { + home-manager.users.${username} = { + imports = [ inputs.anyrun.homeManagerModules.default ]; + + programs.anyrun = { + enable = true; + config = { + plugins = with inputs.anyrun.packages.${pkgs.system}; [ + applications + dictionary + kidex + rink + shell + symbols + translate + ]; + hideIcons = false; + ignoreExclusiveZones = false; + layer = "overlay"; + hidePluginInfo = true; + closeOnClick = true; + showResultsImmediately = true; + maxEntries = 50; + width.fraction = 0.3; + y.absolute = 15; + }; + extraCss = builtins.readFile (./. + "/style.css"); + + extraConfigFiles."applications.ron".text = '' + Config( + desktop_actions: false, + max_entries: 5, + terminal: Some("kitty"), + ) + ''; + }; + }; + }; +} + diff --git a/modules/gui/anyrun/default.nix b/modules/gui/anyrun/default.nix new file mode 100644 index 0000000..102ad3a --- /dev/null +++ b/modules/gui/anyrun/default.nix @@ -0,0 +1,3 @@ +_: { + imports = [./anyrun.nix]; +} diff --git a/modules/gui/anyrun/style.css b/modules/gui/anyrun/style.css new file mode 100644 index 0000000..32971ab --- /dev/null +++ b/modules/gui/anyrun/style.css @@ -0,0 +1,69 @@ +* { + all: unset; + font-size: 1.3rem; + font-family: "JetBrains Mono" +} + +#window, +#match, +#entry, +#plugin, +#main { + background: transparent; +} + +#match.activatable { + border-radius: 16px; + padding: 0.3rem 0.9rem; + margin-top: 0.01rem; +} +#match.activatable:first-child { + margin-top: 0.7rem; +} +#match.activatable:last-child { + margin-bottom: 0.6rem; +} + +#plugin:hover #match.activatable { + border-radius: 10px; + padding: 0.3rem; + margin-top: 0.01rem; + margin-bottom: 0; +} + +#match:selected, +#match:hover, +#plugin:hover { + background: rgba(255, 255, 255, 0.1); +} + +#entry { + background: rgba(255, 255, 255, 0.05); + border: 1px solid rgba(255, 255, 255, 0.1); + border-radius: 16px; + margin: 0.5rem; + padding: 0.3rem 1rem; +} + +list > #plugin { + border-radius: 16px; + margin: 0 0.3rem; +} +list > #plugin:first-child { + margin-top: 0.3rem; +} +list > #plugin:last-child { + margin-bottom: 0.3rem; +} +list > #plugin:hover { + padding: 0.6rem; +} + +box#main { + background: rgba(0, 0, 0, 0.5); + box-shadow: + inset 0 0 0 1px rgba(255, 255, 255, 0.1), + 0 0 0 1px rgba(0, 0, 0, 0.5); + border-radius: 24px; + padding: 0.3rem; +} diff --git a/modules/gui/default.nix b/modules/gui/default.nix index 50427e0..3b99d36 100644 --- a/modules/gui/default.nix +++ b/modules/gui/default.nix @@ -7,7 +7,7 @@ _: { ./qt.nix ./zathura.nix ./stylix.nix - ./anyrun.nix + ./anyrun ./rofi.nix ./kitty.nix ./vivado.nix diff --git a/modules/gui/emacs/default.nix b/modules/gui/emacs/default.nix new file mode 100644 index 0000000..5ecdff6 --- /dev/null +++ b/modules/gui/emacs/default.nix @@ -0,0 +1,90 @@ +{ config, lib, pkgs, ... }: +with lib; let + cfg = config.modules.programs.emacs; + envExtra = '' + export PATH="${config.xdg.configHome}/emacs/bin:$PATH" + ''; + shellAliases = { + e = "emacsclient --create-frame"; # gui + et = "emacsclient --create-frame --tty"; # termimal + }; + librime-dir = "${config.xdg.dataHome}/emacs/librime"; + parinfer-rust-lib-dir = "${config.xdg.dataHome}/emacs/parinfer-rust"; + myEmacsPackagesFor = emacs: ((pkgs.emacsPackagesFor emacs).emacsWithPackages (epkgs: [ + epkgs.vterm + ])); +in { + options.modules.editors.emacs = { + enable = mkEnableOption "Emacs Editor"; + }; + + config = mkIf cfg.enable (mkMerge [ + { + home.packages = with pkgs; [ + ## Doom dependencies + git + (ripgrep.override {withPCRE2 = true;}) + gnutls # for TLS connectivity + + ## Optional dependencies + fd # faster projectile indexing + imagemagick # for image-dired + fd # faster projectile indexing + zstd # for undo-fu-session/undo-tree compression + + # go-mode + # gocode # project archived, use gopls instead + + ## Module dependencies + # :checkers spell + (aspellWithDicts (ds: with ds; [en en-computers en-science])) + # :tools editorconfig + editorconfig-core-c # per-project style config + # :tools lookup & :lang org +roam + sqlite + # :lang latex & :lang org (latex previews) + # texlive.combined.scheme-medium + ]; + + programs.bash.bashrcExtra = envExtra; + programs.zsh.envExtra = envExtra; + home.shellAliases = shellAliases; + programs.nushell.shellAliases = shellAliases; + + xdg.configFile."doom" = { + source = ./doom; + force = true; + }; + + home.activation.installDoomEmacs = lib.hm.dag.entryAfter ["writeBoundary"] '' + ${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${doomemacs}/ ${config.xdg.configHome}/emacs/ + + # librime for emacs-rime + mkdir -p ${librime-dir} + ${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${pkgs.librime}/ ${librime-dir}/ + + # libparinfer_rust for emacs' parinfer-rust-mode + mkdir -p ${parinfer-rust-lib-dir} + ${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${pkgs.vimPlugins.parinfer-rust}/lib/libparinfer_rust.* ${parinfer-rust-lib-dir}/parinfer-rust.so + ''; + } + + let + # Do not use emacs-nox here, which makes the mouse wheel work abnormally in terminal mode. + # pgtk (pure gtk) build add native support for wayland. + # https://www.gnu.org/savannah-checkouts/gnu/emacs/emacs.html#Releases + emacsPkg = myEmacsPackagesFor pkgs.emacs29-pgtk; + in { + home.packages = [emacsPkg]; + services.emacs = { + enable = true; + package = emacsPkg; + client = { + enable = true; + arguments = [" --create-frame"]; + }; + startWithUserSession = true; + }; + } + ]); +} diff --git a/modules/gui/stylix.nix b/modules/gui/stylix.nix index 596f7cf..1d538ad 100644 --- a/modules/gui/stylix.nix +++ b/modules/gui/stylix.nix @@ -46,18 +46,13 @@ in { popups = 14; }; - sansSerif = { - package = pkgs.dejavu_fonts; - name = "DejaVu Sans"; - }; + sansSerif = config.stylix.fonts.monospace; + serif = config.stylix.fonts.monospace; + emoji = config.stylix.fonts.monospace; monospace = { package = (pkgs.nerdfonts.override {fonts = ["JetBrainsMono"];}); name = "JetBrainsMono"; }; - emoji = { - package = pkgs.noto-fonts-emoji; - name = "Noto Color Emoji"; - }; }; }; diff --git a/modules/other/xdg.nix b/modules/other/xdg.nix index f272013..dbae93c 100644 --- a/modules/other/xdg.nix +++ b/modules/other/xdg.nix @@ -12,21 +12,16 @@ let terminal = "kitty.desktop"; in { -# xdg.portal = { -# enable = true; -# extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; -# config.common.default = "gtk"; -# }; environment.sessionVariables = { TERMINAL = "${terminal}"; }; home-manager.users.${username} = { xdg = { -# cacheHome = "${hmCfg.home.homeDirectory}/.cache"; -# configHome = "${hmCfg.home.homeDirectory}/.config"; -# dataHome = "${hmCfg.home.homeDirectory}/.local/share"; -# stateHome = "${hmCfg.home.homeDirectory}/.local/state"; + cacheHome = "${hmCfg.home.homeDirectory}/.cache"; + configHome = "${hmCfg.home.homeDirectory}/.config"; + dataHome = "${hmCfg.home.homeDirectory}/.local/share"; + stateHome = "${hmCfg.home.homeDirectory}/.local/state"; mimeApps = { enable = true; defaultApplications = { diff --git a/modules/services/pipewire.nix b/modules/services/pipewire.nix index 3de50d7..618f98e 100644 --- a/modules/services/pipewire.nix +++ b/modules/services/pipewire.nix @@ -8,10 +8,7 @@ in { hardware.pulseaudio.enable = false; services.pipewire = { enable = true; - alsa.enable = true; - alsa.support32Bit = true; pulse.enable = true; - wireplumber.enable = true; }; security.rtkit.enable = true; };