New config as a flake

This commit is contained in:
Andrea Ciceri 2023-02-12 15:46:59 +01:00
parent 627707f13d
commit 819123f2b7
No known key found for this signature in database
GPG key ID: A1FC89532D1C5654
9 changed files with 674 additions and 326 deletions

76
hmModules/default.nix Normal file
View file

@ -0,0 +1,76 @@
{self, inputs, ...}: {
flake.overlays.default = self: super: {
ccrEmacs = self.packages.${self.system}.ccrEmacs;
};
flake.hmModules = {
default = self.hmModules.ccrEmacs;
ccrEmacs = {
lib,
pkgs,
config,
...
}: {
options.ccrEmacs = {
enable = lib.mkEnableOption "Enable custom Emacs";
package = lib.mkOption {
type = lib.types.package;
description = "Custom Emacs package";
default = self.packages.${pkgs.system}.ccrEmacs;
};
};
config = let
ccrEmacsConfig = config.ccrEmacs;
in
lib.mkIf ccrEmacsConfig.enable {
nixpkgs.overlays = [(self: super: {
ccrEmacs = super.hello;
})];
programs.emacs = {
enable = true;
package = ccrEmacsConfig.package;
};
services.emacs = {
enable = true;
client.enable = true;
defaultEditor = true;
socketActivation.enable = true;
startWithUserSession = true;
};
home.packages = with pkgs;
[
# TODO add epub-thumbnailer to nixpkgs
nil
terraform-lsp
imagemagick
ffmpegthumbnailer
mediainfo
unzipNLS
binutils
(ripgrep.override {withPCRE2 = true;})
gnutls
fd
imagemagick
sqlite
maim
jq
xclip
hunspell
]
++ (with hunspellDicts; [
en_US-large
it_IT
]);
home.activation = {
cloneCcrEmacsFlake = lib.hm.dag.entryAfter ["writeBoundary"] ''
PATH=$PATH:${lib.makeBinPath (with pkgs; [ git openssh ])}
if [ ! -d "$HOME/.config/emacs" ]; then
$DRY_RUN_CMD git clone \
https://github.com/aciceri/emacs.git \
"$HOME/.config/emacs"
fi
'';
};
};
};
};
}