mirror of
https://github.com/nix-community/nix-doom-emacs
synced 2025-08-07 12:47:32 -05:00
wip: flake support
This commit is contained in:
79
flake.nix
Normal file
79
flake.nix
Normal file
@ -0,0 +1,79 @@
|
||||
/* Usage example in flake.nix:
|
||||
|
||||
{
|
||||
inputs = {
|
||||
home-manager.url = "github:rycee/home-manager";
|
||||
nix-doom-emacs.url = "github:vlaci/nix-doom-emacs/flake";
|
||||
doomPrivateDir.url = "/path/to/doom.d";
|
||||
doomPrivateDir.flake = false;
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
nix-doom-emacs,
|
||||
doomPrivateDir,
|
||||
...
|
||||
}: {
|
||||
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;
|
||||
inherit doomPrivateDir;
|
||||
};
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
*/
|
||||
|
||||
{
|
||||
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;
|
||||
};
|
||||
}
|
67
modules/home-manager.nix
Normal file
67
modules/home-manager.nix
Normal file
@ -0,0 +1,67 @@
|
||||
{ self, ... }@inputs:
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.programs.doom-emacs;
|
||||
inherit (lib) literalExample mkEnableOption mkIf mkOption types;
|
||||
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.
|
||||
'';
|
||||
};
|
||||
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 ]";
|
||||
};
|
||||
package = mkOption {
|
||||
internal = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (
|
||||
let
|
||||
emacs = pkgs.callPackage self {
|
||||
extraPackages = (epkgs: cfg.extraPackages);
|
||||
inherit (cfg) doomPrivateDir extraConfig;
|
||||
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;
|
||||
}
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user