Merge branch 'emacs-tree-sitter'
This commit is contained in:
commit
9c46081556
5 changed files with 150 additions and 40 deletions
106
flake.lock
generated
106
flake.lock
generated
|
@ -35,11 +35,11 @@
|
|||
},
|
||||
"emacs-overlay": {
|
||||
"locked": {
|
||||
"lastModified": 1628182179,
|
||||
"narHash": "sha256-W6ZwlXtrcsGLXaLo50XWBNvhZ1/rZ1KO+ej1BHkKp4w=",
|
||||
"lastModified": 1628356768,
|
||||
"narHash": "sha256-MYnHBDAH1pF3jCvsnxjfECD2PP0t1ODVFH6SnzIc2FQ=",
|
||||
"owner": "nix-community",
|
||||
"repo": "emacs-overlay",
|
||||
"rev": "690f9a2de09b69091eb430b39d1faa5979c5f04e",
|
||||
"rev": "cd04543c0155979dc019213a434e71734455e903",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -190,16 +190,14 @@
|
|||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1627592512,
|
||||
"narHash": "sha256-+bauwACGl+/dTQB047XImRz5P6Lp6vxl5ruiKjtENxo=",
|
||||
"lastModified": 1628287034,
|
||||
"narHash": "sha256-pWMEpQQcKxBy0OKskFLXJHEyGYJIiMu/BUQjCWxGF38=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "7f976da06840c268cc291a021bab7532b923713c",
|
||||
"rev": "b0d769691cc379c9ab91d3acec5d14e75c02c02b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -208,6 +206,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"myNixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1628199198,
|
||||
"narHash": "sha256-DkMFcm5VdqbausjUjyHWGBlcXNw/EMFiQpiCY5KKtMo=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "439b1605227b8adb1357b55ce8529d541abbe9eb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-doom-emacs": {
|
||||
"inputs": {
|
||||
"doom-emacs": "doom-emacs",
|
||||
|
@ -223,7 +237,7 @@
|
|||
"flake-utils": "flake-utils_2",
|
||||
"nix-straight": "nix-straight",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
"myNixpkgs"
|
||||
],
|
||||
"nose": "nose",
|
||||
"ob-racket": "ob-racket",
|
||||
|
@ -232,18 +246,20 @@
|
|||
"org-yt": "org-yt",
|
||||
"php-extras": "php-extras",
|
||||
"revealjs": "revealjs",
|
||||
"rotate-text": "rotate-text"
|
||||
"rotate-text": "rotate-text",
|
||||
"straight": "straight"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1627398156,
|
||||
"narHash": "sha256-Ru1aV3NuIFXAsvUE3de8KR7xDZOo1GCBJdsWKJn+Ebw=",
|
||||
"lastModified": 1628328518,
|
||||
"narHash": "sha256-U56ydG0+GQvXc9ivjPwJzIE4U4ovXDOzTLdHqJx6oxo=",
|
||||
"owner": "vlaci",
|
||||
"repo": "nix-doom-emacs",
|
||||
"rev": "fee14d217b7a911aad507679dafbeaa8c1ebf5ff",
|
||||
"rev": "656a3aea172d6fb99a1d6e5c45667121855e5996",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "vlaci",
|
||||
"ref": "develop",
|
||||
"repo": "nix-doom-emacs",
|
||||
"type": "github"
|
||||
}
|
||||
|
@ -251,16 +267,15 @@
|
|||
"nix-straight": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1621543597,
|
||||
"narHash": "sha256-E/m2Hrw2og//CfOCOWe2yapYC01Tqhozn4YMPYJsC3o=",
|
||||
"lastModified": 1628328207,
|
||||
"narHash": "sha256-ZWdev0HyxmKIdzLetPKiNK7Hh5gBuCnGwqgq95aNf5k=",
|
||||
"owner": "vlaci",
|
||||
"repo": "nix-straight.el",
|
||||
"rev": "8e84d04f10b2298de856b2b8b9a0d13abc91b5ca",
|
||||
"rev": "4bb7a6267d0bbb76d7bf4168ada1fb4eec1b735f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "vlaci",
|
||||
"ref": "v2.2.0",
|
||||
"repo": "nix-straight.el",
|
||||
"type": "github"
|
||||
}
|
||||
|
@ -285,16 +300,13 @@
|
|||
"locked": {
|
||||
"lastModified": 1627942574,
|
||||
"narHash": "sha256-guUcGRWvY2mfiVSet2x/zeHIyflm2wgglj0ldg0mMio=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"path": "/nix/store/4l9d555va23q26p985kwr2rzfn01n6vw-source",
|
||||
"rev": "c464dc811babfe316ed4ab7bbc12351122e69dd7",
|
||||
"type": "github"
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nose": {
|
||||
|
@ -317,7 +329,7 @@
|
|||
"inputs": {
|
||||
"flake-utils": "flake-utils_3",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
"myNixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
|
@ -435,11 +447,15 @@
|
|||
"emacs-overlay": "emacs-overlay",
|
||||
"flake-utils": "flake-utils",
|
||||
"home-manager": "home-manager",
|
||||
"myNixpkgs": "myNixpkgs",
|
||||
"nix-doom-emacs": "nix-doom-emacs",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs": [
|
||||
"myNixpkgs"
|
||||
],
|
||||
"nvd": "nvd",
|
||||
"scripts": "scripts"
|
||||
"scripts": "scripts",
|
||||
"unstableNixpkgs": "unstableNixpkgs"
|
||||
}
|
||||
},
|
||||
"rotate-text": {
|
||||
|
@ -462,7 +478,7 @@
|
|||
"inputs": {
|
||||
"flake-utils": "flake-utils_4",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
"myNixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
|
@ -479,6 +495,38 @@
|
|||
"type": "git",
|
||||
"url": "https://git.dadada.li/dadada/scripts.git"
|
||||
}
|
||||
},
|
||||
"straight": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1623633709,
|
||||
"narHash": "sha256-taLIYnjs9sD8N8PuGO2F7l+O69u0dNPunwzFVTlXjUM=",
|
||||
"owner": "raxod502",
|
||||
"repo": "straight.el",
|
||||
"rev": "1e27b0590df77a5d478970ca58fd6606971692f5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "raxod502",
|
||||
"repo": "straight.el",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"unstableNixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1627942574,
|
||||
"narHash": "sha256-guUcGRWvY2mfiVSet2x/zeHIyflm2wgglj0ldg0mMio=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c464dc811babfe316ed4ab7bbc12351122e69dd7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c464dc811babfe316ed4ab7bbc12351122e69dd7",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
17
flake.nix
17
flake.nix
|
@ -2,29 +2,32 @@
|
|||
description = "dadada's nix flake";
|
||||
|
||||
inputs = {
|
||||
myNixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
|
||||
emacs-overlay = {
|
||||
url = github:nix-community/emacs-overlay;
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.nixpkgs.follows = "myNixpkgs";
|
||||
};
|
||||
flake-utils.url = github:numtide/flake-utils;
|
||||
unstableNixpkgs.url = "github:nixos/nixpkgs?rev=c464dc811babfe316ed4ab7bbc12351122e69dd7";
|
||||
home-manager = {
|
||||
url = github:nix-community/home-manager;
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
# broken some commit after c464dc811babfe316ed4ab7bbc12351122e69dd7
|
||||
#inputs.nixpkgs.follows = "unstableNixpkgs";
|
||||
};
|
||||
nix-doom-emacs = {
|
||||
url = github:vlaci/nix-doom-emacs;
|
||||
url = github:vlaci/nix-doom-emacs/develop;
|
||||
inputs.emacs-overlay.follows = "emacs-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.nixpkgs.follows = "myNixpkgs";
|
||||
};
|
||||
nixos-hardware.url = github:NixOS/nixos-hardware/master;
|
||||
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
|
||||
nixpkgs.follows = "myNixpkgs";
|
||||
nvd = {
|
||||
url = git+https://gitlab.com/khumba/nvd.git;
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.nixpkgs.follows = "myNixpkgs";
|
||||
};
|
||||
scripts = {
|
||||
url = git+https://git.dadada.li/dadada/scripts.git?ref=main;
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.nixpkgs.follows = "myNixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -13,10 +13,58 @@ in
|
|||
programs.doom-emacs = {
|
||||
enable = true;
|
||||
doomPrivateDir = ./doom.d;
|
||||
emacsPackagesOverlay = self: super: with pkgs; {
|
||||
tsc = super.tsc.overrideAttrs (old:
|
||||
let
|
||||
libtsc_dyn = rustPlatform.buildRustPackage rec {
|
||||
pname = "emacs-tree-sitter";
|
||||
version = "0.15.1";
|
||||
src = fetchFromGitHub {
|
||||
owner = "ubolonton";
|
||||
repo = "emacs-tree-sitter";
|
||||
rev = version;
|
||||
sha256 = "sha256-WgkGtmw63+kRLTRiSEO4bFF2IguH5g4odCujyazkwJc=";
|
||||
};
|
||||
preBuild = ''
|
||||
export BINDGEN_EXTRA_CLANG_ARGS="$(< ${stdenv.cc}/nix-support/libc-crt1-cflags) \
|
||||
$(< ${stdenv.cc}/nix-support/libc-cflags) \
|
||||
$(< ${stdenv.cc}/nix-support/cc-cflags) \
|
||||
$(< ${stdenv.cc}/nix-support/libcxx-cxxflags) \
|
||||
${lib.optionalString stdenv.cc.isClang "-idirafter ${stdenv.cc.cc}/lib/clang/${lib.getVersion stdenv.cc.cc}/include"} \
|
||||
${lib.optionalString stdenv.cc.isGNU
|
||||
"-isystem ${stdenv.cc.cc}/lib/gcc/${stdenv.hostPlatform.config}/${lib.getVersion stdenv.cc.cc}/include/"} \
|
||||
${lib.optionalString stdenv.cc.isGNU
|
||||
"-isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc} -isystem ${stdenv.cc.cc}/include/c++/${lib.getVersion stdenv.cc.cc}/${stdenv.hostPlatform.config}"} \
|
||||
$NIX_CFLAGS_COMPILE"
|
||||
'';
|
||||
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
|
||||
cargoHash = "sha256-HB5tFR1slY2D6jb2mt4KrGrGBUUVrxiBjmVycO+qfYY=";
|
||||
};
|
||||
in
|
||||
{
|
||||
inherit (libtsc_dyn) src;
|
||||
preBuild = ''
|
||||
ext=${stdenv.hostPlatform.extensions.sharedLibrary}
|
||||
dest=$out/share/emacs/site-lisp/elpa/tsc-${old.version}
|
||||
install -D ${libtsc_dyn}/lib/libtsc_dyn$ext $dest/tsc-dyn$ext
|
||||
echo -n "0.15.1" > $dest/DYN-VERSION
|
||||
'';
|
||||
});
|
||||
tree-sitter-langs = super.tree-sitter-langs.overrideAttrs (old: {
|
||||
postInstall = ''
|
||||
dest=$out/share/emacs/site-lisp/elpa/tree-sitter-langs-${old.version}
|
||||
echo -n "0.10.2" > $dest/BUNDLE-VERSION
|
||||
${lib.concatStringsSep "\n"
|
||||
(lib.mapAttrsToList (name: src: "name=${name}; ln -s ${src}/parser $dest/bin/\${name#tree-sitter-}.so") pkgs.tree-sitter.builtGrammars)};
|
||||
'';
|
||||
});
|
||||
};
|
||||
};
|
||||
services.emacs = {
|
||||
enable = true;
|
||||
socketActivation.enable = true;
|
||||
};
|
||||
home.file.".tree-sitter".source = (pkgs.runCommand "grammars" {} ''
|
||||
mkdir -p $out/bin
|
||||
echo -n "0.10.2" > $out/BUNDLE-VERSION
|
||||
${lib.concatStringsSep "\n"
|
||||
(lib.mapAttrsToList (name: src: "name=${name}; ln -s ${src}/parser $out/bin/\${name#tree-sitter-}.so") pkgs.tree-sitter.builtGrammars)};
|
||||
'');
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,3 +2,11 @@
|
|||
(setq org-directory "~/src/notes/org/")
|
||||
(with-eval-after-load 'treemacs
|
||||
(define-key treemacs-mode-map [mouse-1] #'treemacs-single-click-expand-action))
|
||||
(defun fixed-tree-sitter-langs-install-grammars (&optional skip-if-installed version os keep-bundle) ())
|
||||
(advice-add 'tree-sitter-langs-install-grammars :override #'fixed-tree-sitter-langs-install-grammars)
|
||||
(use-package! tree-sitter
|
||||
:config
|
||||
(cl-pushnew (expand-file-name "~/.tree-sitter") tree-sitter-load-path)
|
||||
(require 'tree-sitter-langs)
|
||||
(global-tree-sitter-mode)
|
||||
(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode))
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
(package! direnv)
|
||||
(package! tree-sitter)
|
||||
(package! tree-sitter-langs)
|
Loading…
Add table
Add a link
Reference in a new issue