Fix bugs with automatic nix builds

This commit is contained in:
Kiana Sheibani 2024-03-02 17:23:00 -05:00
parent 9595ea7dc4
commit 3647bca4fd
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -1269,6 +1269,7 @@ We first need a function to build a flake reference:
If IMPURE is t, then allow impure builds." If IMPURE is t, then allow impure builds."
(message "Building \"%s\" ..." out) (message "Building \"%s\" ..." out)
(require 's)
(s-trim (shell-command-to-string (s-trim (shell-command-to-string
(concat "nix build --no-link --print-out-paths " (concat "nix build --no-link --print-out-paths "
(when impure "--impure ") out)))) (when impure "--impure ") out))))
@ -1290,11 +1291,13 @@ a call to this function reuses the same NAME argument, then the
symlink is overwritten. symlink is overwritten.
If IMPURE is t, then allow impure builds." If IMPURE is t, then allow impure builds."
(let* ((gcdir "/sudo::/nix/var/nix/gcroots/emacs") (let* ((gcdir "/nix/var/nix/gcroots/emacs")
(sym (expand-file-name name gcdir)) (sym (expand-file-name name gcdir))
(path (nix-build-out-path out impure))) (path (nix-build-out-path out impure)))
(make-directory gcdir t) (unless (equal path (file-symlink-p sym))
(make-symbolic-link path sym t) (require 'epg)
(make-directory (concat "/sudo::" gcdir) t)
(make-symbolic-link path (concat "/sudo::" sym) t))
path)) path))
#+end_src #+end_src
@ -1991,7 +1994,8 @@ like. Let's add a ~use-package!~ declaration to fix some of them:
; More accurate git status ; More accurate git status
(setq +treemacs-git-mode 'deferred (setq +treemacs-git-mode 'deferred
treemacs-python-executable treemacs-python-executable
(concat (nix-build-out-path-gcroot "nixpkgs#python3") "/bin/python")) (concat (nix-build-out-path-gcroot "treemacs-python" "nixpkgs#python3")
"/bin/python"))
:config :config
(setq ; Child-frame reading is broken (and sucks anyways) (setq ; Child-frame reading is broken (and sucks anyways)
treemacs-read-string-input 'from-minibuffer treemacs-read-string-input 'from-minibuffer