summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Santiago <[email protected]>2025-05-05 08:41:22 -0300
committerLeonardo Santiago <[email protected]>2025-05-05 08:41:22 -0300
commit988c9b4d79d502294c3309d193987f776af5c676 (patch)
treeb2c3c1f23d887313f954e07683c461dc6289d0ea
parentb8b8078854b9249ec2b73f21e42cadc3a4952c7a (diff)
chore(emacs): re-expose emacs as a package output in the flake
-rw-r--r--flake.nix5
-rw-r--r--modules/emacs/default.nix41
-rw-r--r--modules/emacs/package.nix33
3 files changed, 43 insertions, 36 deletions
diff --git a/flake.nix b/flake.nix
index c9b988a..1054d01 100644
--- a/flake.nix
+++ b/flake.nix
@@ -20,6 +20,10 @@
outputs = { self, nixpkgs, deploy-rs, ... } @ inputs : let
inherit (builtins) readDir attrNames listToAttrs split head;
+ pkgs = import nixpkgs {
+ overlays = [ (inputs.emacs-overlay.overlays.default) ];
+ system = "x86_64-linux";
+ };
modules = map (p: ./modules/${p}) (attrNames (readDir ./modules));
make-config-named = host: nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
@@ -33,6 +37,7 @@
nixos-configs = map (h: { name= h; value = make-config-named h;}) hosts-names;
in rec {
nixosConfigurations = listToAttrs nixos-configs;
+ packages.x86_64-linux.emacs = pkgs.callPackage ./modules/emacs/package.nix {};
deploy.nodes.iori = {
hostname = "ssh.santi.net.br";
remoteBuild = true;
diff --git a/modules/emacs/default.nix b/modules/emacs/default.nix
index 91a6069..6143cde 100644
--- a/modules/emacs/default.nix
+++ b/modules/emacs/default.nix
@@ -1,43 +1,12 @@
-{ pkgs, inputs, lib, config, ...}:
-let
- outside-emacs = with pkgs; [
- git
- nil
- ripgrep
- emacs-lsp-booster
- delta
- ];
- emacs = pkgs.emacsWithPackagesFromUsePackage {
- package = pkgs.emacs-unstable.override {
- withGTK3 = true;
- withNativeCompilation = true;
- withAlsaLib = true;
- withSystemd = true;
- withToolkitScrollBars = true;
- withImageMagick = true;
- };
- override = epkgs: let
- callPackage = pkgs.lib.callPackageWith (pkgs // epkgs);
- in epkgs // {
- eglot-booster = callPackage ./eglot-booster.nix {};
- };
- config = ./README.org;
- alwaysTangle = true;
- defaultInitFile = true;
- extraEmacsPackages = epkgs: [
- (epkgs.treesit-grammars.with-grammars (g: with g; [
- tree-sitter-rust
- tree-sitter-python
- ]))
- ];
- };
-in with lib; {
+{ pkgs, inputs, config, lib, ...}: let
+ inherit (lib) mkEnableOption mkIf;
+in {
options.santi-modules.emacs.enable = mkEnableOption "Enable emacs configuration";
config = mkIf config.santi-modules.emacs.enable {
nixpkgs.overlays = [ inputs.emacs-overlay.overlays.default ];
environment.systemPackages = [
- emacs
- ] ++ outside-emacs;
+ pkgs.callPackage ./package.nix {}
+ ];
fonts.packages = with pkgs; [
nerd-fonts.dejavu-sans-mono
];
diff --git a/modules/emacs/package.nix b/modules/emacs/package.nix
new file mode 100644
index 0000000..9bebd0f
--- /dev/null
+++ b/modules/emacs/package.nix
@@ -0,0 +1,33 @@
+{ pkgs }: let
+ outside-emacs = with pkgs; [
+ git
+ nil
+ ripgrep
+ emacs-lsp-booster
+ delta
+ ];
+in
+ pkgs.emacsWithPackagesFromUsePackage {
+ package = pkgs.emacs-unstable.override {
+ withGTK3 = true;
+ withNativeCompilation = true;
+ withAlsaLib = true;
+ withSystemd = true;
+ withToolkitScrollBars = true;
+ withImageMagick = true;
+ };
+ override = epkgs: let
+ callPackage = pkgs.lib.callPackageWith (pkgs // epkgs);
+ in epkgs // {
+ eglot-booster = callPackage ./eglot-booster.nix {};
+ };
+ config = ./README.org;
+ alwaysTangle = true;
+ defaultInitFile = true;
+ extraEmacsPackages = epkgs: [
+ (epkgs.treesit-grammars.with-grammars (g: with g; [
+ tree-sitter-rust
+ tree-sitter-python
+ ]))
+ ] ++ outside-emacs;
+ }