added helix :)

This commit is contained in:
Charlie Root 2024-05-14 23:47:14 +02:00
commit 5dbe5ff071
12 changed files with 433 additions and 137 deletions

View file

@ -54,6 +54,7 @@ in {
lg = "lazygit";
cd = "z";
v = "nvim";
h = "hx";
e = "emacs";
update = "sudo nixos-rebuild switch --flake \"${gitPath}#${hostname}\"";
flake = "cd '${gitPath}'";

View file

@ -13,7 +13,8 @@ _: {
./vivado.nix
./firefox.nix
./steam.nix
./schizofox.nix
./minecraft.nix
./emacs.nix
# ./emacs
];
}

View file

@ -1,90 +1,5 @@
{ config, lib, pkgs, ... }:
with lib; let
cfg = config.modules.programs.emacs;
envExtra = ''
export PATH="${config.xdg.configHome}/emacs/bin:$PATH"
'';
shellAliases = {
e = "emacsclient --create-frame"; # gui
et = "emacsclient --create-frame --tty"; # termimal
};
librime-dir = "${config.xdg.dataHome}/emacs/librime";
parinfer-rust-lib-dir = "${config.xdg.dataHome}/emacs/parinfer-rust";
myEmacsPackagesFor = emacs: ((pkgs.emacsPackagesFor emacs).emacsWithPackages (epkgs: [
epkgs.vterm
]));
in {
options.modules.editors.emacs = {
enable = mkEnableOption "Emacs Editor";
};
config = mkIf cfg.enable (mkMerge [
{
home.packages = with pkgs; [
## Doom dependencies
git
(ripgrep.override {withPCRE2 = true;})
gnutls # for TLS connectivity
## Optional dependencies
fd # faster projectile indexing
imagemagick # for image-dired
fd # faster projectile indexing
zstd # for undo-fu-session/undo-tree compression
# go-mode
# gocode # project archived, use gopls instead
## Module dependencies
# :checkers spell
(aspellWithDicts (ds: with ds; [en en-computers en-science]))
# :tools editorconfig
editorconfig-core-c # per-project style config
# :tools lookup & :lang org +roam
sqlite
# :lang latex & :lang org (latex previews)
# texlive.combined.scheme-medium
];
programs.bash.bashrcExtra = envExtra;
programs.zsh.envExtra = envExtra;
home.shellAliases = shellAliases;
programs.nushell.shellAliases = shellAliases;
xdg.configFile."doom" = {
source = ./doom;
force = true;
};
home.activation.installDoomEmacs = lib.hm.dag.entryAfter ["writeBoundary"] ''
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${doomemacs}/ ${config.xdg.configHome}/emacs/
# librime for emacs-rime
mkdir -p ${librime-dir}
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${pkgs.librime}/ ${librime-dir}/
# libparinfer_rust for emacs' parinfer-rust-mode
mkdir -p ${parinfer-rust-lib-dir}
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${pkgs.vimPlugins.parinfer-rust}/lib/libparinfer_rust.* ${parinfer-rust-lib-dir}/parinfer-rust.so
'';
}
let
# Do not use emacs-nox here, which makes the mouse wheel work abnormally in terminal mode.
# pgtk (pure gtk) build add native support for wayland.
# https://www.gnu.org/savannah-checkouts/gnu/emacs/emacs.html#Releases
emacsPkg = myEmacsPackagesFor pkgs.emacs29-pgtk;
in {
home.packages = [emacsPkg];
services.emacs = {
enable = true;
package = emacsPkg;
client = {
enable = true;
arguments = [" --create-frame"];
};
startWithUserSession = true;
};
}
]);
_:{
imports = [
./emacs.nix
];
}

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, inputs, ... }:
with lib; let
cfg = config.modules.programs.emacs;
username = config.modules.other.system.username;
@ -7,19 +7,14 @@ in {
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.emacs = {
programs.doom-emacs = {
enable = true;
package = pkgs.emacs;
extraConfig = ''
(setq standard-indent 2)
(require 'evil)
(evil-mode 1)
'';
extraPackages = epkgs: [
epkgs.evil
epkgs.gruvbox-theme
];
doomPrivateDir = ./doom.d;
};
};
};

106
modules/gui/schizofox.nix Normal file
View file

@ -0,0 +1,106 @@
{ config, inputs, lib, ... }: let
cfg = config.modules.programs.schizofox;
inherit (config.modules.other.system) username;
inherit (lib) mkEnableOption mkIf;
in {
options.modules.programs.schizofox = {
enable = mkEnableOption "schizofox";
};
config = mkIf cfg.enable {
home-manager.users.${username} = {
imports = [ inputs.schizofox.homeManagerModule ];
programs.schizofox = {
enable = true;
theme = {
background-darker = "181825";
background = "1e1e2e";
foreground = "cdd6f4";
font = "Lexend";
simplefox.enable = false;
darkreader.enable = true;
extraCss = ''
body {
color: red !important;
}
'';
};
search = {
defaultSearchEngine = "DuckDuckGo";
removeEngines = ["Google" "Bing" "Amazon.com" "eBay" "Twitter" "Wikipedia"];
addEngines = [
{
Name = "NixOS Packages";
Description = "NixOS Unstable package search";
Alias = "!np";
Method = "GET";
URLTemplate = "https://search.nixos.org/packages?channel=unstable&query={searchTerms}";
}
{
Name = "NixOS Options";
Description = "NixOS Unstable option search";
Alias = "!no";
Method = "GET";
URLTemplate = "https://search.nixos.org/options?channel=unstable&query={searchTerms}";
}
{
Name = "NixOS Wiki";
Description = "NixOS Wiki search";
Alias = "!nw";
Method = "GET";
URLTemplate = "https://nixos.wiki/index.php?search={searchTerms}";
}
{
Name = "Home Manager Options";
Description = "Home Manager option search";
Alias = "!hm";
Method = "GET";
URLTemplate = "https://mipmip.github.io/home-manager-option-search?query={searchTerms}";
}
{
Name = "Arch Wiki";
Description = "Arch Wiki search";
Alias = "!aw";
Method = "GET";
URLTemplate = "https://wiki.archlinux.org/index.php?search={searchTerms}";
}
{
Name = "Gentoo Wiki";
Description = "Gentoo Wiki search";
Alias = "!gw";
Method = "GET";
URLTemplate = "https://wiki.gentoo.org/index.php?search={searchTerms}";
}
{
Name = "Debian Wiki";
Description = "Debian Wiki search";
Alias = "!dw";
Method = "GET";
URLTemplate = "https://wiki.debian.org/FrontPage?action=fullsearch&value={searchTerms}";
}
];
};
extensions = {
# simplefox.enable = true;
darkreader.enable = true;
# vimium.enable = true;
extraExtensions = {
"webextension@vimium".install_url = "https://addons.mozilla.org/firefox/downloads/file/4259790/vimium_ff-2.1.2.xpi";
};
};
security = {
sanitizeOnShutdown = true;
sandbox = true;
userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:106.0) Gecko/20100101 Firefox/106.0";
};
misc = {
drmFix = false;
disableWebgl = true;
};
};
};
};
}

View file

@ -8,7 +8,7 @@ let
file_manager = "pcmanfm.desktop";
media_player = "mpv.desktop";
image_viewer = "imv.desktop";
text_editor = "nvim.desktop";
text_editor = "helix.desktop";
terminal = "kitty.desktop";
in {

View file

@ -1,7 +1,7 @@
_: {
imports = [
./btop.nix
# ./helix.nix
./helix.nix
./neovim.nix
./newsboat.nix
./ncmpcpp.nix

30
modules/tui/helix.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, lib, pkgs, inputs, ... }:
with lib; let
cfg = config.modules.programs.helix;
username = config.modules.other.system.username;
in {
options.modules.programs.helix.enable = mkEnableOption "helix";
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.helix = {
enable = true;
settings = {
editor = {
line-number = "relative";
mouse = false;
bufferline = "multiple";
lsp.display-messages = true;
cursor-shape = {
insert = "bar";
};
};
keys.normal = {
C-g = [":new" ":insert-output lazygit" ":buffer-close!" ":redraw"];
esc = ["collapse_selection" "keep_primary_selection"];
};
};
};
};
};
}