diff options
| author | Miran Bastaja <miran.bastaja04@gmail.com> | 2024-09-12 18:05:23 +0200 |
|---|---|---|
| committer | Miran Bastaja <miran.bastaja04@gmail.com> | 2024-09-12 18:45:06 +0200 |
| commit | 0da0e8fb5d626bd511c55457ab624b800b9abfe8 (patch) | |
| tree | f49d24a1de22ad6488a37c56fe86360db4c3b161 | |
Initial commit
| -rw-r--r-- | default.nix | 10 | ||||
| -rw-r--r-- | flake.lock | 133 | ||||
| -rw-r--r-- | flake.nix | 33 | ||||
| -rw-r--r-- | lib/default.nix | 5 | ||||
| -rw-r--r-- | modules/default.nix | 5 | ||||
| -rw-r--r-- | overlays/default.nix | 5 | ||||
| -rw-r--r-- | pkgs/sorremacs/default.nix | 12 | ||||
| -rw-r--r-- | pkgs/sorremacs/emacs.el | 137 |
8 files changed, 340 insertions, 0 deletions
diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..d89d302 --- /dev/null +++ b/default.nix @@ -0,0 +1,10 @@ +{ + pkgs ? import <nixpkgs> { }, +}: +{ + lib = import ./lib { inherit pkgs; }; + modules = import ./modules; + overlays = import ./overlays; + + sorremacs = pkgs.callPackage ./pkgs/sorremacs { }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..4519a33 --- /dev/null +++ b/flake.lock @@ -0,0 +1,133 @@ +{ + "nodes": { + "emacs-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1726132515, + "narHash": "sha256-AmNvjJ5IzJzCHc+I8JYMGFO3dXXTTrIoTfg6tpUImSE=", + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "5788c86646c42ebce3d8731fccd4f973b530240b", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "emacs-overlay", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "futils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1722472559, + "narHash": "sha256-HqzEdURUwgCNDpopDC38NbChC0cOyj1L47EP+1aco8k=", + "ref": "refs/heads/main", + "rev": "aaa51589dd772073c6eb48d6b7bd51dc8be3b455", + "revCount": 4, + "type": "git", + "url": "https://git.sorre.xyz/miranb/futils" + }, + "original": { + "type": "git", + "url": "https://git.sorre.xyz/miranb/futils" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1724819573, + "narHash": "sha256-GnR7/ibgIH1vhoy8cYdmXE6iyZqKqFxQSVkFgosBh6w=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "71e91c409d1e654808b2621f28a327acfdad8dc2", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1725930920, + "narHash": "sha256-RVhD9hnlTT2nJzPHlAqrWqCkA7T6CYrP41IoVRkciZM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "44a71ff39c182edaf25a7ace5c9454e7cba2c658", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "emacs-overlay": "emacs-overlay", + "futils": "futils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7163d14 --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + description = "My personal NUR repository."; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + futils.url = "git+https://git.sorre.xyz/miranb/futils"; + emacs-overlay = { + url = "github:nix-community/emacs-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { + self, + nixpkgs, + futils, + emacs-overlay, + }: + futils.lib.eachSystem ( + system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ emacs-overlay.overlays.default ]; + }; + in + { + legacyPackages = import ./default.nix { inherit pkgs; }; + packages = nixpkgs.lib.filterAttrs (_: v: nixpkgs.lib.isDerivation v) self.legacyPackages.${system}; + } + ); +} diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..626b52a --- /dev/null +++ b/lib/default.nix @@ -0,0 +1,5 @@ +{ pkgs }: +with pkgs.lib; +{ + # library functions go here +} diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..ff6c7c0 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,5 @@ +{ + # Add your NixOS modules here + # + # my-module = ./my-module; +} diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..0c2d870 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,5 @@ +{ + # Add your overlays here + # + # my-overlay = import ./my-overlay; +} diff --git a/pkgs/sorremacs/default.nix b/pkgs/sorremacs/default.nix new file mode 100644 index 0000000..eea70f5 --- /dev/null +++ b/pkgs/sorremacs/default.nix @@ -0,0 +1,12 @@ +{ emacsWithPackagesFromUsePackage, ... }: +emacsWithPackagesFromUsePackage { + config = ./emacs.el; + defaultInitFile = true; + alwaysEnsure = true; + alwaysTangle = true; + + # Optionally provide extra packages not in the configuration file. + extraEmacsPackages = epkgs: [ + epkgs.cask + ]; +} diff --git a/pkgs/sorremacs/emacs.el b/pkgs/sorremacs/emacs.el new file mode 100644 index 0000000..e903b10 --- /dev/null +++ b/pkgs/sorremacs/emacs.el @@ -0,0 +1,137 @@ +;; -*- coding: utf-8 -*- + +(setq use-package-always-ensure t) + +;;; For performance +(setq gc-cons-threshold 100000000) +(setq read-process-output-max (* 1024 1024)) ;; 1mb + +(add-hook 'after-init-hook #'(lambda () + ;; restore after startup + (setq gc-cons-threshold 800000))) + +;;; Disable menu-bar, tool-bar, and scroll-bar. +(if (fboundp 'menu-bar-mode) + (menu-bar-mode -1)) +(if (fboundp 'tool-bar-mode) + (tool-bar-mode -1)) +(if (fboundp 'scroll-bar-mode) + (scroll-bar-mode -1)) + +;;; Fix this bug: +;;; https://www.reddit.com/r/emacs/comments/cueoug/the_failed_to_download_gnu_archive_is_a_pretty/ +(when (version< emacs-version "26.3") + (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")) + +(setq-default cursor-type 'bar) ; Line-style cursor similar to other text editors +(setq inhibit-startup-screen t) ; Disable startup screen +(setq initial-scratch-message "") ; Make *scratch* buffer blank +(setq-default frame-title-format '("%b")) ; Make window title the buffer name +(setq ring-bell-function 'ignore) ; Disable bell sound +(fset 'yes-or-no-p 'y-or-n-p) ; y-or-n-p makes answering questions faster +(show-paren-mode 1) ; Show closing parens by default +(setq linum-format "%4d ") ; Line number format +(delete-selection-mode 1) ; Selected text will be overwritten when you start typing +(global-auto-revert-mode t) ; Auto-update buffer if file has changed on disk + +;; Show line numbers in programming modes +(add-hook 'prog-mode-hook + (if (or + ; If linum-mode doesn't exist... + (not (fboundp 'linum-mode)) + ; ...or Emacs has display-line-numbers-mode capability + (and (fboundp 'display-line-numbers-mode) (display-graphic-p))) + ; ...then use display-line-numbers-mode! + 'display-line-numbers-mode + ; Otherwise, use linum-mode + 'linum-mode)) + +(global-display-line-numbers-mode) + +;; Define the whitespace style. +(setq-default whitespace-style + '(face spaces tabs newline space-mark tab-mark newline-mark)) + +(setq-default whitespace-display-mappings + ;; all numbers are unicode codepoint in decimal + '( + ;; 32 is SPACE, 183 is MIDDLE DOT · + (space-mark 32 [183]) + ;; 10 is LINE FEED, 182 isPILCROW SIGN ¶ + (newline-mark 10 [182 10]) + ;; 9 is tab, 182 isPILCROW SIGN ¶ + (tab-mark 9 [9655 9]))) + +;; Set whitespace actions. +(setq-default whitespace-action + '(cleanup auto-cleanup)) + +;;; Put Emacs auto-save and backup files to /tmp/ or C:/Temp/ +(defconst emacs-tmp-dir (expand-file-name (format "emacs%d" (user-uid)) temporary-file-directory)) +(setq + backup-by-copying t ; Avoid symlinks + delete-old-versions t + kept-new-versions 6 + kept-old-versions 2 + version-control t + auto-save-list-file-prefix emacs-tmp-dir + auto-save-file-name-transforms `((".*" ,emacs-tmp-dir t)) ; Change autosave dir to tmp + backup-directory-alist `((".*" . ,emacs-tmp-dir))) + +;;; Lockfiles unfortunately cause more pain than benefit +(setq create-lockfiles nil) + +;;; Load wheatgrass as the default theme if one is not loaded already + +(if (not custom-enabled-themes) + (load-theme 'wheatgrass t)) + +(defun reload-config () + (interactive) + (load-file (expand-file-name "init.el" user-emacs-directory))) + +;; Make a single ESC quit the current action +(global-set-key (kbd "<escape>") 'keyboard-escape-quit) + +;; Autopairs +(add-hook 'prog-mode-hook + (lambda () + (electric-pair-mode 1))) + +;; Org mode config +(setq-default org-startup-indented t) + +;; Emacs lisp mode config +(add-hook 'emacs-lisp-mode-hook + (lambda () + ;; Use spaces, not tabs + (setq indent-tabs-mode nil))) + +;; Theme +(use-package doom-themes + :config + (setq doom-themes-enable-bold t + doom-themes-enable-italic t) + (load-theme 'doom-moonlight t) + + ;; Enable flashing mode-line on errors + (doom-themes-visual-bell-config) + ;; Corrects (and improves) org-mode's native fontification. + (doom-themes-org-config)) + +;; Some quality of life packages +(use-package which-key + :config + (which-key-mode)) + +(use-package helm + ;; :bind ("C-c C-p" . helm-find-files) + :config + ;; Enable global fuzzy matching + (setq helm-mode-fuzzy-match t + helm-completion-in-region-fuzzy-match t) + (helm-mode 1)) + +;;; --- Various major modes --- ;;; +(use-package nix-mode + :mode "\\.nix\\'") |
