Replace straight.el with nix

This commit is contained in:
outfoxxed 2023-01-14 02:26:58 -08:00
parent e80b231881
commit 1f9c5f8980
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
5 changed files with 190 additions and 23 deletions

6
early-init.el Normal file → Executable file
View file

@ -1,8 +1,12 @@
(setq native-comp-speed -1) (setq native-comp-speed -1)
(setq package-enable-at-startup nil)
;; Anti-flashbang ;; Anti-flashbang
(custom-set-faces (custom-set-faces
'(default ((t (:foreground "#b7c9ee" :background "#0d1017"))))) '(default ((t (:foreground "#b7c9ee" :background "#0d1017")))))
(menu-bar-mode -1) (menu-bar-mode -1)
(tool-bar-mode -1) (tool-bar-mode -1)
;; This defaults to XDG_CONFIG_HOME, which is bad because lots of
;; state gets written to it.
(setq user-emacs-directory
(concat (file-name-as-directory (getenv "XDG_DATA_HOME")) "emacs"))

80
flake.lock Executable file
View file

@ -0,0 +1,80 @@
{
"nodes": {
"emacs-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1673667358,
"narHash": "sha256-29xEYwKyYQQzpmN7bdCGRTNiSazkpFF6UWYx2RYaKJo=",
"owner": "nix-community",
"repo": "emacs-overlay",
"rev": "1114c22aeb13c1c2344f237ec57bf155c9fc1a8f",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "emacs-overlay",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1673612960,
"narHash": "sha256-DWR7hrbecJKmUJCswk9MXZta710mq+3jZwTvHU/UfyY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e285dd0ca97c264003867c7329f0d1f4f028739c",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-22.11",
"type": "indirect"
}
},
"root": {
"inputs": {
"emacs-overlay": "emacs-overlay",
"nixpkgs": "nixpkgs",
"ts-fold": "ts-fold"
}
},
"ts-fold": {
"flake": false,
"locked": {
"lastModified": 1673328482,
"narHash": "sha256-6yQ35uJDAK531QNQZgloQaOQayRa8azOlOMbO8lXsHE=",
"owner": "emacs-tree-sitter",
"repo": "ts-fold",
"rev": "75d6f9ed317b042b5bc7cb21503596d1c7a1b8c0",
"type": "github"
},
"original": {
"owner": "emacs-tree-sitter",
"repo": "ts-fold",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

102
flake.nix Executable file
View file

@ -0,0 +1,102 @@
{
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.11";
emacs-overlay = {
url = "github:nix-community/emacs-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
ts-fold = {
url = "github:emacs-tree-sitter/ts-fold";
flake = false;
};
};
outputs = { ts-fold, nixpkgs, emacs-overlay, ... }: let
system = "x86_64-linux";
nix = import nixpkgs (let
inherit (emacs-overlay.overlays) emacs package;
grammers = (self: super: {
tree-sitter-grammars = super.tree-sitter-grammars // {
tree-sitter-rust = super.tree-sitter-grammars.tree-sitter-rust.overrideAttrs(_: {
nativeBuildInputs = [ self.nodejs self.tree-sitter ];
configurePhase = ''
tree-sitter generate --abi 13 src/grammar.json
'';
});
};
});
in {
inherit system;
overlays = [
emacs
package
grammers
];
});
in {
packages.${system} = let
custom-emacs =
with nix; with pkgs;
((emacsPackagesFor emacs).emacsWithPackages (epkgs: with epkgs; [
avy
company
editorconfig
evil
evil-collection
evil-goggles
evil-textobj-tree-sitter
flycheck
lsp-mode
lsp-treemacs
lsp-ui
magit
markdown-mode
nix-mode reformatter # required by nix mode
projectile
rainbow-mode
rustic
tree-sitter
tree-sitter-langs
(trivialBuild {
pname = "ts-fold";
version = "0.1.0";
src = ts-fold;
buildInputs = [
tree-sitter
s
fringe-helper
];
})
treemacs
treemacs-evil
treemacs-projectile
treemacs-magit
use-package
vertico
which-key
ws-butler
]));
in {
emacs = custom-emacs;
module =
with nix; {
home.packages = [ custom-emacs ];
xdg.configFile."emacs".source = with pkgs;
runCommandNoCC ".emacs.d" {
nativeBuildInputs = [ emacs ];
} ''
cp ${./early-init.el} early-init.el
cp ${./init.el} init.el
cp ${./my-theme-theme.el} my-theme-theme.el
install -d $out
install *.el *.elc $out
'';
};
};
};
}

25
init.el Normal file → Executable file
View file

@ -47,26 +47,8 @@
(add-hook 'lisp-mode-hook 'disable-tabs) (add-hook 'lisp-mode-hook 'disable-tabs)
(add-hook 'emacs-lisp-mode-hook 'disable-tabs) (add-hook 'emacs-lisp-mode-hook 'disable-tabs)
;;;; Packages (straight.el) ;; Packages
(require 'use-package)
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(setq straight-disable-native-compile t)
;; Use-Package
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
;; Evil (Vim Emulation) ;; Evil (Vim Emulation)
(use-package evil (use-package evil
@ -118,8 +100,7 @@
(add-hook 'prog-mode-hook #'ws-butler-mode)) (add-hook 'prog-mode-hook #'ws-butler-mode))
;; Code folding ;; Code folding
(use-package ts-fold (use-package ts-fold)
:straight (ts-fold :type git :host github :repo "emacs-tree-sitter/ts-fold"))
;; Markdown ;; Markdown
(use-package markdown-mode (use-package markdown-mode

0
my-theme-theme.el Normal file → Executable file
View file