initial commit

This commit is contained in:
Mars 2024-08-12 23:29:44 -04:00
commit fb46d04a50
Signed by: pupbrained
GPG key ID: 0FF5B8826803F895
8 changed files with 393 additions and 0 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use_flake

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.direnv/

20
config/default.nix Normal file
View file

@ -0,0 +1,20 @@
{pkgs, ...}:
with pkgs;
emacsWithPackagesFromUsePackage {
config = ./init.el;
package = pkgs.emacs29;
defaultInitFile = true;
alwaysEnsure = true;
alwaysTangle = true;
override = epkgs:
epkgs
// {
sideline-eglot = callPackage ./extraPackages/sideline-eglot.nix {
inherit (pkgs) fetchFromGitHub;
inherit (epkgs) trivialBuild sideline;
};
};
}

View file

@ -0,0 +1,19 @@
{
sideline,
trivialBuild,
fetchFromGitHub,
}:
trivialBuild rec {
pname = "sideline-eglot";
version = "main-12-08-2024";
src = fetchFromGitHub {
owner = "emacs-sideline";
repo = "sideline-eglot";
rev = "d7fbb9e13edbe5b9b9de464c8dabb8b0014de78e";
hash = "sha256-/NCclLf4stF4+C1W+s2Y+LJ0TgqGAxVDa6v7+H+3/vA=";
};
propagatedUserEnvPkgs = [
sideline
];
buildInputs = propagatedUserEnvPkgs;
}

122
config/init.el Normal file
View file

@ -0,0 +1,122 @@
; Disable bars
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
; Set font
(set-frame-font "Maple Mono NF 12" nil t)
; Set theme
(use-package catppuccin-theme :ensure t :demand t)
(load-theme 'catppuccin t)
; Set modeline
(use-package doom-modeline
:ensure t
:hook (after-init . doom-modeline-mode))
; Emoji support
(use-package emojify
:hook (after-init . global-emojify-mode))
; Evil mode
(use-package evil
:ensure t
:init
(setq evil-want-integration t) ;; This is optional since it's already set to t by default.
(setq evil-want-keybinding nil)
:config
(evil-mode 1))
;; Evil collection
(use-package evil-collection
:after evil
:ensure t
:config
(evil-collection-init))
;; Evil leader
(use-package evil-leader
:after evil
:config
(global-evil-leader-mode)
(setq evil-leader/leader "<SPC>") ;; Set the leader key to space
(evil-leader/set-key
"a" #'eglot-code-actions))
(use-package undo-tree
:demand t
:config
(global-undo-tree-mode) ;; Enable undo-tree mode globally
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo")))) ;; Directory for undo files
; Dashboard
(use-package dashboard
:ensure t
:config
(dashboard-setup-startup-hook)
(setq dashboard-startup-banner 'logo))
; Direnv
(use-package direnv
:config
(direnv-mode))
; Nix
(use-package nix-mode
:mode "\\.nix\\'")
; Treesitter
(use-package tree-sitter
:hook ((prog-mode . tree-sitter-mode)
(prog-mode . tree-sitter-hl-mode)))
(use-package tree-sitter-langs)
(use-package treesit-auto
:config
(global-treesit-auto-mode)
(dolist (lang treesit-language-source-alist)
(let ((mode (intern (format "%s-ts-mode" (car lang)))))
(when (fboundp mode)
(add-to-list 'major-mode-remap-alist
(cons (intern (car lang)) mode))))))
; Eglot setup
(add-hook 'prog-mode-hook 'eglot-ensure)
(evil-leader/set-key
"a" #'eglot-code-actions)
;; Function to format the buffer using Eglot
(defun my/eglot-format-buffer-on-save ()
"Format the current buffer if Eglot is active."
(when (bound-and-true-p eglot--managed-p)
(eglot-format-buffer)))
;; Add the function to the save-hook
(add-hook 'before-save-hook #'my/eglot-format-buffer-on-save)
; Flycheck
(use-package flycheck
:ensure t
:config
(add-hook 'after-init-hook #'global-flycheck-mode))
; Sideline
(use-package sideline-flycheck
:hook (flycheck-mode . sideline-mode)
:init (setq sideline-backends-right '(sideline-flycheck)
sideline-delay 0.0))
(use-package sideline-flycheck
:hook (flycheck-mode . sideline-flycheck-setup)
:init (setq sideline-flycheck-display-mode 'line))
; Eglot
(use-package sideline-eglot
:init
(setq sideline-backends-right '(sideline-eglot)))
(use-package eglot :hook (eglot-mode . sideline-mode)) ; enable it when eglot is on

182
flake.lock Normal file
View file

@ -0,0 +1,182 @@
{
"nodes": {
"emacs-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1723482913,
"narHash": "sha256-wzIUWp672DHcFYhfKBxzfs4nSlm6W34tOmTOlFwwETE=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "463ee3b4d1c63385c58d7742d33dbe6bdc8fd2a1",
"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"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"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"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1723175592,
"narHash": "sha256-M0xJ3FbDUc4fRZ84dPGx5VvgFsOzds77KiBMW/mMTnI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5e0ca22929f3342b19569b21b2f3462f053e497b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1723282977,
"narHash": "sha256-oTK91aOlA/4IsjNAZGMEBz7Sq1zBS0Ltu4/nIQdYDOg=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a781ff33ae258bbcfd4ed6e673860c3e923bf2cc",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1723175592,
"narHash": "sha256-M0xJ3FbDUc4fRZ84dPGx5VvgFsOzds77KiBMW/mMTnI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5e0ca22929f3342b19569b21b2f3462f053e497b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1720957393,
"narHash": "sha256-oedh2RwpjEa+TNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "693bc46d169f5af9c992095736e82c3488bf7dbb",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"emacs-overlay": "emacs-overlay",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2",
"treefmt-nix": "treefmt-nix"
}
},
"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"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1723454642,
"narHash": "sha256-S0Gvsenh0II7EAaoc9158ZB4vYyuycvMGKGxIbERNAM=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "349de7bc435bdff37785c2466f054ed1766173be",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

48
flake.nix Normal file
View file

@ -0,0 +1,48 @@
{
description = "A nixvim configuration";
inputs = {
emacs-overlay.url = "github:nix-community/emacs-overlay";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs = {
emacs-overlay,
flake-utils,
nixpkgs,
treefmt-nix,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [emacs-overlay.overlay];
};
in {
formatter = treefmt-nix.lib.mkWrapper pkgs {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
deadnix.enable = true;
stylua.enable = true;
};
};
packages.default = import ./config {inherit pkgs;};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
alejandra
nvfetcher
stylua
(writeScriptBin "up" ''
nvfetcher
nix flake update
'')
];
};
});
}

0
nvfetcher.toml Normal file
View file