Merge branch 'main' of git.datarift.nl:erwin/nixos-config

This commit is contained in:
Erwin Boskma 2023-03-31 19:48:32 +02:00
commit bdbbd63a2e
Signed by: erwin
SSH key fingerprint: SHA256:CyeNoWXd3kjX2Nwu6pDxxdS7OqmPVOy0NavA/KU/ntU
3 changed files with 35 additions and 40 deletions

View file

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1679947957, "lastModified": 1680146283,
"narHash": "sha256-dK1z5LlfK9ZFmvzaKyQ2Nm4R2MSPPn/0THU1E1xpUag=", "narHash": "sha256-YZSw3O6uv6NqOJP+dol/njmzblRFIsrmqqb0HsL4mcQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "3a1c23eefcb1eec4fed63039c2d5594a02351ae0", "rev": "4d9c89abde7ccedf743a01119d41fb880793bcba",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -30,11 +30,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1679999154, "lastModified": 1680257010,
"narHash": "sha256-FYgB8LB3QEBT7s2l6tqqufd6oJ7L7nFbDg+7TFep2XM=", "narHash": "sha256-pNMB9sdoZOXEsszLD5TS0WG5Ysj2rVRmf92uxsxH/9A=",
"owner": "nix-community", "owner": "nix-community",
"repo": "emacs-overlay", "repo": "emacs-overlay",
"rev": "7ecb77c734114cd51f4f79b91725f3b6aae9f0cc", "rev": "cfec7f9501cc0e001f49d725a7cd733af7deb2ed",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -158,11 +158,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1680000368, "lastModified": 1680249941,
"narHash": "sha256-TlgC4IJ7aotynUdkGRtaAVxquaiddO38Ws89nB7VGY8=", "narHash": "sha256-7Ylr0NAr8msd3YVaYBw6uyJIRbtOq5l6aLrmrYA5qTw=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "765e4007b6f9f111469a25d1df6540e8e0ca73a6", "rev": "67b97020b6970d39b4126a7870063d11337ecb80",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -228,11 +228,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1679847043, "lastModified": 1680185050,
"narHash": "sha256-Md5zV84PkRz/4X8pVlvuBfJymRhq9z2g5mv8Ine+hQc=", "narHash": "sha256-MtyaP3j1yxwrqPFUsLD0qFyyH7d/h0D/whfErxS2UFM=",
"owner": "oxalica", "owner": "oxalica",
"repo": "nil", "repo": "nil",
"rev": "775ba9e6ac31a3b20ecec7ae3c29ca1a7baee3b1", "rev": "0718fca59b82e53aef07699db7e1bbd86ba8dacf",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -263,11 +263,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1679944521, "lastModified": 1680070330,
"narHash": "sha256-SipdMlnCv/pDvo/j7ctEGqKvQSmn2gcoHSJgIVysXbk=", "narHash": "sha256-aoT2YZCd9LEtiEULFLIF0ykKydgE72X8gw/k9/pRS5I=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "82ecc5b88ffed8c0317c064dfd8f82f4b9882100", "rev": "a6aa8174fa61e55bd7e62d35464d3092aefe0421",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -278,11 +278,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1679944645, "lastModified": 1680125544,
"narHash": "sha256-e5Qyoe11UZjVfgRfwNoSU57ZeKuEmjYb77B9IVW7L/M=", "narHash": "sha256-mlqo1r+TZUOuypWdrZHluxWL+E5WzXlUXNZ9Y0WLDFU=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4bb072f0a8b267613c127684e099a70e1f6ff106", "rev": "9a6aabc4740790ef3bbb246b86d029ccf6759658",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -380,11 +380,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1678976941, "lastModified": 1680170909,
"narHash": "sha256-skNr08frCwN9NO+7I77MjOHHAw+L410/37JknNld+W4=", "narHash": "sha256-FtKU/edv1jFRr/KwUxWTYWXEyj9g8GBrHntC2o8oFI8=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "32b1dbedfd77892a6e375737ef04d8efba634e9e", "rev": "29dbe1efaa91c3a415d8b45d62d48325a4748816",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -441,11 +441,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1679970108, "lastModified": 1680229280,
"narHash": "sha256-8OfySbY1hhBzj0Iz90k4se6oFCGS3+ke31vkd0d4k/o=", "narHash": "sha256-9UoyQCeKUmHcsIdpsAgcz41LAIDkWhI2PhVDjckrpg0=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "26ef1a2029239e204e51ab3402f8aae5aa1187ed", "rev": "aa480d799023141e1b9e5d6108700de63d9ad002",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -866,14 +866,15 @@ Visualise git changes in the gutter, next to the line numbers
*** Tree-sitter *** Tree-sitter
[[https://tree-sitter.github.io/][tree-sitter]] is a new development in parsing and syntax highlighting. There is [[https://www.reddit.com/r/emacs/comments/pxpq8d/rfc_emacs_treesitter_integration/][an effort underway]] to get it into Emacs core, but for now we're using the [[https://emacs-tree-sitter.github.io/][emacs-tree-sitter]] package. [[https://tree-sitter.github.io/][tree-sitter]] is a new development in parsing and syntax highlighting. It has been merged into Emacs 29, but until that's released we're using the [[https://emacs-tree-sitter.github.io/][emacs-tree-sitter]] package while on Emacs 28.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package tree-sitter (when (< emacs-major-version 29)
(use-package tree-sitter
:config :config
(global-tree-sitter-mode) (global-tree-sitter-mode)
:ghook :ghook
('tree-sitter-after-on-hook #'tree-sitter-hl-mode)) ('tree-sitter-after-on-hook #'tree-sitter-hl-mode)))
#+end_src #+end_src
[[https://github.com/emacs-tree-sitter/tree-sitter-langs][tree-sitter-langs]] provides =tree-sitter= support for a bunch of languages. [[https://github.com/emacs-tree-sitter/tree-sitter-langs][tree-sitter-langs]] provides =tree-sitter= support for a bunch of languages.
@ -976,12 +977,14 @@ Visualise git changes in the gutter, next to the line numbers
(find-file-existing filename)))) (find-file-existing filename))))
#+end_src #+end_src
*** Snippets ** Snippets
Snippets are predefined pieces of code that can be inserted and filled in. [[https://github.com/joaotavora/yasnippet][YASnippet]] uses syntax inspired by TextMate is the most popular, for good reason. Snippets are predefined pieces of code that can be inserted and filled in. [[https://github.com/joaotavora/yasnippet][YASnippet]] uses syntax inspired by TextMate is the most popular, for good reason.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package yasnippet (use-package yasnippet
:init
(load "yasnippet.el")
:diminish t :diminish t
:general :general
(:keymaps 'yas-minor-mode-map (:keymaps 'yas-minor-mode-map
@ -990,8 +993,7 @@ Snippets are predefined pieces of code that can be inserted and filled in. [[htt
"<C-tab>" 'yas-expand) "<C-tab>" 'yas-expand)
:config :config
(add-to-list 'yas-snippet-dirs my/snippets-dir) (add-to-list 'yas-snippet-dirs my/snippets-dir)
(yas-global-mode) (yas-global-mode))
:diminish yas-minor-mode)
(use-package yasnippet-snippets) (use-package yasnippet-snippets)
#+end_src #+end_src

View file

@ -7,7 +7,6 @@ with lib; let
cfg = config.eboskma.programs.emacs; cfg = config.eboskma.programs.emacs;
emacsWithPackages = pkgs.emacsWithPackagesFromUsePackage { emacsWithPackages = pkgs.emacsWithPackagesFromUsePackage {
# config = ./config.org;
config = config =
let let
tangledOrgConfig = pkgs.runCommand "tangled-emacs-config" { } '' tangledOrgConfig = pkgs.runCommand "tangled-emacs-config" { } ''
@ -35,7 +34,6 @@ with lib; let
categories = [ "Development" "TextEditor" ]; categories = [ "Development" "TextEditor" ];
keywords = [ "org-protocol" ]; keywords = [ "org-protocol" ];
type = "Application"; type = "Application";
# exec = "${cfg.package}/bin/emacsclient -- %u";
exec = "${emacsWithPackages}/bin/emacsclient -- %u"; exec = "${emacsWithPackages}/bin/emacsclient -- %u";
terminal = false; terminal = false;
mimeTypes = [ "x-scheme-handler/org-protocol" ]; mimeTypes = [ "x-scheme-handler/org-protocol" ];
@ -46,11 +44,7 @@ in
options.eboskma.programs.emacs = { options.eboskma.programs.emacs = {
enable = mkEnableOption "activate emacs"; enable = mkEnableOption "activate emacs";
package = mkOption { package = mkPackageOption pkgs "emacs" { };
description = "The emacs package to install";
type = types.package;
default = pkgs.emacs;
};
daemon = mkOption { daemon = mkOption {
description = "Whether to enable emacs daemon"; description = "Whether to enable emacs daemon";
@ -63,13 +57,11 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
programs.emacs = { programs.emacs = {
enable = true; enable = true;
# package = cfg.package;
package = emacsWithPackages; package = emacsWithPackages;
}; };
services.emacs = mkIf cfg.daemon { services.emacs = mkIf cfg.daemon {
enable = true; enable = true;
# package = cfg.package;
package = emacsWithPackages; package = emacsWithPackages;
client.enable = true; client.enable = true;
socketActivation.enable = true; socketActivation.enable = true;
@ -86,7 +78,8 @@ in
python3 python3
lldb lldb
] ++ ] ++
(with aspellDicts; [ en en-computers en-science fy nl ]); (with aspellDicts; [ en en-computers en-science fy nl ]) ++
(lib.optional (versionOlder cfg.package.version "29") (tree-sitter.withPlugins builtins.attrValues));
}; };
} }