1

Initial emacs module

This commit is contained in:
2022-07-01 16:03:22 +02:00
parent df6fe4fcbc
commit 9e72139145
2 changed files with 119 additions and 31 deletions

View File

@ -1,14 +1,28 @@
# This is your home-manager configuration file
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
{ inputs, lib, config, pkgs, ... }: {
{ inputs, lib, config, nixosConfig, pkgs, ... }:
rec {
imports = [
# If you want to use home-manager modules from other flakes (such as nix-colors), use something like:
# inputs.nix-colors.homeManagerModule
# Feel free to split up your configuration and import pieces of it here.
./modules/emacs.nix
];
# Config my modules
modules = {
emacs.enable = false;
emacs.useDoom = false;
};
# TODO: Fonts
# TODO: Gtk
# TODO: Email
# Disabled since HomeManager should use global pkgs
# https://github.com/nix-community/home-manager/issues/2942
# nixpkgs.config.allowUnfreePredicate = (pkg: true);
@ -20,7 +34,7 @@
home = {
username = "christoph";
homeDirectory = "/home/christoph";
homeDirectory = "/home/${home.username}";
enableNixpkgsReleaseCheck = true;
# TODO: There are many more home.* options
@ -42,6 +56,8 @@
rsync
rclone
xclip
xorg.xwininfo
xdotool
poppler_utils # pdfunite
ffmpeg
imagemagick
@ -75,27 +91,24 @@
exiftool
mediainfo
# Doom Emacs
# TODO: Make module out of this
binutils
zstd
ripgrep
fd
gcc
libgccjit
gnumake
cmake
sqlite
python310Packages.pygments
inkscape
graphviz
gnuplot
pandoc
nixfmt
shellcheck
maim
xorg.xwininfo
xdotool
# Doom Emacs (contained in Module)
# binutils
# zstd
# ripgrep
# fd
# gcc
# libgccjit
# gnumake
# cmake
# sqlite
# python310Packages.pygments
# inkscape
# graphviz
# gnuplot
# pandoc
# nixfmt
# shellcheck
# maim
# Web
signal-desktop
@ -164,7 +177,7 @@
# Flatpak bottles
# Flatpak steam
polymc # TODO: Should I use Flatpak for all gaming stuff?
# lutris # I don't want that crap, pleaaaase
# lutris # I don't want to, pleeeease
];
# Packages with extra options managed by HomeManager natively
@ -182,12 +195,12 @@
nix-direnv.enable = true;
};
# TODO: Move to emacs module
emacs = {
package = pkgs.emacsPgtkNativeComp; # NOTE: I have no idea why not pkgs.emacs.emacsPgtkNativeComp...
# package = pkgs.emacs28NativeComp;
enable = true;
};
# Contained in Module
# emacs = {
# package = pkgs.emacsPgtkNativeComp; # NOTE: I have no idea why not pkgs.emacs.emacsPgtkNativeComp...
# # package = pkgs.emacs28NativeComp;
# enable = true;
# };
exa.enable = true;
@ -242,7 +255,7 @@
settings = {
"app.update.auto" = false;
# "browser.startup.homepage" = "https://lobste.rs";
"identity.fxaccounts.account.device.name" = "nixinator"; # TODO: I want to pass the toplevel config to use config.networking.hostName, there seems to be an attribute nixosConfig for that but it didn't work
"identity.fxaccounts.account.device.name" = nixosConfig.networking.hostName; # NOTE: nixosConfig attribute is somehow not documented, so Idk if I should use it
"signon.rememberSignons" = false;
# "browser.urlbar.placeholderName" = "DuckDuckGo";
# "toolkit.legacyUserProfileCustomizations.stylesheets" = true;

75
home/modules/emacs.nix Normal file
View File

@ -0,0 +1,75 @@
# https://nixos.org/manual/nixos/stable/index.html#sec-writing-modules
# This is a function with arguments
{ config, lib, pkgs, ... }:
# We add stuff from lib to our namespace (mkOption...)
with lib;
let
# This is the current state of the option that this module defines
# We use it to determine if the config should be changed below
cfg = config.modules.emacs;
in {
imports = [];
# Options is a vector of options this module defines
# This module defines only the "emacs" option and suboptions "enable" and "doom"
options.modules.emacs = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable the GNU Emacs editor";
};
useDoom = mkOption {
type = types.bool;
default = false;
description = "Use the Doom Emacs framework";
};
};
# Config is the merged set of all module configurations
# Here we define what happens to the config if the module is active (but only if the module is active)
# Since this module is for HomeManager, config is not the system config
config = mkIf cfg.enable {
# What home packages should be enabled
home.packages = [
binutils
zstd
(ripgrep.override { withPCRE2 = true; })
fd
# libgccjit
sqlite
python310Packages.pygments
inkscape
graphviz
gnuplot
pandoc
nixfmt
shellcheck
maim
];
programs.emacs = {
package = pkgs.emacsPgtkNativeComp;
enable = true;
};
home.sessionPath = [
"/home/${home.username}/.emacs.d/bin"
];
# TODO:
# fonts.fonts = [ pkgs.emacs-all-the-icons-fonts ];
# If doom is enabled we want to clone the framework
system.userActivationScripts = mkIf cfg.useDoom {
installDoomEmacs = ''
if [ ! -d "${home.homeDirectory}/.emacs.d" ]; then
git clone --depth=1 --single-branch "https://github.com/doomemacs/doomemacs" "${home.homeDirectory}/.emacs.d"
fi
'';
};
};
}