Refactor the whole configuration

Reviewed-on: #1
This commit is contained in:
caem 2025-02-01 14:05:15 +01:00
parent fb5d4d46f8
commit 6cb66d86d2
153 changed files with 2078 additions and 3094 deletions

View file

@ -0,0 +1,6 @@
{ lib, ... }:
{
imports = lib.getModuleImports ./.;
}

View file

@ -0,0 +1,8 @@
{ config, ... }:
{
programs.gpg = {
enable = true;
homedir = "${config.xdg.dataHome}/gnupg";
};
}

View file

@ -0,0 +1,25 @@
#!/usr/bin/env zsh
local c0=$'%{\e[0m%}'
local c31=$'%{\e[31m%}'
local c33=$'%{\e[33m%}'
local c34=$'%{\e[34m%}'
local c35=$'%{\e[35m%}'
local c38=$'%{\e[38m%}'
local nix_shell_ps1_t=" $c34{$c33󱄅 shell$c34}$c0"
local path_no_ghostty="$(echo "$PATH" | sed -e 's/:\/nix\/store\/.*-ghostty-.*\/bin://g')"
if [ -n "$IN_NIX_SHELL" ]; then
local nix_shell_ps1="$nix_shell_ps1_t"
elif [[ "$path_no_ghostty" == *"/nix/store"* ]]; then
IN_NIX_SHELL=true
local nix_shell_ps1="$nix_shell_ps1_t"
fi
setopt prompt_subst
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' formats " ${c34}${c0}${c31}(%b)${c0}"
precmd () { vcs_info }
export PS1='${c38}[${c35}%3~${c0}${vcs_info_msg_0_}${nix_shell_ps1}${c38}]${c0}# '

View file

@ -0,0 +1,103 @@
{ pkgs, config, ... }:
{
home.packages = with pkgs; [
lsd
bat
fd
ripgrep
fzf
tmux
fastfetch
tre-command
btop
zsh-completions
nix-zsh-completions
git
];
programs.bat = {
enable = true;
config = {
theme = "ansi";
};
};
programs.btop = {
enable = true;
settings = {
color_theme = "TTY";
};
};
programs.fastfetch = {
enable = true;
settings = {
modules = [
"title"
"separator"
"os"
"kernel"
"initsystem"
"uptime"
"datetime"
"packages"
"terminal"
"wm"
"shell"
"cpu"
"gpu"
"memory"
"break"
"colors"
];
};
};
home.file.".zshenv".enable = false;
home.file.".config/zsh/conf.d" = {
source = ./conf.d;
recursive = true;
};
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
dotDir = ".config/zsh";
autocd = true;
history.size = 10000;
history.ignoreAllDups = true;
/* Not persisted on purpose */
history.path = "${config.xdg.cacheHome}/zsh_history";
shellAliases = {
cat = "bat --paging=never --wrap=never --style='changes,snip,numbers'";
ls = "lsd";
tree = "tre";
};
initExtra = ''
alias -g -- -h='-h 2>&1 | bat --language=help --style=plain'
alias -g -- --help='--help 2>&1 | bat --language=help --style=plain'
for dotfile in "$ZDOTDIR/conf.d/"*; do
source "$dotfile"
done
'';
plugins = [
{
name = "zsh-nix-shell";
file = "nix-shell.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "chisui";
repo = "zsh-nix-shell";
rev = "v0.8.0";
sha256 = "1lzrn0n4fxfcgg65v0qhnj7wnybybqzs4adz7xsrkgmcsr0ii8b7";
};
}
];
};
}

View file

@ -0,0 +1,32 @@
{ lib, config, ... }:
{
imports = [
./packages.nix
];
home = {
username = "caem";
homeDirectory = "/home/caem";
stateVersion = "24.11";
};
home.file."${config.xdg.configHome}/user-dirs.dirs".force = lib.mkForce true;
xdg = {
enable = true;
userDirs = {
enable = true;
documents = "${config.home.homeDirectory}/documents";
download = "${config.home.homeDirectory}/download";
music = "${config.home.homeDirectory}/music";
pictures = "${config.home.homeDirectory}/images";
videos = "${config.home.homeDirectory}/videos";
/* I do not use these */
desktop = "${config.xdg.dataHome}/xdg/desktop";
publicShare = "${config.xdg.dataHome}/xdg/publicShare";
templates = "${config.xdg.dataHome}/xdg/templates";
};
};
}

View file

