mirror of
https://github.com/nix-community/nix-doom-emacs
synced 2025-08-09 12:57:26 -05:00
improve documentation
This commit is contained in:
16
README.md
16
README.md
@ -1,3 +1,5 @@
|
||||
<table><tr><th>faq</th><th>readme</th><th>reference</th></tr><tr><th>[docs/faq.md](./faq.md)</th><th>this document</th><th>[docs/reference.md](./docs/reference.md)</th></tr></table>
|
||||
|
||||
# nix-doom-emacs
|
||||
|
||||
| | Status |
|
||||
@ -9,6 +11,8 @@
|
||||
Nix expression to install and configure
|
||||
[doom-emacs](https://github.com/doomemacs/doomemacs).
|
||||
|
||||
nix-doom-emacs (also commonly referred to as NDE in chatrooms) is a project with lots of moving pieces and hacks. Users are expected to know their way around using (and especially debugging) Nix and Emacs Lisp in order to use this project.
|
||||
|
||||
The expression builds a `doom-emacs` distribution with dependencies
|
||||
pre-installed based on an existing `~/.doom.d` directory.
|
||||
|
||||
@ -19,15 +23,9 @@ compatible with the `doom-emacs` requirements.
|
||||
|
||||
# Quick Start
|
||||
|
||||
If you want to get a taste of nix-doom-emacs, you can run:
|
||||
|
||||
```
|
||||
$ nix run github:nix-community/nix-doom-emacs
|
||||
```
|
||||
|
||||
If you want to get a taste of nix-doom-emacs, you can run ``nix run github:nix-community/nix-doom-emacs``
|
||||
Which will run nix-doom-emacs with an example configuration.
|
||||
Continue to [the documentation](./docs) to learn how to customise your setup further to your needs.
|
||||
|
||||
Pick which setup you're using here (if you're not using NixOS or Home-Manager, then you should use standalone):
|
||||
<table><tr>Home-Manager<th></th><th>NixOS</th><th>Standalone</th></tr><tr><th>[Flake + Home-Manager](./docs/reference.md#flake--home-manager)</th><th>[NixOS](./docs/reference.md#nixos)</th><th>[Standalone](./docs/reference.md#standalone)</th></tr></table>
|
||||
|
||||
# Documentation
|
||||
To know how to use nix-doom-emacs, and to fix other issues, check the [documentation](./docs)
|
||||
|
163
docs/README.md
163
docs/README.md
@ -1,163 +0,0 @@
|
||||
# Documentation for nix-doom-emacs
|
||||
|
||||
nix-doom-emacs (also commonly referred to as NDE in chatrooms) is a project with lots of moving pieces and hacks. Users are expected to know their way around using (and especially debugging) Nix and Emacs Lisp before using this project.
|
||||
|
||||
If you encounter any issues that make it unusable to you (or if you need support), please talk to us first in the [Matrix room](https://matrix.to/#/#doom-emacs:nixos.org) and if it's indeed a bug of nix-doom-emacs, file it in the [issue tracker](https://github.com/nix-community/nix-doom-emacs/issues).
|
||||
|
||||
If you find this documentation unclear or incomplete, please let us know as well.
|
||||
|
||||
Here's the [FAQ](./faq.md)
|
||||
|
||||
nix-doom-emacs uses [`nix-straight.el`](https://github.com/nix-community/nix-straight.el) under the hood to install dependencies. It's a low level wrapper to add Nix integration over [`straight.el`](https://github.com/radian-software/straight.el), the declarative package manager used by Doom Emacs.
|
||||
|
||||
Before using nix-doom-emacs, make sure to read [`nix-straight.el`'s README'](https://github.com/nix-community/nix-straight.el), and that you understand the consequences.
|
||||
|
||||
# Getting Started
|
||||
|
||||
To get started, we suggest these methods. They are ordered from most suggested to least suggested.
|
||||
In all of these methods, you'll need your Doom Emacs configuration. It should contain the following three files:
|
||||
`config.el`, `init.el` and `packages.el`. If you don't already have an existing `doom-emacs` configuration, you can use the contents of `test/doom.d` as a template.
|
||||
|
||||
The Doom configuration will be referred to as `./doom.d` in these snippets. You can name it whatever you like.
|
||||
|
||||
## Flake + Home-Manager
|
||||
|
||||
`File: flake.nix`
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
nix-doom-emacs.url = "github:nix-community/nix-doom-emacs";
|
||||
};
|
||||
|
||||
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 = { ... }: {
|
||||
imports = [ nix-doom-emacs.hmModule ];
|
||||
programs.doom-emacs = {
|
||||
enable = true;
|
||||
doomPrivateDir = ./doom; # Directory containing your config.el, init.el
|
||||
# and packages.el files
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Non-Flake Home-Manager
|
||||
|
||||
```nix
|
||||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
doom-emacs = pkgs.callPackage (builtins.fetchTarball {
|
||||
url = https://github.com/nix-community/nix-doom-emacs/archive/master.tar.gz;
|
||||
}) {
|
||||
doomPrivateDir = ./doom.d; # Directory containing your config.el, init.el
|
||||
# and packages.el files
|
||||
};
|
||||
in {
|
||||
home.packages = [ doom-emacs ];
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## NixOS
|
||||
|
||||
`File: flake.nix`
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nix-doom-emacs.url = "github:nix-community/nix-doom-emacs";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
nix-doom-emacs,
|
||||
...
|
||||
}: {
|
||||
nixosConfigurations.exampleHost = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
{
|
||||
environment.systemPackages =
|
||||
let
|
||||
doom-emacs = inputs.nix-doom-emacs.packages.${system}.defaut.override {
|
||||
doomPrivateDir = ./doom;
|
||||
};
|
||||
in [
|
||||
doom-emacs
|
||||
];
|
||||
}
|
||||
# ...
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
For what it's worth, you can see all overridable parameters of nix-doom-emacs in [default.nix](../default.nix).
|
||||
|
||||
## Standalone
|
||||
|
||||
### Flake
|
||||
|
||||
```nix
|
||||
{
|
||||
description = "nix-doom-emacs shell";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
nix-doom-emacs.url = "github:nix-community/nix-doom-emacs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nix-doom-emacs, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
doom-emacs = nix-doom-emacs.packages.${system}.default.override {
|
||||
doomPrivateDir = ./doom.d;
|
||||
};
|
||||
in
|
||||
{
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
buildInputs = [ doom-emacs ];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Non-Flake
|
||||
```nix
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
let
|
||||
repo = pkgs.fetchFromGitHub {
|
||||
owner = "nix-community";
|
||||
repo = "nix-doom-emacs";
|
||||
rev = "<commit>";
|
||||
sha256 = "<hash>";
|
||||
};
|
||||
nix-doom-emacs = pkgs.callPackage (import repo) {
|
||||
doomPrivateDir = ./doom.d;
|
||||
};
|
||||
in
|
||||
pkgs.mkShell {
|
||||
buildInputs = [ nix-doom-emacs ];
|
||||
}
|
||||
```
|
110
docs/faq.md
110
docs/faq.md
@ -1,3 +1,5 @@
|
||||
<table><tr><th>faq</th><th>readme</th><th>reference</th></tr><tr><th>this document</th><th>[README.md](/README.md)</th><th>[docs/reference.md](./docs/reference.md)</th></tr></table>
|
||||
|
||||
# FAQ
|
||||
This is more meant as a "Fully Anticipated Questions" than a "Frequently Asked Questions", as they're anticipated as common pitfalls to using NDE.
|
||||
|
||||
@ -9,7 +11,10 @@ Nope! Doom Emacs is still perfectly usable imperatively. In fact, the very autho
|
||||
|
||||
To update your Doom Emacs config, you simply rebuild your configuration. For example, in NixOS you can use `nixos-rebuild switch` (or `home-manager switch` if you use Home-Manager standalone). nix-doom-emacs will do everything else for you.
|
||||
|
||||
## How do I install my favourite package?
|
||||
In an imperative environment, Doom updates can break Emacs with no easy way to roll back.
|
||||
nix-doom-emacs moves the moving parts of your Emacs installation into the Nix build sandbox.
|
||||
|
||||
## How do I add a native dependency to a package's build?
|
||||
|
||||
You should use the `emacsPackagesOverlay` attribute. Here's an example that installs `magit-delta`, which depends on Git:
|
||||
|
||||
@ -24,7 +29,7 @@ programs.doom-emacs = {
|
||||
};
|
||||
```
|
||||
|
||||
### But what if my package is from a Git source, and isn't on ELPA?
|
||||
## How do I add a package that's only on GitHub (or any Git frontend)
|
||||
|
||||
This requires a few more lines, but it isn't by any means difficult. For an example, this installs `idris2-mode` which isn't on ELPA, but is hosted on GitHub:
|
||||
|
||||
@ -48,104 +53,11 @@ programs.doom-emacs = {
|
||||
};
|
||||
```
|
||||
|
||||
### Help! My favourite package doesn't work after adding it in!
|
||||
## nix-doom-emacs isn't working if I set DOOMDIR or EMACSDIR
|
||||
|
||||
This usually happens when the package depends on either some ELPA package or a normal package that you need to add into the `buildInputs` to make it work.
|
||||
Let's take the above `idris2-mode` package, and I'll remove the `buildInputs` line:
|
||||
You shouldn't do that. nix-doom-emacs' home-manager module only writes `~/.emacs.d/init.el` in your `$HOME`, which points to the Nix store. Make sure to remove the environment variables from your configuration, then reboot after rebuilding it. If for just the session, you can just `unset` those 2 variables.
|
||||
|
||||
**WARNING**: THIS IS ERRONEOUS CODE FOR DEMONSTRATION. DO NOT USE THIS SNIPPET, THE ABOVE ONE IS THE FUNCTIONING VERSION.
|
||||
```nix
|
||||
programs.doom-emacs = {
|
||||
# ...
|
||||
emacsPackagesOverlay = self: super: {
|
||||
idris2-mode = self.trivialBuild {
|
||||
pname = "idris2-mode";
|
||||
ename = "idris2-mode";
|
||||
version = "0.0.0";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "idris-community";
|
||||
repo = "idris2-mode";
|
||||
rev = "4a3f9cdb1a155da59824e39f0ac78ccf72f2ca97";
|
||||
sha256 = "sha256-TxsGaG2fBRWWP9aas59kiNnUVD4ZdNlwwaFbM4+n81c=";
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
This will error with (this is a part of the build log):
|
||||
|
||||
```
|
||||
In toplevel form:
|
||||
idris2-hole-list.el:27:2: Error: Cannot open load file: No such file or directory, prop-menu
|
||||
|
||||
In toplevel form:
|
||||
idris2-info.el:29:2: Error: Cannot open load file: No such file or directory, prop-menu
|
||||
|
||||
In idris2-ipkg-pkgs-flags-for-current-buffer:
|
||||
idris2-ipkg-mode.el:372:2: Warning: docstring wider than 80 characters
|
||||
|
||||
In toplevel form:
|
||||
idris2-mode.el:20:2: Error: Cannot open load file: No such file or directory, prop-menu
|
||||
|
||||
In idris2-prover-end:
|
||||
idris2-prover.el:378:2: Warning: docstring wider than 80 characters
|
||||
|
||||
In toplevel form:
|
||||
idris2-repl.el:29:2: Error: Cannot open load file: No such file or directory, prop-menu
|
||||
```
|
||||
|
||||
The way to fix it is by just adding the dependency it's complaining about.
|
||||
|
||||
Though, not all packages will complain very clearly about missing dependencies or really any issue. The best way to know how to get around this is to know how to debug Nix packages and derivations. Tools like `nix build`, `nix repl`, and `nix log` are your friend. Especially if you want to debug another person's configuration, or your own nix-doom-emacs configuration without needing to `nixos-rebuild` it, then `nix build` is very useful.
|
||||
|
||||
For an example, if a person is using Home-Manager+NixOS, then you can build their configuration via `nix build $CONFIG_PATH_HERE#nixosConfigurations.nixos.config.home-manager.users.$USER_HERE.programs.doom-emacs.package`. You need to replace `$CONFIG_PATH_HERE` with the path (like `.` if it's in the current directory), and `$USER_HERE` with the user. This could fail, and if it does, it'll tell you to use the `nix log` command to look at the full log. This will be important.
|
||||
|
||||
For the `nix repl` command, it could be very useful for debugging as well. To know how to use it, I suggest [nix pills](https://nixos.org/guides/nix-pills/index.html), and to look at [the nix manual](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-repl.html)
|
||||
|
||||
## How do I enable the service?
|
||||
|
||||
There aren't many complications about this. If you use the Home-Manager module, it's simply `services.emacs.enable = true;`. The Home-Manager module will do the rest for you.
|
||||
|
||||
If you're not, and you're using a standalone method (NixOS only without home-manager/nix-darwin) instead, you'll need:
|
||||
|
||||
```nix
|
||||
services.emacs = {
|
||||
enable = true;
|
||||
package = inputs.doom-emacs.packages.${system}.doom-emacs.override {
|
||||
doomPrivateDir = ./doom;
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
You can now run `emacsclient -c` to connect to the daemon.
|
||||
|
||||
## What is `trivialBuild`?
|
||||
|
||||
Though beyond the scope of this document, [`trivialBuild`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/emacs/trivial.nix) is a Nixpkgs function to trivially build Emacs packages. You can use it to build e.g. local packages or packages hosted on Git repositories. It is not a nix-doom-emacs tool. It's also in a family of functions in Nixpkgs which are made to build Emacs packages. Such as:
|
||||
|
||||
[`generic`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/emacs/generic.nix): This is the "base" function which all the other build functions are derived from.
|
||||
|
||||
[`elpaBuild`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/emacs/elpa.nix), and [`melpaBuild`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/emacs/elpa.nix): Those are self-explanatory. To find examples of how they're used, you'll unfortunately have to [search Nixpkgs](https://github.com/NixOS/nixpkgs/search) for them. Luckily, the way they're used in Nixpkgs is very simple.
|
||||
|
||||
For what it's worth, this will not be the last time you muddle around in the Nixpkgs code to understand how to use something. The NixOS project is known to have very bad documentation, and unfortunately the code may be your only way to understand some things.
|
||||
|
||||
## Help! nix-doom-emacs isn't working if I set DOOMDIR or EMACSDIR
|
||||
|
||||
You shouldn't do that. The only thing that nix-doom-emacs writes in your $HOME is `~/.emacs.d/init.el`, which points to the Nix store. Make sure to remove them from your configuration, then reboot after rebuilding it. If for just the session, you can just `unset` those 2 variables.
|
||||
|
||||
## Help! on MacOS, it says "Too many files open"!
|
||||
## I'm on MacOS and it says "Too many files open"!
|
||||
|
||||
Running `ulimit -S -n 2048` will fix it for the duration of your shell session.
|
||||
|
||||
## How do I use emacs-overlay's emacs with nix-doom-emacs?
|
||||
|
||||
This is very simple. you just use the `emacsPackage` attribute after applying `emacs-overlay` to your Nixpkgs. something like:
|
||||
|
||||
```nix
|
||||
programs.doom-emacs = {
|
||||
enable = true;
|
||||
doomPrivateDir = ./doom;
|
||||
emacsPackage = pkgs.emacsPgtkNativeComp; # I used the native comp pgtk as an example
|
||||
}
|
||||
```
|
||||
For a more permanent solution, NixOS has [`security.pam.loginLimits`](https://search.nixos.org/options?channel=22.05&from=0&size=50&sort=relevance&type=packages&query=security.pam.loginLimits)
|
||||
|
225
docs/reference.md
Normal file
225
docs/reference.md
Normal file
@ -0,0 +1,225 @@
|
||||
<table><tr><th>faq</th><th>readme</th><th>reference</th></tr><tr><th>[docs/faq.md](./faq.md)</th><th>[README.md](/README.md)</th><th>this document</th></tr></table>
|
||||
|
||||
# nix-doom-emacs reference
|
||||
|
||||
If you encounter any issues while using nix-doom-emacs, you can find some of us in the [Matrix room](https://matrix.to/#/#doom-emacs:nixos.org). Only bugs should be filed in our [issue tracker](https://github.com/nix-community/nix-doom-emacs/issues).
|
||||
|
||||
nix-doom-emacs uses [`nix-straight.el`](https://github.com/nix-community/nix-straight.el) under the hood to install dependencies. It's a low level wrapper to integrate Nix with [`straight.el`](https://github.com/radian-software/straight.el). It is maintained by the same people as this project.
|
||||
|
||||
Currently, `nix-straight.el` only extracts package names and uses [`emacs-overlay`](https://github.com/nix-community/emacs-overlay) to obtain the package sources. This works most of the time but occasionally results in very obscure issues.
|
||||
|
||||
# Getting Started
|
||||
|
||||
To get started, we suggest these methods. They are ordered from most suggested to least suggested.
|
||||
In all of these methods, you'll need your Doom Emacs configuration. It should contain the following three files:
|
||||
`config.el`, `init.el` and `packages.el`. If you don't already have an existing `doom-emacs` configuration, you can use the contents of `test/doom.d` as a template.
|
||||
|
||||
## Home-Manager
|
||||
|
||||
### With Flakes
|
||||
|
||||
`File: flake.nix`
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
nix-doom-emacs.url = "github:nix-community/nix-doom-emacs";
|
||||
};
|
||||
|
||||
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 = { ... }: {
|
||||
imports = [ nix-doom-emacs.hmModule ];
|
||||
programs.doom-emacs = {
|
||||
enable = true;
|
||||
doomPrivateDir = ./doom.d; # Directory containing your config.el, init.el
|
||||
# and packages.el files
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Without Flakes
|
||||
|
||||
```nix
|
||||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
doom-emacs = pkgs.callPackage (builtins.fetchTarball {
|
||||
url = https://github.com/nix-community/nix-doom-emacs/archive/master.tar.gz;
|
||||
}) {
|
||||
doomPrivateDir = ./doom.d; # Directory containing your config.el, init.el
|
||||
# and packages.el files
|
||||
};
|
||||
in {
|
||||
home.packages = [ doom-emacs ];
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## NixOS
|
||||
|
||||
`File: flake.nix`
|
||||
```nix
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nix-doom-emacs.url = "github:nix-community/nix-doom-emacs";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
nix-doom-emacs,
|
||||
...
|
||||
}: {
|
||||
nixosConfigurations.exampleHost = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
{
|
||||
environment.systemPackages =
|
||||
let
|
||||
doom-emacs = inputs.nix-doom-emacs.packages.${system}.defaut.override {
|
||||
doomPrivateDir = ./doom.d;
|
||||
};
|
||||
in [
|
||||
doom-emacs
|
||||
];
|
||||
}
|
||||
# ...
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
For what it's worth, you can see all overridable parameters of nix-doom-emacs in [default.nix](../default.nix).
|
||||
|
||||
## Standalone
|
||||
|
||||
### Flake
|
||||
|
||||
```nix
|
||||
{
|
||||
description = "nix-doom-emacs shell";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
nix-doom-emacs.url = "github:nix-community/nix-doom-emacs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nix-doom-emacs, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
doom-emacs = nix-doom-emacs.packages.${system}.default.override {
|
||||
doomPrivateDir = ./doom.d;
|
||||
};
|
||||
in
|
||||
{
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
buildInputs = [ doom-emacs ];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### Non-Flake
|
||||
```nix
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
let
|
||||
repo = pkgs.fetchFromGitHub {
|
||||
owner = "nix-community";
|
||||
repo = "nix-doom-emacs";
|
||||
rev = "<commit>";
|
||||
sha256 = "<hash>";
|
||||
};
|
||||
nix-doom-emacs = pkgs.callPackage (import repo) {
|
||||
doomPrivateDir = ./doom.d;
|
||||
};
|
||||
in
|
||||
pkgs.mkShell {
|
||||
buildInputs = [ nix-doom-emacs ];
|
||||
}
|
||||
```
|
||||
|
||||
# Setup
|
||||
|
||||
## Emacs daemon
|
||||
If you use the Home-Manager module, you can enable it via `services.emacs.enable = true;`. The Home-Manager module will do the rest for you.
|
||||
|
||||
If you're not, and you're using a standalone method (NixOS only without home-manager/nix-darwin) instead, you'll need:
|
||||
|
||||
```nix
|
||||
services.emacs = {
|
||||
enable = true;
|
||||
package = inputs.doom-emacs.packages.${system}.doom-emacs.override {
|
||||
doomPrivateDir = ./doom.d;
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
You can now run `emacsclient -c` to connect to the daemon.
|
||||
|
||||
## Custom Emacs derivations (i.e., pgtk, nativeComp)
|
||||
|
||||
You can use the `emacsPackage` attribute after applying `emacs-overlay` to your Nixpkgs:
|
||||
|
||||
```nix
|
||||
programs.doom-emacs = {
|
||||
enable = true;
|
||||
doomPrivateDir = ./doom.d;
|
||||
emacsPackage = pkgs.emacsPgtkNativeComp;
|
||||
}
|
||||
```
|
||||
|
||||
For Non-HM:
|
||||
|
||||
```nix
|
||||
let
|
||||
# ...
|
||||
doom-emacs = nix-doom-emacs.packages.${system}.default.override {
|
||||
doomPrivateDir = ./doom.d;
|
||||
emacsPackage = pkgs.emacsPgtkNativeComp;
|
||||
};
|
||||
in {
|
||||
# ...
|
||||
}
|
||||
```
|
||||
|
||||
And for Non-Flake:
|
||||
```nix
|
||||
let
|
||||
# ...
|
||||
nix-doom-emacs = pkgs.callPackage (import repo) {
|
||||
doomPrivateDir = ./doom.d;
|
||||
emacsPackage = pkgs.emacsPgtkNativeComp
|
||||
};
|
||||
in {
|
||||
# ...
|
||||
}
|
||||
```
|
||||
|
||||
## trivialBuild and co
|
||||
|
||||
Though beyond the scope of this document, [`trivialBuild`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/emacs/trivial.nix) is a Nixpkgs function to trivially build Emacs packages, if you're confused about it's usage here. You can use it to build e.g. local packages or packages hosted on Git repositories. It is not a nix-doom-emacs tool. It's also in a family of functions in Nixpkgs which are made to build Emacs packages. Such as:
|
||||
|
||||
[`generic`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/emacs/generic.nix): This is the "base" function which all the other build functions are derived from.
|
||||
|
||||
[`elpaBuild`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/emacs/elpa.nix), and [`melpaBuild`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/emacs/elpa.nix): Those are self-explanatory. To find examples of how they're used, you'll unfortunately have to [search Nixpkgs](https://github.com/NixOS/nixpkgs/search) for them. Luckily, the way they're used in Nixpkgs is very simple.
|
Reference in New Issue
Block a user