diff options
author | Crazazy | 2022-04-27 10:02:43 +0200 |
---|---|---|
committer | Crazazy | 2022-04-27 19:29:05 +0200 |
commit | 1f256dc86ba198614e4d90cc0ff6caebd4ed5090 (patch) | |
tree | fda25acb4c6df8f4e6184734f89fb1b6d2d5f23e /emacs.org | |
parent | 184aaf51d5b5b16b90701889580cb26a48189a46 (diff) |
fix loading order of nix-env-from-packages for haskell
Diffstat (limited to 'emacs.org')
-rw-r--r-- | emacs.org | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/emacs.org b/emacs.org index 649b0e7..9d76288 100644 --- a/emacs.org +++ b/emacs.org @@ -373,32 +373,34 @@ Also, if you just stumbled accross this at random, there is an easy tangle butto I use nix-sandbox for managing nix package for other languages. One of the functions doesn't work that well for me so I replaced it with something that does #+begin_src emacs-lisp :tangle emacsconfig/nix.el - (use-package nix-sandbox - :config - (defun nix-executable-find (sandbox executable) - "finds an EXECUTABLE in SANDBOX" - (set (make-local-variable 'exec-path) (nix-exec-path sandbox)) - (executable-find executable))) + (use-package nix-sandbox + :demand + :config + (defun nix-executable-find (sandbox executable) + "finds an EXECUTABLE in SANDBOX" + (set (make-local-variable 'exec-path) (nix-exec-path sandbox)) + (executable-find executable)) #+end_src Beyond that, there is a helper function that makes it easy to quickly define environments with the required packages for a programming language #+begin_src emacs-lisp :tangle emacsconfig/nix.el - (defun nix-env-from-packages (name &rest packages) - "create a nix environment from nix packages. returns the location of the environment" - (interactive (append - (list (read-string "Environment name: " nil nil "nameless")) - (split-string (read-string "Packages: ")))) - (with-temp-buffer - (insert (format " - { pkgs ? import %s {}}: - pkgs.mkShell { - buildInputs = with pkgs;[ - %s - ]; - } - " (or nix-nixpkgs-path "<nixpkgs>") (apply 'concat (intersperse "\n" packages)))) - (write-file (concat temporary-file-directory name "-env/shell.nix")) - (nix-find-sandbox (concat temporary-file-directory name "-env")))) + (defun intersperse (el ls) (if (cdr ls) `(,(car ls) ,el . ,(intersperse el (cdr ls))) ls)) + (defun nix-env-from-packages (name &rest packages) + "create a nix environment from nix packages. returns the location of the environment" + (interactive (append + (list (read-string "Environment name: " nil nil "nameless")) + (split-string (read-string "Packages: ")))) + (with-temp-buffer + (insert (format " + { pkgs ? import %s {}}: + pkgs.mkShell { + buildInputs = with pkgs;[ + %s + ]; + } + " (or nix-nixpkgs-path "<nixpkgs>") (apply 'concat (intersperse "\n" packages)))) + (write-file (concat temporary-file-directory name "-env/shell.nix")) + (nix-find-sandbox (concat temporary-file-directory name "-env"))))) #+end_src **** Python Python is a bit weird. It had no intentions at all to do things the way I wanted it to do things with |