Make Emacs flake standalone

This commit is contained in:
Tobias Ostner 2026-07-18 10:57:45 +02:00
parent bad1727674
commit bbd082947e
7 changed files with 293 additions and 126 deletions

54
flakes/emacs/README.md Normal file
View file

@ -0,0 +1,54 @@
# Tobmacs flake
This flake builds the complete Emacs configuration without Home Manager. It
contains Emacs, all Emacs packages, tree-sitter grammars, snippets, Hunspell,
and dictionaries.
## Run or install directly
```console
nix run 'git+https://codeberg.org/oibot/dotfiles?dir=flakes/emacs'
nix profile install 'git+https://codeberg.org/oibot/dotfiles?dir=flakes/emacs'
```
From this repository, use `nix run path:./flakes/emacs`.
## NixOS
Add the flake as an input and make its nixpkgs follow the system nixpkgs:
```nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
tobs-emacs = {
url = "git+https://codeberg.org/oibot/dotfiles?dir=flakes/emacs";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, tobs-emacs, ... }: {
nixosConfigurations.server = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
tobs-emacs.nixosModules.default
{
# Installs Tobmacs and starts an Emacs user service. No Home Manager
# module is involved.
services.emacs.enable = true;
services.emacs.startWithGraphical = false;
}
];
};
};
}
```
If no daemon is wanted, either set `services.emacs.install = true` instead of
`enable`, or install the package directly:
```nix
environment.systemPackages = [
tobs-emacs.packages.${pkgs.stdenv.hostPlatform.system}.default
];
```