@ -0,0 +1,103 @@
{ pkgs, lib, inputs, config, ... }:
let
picture-uri = if builtins.hasAttr "wallpaper" inputs.secrets.paths
then builtins.toString inputs.secrets.paths.wallpaper
else builtins.toString ../../../../../assets/wallpaper.jpg;
in {
gtk = {
enable = true;
gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
gtk3.extraConfig = {
gtk-application-prefer-dark-theme = true;
};
};
dconf.settings = {
"org/gnome/desktop/background".picture-uri = picture-uri;
"org/gnome/desktop/background".picture-uri-dark = picture-uri;
"org/gnome/desktop/screensaver".picture-uri = picture-uri;
"org/gnome/desktop/interface" = {
accent-color = "slate";
color-scheme = "prefer-dark";
};
"org/gnome/desktop/input-sources" = {
sources = [
(lib.hm.gvariant.mkTuple ["xkb" "gb"])
(lib.hm.gvariant.mkTuple ["xkb" "de"])
];
};
"org/gnome/desktop/peripherals/mouse" = {
accel-profile = "flat";
};
"org/gnome/shell" = {
disable-user-extensions = false;
allow-extension-installation = false;
enabled-extensions = with pkgs.gnomeExtensions; [
caffeine.extensionUuid
accent-directories.extensionUuid
just-perfection.extensionUuid
quick-settings-tweaker.extensionUuid
forge.extensionUuid
];
favorite-apps = [
"firefox-esr.desktop"
"com.mitchellh.ghostty.desktop"
"org.gnome.Nautilus.desktop"
];
};
"org/gnome/shell/extensions/forge" = {
float-always-on-top-enabled = false;
focus-border-toggle = false;
move-pointer-to-focus = true;
stacked-tiling-mode-enable = true;
};
"org/gnome/shell/extensions/just-perfection" = {
calendar = false;
events-button = false;
quick-settings-dark-mode = false;
world-clock = false;
};
"org/gnome/shell/extensions/quick-settings-tweaks" = {
notifications-enabled = false;
};
"org/gnome/desktop/wm/preferences" = {
audible-bell = false;
num-workspaces = 9;
};
"org/gnome/mutter" = {
dynamic-workspaces = false;
};
"org/gnome/shell/keybindings" = {
switch-to-application-1 = [];
switch-to-application-2 = [];
switch-to-application-3 = [];
switch-to-application-4 = [];
switch-to-application-5 = [];
switch-to-application-6 = [];
switch-to-application-7 = [];
switch-to-application-8 = [];
switch-to-application-9 = [];
};
"org/gnome/desktop/wm/keybindings" = {
switch-to-workspace-1 = ["<Super>1"];
switch-to-workspace-2 = ["<Super>2"];
switch-to-workspace-3 = ["<Super>3"];
switch-to-workspace-4 = ["<Super>4"];
switch-to-workspace-5 = ["<Super>5"];
switch-to-workspace-6 = ["<Super>6"];
switch-to-workspace-7 = ["<Super>7"];
switch-to-workspace-8 = ["<Super>8"];
switch-to-workspace-9 = ["<Super>9"];
move-to-workspace-1 = ["<Super><Shift>1"];
move-to-workspace-2 = ["<Super><Shift>2"];
move-to-workspace-3 = ["<Super><Shift>3"];
move-to-workspace-4 = ["<Super><Shift>4"];
move-to-workspace-5 = ["<Super><Shift>5"];
move-to-workspace-6 = ["<Super><Shift>6"];
move-to-workspace-7 = ["<Super><Shift>7"];
move-to-workspace-8 = ["<Super><Shift>8"];
move-to-workspace-9 = ["<Super><Shift>9"];
};
};
}

View file

@ -0,0 +1,5 @@
{ lib, ... }:
{
imports = lib.getModuleImports ./.;
}

View file

@ -0,0 +1,21 @@
{ pkgs, config, ... }:
let
# Has to be >= 29 due to treesitter
emacsPkg = "emacs30";
in {
services.emacs = {
enable = true;
package = pkgs."${emacsPkg}";
defaultEditor = true;
};
programs.emacs = {
enable = true;
package = (pkgs."${emacsPkg}-pgtk".pkgs.withPackages (epkgs: [
epkgs.treesit-grammars.with-all-grammars
]));
};
home.file."${config.xdg.configHome}/emacs".source = ./emacs.d;
}

View file

@ -0,0 +1,9 @@
(setq custom-file "/dev/null")
(let ((backup_dir (concat (or (getenv "XDG_CACHE_HOME") "~/.cache") "/emacs_backups")))
(make-directory backup_dir t)
(setq backup-directory-alist '(("." . backup_dir))
backup-by-copying t))
(setq inhibit-startup-message t)
(setq auto-save-default nil)

