mirror of
https://github.com/nix-community/nix-doom-emacs
synced 2025-09-18 16:06:59 -05:00
Merge remote-tracking branch 'origin/develop' into master
This commit is contained in:
37
README.md
37
README.md
@@ -15,7 +15,7 @@ compatible with the `doom-emacs` requirements.
|
||||
|
||||
Using [home-manager](https://github.com/rycee/home-manager):
|
||||
|
||||
``` nix
|
||||
``` nix
|
||||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
@@ -33,6 +33,41 @@ in {
|
||||
}
|
||||
```
|
||||
|
||||
Using `flake.nix`:
|
||||
|
||||
``` nix
|
||||
{
|
||||
inputs = {
|
||||
home-manager.url = "github:rycee/home-manager";
|
||||
nix-doom-emacs.url = "github:vlaci/nix-doom-emacs/flake";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
nix-doom-emacs,
|
||||
...
|
||||
}: {
|
||||
nixosConfigurations.exampleHost = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.users.exampleUser = { pkgs, ... }: {
|
||||
imports = [ nix-doom-emacs.hmModule ];
|
||||
home.doom-emacs = {
|
||||
enable = true;
|
||||
doomPrivateDir = ./doom.d;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Under the hood
|
||||
|
||||
This expression leverages
|
||||
|
76
flake.nix
Normal file
76
flake.nix
Normal file
@@ -0,0 +1,76 @@
|
||||
/* Usage example in flake.nix:
|
||||
|
||||
{
|
||||
inputs = {
|
||||
home-manager.url = "github:rycee/home-manager";
|
||||
nix-doom-emacs.url = "github:vlaci/nix-doom-emacs/flake";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
nix-doom-emacs,
|
||||
...
|
||||
}: {
|
||||
nixosConfigurations.exampleHost = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.users.exampleUser = { pkgs, ... }: {
|
||||
imports = [ nix-doom-emacs.hmModule ];
|
||||
home.doom-emacs = {
|
||||
enable = true;
|
||||
doomPrivateDir = ./path/to/doom.d;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
*/
|
||||
|
||||
{
|
||||
description = "nix-doom-emacs home-manager module";
|
||||
|
||||
inputs = {
|
||||
doom-emacs.url = "github:hlissner/doom-emacs/develop";
|
||||
doom-emacs.flake = false;
|
||||
doom-snippets.url = "github:hlissner/doom-snippets";
|
||||
doom-snippets.flake = false;
|
||||
emacs-overlay.url = "github:nix-community/emacs-overlay";
|
||||
emacs-overlay.flake = false;
|
||||
emacs-so-long.url = "github:hlissner/emacs-so-long";
|
||||
emacs-so-long.flake = false;
|
||||
evil-markdown.url = "github:Somelauw/evil-markdown";
|
||||
evil-markdown.flake = false;
|
||||
evil-org-mode.url = "github:hlissner/evil-org-mode";
|
||||
evil-org-mode.flake = false;
|
||||
evil-quick-diff.url = "github:rgrinberg/evil-quick-diff";
|
||||
evil-quick-diff.flake = false;
|
||||
explain-pause-mode.url = "github:lastquestion/explain-pause-mode";
|
||||
explain-pause-mode.flake = false;
|
||||
"nix-straight.el".url = "github:vlaci/nix-straight.el/v2.1.0";
|
||||
"nix-straight.el".flake = false;
|
||||
nose.url= "github:emacsattic/nose";
|
||||
nose.flake = false;
|
||||
ob-racket.url = "github:xchrishawk/ob-racket";
|
||||
ob-racket.flake = false;
|
||||
org-mode.url = "github:emacs-straight/org-mode";
|
||||
org-mode.flake = false;
|
||||
org-yt.url = "github:TobiasZawada/org-yt";
|
||||
org-yt.flake = false;
|
||||
php-extras.url = "github:arnested/php-extras";
|
||||
php-extras.flake = false;
|
||||
"reveal.js".url = "github:hakimel/reveal.js";
|
||||
"reveal.js".flake = false;
|
||||
"rotate-text.el".url = "github:debug-ito/rotate-text.el";
|
||||
"rotate-text.el".flake = false;
|
||||
};
|
||||
|
||||
outputs = inputs: {
|
||||
hmModule = import ./modules/home-manager.nix inputs;
|
||||
};
|
||||
}
|
104
modules/home-manager.nix
Normal file
104
modules/home-manager.nix
Normal file
@@ -0,0 +1,104 @@
|
||||
{ self, ... }@inputs:
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.programs.doom-emacs;
|
||||
inherit (lib) literalExample mkEnableOption mkIf mkOption types;
|
||||
overlayType = lib.mkOptionType {
|
||||
name = "overlay";
|
||||
description = "Emacs packages overlay";
|
||||
check = lib.isFunction;
|
||||
merge = lib.mergeOneOption;
|
||||
};
|
||||
in
|
||||
{
|
||||
options.programs.doom-emacs = {
|
||||
enable = mkEnableOption "Doom Emacs configuration";
|
||||
doomPrivateDir = mkOption {
|
||||
description = ''
|
||||
Path to your `.doom.d` directory.
|
||||
|
||||
The specified directory should contain yoour `init.el`, `config.el` and
|
||||
`packages.el` files.
|
||||
'';
|
||||
apply = path: builtins.path { inherit path; };
|
||||
};
|
||||
extraConfig = mkOption {
|
||||
description = ''
|
||||
Extra configuration options to pass to doom-emacs.
|
||||
|
||||
Elisp code set here will be appended at the end of `config.el`. This
|
||||
option is useful for refering `nixpkgs` derivation in Emacs without the
|
||||
need to install them globally.
|
||||
'';
|
||||
type = with types; lines;
|
||||
default = "";
|
||||
example = literalExample ''
|
||||
(setq mu4e-mu-binary = "''${pkgs.mu}/bin/mu")
|
||||
'';
|
||||
};
|
||||
extraPackages = mkOption {
|
||||
description = ''
|
||||
Extra packages to install.
|
||||
|
||||
List addition non-emacs packages here that ship elisp emacs bindings.
|
||||
'';
|
||||
type = with types; listOf package;
|
||||
default = [ ];
|
||||
example = literalExample "[ pkgs.mu ]";
|
||||
};
|
||||
emacsPackage = mkOption {
|
||||
description = ''
|
||||
Emacs package to use.
|
||||
|
||||
Override this if you want to use a custom emacs derivation to base
|
||||
`doom-emacs` on.
|
||||
'';
|
||||
type = with types; package;
|
||||
default = pkgs.emacs;
|
||||
example = literalExample "pkgs.emacs";
|
||||
};
|
||||
emacsPackagesOverlay = mkOption {
|
||||
description = ''
|
||||
Overlay to customize emacs (elisp) dependencies.
|
||||
|
||||
As inputs are gathered dynamically, this is the only way to hook into
|
||||
package customization.
|
||||
'';
|
||||
type = with types; overlayType;
|
||||
default = self: super: { };
|
||||
defaultText = "self: super { }";
|
||||
example = literalExample ''
|
||||
self: super: {
|
||||
magit-delta = super.magit-delta.overrideAttrs (esuper: {
|
||||
buildInputs = esuper.buildInputs ++ [ pkgs.git ];
|
||||
});
|
||||
};
|
||||
'';
|
||||
};
|
||||
package = mkOption {
|
||||
internal = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (
|
||||
let
|
||||
emacs = pkgs.callPackage self {
|
||||
extraPackages = (epkgs: cfg.extraPackages);
|
||||
emacsPackages = pkgs.emacsPackagesFor cfg.emacsPackage;
|
||||
inherit (cfg) doomPrivateDir extraConfig emacsPackagesOverlay;
|
||||
dependencyOverrides = inputs;
|
||||
};
|
||||
in
|
||||
{
|
||||
home.file.".emacs.d/init.el".text = ''
|
||||
(load "default.el")
|
||||
'';
|
||||
home.packages = with pkgs; [
|
||||
emacs-all-the-icons-fonts
|
||||
];
|
||||
programs.emacs.package = emacs;
|
||||
programs.emacs.enable = true;
|
||||
programs.doom-emacs.package = emacs;
|
||||
}
|
||||
);
|
||||
}
|
@@ -5,10 +5,10 @@
|
||||
"homepage": "",
|
||||
"owner": "hlissner",
|
||||
"repo": "doom-emacs",
|
||||
"rev": "adff1aa68da379370cfd6a7605fc15c28ade52f1",
|
||||
"sha256": "1655jhcvjjgz6gf0j8aaxvfylh81m5d86bq2x1li3q6vpd1n9j27",
|
||||
"rev": "57ef63d6ba8432067a2c32cca3f5ccd369d21099",
|
||||
"sha256": "1zsw33mb2j852phql6qqqd7yr41h67azy3g5603fx212lfhzai1m",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/hlissner/doom-emacs/archive/adff1aa68da379370cfd6a7605fc15c28ade52f1.tar.gz",
|
||||
"url": "https://github.com/hlissner/doom-emacs/archive/57ef63d6ba8432067a2c32cca3f5ccd369d21099.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"doom-snippets": {
|
||||
@@ -29,10 +29,10 @@
|
||||
"homepage": "",
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "a65baf3d03b54cf9282c30cbcc5895e29be84ff2",
|
||||
"sha256": "1b21b5xqqh7avhb240szhnj9d9b7ya02a8bf9pv2i2wx7dw37ikn",
|
||||
"rev": "489f44aa462cea641d344e6b744296b3c07427a6",
|
||||
"sha256": "1i44w1668w0wj3qsnxrfm6ln0x1cs0ljlxj6303c9jpr1mpg9fgc",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/nix-community/emacs-overlay/archive/a65baf3d03b54cf9282c30cbcc5895e29be84ff2.tar.gz",
|
||||
"url": "https://github.com/nix-community/emacs-overlay/archive/489f44aa462cea641d344e6b744296b3c07427a6.tar.gz",
|
||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"emacs-so-long": {
|
||||
|
Reference in New Issue
Block a user