From f7dcd6dcd79be041c00b313e28583a4e47c2b921 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Fri, 6 Sep 2024 09:49:49 -0600 Subject: [PATCH] configs/emacs: move things around so I can add packages It would be nice if they weren't system level.. but this works --- configs/default.nix | 5 +++-- configs/emacs.nix | 38 ++++++++++++++++++++++++-------------- gui/default.nix | 13 ------------- pkgs/emacs.nix | 21 +++++++++++++++++++++ 4 files changed, 48 insertions(+), 29 deletions(-) create mode 100644 pkgs/emacs.nix diff --git a/configs/default.nix b/configs/default.nix index 09ceb0d..7c29ae4 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -3,17 +3,18 @@ ./alacritty.nix ./ca.nix ./ci.nix - ./smug.nix - ./konsole.nix ./colemak.nix ./dns.nix ./doas.nix + ./emacs.nix ./git.nix + ./konsole.nix ./manager.nix ./neovim.nix ./net-overlay.nix ./nix.nix ./polybar.nix + ./smug.nix ./ssh.nix ./tmux.nix ./update.nix diff --git a/configs/emacs.nix b/configs/emacs.nix index e3123a9..b1998df 100644 --- a/configs/emacs.nix +++ b/configs/emacs.nix @@ -1,21 +1,31 @@ -{ emacsWithPackagesFromUsePackage +{ config , pkgs -, emacsPkg ? pkgs.emacs-pgtk +, isUnstable +, lib , ... }: -emacsWithPackagesFromUsePackage { - config = ./emacs.org; +let + myEmacs = pkgs.callPackage ../pkgs/emacs.nix { inherit isUnstable; }; + editorScript = pkgs.writeShellScriptBin "emacseditor" '' + if [ -z "$1" ]; then + exec ${myEmacs}/bin/emacsclient --create-frame --alternate-editor ${myEmacs}/bin/emacs + else + exec ${myEmacs}/bin/emacsclient --alternate-editor ${myEmacs}/bin/emacs "$@" + fi + ''; +in +{ + config = { + environment = { + variables.EDITOR = lib.mkOverride 900 "emacseditor"; + systemPackages = with pkgs; [ + (aspellWithDicts (dicts: with dicts; [ en en-computers es de ])) + go-font + texlive.combined.scheme-full - alwaysEnsure = true; - alwaysTangle = true; - - defaultInitFile = true; - package = emacsPkg; - - override = epkgs: epkgs // { - ollama = pkgs.callPackage ../pkgs/ollama-el.nix { - inherit (pkgs) fetchFromGitHub; - inherit (epkgs) trivialBuild; + myEmacs + editorScript + ]; }; }; } diff --git a/gui/default.nix b/gui/default.nix index 6b2d964..ede6bec 100644 --- a/gui/default.nix +++ b/gui/default.nix @@ -2,7 +2,6 @@ , lib , pkgs , xinlib -, isUnstable , inputs , ... }: @@ -12,17 +11,9 @@ let inherit (inputs.beyt.packages.${pkgs.system}) beyt; firefox = import ../configs/firefox.nix { inherit pkgs; }; rage = pkgs.writeScriptBin "rage" (import ../bins/rage.nix { inherit pkgs; }); - myEmacs = pkgs.callPackage ../configs/emacs.nix { inherit isUnstable; }; rpr = pkgs.writeScriptBin "rpr" (import ../bins/rpr.nix { inherit (pkgs) hut gh tea; }); - editorScript = pkgs.writeShellScriptBin "emacseditor" '' - if [ -z "$1" ]; then - exec ${myEmacs}/bin/emacsclient --create-frame --alternate-editor ${myEmacs}/bin/emacs - else - exec ${myEmacs}/bin/emacsclient --alternate-editor ${myEmacs}/bin/emacs "$@" - fi - ''; promnesia = pkgs.python3Packages.callPackage ../pkgs/promnesia.nix { inherit pkgs; }; hpi = pkgs.python3Packages.callPackage ../pkgs/hpi.nix { inherit pkgs; }; @@ -113,10 +104,8 @@ with lib; { SSH_AUTH_SOCK = "$HOME/.traygent"; OLLAMA_HOST = "https://ollama.otter-alligator.ts.net"; }; - variables.EDITOR = mkOverride 900 "emacseditor"; systemPackages = with pkgs; (xinlib.filterList [ alacritty - (aspellWithDicts (dicts: with dicts; [ en en-computers es de ])) bc beyt black @@ -137,8 +126,6 @@ with lib; { zeal trayscale - myEmacs - editorScript (callPackage ../configs/helix.nix { }) ]); }; diff --git a/pkgs/emacs.nix b/pkgs/emacs.nix new file mode 100644 index 0000000..9253f99 --- /dev/null +++ b/pkgs/emacs.nix @@ -0,0 +1,21 @@ +{ emacsWithPackagesFromUsePackage +, pkgs +, emacsPkg ? pkgs.emacs-pgtk +, ... +}: +emacsWithPackagesFromUsePackage { + config = ../configs/emacs.org; + + alwaysEnsure = true; + alwaysTangle = true; + + defaultInitFile = true; + package = emacsPkg; + + override = epkgs: epkgs // { + ollama = pkgs.callPackage ../pkgs/ollama-el.nix { + inherit (pkgs) fetchFromGitHub; + inherit (epkgs) trivialBuild; + }; + }; +}