View file

@ -0,0 +1,18 @@
(tool-bar-mode 0)
(menu-bar-mode 0)
(scroll-bar-mode 0)
(setq display-line-numbers-type 'relative)
(global-display-line-numbers-mode t)
(global-hl-line-mode t)
(set-frame-parameter nil 'alpha-background 90)
(add-to-list 'default-frame-alist
'(font . "Go Mono Nerd Font-12"))
;; Temporary theme. Replace later.
(use-package darktooth-theme
:ensure t
:config
(load-theme 'darktooth-dark t)
(set-face-background 'hl-line "#262626")) ;; darktooth-background-0

View file

@ -0,0 +1,8 @@
(ido-mode 1)
(ido-everywhere 1)
(use-package smex
:ensure t
:bind (("M-x" . smex)
("M-X" . smex-major-mode-commands))
:config (smex-initialize))

View file

@ -0,0 +1,15 @@
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)
(setq-default show-trailing-whitespace t)
(use-package indent-bars
:ensure t
:hook (prog-mode . indent-bars-mode)
:custom
(indent-bars-display-on-blank-lines t)
(indent-bars-pattern " . . . ")
(indent-bars-color '("#7C6F64" :blend 0.2))
(indent-bars-width-frac 0.15)
(indent-bars-color-by-depth nil)
(indent-bars-highlight-current-depth '(:color "#DD6F48" :pattern "." :blend 0.4)))

View file

@ -0,0 +1,27 @@
;; Set up paths so that emacs never touches ~/.config/emacs
(let ((data-home (concat (or (getenv "XDG_DATA_HOME") "~/.local/share") "/emacs")))
(setq user-emacs-directory data-home
custom-file (expand-file-name "custom.el" data-home)
url-history-file (expand-file-name "url/history" data-home)
package-user-dir (expand-file-name "elpa" data-home)
boomark-default-file (expand-file-name "bookmarks" data-home)
recentf-save-file (expand-file-name "recentf" data-home)
tramp-persistent-file-name (expand-file-name "tramp" data-home)
auto-save-list-file-prefix (expand-file-name "auto-save-list/.saves-" data-home)
abbrev-file-name (expand-file-name "abbrev.el" data-home)
savehist-file (expand-file-name "savehist" data-home)
server-auth-dir (expand-file-name "server" data-home)
package-quickstart-file (expand-file-name "package-quickstart.elc" data-home)))
(setq conf-home (concat (or (getenv "XDG_CONFIG_HOME") "~/.config") "/emacs"))
(package-initialize)
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(load (expand-file-name "./appearance.el" conf-home))
(load (expand-file-name "./annoyances.el" conf-home))
(load (expand-file-name "./completions.el" conf-home))
(load (expand-file-name "./formatting.el" conf-home))
(mapc 'load (file-expand-wildcards (expand-file-name "./languages/*.el" conf-home)))

View file

@ -0,0 +1,11 @@
(use-package nix-mode
:ensure t
:mode "\\.nix\\'")
(use-package pretty-sha-path
:ensure t
:config (global-pretty-sha-path-mode 1))
(add-hook 'nix-mode-hook
(lambda ()
(setq tab-width 2)))

View file

@ -0,0 +1,19 @@
{ ... }:
{
programs.ghostty = {
enable = true;
enableZshIntegration = true;
settings = let
literally_a_billion_million = 10000000000000;
in {
font-family = "Go Mono Nerd Font";
font-size = 12;
background-opacity = 0.85;
scrollback-limit = literally_a_billion_million;
theme = "Tomorrow Night Burns";
window-padding-x = 4;
window-padding-y = 4;
};
};
}

View file

@ -0,0 +1,17 @@
{ ... }:
{
programs.git = {
enable = true;
userName = "caem";
userEmail = "me@caem.dev";
signing = {
signByDefault = true;
key = "E50FC66B5062070DC462661C69A830D03203405F";
};
extraConfig = {
pull.rebase = true;
init.defaultBranch = "master";
};
};
}

View file

@ -0,0 +1,5 @@
{ lib, ... }:
{
imports = lib.getModuleImports ./.;
}

View file

@ -0,0 +1,5 @@
{ ... }:
{
}

View file

@ -0,0 +1,5 @@
{ lib, ... }:
{
imports = lib.getModuleImports ./.;
}

View file

@ -0,0 +1,5 @@
{ ... }:
{
}

View file

@ -0,0 +1,10 @@
{ ... }:
{
imports = [
./development
./core
./desktop/gnome
./multimedia
];
}