From 7b5bf013daf1038cc11872868e6822eb14eb2861 Mon Sep 17 00:00:00 2001 From: Miran Bastaja Date: Thu, 7 Mar 2024 00:34:30 +0100 Subject: Slim down client machines, fix some issues - completely remove emacs module - use nixpkgs hyprland package instead of the flake - fix tofi desktop file cache issue - update flake lock - wonderland: remove madhatter - remove hyprdesktop module from clients' sharedModules and move it into the users' individual modules wherever it's needed --- share/home/emacs/default.nix | 27 ----- share/home/emacs/early-init.el | 13 --- share/home/emacs/emacs.el | 236 ----------------------------------------- share/home/hyprdesktop.nix | 11 +- share/home/tofi.nix | 13 ++- share/system/client-common.nix | 2 +- share/system/common.nix | 15 +-- share/system/hyprland.nix | 7 +- 8 files changed, 21 insertions(+), 303 deletions(-) delete mode 100644 share/home/emacs/default.nix delete mode 100644 share/home/emacs/early-init.el delete mode 100644 share/home/emacs/emacs.el (limited to 'share') diff --git a/share/home/emacs/default.nix b/share/home/emacs/default.nix deleted file mode 100644 index 22f6ee7..0000000 --- a/share/home/emacs/default.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ pkgs, ... }: -let - my-emacs = pkgs.emacsWithPackagesFromUsePackage { - config = ./emacs.el; - defaultInitFile = true; - package = pkgs.emacs-pgtk; - alwaysEnsure = true; - }; -in -{ - home.packages = [ my-emacs ]; - - xdg.configFile = { - emacs-init = { - enable = true; - target = "emacs/init.el"; - text = '' - (setq inhibit-startup-screen t) - ''; - }; - emacs-early-init = { - enable = true; - target = "emacs/early-init.el"; - source = ./early-init.el; - }; - }; -} diff --git a/share/home/emacs/early-init.el b/share/home/emacs/early-init.el deleted file mode 100644 index bc32deb..0000000 --- a/share/home/emacs/early-init.el +++ /dev/null @@ -1,13 +0,0 @@ -;;; early-init.el --- Early Initalization -*- lexical-binding: t; -*- -;;; Commentary: -;;; Code: - -(push '(menu-bar-mode . 0) default-frame-alist) -(push '(tool-bar-lines . 0) default-frame-alist) -(push '(vertical-scroll-bars) default-frame-alist) - -;; All our packages come from Nix -(setq package-enable-at-startup nil - package-archives nil) -(provide 'early-init) -;;; early-init.el ends here diff --git a/share/home/emacs/emacs.el b/share/home/emacs/emacs.el deleted file mode 100644 index 926face..0000000 --- a/share/home/emacs/emacs.el +++ /dev/null @@ -1,236 +0,0 @@ -;;; init.el --- Initalization -*- lexical-binding: t; -*- -;;; -;;; Commentary: -;;; Various resources were used to hack together this config: -;;; - https://sanemacs.com/ -;;; - https://rossabaker.com/configs/emacs/ -;;; -;;; Code: - -;;;;;;;;;;;;;;;;;;;;;;; -;;; Startup ;;; -;;;;;;;;;;;;;;;;;;;;;;; - -;;; Startup - Use package ;;; - -;; some packages complain if I don't have this -(use-package bind-key - :demand t - :bind - (:prefix-map rab/files-map - :prefix "C-c f") - :bind - (:prefix-map rab/toggles-map - :prefix "C-c t")) - -;;; Startup - Benchmarking ;;; - -(use-package benchmark-init - :ensure t - :demand t - :hook (after-init . benchmark-init/deactivate) - :config - (benchmark-init/activate)) - -;;; Startup - Garbage collection ;;; - -(use-package gcmh - :ensure t - :diminish - :init (setq gc-cons-threshold (* 80 1024 1024)) - :hook (emacs-startup . gcmh-mode)) - -;;; Startup - Better cache location ;;; -(use-package no-littering - :ensure t - :init - (setq no-littering-etc-directory "~/.cache/emacs/etc/" - no-littering-var-directory "~/.cache/emacs/var/") - (when (fboundp 'startup-redirect-eln-cache) - (startup-redirect-eln-cache - (convert-standard-filename - (expand-file-name "eln-cache/" no-littering-var-directory)))) - :config - (no-littering-theme-backups)) - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Customization ;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;; Customization - General settings ;;; - -(use-package emacs - :init - (setq inhibit-startup-screen t - initial-scratch-message nil - initial-major-mode 'text-mode - ring-bell-function 'ignore - use-file-dialog nil) - - (tool-bar-mode -1) - (scroll-bar-mode -1) - - (setq-default cursor-type 'bar - frame-title-format '("%b") - ;; Use spaces, but configure tab-width for modes that use tabs - indent-tabs-mode nil - tab-width 2) - - (fset 'yes-or-no-p 'y-or-n-p) - (show-paren-mode 1) ; Show closing parens - (global-auto-revert-mode t) ; Auto-update buffer on file change - (setopt create-lockfiles nil) - (electric-pair-mode 1) ; Autopairs - (global-hl-line-mode) - - (defun mb/enable-fill-column () - "Enable vertical ruler" - (interactive) - (setq fill-column 80) - (display-fill-column-indicator-mode)) - - (defun display-startup-echo-area-message () - (message "")) - - :hook (prog-mode . mb/enable-fill-column) - :bind (("C-z" . undo) - ("C-S-z" . undo-redo) - ("C-x h" . previous-buffer) - ("C-x l" . next-buffer))) - -;;; Customization - Scrolling ;;; -;; TODO: Smooth scroll - -;;; Customization - Theme ;;; - -(use-package doom-themes - :demand - :config - ;; Global settings (defaults) - (setq doom-themes-enable-bold t ; if nil, bold is universally disabled - doom-themes-enable-italic t) ; if nil, italics is universally disabled - (load-theme 'doom-laserwave t)) - - -;;; Customization - Modeline ;;; -(use-package doom-modeline - :ensure t - :config (doom-modeline-mode 1)) - -(use-package nerd-icons - :custom - (nerd-icons-font-family "FiraCode Nerd Font Mono")) - -(use-package nyan-mode - :config (nyan-mode)) - -;;; Customization - Evil ;;; - -;; Set up vi keybinds -(use-package evil - :demand - :init - (defun mb/enable-line-numbers () - "Enable relative line numbers" - (interactive) - (display-line-numbers-mode) - (setq display-line-numbers 'relative)) - - :hook ((prog-mode . evil-local-mode) - (text-mode . evil-local-mode) - (evil-mode . mb/enable-line-numbers) - (evil-local-mode . mb/enable-line-numbers))) - -;;; Customization - Direnv support ;;; - -(use-package envrc - :ensure t - :hook (on-first-file . envrc-global-mode)) - -;;; Customziation - Completion framework ;;; - -(use-package helm - :config - (setq helm-completion-style 'emacs)) - -(use-package helm-mode - :config - (helm-mode 1)) - -(use-package fussy - :config - (push 'fussy completion-styles) - (setq - ;; For example, project-find-file uses 'project-files which uses - ;; substring completion by default. Set to nil to make sure it's using - ;; flx. - completion-category-defaults nil - completion-category-overrides nil)) - -;;; Customization - Project management ;;; - -;; (use-package projectile -;; :bind-keymap ("C-c p" . projectile-command-map) -;; :config -;; (projectile-mode +1)) - -;;; Customization - Completions ;;; - -(use-package company - :hook (prog-mode . company-mode)) - -;;; Customization - Syntax checking ;;; - -(use-package flycheck - :hook (prog-mode . flycheck-mode)) - -;;; Customization - Which key ;;; - -(use-package which-key - :init - (setq which-key-idle-delay 0.1) - :config - (which-key-mode +1)) - -;;; Customization - LSP support ;;; - -(use-package eglot - ; nix-mode doesn't have a hook for some reason - :mode ("\\.nix\\'" "\\.nix.in\\'")) - -;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Languages ;;; -;;;;;;;;;;;;;;;;;;;;;;;;; - -;;; Languages - Nix ;;; - -(use-package nix-mode - :mode ("\\.nix\\'" "\\.nix.in\\'")) - -;;; Languages - Coq ;;; - -(use-package proof-general - :mode ("\\.v\\'" . coq-mode)) - - -;;; Languages - Rust ;;; - -(use-package rustic - :init - (setq rustic-lsp-client 'eglot) - (defun rustic-mode-auto-save-hook () - "Enable auto-saving in rustic-mode buffers." - (when buffer-file-name - (setq-local compilation-ask-about-save nil))) - :hook (rustic-mode . rustic-mode-auto-save-hook)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;; Useful modes ;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;; Useful modes - magit ;;; - -(use-package magit) - -;;; emacs.el ends here diff --git a/share/home/hyprdesktop.nix b/share/home/hyprdesktop.nix index 166a18b..6f923e7 100644 --- a/share/home/hyprdesktop.nix +++ b/share/home/hyprdesktop.nix @@ -1,7 +1,7 @@ # Module containing a bunch of things that make up a `desktop environment` built # off of hyprland. I install this on all my desktop/laptop machines. # IMPORTANT: this module requires the system to already have `programs.hyprland` -# enabled. You can enable it by importing `share/system/hyprland.nix` +# enabled. { pkgs, config, inputs, ... }: { imports = [ # Custom home manager modules @@ -18,7 +18,6 @@ ./kitty.nix ./offpunk.nix ./firefox - #./emacs ./helix.nix ]; @@ -169,6 +168,7 @@ zathura # document reader bitwarden # password manager heroic # FOSS game launcher for GOG & Epic + foliate # Gaming jdk17_headless @@ -198,13 +198,14 @@ ]; userDirs = let - home = config.home.homeDirectory; + annex = "${config.home.homeDirectory}/Annex"; in { enable = true; createDirectories = true; - pictures = "${home}/Annex/Pictures"; - music = "${home}/Annex/Music"; + pictures = "${annex}/Pictures"; + music = "${annex}/Music"; + documents = "${annex}/Documents"; }; }; } diff --git a/share/home/tofi.nix b/share/home/tofi.nix index b53aca4..b0a7a89 100644 --- a/share/home/tofi.nix +++ b/share/home/tofi.nix @@ -1,7 +1,18 @@ # IMPORTANT: this is the config for a custom module that's located at # /share/hm-modules/tofi.nix. In order to use this config you have to also # import that module. -{ ... }: { +{ lib, config, ... }: { + + # Tofi's cache seems to get messed up sometimes, so we regenerate it when + # building the system. + # https://github.com/philj56/tofi/issues/115#issuecomment-1701748297 + home.activation = { + regenerateTofiCache = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + tofi_cache=${config.xdg.cacheHome}/tofi-drun + [[ -f "$tofi_cache" ]] && rm "$tofi_cache" + ''; + }; + programs.tofi = { enable = true; settings = { diff --git a/share/system/client-common.nix b/share/system/client-common.nix index 63c5219..c58a0f5 100644 --- a/share/system/client-common.nix +++ b/share/system/client-common.nix @@ -2,10 +2,10 @@ { pkgs, ... }: { imports = [ - ./hyprland.nix ./steam.nix ]; + programs.hyprland.enable = true; boot.supportedFilesystems = [ "ntfs" "bcachefs" ]; nixpkgs.config.allowUnfree = true; diff --git a/share/system/common.nix b/share/system/common.nix index d8bea21..b280667 100644 --- a/share/system/common.nix +++ b/share/system/common.nix @@ -1,21 +1,8 @@ # Common system settings shared across every machine # Used mostly for adding substituters and such -{ inputs, ... }: { +{ ... }: { nix.settings = { experimental-features = [ "nix-command" "flakes" ]; auto-optimise-store = true; - - extra-substituters = [ - "https://hyprland.cachix.org" - "https://nix-community.cachix.org" - ]; - extra-trusted-public-keys = [ - "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; }; - nixpkgs.overlays = [ - inputs.hyprland.overlays.default - #inputs.emacs-overlay.overlays.default - ]; } diff --git a/share/system/hyprland.nix b/share/system/hyprland.nix index 2e1c679..8b13789 100644 --- a/share/system/hyprland.nix +++ b/share/system/hyprland.nix @@ -1,6 +1 @@ -{ inputs, pkgs, ... }: { - programs.hyprland = { - enable = true; - package = inputs.hyprland.packages.${pkgs.system}.hyprland; - }; -} + -- cgit v1.3.1