diff --git a/flake.lock b/flake.lock index 20057f7..4a5644c 100644 --- a/flake.lock +++ b/flake.lock @@ -20,6 +20,25 @@ "type": "github" } }, + "emacs-config": { + "inputs": { + "home-manager": [ + "home-manager" + ], + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "path": "./flakes/emacs", + "type": "path" + }, + "original": { + "path": "./flakes/emacs", + "type": "path" + }, + "parent": [] + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -27,11 +46,11 @@ ] }, "locked": { - "lastModified": 1744600951, - "narHash": "sha256-LNAAfQTDXSwtYYlh/v/tMwnCqeQAEHlBC9PgyQK5b/Q=", + "lastModified": 1745205007, + "narHash": "sha256-k67bEcLkSo13TIBfs0CGYkJjG12aaikabMtxWbSeqr0=", "owner": "nix-community", "repo": "home-manager", - "rev": "e980d0e0e216f527ea73cfd12c7b019eceffa7f1", + "rev": "3fbe9a2b76ff5c4dcb2a2a2027dac31cfc993c8c", "type": "github" }, "original": { @@ -42,11 +61,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1744463964, - "narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", + "lastModified": 1744932701, + "narHash": "sha256-fusHbZCyv126cyArUwwKrLdCkgVAIaa/fQJYFlCEqiU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", + "rev": "b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef", "type": "github" }, "original": { @@ -59,6 +78,7 @@ "root": { "inputs": { "darwin": "darwin", + "emacs-config": "emacs-config", "home-manager": "home-manager", "nixpkgs": "nixpkgs" } diff --git a/flake.nix b/flake.nix index f6d1c30..7196818 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,11 @@ home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.url = "github:nix-community/home-manager/"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + emacs-config = { + url = "path:./flakes/emacs"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + }; }; outputs = inputs: @@ -13,11 +18,14 @@ in { darwinConfigurations = { - TobAir = darwin-system { + TobBook = darwin-system { system = "aarch64-darwin"; username = "tobi"; email = "tobias.ostner@gmail.com"; - hostname = "TobAir"; + hostname = "TobBook"; + extraHomeManagerModules = [ + inputs.emacs-config.homeManagerModules.aarch64-darwin + ]; }; TobWork = darwin-system { system = "aarch64-darwin"; @@ -25,12 +33,6 @@ email = "tobias.ostner@jambit.com"; hostname = "laptop1042"; }; - TobBook = darwin-system { - system = "aarch64-darwin"; - username = "tobi"; - email = "tobias.ostner@gmail.com"; - hostname = "TobBook"; - }; }; }; } diff --git a/config/emacs/early-init.el b/flakes/emacs/config/early-init.el similarity index 100% rename from config/emacs/early-init.el rename to flakes/emacs/config/early-init.el diff --git a/config/emacs/init.el b/flakes/emacs/config/init.el similarity index 98% rename from config/emacs/init.el rename to flakes/emacs/config/init.el index 547a213..904123d 100644 --- a/config/emacs/init.el +++ b/flakes/emacs/config/init.el @@ -257,12 +257,14 @@ (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) (add-hook 'package-menu-mode-hook #'hl-line-mode) (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) - (add-hook 'enable-theme-functions - (lambda (&rest _args) - (set-face-attribute - 'tab-bar nil - :box `(:line-width 4 :color ,(modus-themes-get-color-value 'bg-main)) - :background (modus-themes-get-color-value 'bg-main))))) + ;; TODO: symbols function definition is void + ;; (add-hook 'enable-theme-functions + ;; (lambda (&rest _args) + ;; (set-face-attribute + ;; 'tab-bar nil + ;; :box `(:line-width 4 :color ,(modus-themes-get-color-value 'bg-main)) + ;; :background (modus-themes-get-color-value 'bg-main)))) + ) (use-package envrc :config diff --git a/config/emacs/lisp/utils.el b/flakes/emacs/config/lisp/utils.el similarity index 100% rename from config/emacs/lisp/utils.el rename to flakes/emacs/config/lisp/utils.el diff --git a/config/emacs/snippets/tsx-ts-mode/rnfc b/flakes/emacs/config/snippets/tsx-ts-mode/rnfc similarity index 100% rename from config/emacs/snippets/tsx-ts-mode/rnfc rename to flakes/emacs/config/snippets/tsx-ts-mode/rnfc diff --git a/config/emacs/tree-sitter/libtree-sitter-swift.dylib b/flakes/emacs/config/tree-sitter/libtree-sitter-swift.dylib similarity index 100% rename from config/emacs/tree-sitter/libtree-sitter-swift.dylib rename to flakes/emacs/config/tree-sitter/libtree-sitter-swift.dylib diff --git a/flakes/emacs/flake.nix b/flakes/emacs/flake.nix new file mode 100644 index 0000000..b9469e4 --- /dev/null +++ b/flakes/emacs/flake.nix @@ -0,0 +1,14 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager.url = "github:nix-community/home-manager/"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs: + { + homeManagerModules = { + aarch64-darwin = import ./home.nix; + }; + }; +} diff --git a/flakes/emacs/home.nix b/flakes/emacs/home.nix new file mode 100644 index 0000000..2f7b3e9 --- /dev/null +++ b/flakes/emacs/home.nix @@ -0,0 +1,108 @@ +{ config, pkgs, lib, ... }: +{ + home.file.".emacs.d/early-init.el".source = ./config/early-init.el; + home.file.".emacs.d/tree-sitter/libtree-sitter-swift.dylib".source = ./config/tree-sitter/libtree-sitter-swift.dylib; + home.file.".emacs.d/snippets".source = ./config/snippets; + + programs.emacs = { + enable = true; + extraConfig = builtins.readFile ./config/init.el + + builtins.readFile ./config/lisp/utils.el; + extraPackages = epkgs: (with epkgs; [ + ace-window + apheleia + avy + cape + cider + clojure-mode + consult + (trivialBuild { + pname = "copilot"; + version = "master-12-28-2024"; + src = pkgs.fetchFromGitHub { + owner = "copilot-emacs"; + repo = "copilot.el"; + rev = "c5dfa99f05878db5e6a6a378dc7ed09f11e803d4"; + hash = "sha256-FzI08AW7a7AleEM7kSQ8LsWsDYID8SW1SmSN6/mIB/A="; + }; + packageRequires = [ + editorconfig + dash + f + jsonrpc + ]; + }) + corfu + diff-hl + dockerfile-mode + ef-themes + eglot + envrc + exec-path-from-shell + flycheck + flycheck-clj-kondo + flycheck-swiftlint + (trivialBuild { + pname = "gptel"; + version = "master-09-29-2024"; + src = pkgs.fetchFromGitHub { + owner = "karthink"; + repo = "gptel"; + rev = "2b9398a7b3bb2a66f52a8d0b1fdc3f311b2c1a3d"; + hash = "sha256-+CxSA9QmyKigbk8kB5N6kKZ/a5Tw0X4ym57AOoqYA4Y="; + }; + }) + graphql-mode + helpful + htmlize + jinx + js2-mode + json-mode + ligature + minions + multiple-cursors + nerd-icons + nerd-icons-completion + nerd-icons-corfu + nerd-icons-dired + nerd-icons-ibuffer + ob-restclient + ob-swift + olivetti + orderless + org + org-modern + ox-gfm + ox-reveal + pulsar + rainbow-delimiters + rainbow-mode + restclient + smartparens + swift-mode + (trivialBuild { + pname = "swift-ts-mode"; + version = "main-07-05-2024"; + src = pkgs.fetchFromGitHub { + owner = "rechsteiner"; + repo = "swift-ts-mode"; + rev = "5e198d306bd4d49e4dddab39195fe99e1caf8892"; + hash = "sha256-c7AAFuaDbufMpzJtJ2PbRRXFJmo1y4L50T0idzxrvao="; + }; + }) + super-save + treesit-auto + ob-typescript + yaml-mode + vterm + fontaine + magit + magit-todos + marginalia + modus-themes + nix-mode + vertico + yasnippet + ]); + }; +} diff --git a/module/home-manager.nix b/module/home-manager.nix index 8f23449..8240946 100644 --- a/module/home-manager.nix +++ b/module/home-manager.nix @@ -1,7 +1,4 @@ { email }: { pkgs, ... }: { - home.file.".emacs.d/early-init.el".source = ../config/emacs/early-init.el; - home.file.".emacs.d/tree-sitter/libtree-sitter-swift.dylib".source = ../config/emacs/tree-sitter/libtree-sitter-swift.dylib; - home.file.".emacs.d/snippets".source = ../config/emacs/snippets; home.file.".clojure/deps.edn".source = ../config/clojure/deps.edn; @@ -69,108 +66,6 @@ nix-direnv.enable = true; }; - emacs = { - enable = true; - extraConfig = builtins.readFile ../config/emacs/init.el + - builtins.readFile ../config/emacs/lisp/utils.el; - extraPackages = epkgs: (with epkgs; [ - ace-window - apheleia - avy - cape - cider - clojure-mode - consult - (trivialBuild { - pname = "copilot"; - version = "master-12-28-2024"; - src = pkgs.fetchFromGitHub { - owner = "copilot-emacs"; - repo = "copilot.el"; - rev = "c5dfa99f05878db5e6a6a378dc7ed09f11e803d4"; - hash = "sha256-FzI08AW7a7AleEM7kSQ8LsWsDYID8SW1SmSN6/mIB/A="; - }; - packageRequires = [ - editorconfig - dash - f - jsonrpc - ]; - }) - corfu - diff-hl - dockerfile-mode - ef-themes - eglot - envrc - exec-path-from-shell - flycheck - flycheck-clj-kondo - flycheck-swiftlint - (trivialBuild { - pname = "gptel"; - version = "master-09-29-2024"; - src = pkgs.fetchFromGitHub { - owner = "karthink"; - repo = "gptel"; - rev = "2b9398a7b3bb2a66f52a8d0b1fdc3f311b2c1a3d"; - hash = "sha256-+CxSA9QmyKigbk8kB5N6kKZ/a5Tw0X4ym57AOoqYA4Y="; - }; - }) - graphql-mode - helpful - htmlize - jinx - js2-mode - json-mode - ligature - minions - multiple-cursors - nerd-icons - nerd-icons-completion - nerd-icons-corfu - nerd-icons-dired - nerd-icons-ibuffer - ob-restclient - ob-swift - olivetti - orderless - org - org-modern - ox-gfm - ox-reveal - pulsar - rainbow-delimiters - rainbow-mode - restclient - smartparens - swift-mode - (trivialBuild { - pname = "swift-ts-mode"; - version = "main-07-05-2024"; - src = pkgs.fetchFromGitHub { - owner = "rechsteiner"; - repo = "swift-ts-mode"; - rev = "5e198d306bd4d49e4dddab39195fe99e1caf8892"; - hash = "sha256-c7AAFuaDbufMpzJtJ2PbRRXFJmo1y4L50T0idzxrvao="; - }; - }) - super-save - treesit-auto - ob-typescript - yaml-mode - vterm - fontaine - magit - magit-todos - marginalia - modus-themes - nix-mode - vertico - yasnippet - ]); - }; - fzf = { enable = true; enableZshIntegration = true; diff --git a/system/darwin.nix b/system/darwin.nix index e4b9bf7..71bac40 100644 --- a/system/darwin.nix +++ b/system/darwin.nix @@ -4,10 +4,11 @@ , username , email , hostname +, extraHomeManagerModules ? [ ] }: let - system-config = import ../module/configuration.nix { inherit hostname; }; - home-manager-config = import ../module/home-manager.nix { inherit email; }; + systemConfig = import ../module/configuration.nix { inherit hostname; }; + homeManagerConfig = import ../module/home-manager.nix { inherit email; }; in inputs.darwin.lib.darwinSystem { inherit system; @@ -17,13 +18,16 @@ inputs.darwin.lib.darwinSystem { users.users.${username}.home = "/Users/${username}"; } - system-config + systemConfig inputs.home-manager.darwinModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users."${username}" = home-manager-config; + home-manager.users."${username}" = + inputs.nixpkgs.lib.modules.mkMerge ( + [ homeManagerConfig ] ++ extraHomeManagerModules + ); home-manager.backupFileExtension = "backup"; } ];