Switch to buildEnv instead of symlinkJoin for better control over the joining process.
This commit is contained in:
		
							parent
							
								
									d3ea8b3667
								
							
						
					
					
						commit
						054e056d00
					
				| @ -6,42 +6,43 @@ | ||||
| }: | ||||
| 
 | ||||
| let | ||||
|   plainmacs = pkgs.writeShellScriptBin "plainmacs" '' | ||||
|     INIT_SCRIPT=$(cat <<EOF | ||||
|     (progn | ||||
|       (setq make-backup-files nil auto-save-default nil create-lockfiles nil) | ||||
|       (load-theme 'tango-dark t) | ||||
|       (set-face-attribute 'default nil :background "black") | ||||
|       ;; Bright yellow highlighting for selected region | ||||
|       (set-face-attribute 'region nil :background "#ffff50" :foreground "black") | ||||
|       ;; Bright green cursor to distinguish from yellow region | ||||
|       (set-cursor-color "#ccff66") | ||||
|       ;; Hightlight the current line | ||||
|       (set-face-attribute 'line-number-current-line nil :foreground "white") | ||||
|       ;; Set default font | ||||
|       (set-face-attribute 'default nil :height 100 :width 'regular :weight 'regular :family "Cascadia Mono") | ||||
|       ;; Set fallback font for unicode glyphs | ||||
|       (when (display-graphic-p) | ||||
|         (set-fontset-font "fontset-default" nil (font-spec :name "Noto Color Emoji"))) | ||||
|       (menu-bar-mode -1) | ||||
|       (when (fboundp 'tool-bar-mode) | ||||
|         (tool-bar-mode -1)) | ||||
|       (when (  fboundp 'scroll-bar-mode) | ||||
|         (scroll-bar-mode -1)) | ||||
|       (pixel-scroll-precision-mode) | ||||
|       (setq frame-resize-pixelwise t) | ||||
|   plainmacs = | ||||
|     emacs_package: | ||||
|     pkgs.writeShellScriptBin "plainmacs" '' | ||||
|       INIT_SCRIPT=$(cat <<EOF | ||||
|       (progn | ||||
|         (setq make-backup-files nil auto-save-default nil create-lockfiles nil) | ||||
|         (load-theme 'tango-dark t) | ||||
|         (set-face-attribute 'default nil :background "black") | ||||
|         ;; Bright yellow highlighting for selected region | ||||
|         (set-face-attribute 'region nil :background "#ffff50" :foreground "black") | ||||
|         ;; Bright green cursor to distinguish from yellow region | ||||
|         (set-cursor-color "#ccff66") | ||||
|         ;; Hightlight the current line | ||||
|         (set-face-attribute 'line-number-current-line nil :foreground "white") | ||||
|         ;; Set default font | ||||
|         (set-face-attribute 'default nil :height 100 :width 'regular :weight 'regular :family "Cascadia Mono") | ||||
|         ;; Set fallback font for unicode glyphs | ||||
|         (when (display-graphic-p) | ||||
|           (set-fontset-font "fontset-default" nil (font-spec :name "Noto Color Emoji"))) | ||||
|         (menu-bar-mode -1) | ||||
|         (when (fboundp 'tool-bar-mode) | ||||
|           (tool-bar-mode -1)) | ||||
|         (when (  fboundp 'scroll-bar-mode) | ||||
|           (scroll-bar-mode -1)) | ||||
|         (pixel-scroll-precision-mode) | ||||
|         (setq frame-resize-pixelwise t) | ||||
|         ) | ||||
|       EOF | ||||
|       ) | ||||
|     EOF | ||||
|     ) | ||||
| 
 | ||||
|     exec ${pkgs.emacs29-pgtk}/bin/emacs -q --eval "$INIT_SCRIPT" "''${@}" | ||||
|   ''; | ||||
|   e_shorthand = pkgs.writeShellScriptBin "e" '' | ||||
|     exec ${pkgs.emacs_full}/bin/emacs "''${@}" | ||||
|   ''; | ||||
|   plain_e_shorthand = pkgs.writeShellScriptBin "e" '' | ||||
|     exec ${pkgs.emacs29-pgtk}/bin/emacs "''${@}" | ||||
|   ''; | ||||
|       exec ${emacs_package}/bin/emacs -q --eval "$INIT_SCRIPT" "''${@}" | ||||
|     ''; | ||||
|   e_shorthand = | ||||
|     emacs_package: | ||||
|     pkgs.writeShellScriptBin "e" '' | ||||
|       exec ${emacs_package}/bin/emacs "''${@}" | ||||
|     ''; | ||||
| in | ||||
| { | ||||
|   imports = [ ]; | ||||
| @ -58,94 +59,93 @@ in | ||||
|     description = "What flavor of emacs to set up."; | ||||
|   }; | ||||
| 
 | ||||
|   config = | ||||
|     lib.mkIf config.me.emacs_flavor != null ( | ||||
|       lib.mkMerge [ | ||||
|         (lib.mkIf (config.me.emacs_flavor == "full") { | ||||
|           environment.systemPackages = with pkgs; [ | ||||
|             plainmacs | ||||
|             e_shorthand | ||||
|             emacs_full | ||||
|           ]; | ||||
|   config = lib.mkIf (config.me.emacs_flavor != null) ( | ||||
|     lib.mkMerge [ | ||||
|       { | ||||
|         environment.systemPackages = with pkgs; [ | ||||
|           emacs29-pgtk | ||||
|           (plainmacs emacs29-pgtk) | ||||
|           (e_shorthand emacs29-pgtk) | ||||
|         ]; | ||||
| 
 | ||||
|           nixpkgs.overlays = [ | ||||
|             (final: prev: { | ||||
|               emacs_full = pkgs.symlinkJoin { | ||||
|                 name = "emacs_full"; | ||||
|                 paths = [ pkgs.emacs29-pgtk ]; | ||||
|                 buildInputs = [ pkgs.makeWrapper ]; | ||||
|                 postBuild = '' | ||||
|                   wrapProgram $out/bin/emacs --prefix PATH : ${ | ||||
|                     lib.makeBinPath [ | ||||
|                       (pkgs.aspellWithDicts ( | ||||
|                         dicts: with dicts; [ | ||||
|                           en | ||||
|                           en-computers | ||||
|                         ] | ||||
|                       )) | ||||
|                       pkgs.nixd # nix language server | ||||
|                       pkgs.nixfmt-rfc-style # auto-formatting nix files through nixd | ||||
|                       pkgs.clang # To compile tree-sitter grammars | ||||
|                       pkgs.shellcheck | ||||
|                     ] | ||||
|                   } | ||||
|                 ''; | ||||
|               }; | ||||
|             }) | ||||
|           ]; | ||||
|         environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) { | ||||
|           hideMounts = true; | ||||
|           users.talexander = { | ||||
|             directories = [ | ||||
|               ".config/emacs/eln-cache" # Installed packages | ||||
|               ".config/emacs/elpa" # Installed packages | ||||
|               ".config/emacs/private" # For recentf | ||||
|               ".config/emacs/tree-sitter" # Compiled tree-sitter grammars | ||||
|             ]; | ||||
|             files = [ | ||||
|               ".config/emacs/history" # For savehist | ||||
|               ".config/emacs/.last-package-update-day" # For use-package | ||||
|             ]; | ||||
|           }; | ||||
|         }; | ||||
| 
 | ||||
|           home-manager.users.talexander = | ||||
|             { pkgs, ... }: | ||||
|             { | ||||
|               home.file.".config/emacs" = { | ||||
|                 source = ./files/emacs; | ||||
|                 recursive = true; | ||||
|               }; | ||||
|         environment.variables.EDITOR = "${pkgs.emacs29-pgtk}/bin/plainmacs"; | ||||
|       } | ||||
|       (lib.mkIf (config.me.emacs_flavor == "full") { | ||||
|         nixpkgs.overlays = [ | ||||
|           (final: prev: { | ||||
|             emacs29-pgtk = pkgs.buildEnv { | ||||
|               name = prev.emacs29-pgtk.name; | ||||
|               paths = with prev; [ | ||||
|                 emacs29-pgtk | ||||
|               ]; | ||||
|               extraOutputsToInstall = [ | ||||
|                 "man" | ||||
|                 "doc" | ||||
|                 "info" | ||||
|               ]; | ||||
|               buildInputs = [ pkgs.makeWrapper ]; | ||||
|               postBuild = '' | ||||
|                 wrapProgram $out/bin/emacs --prefix PATH : ${ | ||||
|                   lib.makeBinPath [ | ||||
|                     (pkgs.aspellWithDicts ( | ||||
|                       dicts: with dicts; [ | ||||
|                         en | ||||
|                         en-computers | ||||
|                       ] | ||||
|                     )) | ||||
|                     pkgs.nixd # nix language server | ||||
|                     pkgs.nixfmt-rfc-style # auto-formatting nix files through nixd | ||||
|                     pkgs.clang # To compile tree-sitter grammars | ||||
|                     pkgs.shellcheck | ||||
|                   ] | ||||
|                 } | ||||
|               ''; | ||||
|             }; | ||||
|           }) | ||||
|         ]; | ||||
| 
 | ||||
|           environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) { | ||||
|             hideMounts = true; | ||||
|             users.talexander = { | ||||
|               directories = [ | ||||
|                 ".config/emacs/eln-cache" # Installed packages | ||||
|                 ".config/emacs/elpa" # Installed packages | ||||
|                 ".config/emacs/private" # For recentf | ||||
|                 ".config/emacs/tree-sitter" # Compiled tree-sitter grammars | ||||
|               ]; | ||||
|               files = [ | ||||
|                 ".config/emacs/history" # For savehist | ||||
|                 ".config/emacs/.last-package-update-day" # For use-package | ||||
|               ]; | ||||
|         home-manager.users.talexander = | ||||
|           { pkgs, ... }: | ||||
|           { | ||||
|             home.file.".config/emacs" = { | ||||
|               source = ./files/emacs; | ||||
|               recursive = true; | ||||
|             }; | ||||
|           }; | ||||
| 
 | ||||
|           environment.variables.EDITOR = "${plainmacs}/bin/plainmacs"; | ||||
|         }) | ||||
|         (lib.mkIf (config.me.emacs_flavor == "plainmacs") { | ||||
|           environment.systemPackages = with pkgs; [ | ||||
|             emacs29-pgtk | ||||
|             plainmacs | ||||
|             plain_e_shorthand | ||||
|           ]; | ||||
| 
 | ||||
|           environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) { | ||||
|             hideMounts = true; | ||||
|             users.talexander = { | ||||
|               directories = [ | ||||
|                 ".config/emacs/eln-cache" # Installed packages | ||||
|                 ".config/emacs/elpa" # Installed packages | ||||
|                 ".config/emacs/private" # For recentf | ||||
|                 ".config/emacs/tree-sitter" # Compiled tree-sitter grammars | ||||
|       }) | ||||
|       (lib.mkIf (config.me.emacs_flavor == "plainmacs") { | ||||
|         nixpkgs.overlays = [ | ||||
|           (final: prev: { | ||||
|             emacs29-pgtk = pkgs.buildEnv { | ||||
|               name = prev.emacs29-pgtk.name; | ||||
|               paths = with prev; [ | ||||
|                 emacs29-pgtk | ||||
|               ]; | ||||
|               files = [ | ||||
|                 ".config/emacs/history" # For savehist | ||||
|                 ".config/emacs/.last-package-update-day" # For use-package | ||||
|               extraOutputsToInstall = [ | ||||
|                 "man" | ||||
|                 "doc" | ||||
|                 "info" | ||||
|               ]; | ||||
|             }; | ||||
|           }; | ||||
| 
 | ||||
|           environment.variables.EDITOR = "${plainmacs}/bin/plainmacs"; | ||||
|         }) | ||||
|       ] | ||||
|     ); | ||||
|           }) | ||||
|         ]; | ||||
|       }) | ||||
|     ] | ||||
|   ); | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander