aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.lock122
-rw-r--r--flake.nix5
-rw-r--r--share/home/emacs/default.nix13
-rw-r--r--share/home/emacs/emacs.el132
-rw-r--r--share/home/hyprdesktop.nix1
-rw-r--r--share/nixos-modules/nix-config.nix11
6 files changed, 263 insertions, 21 deletions
diff --git a/flake.lock b/flake.lock
index 5a2c21c..616d288 100644
--- a/flake.lock
+++ b/flake.lock
@@ -41,6 +41,26 @@
"type": "github"
}
},
+ "emacs-overlay": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs",
+ "nixpkgs-stable": "nixpkgs-stable"
+ },
+ "locked": {
+ "lastModified": 1701509878,
+ "narHash": "sha256-oZ3I8CmZkMADkUSqiVzv1AxLA9rTy0jG7453jMFE5ug=",
+ "owner": "nix-community",
+ "repo": "emacs-overlay",
+ "rev": "590e99479d5f34c57781252f5ac3f956e4c0d237",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "emacs-overlay",
+ "type": "github"
+ }
+ },
"flake-compat": {
"flake": false,
"locked": {
@@ -93,7 +113,25 @@
},
"flake-utils": {
"inputs": {
- "systems": "systems_3"
+ "systems": "systems_2"
+ },
+ "locked": {
+ "lastModified": 1694529238,
+ "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "flake-utils_2": {
+ "inputs": {
+ "systems": "systems_4"
},
"locked": {
"lastModified": 1685518550,
@@ -109,9 +147,9 @@
"type": "github"
}
},
- "flake-utils_2": {
+ "flake-utils_3": {
"inputs": {
- "systems": "systems_4"
+ "systems": "systems_5"
},
"locked": {
"lastModified": 1685518550,
@@ -193,8 +231,8 @@
"hyprland": {
"inputs": {
"hyprland-protocols": "hyprland-protocols",
- "nixpkgs": "nixpkgs",
- "systems": "systems_2",
+ "nixpkgs": "nixpkgs_2",
+ "systems": "systems_3",
"wlroots": "wlroots",
"xdph": "xdph"
},
@@ -239,11 +277,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1700612854,
- "narHash": "sha256-yrQ8osMD+vDLGFX7pcwsY/Qr5PUd6OmDMYJZzZi0+zc=",
+ "lastModified": 1701253981,
+ "narHash": "sha256-ztaDIyZ7HrTAfEEUt9AtTDNoCYxUdSd6NrRHaYOIxtk=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "19cbff58383a4ae384dea4d1d0c823d72b49d614",
+ "rev": "e92039b55bcd58469325ded85d4f58dd5a4eaf58",
"type": "github"
},
"original": {
@@ -273,6 +311,22 @@
},
"nixpkgs-stable": {
"locked": {
+ "lastModified": 1701362232,
+ "narHash": "sha256-GVdzxL0lhEadqs3hfRLuj+L1OJFGiL/L7gCcelgBlsw=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "d2332963662edffacfddfad59ff4f709dde80ffe",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-23.05",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-stable_2": {
+ "locked": {
"lastModified": 1685801374,
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
"owner": "NixOS",
@@ -287,7 +341,7 @@
"type": "github"
}
},
- "nixpkgs-stable_2": {
+ "nixpkgs-stable_3": {
"locked": {
"lastModified": 1700905716,
"narHash": "sha256-w1vHn2MbGfdC+CrP3xLZ3scsI06N0iQLU7eTHIVEFGw=",
@@ -303,7 +357,7 @@
"type": "github"
}
},
- "nixpkgs-stable_3": {
+ "nixpkgs-stable_4": {
"locked": {
"lastModified": 1685801374,
"narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=",
@@ -321,6 +375,22 @@
},
"nixpkgs_2": {
"locked": {
+ "lastModified": 1700612854,
+ "narHash": "sha256-yrQ8osMD+vDLGFX7pcwsY/Qr5PUd6OmDMYJZzZi0+zc=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "19cbff58383a4ae384dea4d1d0c823d72b49d614",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs_3": {
+ "locked": {
"lastModified": 1701068326,
"narHash": "sha256-vmMceA+q6hG1yrjb+MP8T0YFDQIrW3bl45e7z24IEts=",
"owner": "nixos",
@@ -338,12 +408,12 @@
"pre-commit-hooks-nix": {
"inputs": {
"flake-compat": "flake-compat",
- "flake-utils": "flake-utils",
+ "flake-utils": "flake-utils_2",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
],
- "nixpkgs-stable": "nixpkgs-stable"
+ "nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1700922917,
@@ -362,13 +432,13 @@
"pre-commit-hooks-nix_2": {
"inputs": {
"flake-compat": "flake-compat_2",
- "flake-utils": "flake-utils_2",
+ "flake-utils": "flake-utils_3",
"gitignore": "gitignore_2",
"nixpkgs": [
"sorre-website",
"nixpkgs"
],
- "nixpkgs-stable": "nixpkgs-stable_3"
+ "nixpkgs-stable": "nixpkgs-stable_4"
},
"locked": {
"lastModified": 1699271226,
@@ -388,10 +458,11 @@
"inputs": {
"devshell": "devshell",
"disko": "disko",
+ "emacs-overlay": "emacs-overlay",
"flake-parts": "flake-parts",
"home-manager": "home-manager",
"hyprland": "hyprland",
- "nixpkgs": "nixpkgs_2",
+ "nixpkgs": "nixpkgs_3",
"pre-commit-hooks-nix": "pre-commit-hooks-nix",
"scripts": "scripts",
"sops-nix": "sops-nix",
@@ -430,7 +501,7 @@
"nixpkgs": [
"nixpkgs"
],
- "nixpkgs-stable": "nixpkgs-stable_2"
+ "nixpkgs-stable": "nixpkgs-stable_3"
},
"locked": {
"lastModified": 1701127353,
@@ -493,6 +564,21 @@
},
"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"
+ }
+ },
+ "systems_3": {
+ "locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
@@ -506,7 +592,7 @@
"type": "github"
}
},
- "systems_3": {
+ "systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
@@ -521,7 +607,7 @@
"type": "github"
}
},
- "systems_4": {
+ "systems_5": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
diff --git a/flake.nix b/flake.nix
index 3cbdf5d..04d38cd 100644
--- a/flake.nix
+++ b/flake.nix
@@ -16,7 +16,6 @@
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
- hyprland.url = "github:hyprwm/Hyprland";
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
@@ -42,6 +41,10 @@
inputs.devshell.follows = "devshell";
inputs.treefmt-nix.follows = "treefmt-nix";
};
+
+ # No inputs overrides so I can (hopefully) use the binary cache(s)
+ hyprland.url = "github:hyprwm/Hyprland";
+ emacs-overlay.url = "github:nix-community/emacs-overlay";
};
outputs = inputs@{ flake-parts, ... }:
diff --git a/share/home/emacs/default.nix b/share/home/emacs/default.nix
new file mode 100644
index 0000000..6c40b78
--- /dev/null
+++ b/share/home/emacs/default.nix
@@ -0,0 +1,13 @@
+{ pkgs, ... }:
+let
+ my-emacs = pkgs.emacsWithPackagesFromUsePackage {
+ config = ./emacs.el;
+ defaultInitFile = true;
+ package = pkgs.emacs-pgtk;
+ alwaysEnsure = true;
+ alwaysTangle = true;
+ };
+in
+{
+ home.packages = [ my-emacs ];
+}
diff --git a/share/home/emacs/emacs.el b/share/home/emacs/emacs.el
new file mode 100644
index 0000000..bf786de
--- /dev/null
+++ b/share/home/emacs/emacs.el
@@ -0,0 +1,132 @@
+;; -*- lexical-binding: t -*-
+;;; emacs-config --- My emacs config
+;;; Commentary:
+;;; Code:
+;; Lots of stuff copied from Sanemacs version 0.3.2
+;; https://sanemacs.com/
+
+;;; 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"))
+
+;;; Setup package.el
+(require 'package)
+(setq package-enable-at-startup nil)
+(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
+(unless package--initialized (package-initialize))
+
+;;; Setup use-package
+(unless (package-installed-p 'use-package)
+ (package-refresh-contents)
+ (package-install 'use-package))
+(eval-when-compile
+ (require 'use-package))
+(setq use-package-always-ensure t)
+
+;;; Useful Defaults
+(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
+(use-package undo-tree ; Enable undo-tree, sane undo/redo behavior
+ :init (global-undo-tree-mode)
+ :config (setq-default undo-tree-auto-save-history nil))
+(add-hook 'before-save-hook
+ 'delete-trailing-whitespace) ; Delete trailing whitespace on save
+(add-hook 'prog-mode-hook ; Show line numbers in programming modes
+ (if (and (fboundp 'display-line-numbers-mode) (display-graphic-p))
+ #'display-line-numbers-mode
+ #'linum-mode))
+
+(defun sanemacs/backward-kill-word ()
+ (interactive "*")
+ (push-mark)
+ (backward-word)
+ (delete-region (point) (mark)))
+
+;;; Keybindings
+(global-set-key [mouse-3] 'mouse-popup-menubar-stuff) ; Gives right-click a context menu
+(global-set-key (kbd "C->") 'indent-rigidly-right-to-tab-stop) ; Indent selection by one tab length
+(global-set-key (kbd "C-<") 'indent-rigidly-left-to-tab-stop) ; De-indent selection by one tab length
+(global-set-key (kbd "M-DEL") 'sanemacs/backward-kill-word) ; Kill word without copying it to your clipboard
+(global-set-key (kbd "C-DEL") 'sanemacs/backward-kill-word) ; Kill word without copying it to your clipboard
+
+;;; Offload the custom-set-variables to a separate file
+;;; This keeps your init.el neater and you have the option
+;;; to gitignore your custom.el if you see fit.
+(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
+(unless (file-exists-p custom-file)
+ (write-region "" nil custom-file))
+;;; Load custom file. Don't hide errors. Hide success message
+(load custom-file nil t)
+
+;;; 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)))
+
+
+;; Autopairs
+(electric-pair-mode 1)
+
+;; Set up vi keybinds
+(use-package evil
+ :config
+ (evil-mode 1))
+
+(use-package nix-mode
+ :mode "\\.nix\\'")
+
+;; Set up proof general for working with coq
+(use-package proof-general
+ :mode ("\\.v\\'" . coq-mode))
+
+(use-package flycheck
+ :init (global-flycheck-mode))
+
+(use-package company
+ :init (global-company-mode))
+;;; emacs.el ends here
diff --git a/share/home/hyprdesktop.nix b/share/home/hyprdesktop.nix
index 0dd4add..b0a77af 100644
--- a/share/home/hyprdesktop.nix
+++ b/share/home/hyprdesktop.nix
@@ -16,6 +16,7 @@
./kitty.nix
./offpunk.nix
./firefox
+ ./emacs
];
wayland.windowManager.hyprland = {
diff --git a/share/nixos-modules/nix-config.nix b/share/nixos-modules/nix-config.nix
index 2b190cf..8000871 100644
--- a/share/nixos-modules/nix-config.nix
+++ b/share/nixos-modules/nix-config.nix
@@ -3,10 +3,17 @@
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
- extra-substituters = [ "https://hyprland.cachix.org" ];
+ 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 ];
+ nixpkgs.overlays = [
+ inputs.hyprland.overlays.default
+ inputs.emacs-overlay.overlays.default
+ ];
}