emacs/flake.nix

108 lines
2.6 KiB
Nix
Executable file

{
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 = ''
tree-sitter generate --abi 13 src/grammar.json
'';
});
};
});
in {
inherit system;
overlays = [
emacs
package
grammers
];
});
custom-emacs =
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;
buildInputs = [
tree-sitter
s
fringe-helper
];
})
treemacs
treemacs-evil
treemacs-projectile
treemacs-magit
use-package
vertico
which-key
ws-butler
]));
in {
packages.${system} = {
default = custom-emacs;
module =
with nix; {
home.packages = [ custom-emacs ];
services.emacs = {
enable = true;
package = custom-emacs;
};
xdg.configFile."emacs".source = with pkgs;
runCommandNoCC ".emacs.d" {
nativeBuildInputs = [ emacsPgtk ];
} ''
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
'';
};
};
};
}