emacs/flake.nix

108 lines
2.6 KiB
Nix
Raw Normal View History

2023-01-14 10:26:58 +00:00
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.11";
emacs-overlay = {
url = "github:nix-community/emacs-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
ts-fold = {
url = "github:emacs-tree-sitter/ts-fold";
flake = false;
};
};
outputs = { ts-fold, nixpkgs, emacs-overlay, ... }: let
system = "x86_64-linux";
nix = import nixpkgs (let
inherit (emacs-overlay.overlays) emacs package;
grammers = (self: super: {
tree-sitter-grammars = super.tree-sitter-grammars // {
tree-sitter-rust = super.tree-sitter-grammars.tree-sitter-rust.overrideAttrs(_: {
nativeBuildInputs = [ self.nodejs self.tree-sitter ];
configurePhase = ''
2023-01-17 20:25:01 +00:00
tree-sitter generate --abi 13 src/grammar.json
'';
2023-01-14 10:26:58 +00:00
});
};
});
in {
inherit system;
overlays = [
emacs
package
grammers
];
});
2023-01-17 03:18:44 +00:00
custom-emacs =
2023-01-17 20:25:01 +00:00
with nix; with pkgs;
((emacsPackagesFor emacsPgtk).emacsWithPackages (epkgs: with epkgs; [
avy
company
editorconfig
evil
evil-collection
evil-goggles
evil-textobj-tree-sitter
flycheck
lsp-mode
lsp-treemacs
lsp-ui
magit
markdown-mode
nix-mode reformatter # required by nix mode
projectile
rainbow-mode
rustic
tree-sitter
tree-sitter-langs
(trivialBuild {
pname = "ts-fold";
version = "0.1.0";
src = ts-fold;
2023-01-17 03:18:44 +00:00
2023-01-17 20:25:01 +00:00
buildInputs = [
tree-sitter
s
fringe-helper
];
})
treemacs
treemacs-evil
treemacs-projectile
treemacs-magit
use-package
vertico
which-key
ws-butler
]));
2023-01-17 03:18:44 +00:00
in {
packages.${system} = {
default = custom-emacs;
2023-01-14 10:26:58 +00:00
module =
with nix; {
home.packages = [ custom-emacs ];
2023-01-17 20:25:01 +00:00
services.emacs = {
enable = true;
package = custom-emacs;
};
2023-01-17 03:18:44 +00:00
2023-01-14 10:26:58 +00:00
xdg.configFile."emacs".source = with pkgs;
runCommandNoCC ".emacs.d" {
2023-01-17 03:18:44 +00:00
nativeBuildInputs = [ emacsPgtk ];
2023-01-14 10:26:58 +00:00
} ''
cp ${./early-init.el} early-init.el
cp ${./init.el} init.el
cp ${./my-theme-theme.el} my-theme-theme.el
install -d $out
install *.el *.elc $out
'';
};
};
};
}