nix-community / nix-doom-emacs

doom-emacs packaged for Nix [maintainers=@thiagokokada]
MIT License
214 stars 43 forks source link

Avoid package compile #421

Open fkrause98 opened 1 year ago

fkrause98 commented 1 year ago

Hi!

First of all, sorry if this has been asked before or I've missed it but:

Is there a way to avoid building doom every time I use home-manager?

I'm trying to manage doom+emacs through nix-doom-emacs but every time I run home-manager switch to update my config, Doom has to recompile packages which can take 5-10 minutes. Even if I can disable native-comp, doom's setup still runs.

thiagokokada commented 1 year ago

See https://github.com/nix-community/nix-doom-emacs/pull/303.

fkrause98 commented 1 year ago

Thanks for the quick answer!

I've added the doomPackageDir option with a path as its value, but now I'm getting this error:

❯ home-manager switch
building '/nix/store/g2w54b87pr4sxnczv0c5p1r6war111zb-emacs-straight-packages.json.drv'...
installing
[nix-doom-emacs] Advising doom to keep it alive...
Loading /nix/store/kzdm8lvjahr81wdbh18f4sbw4f41yl1x-doom-src/bin/doom...
Installing Doom Emacs!

- Skipping /nix/store/93hkbiav0lc59az5nbciwmbgaz7iawxg-straight/ (already exists)
  - Creating /nix/store/93hkbiav0lc59az5nbciwmbgaz7iawxg-straight/init.el
  x There was an unexpected runtime error
    Message: File error
    Details: ("Opening output file" "Permission denied" "/nix/store/93hkbiav0lc59az5nbciwmbgaz7iawxg-straight/init.el")
    Backtrace:
      (write-region nil nil "/nix/store/93hkbiav0lc59az5nbciwmbgaz7iawxg-str...
      (save-current-buffer (set-buffer temp-buffer) (write-region nil nil te...
      (prog1 (save-current-buffer (set-buffer temp-buffer) (insert-file-cont...
      (unwind-protect (prog1 (save-current-buffer (set-buffer temp-buffer) (...
      (let ((temp-file (doom-path doom-user-dir filename)) (temp-buffer (gen...
      (if (let ((p (let ((file filename)) (and (stringp file) (let ((default...
      (let* ((template file) (filename (if template (car-safe (prog1 templat...
      ((closure ((yes\?) (context . #s(doom-cli-context (25675 55223 213684 ...
      (mapc (closure ((yes\?) (context . #s(doom-cli-context (25675 55223 21...
      (let ((doom-print-indent (+ (if t doom-print-indent-increment 0) doom-...
      (if (eq config\? :no) (doom-print (doom-print--format (doom-print--cla...
      (let ((default-directory doom-emacs-dir) (yes\? (progn (or (progn (and...
    ! Wrote extended backtrace to /private/tmp/nix-build-emacs-straight-packages.json.drv-0/tmp.CteB72t6MK/local/logs/cli.doom.230428142703.5905.error
Opening output file: Permission denied, /nix/store/93hkbiav0lc59az5nbciwmbgaz7iawxg-straight/init.el
error:
       … while calling the 'derivationStrict' builtin

         at //builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'home-manager-generation'
         whose name attribute is located at /nix/store/6m0wa7bv3p47b40qab7szbl2jd9lb4sw-nixpkgs/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:302:7

       … while evaluating attribute 'buildCommand' of derivation 'home-manager-generation'

         at /nix/store/6m0wa7bv3p47b40qab7szbl2jd9lb4sw-nixpkgs/nixpkgs/pkgs/build-support/trivial-builders.nix:87:14:

           86|       enableParallelBuilding = true;
           87|       inherit buildCommand name;
             |              ^
           88|       passAsFile = [ "buildCommand" ]

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: builder for '/nix/store/g2w54b87pr4sxnczv0c5p1r6war111zb-emacs-straight-packages.json.drv' failed with exit code 255;
       last 10 log lines:
       >       (let ((temp-file (doom-path doom-user-dir filename)) (temp-buffer (gen...
       >       (if (let ((p (let ((file filename)) (and (stringp file) (let ((default...
       >       (let* ((template file) (filename (if template (car-safe (prog1 templat...
       >       ((closure ((yes\?) (context . #s(doom-cli-context (25675 55223 213684 ...
       >       (mapc (closure ((yes\?) (context . #s(doom-cli-context (25675 55223 21...
       >       (let ((doom-print-indent (+ (if t doom-print-indent-increment 0) doom-...
       >       (if (eq config\? :no) (doom-print (doom-print--format (doom-print--cla...
       >       (let ((default-directory doom-emacs-dir) (yes\? (progn (or (progn (and...
       >     ! Wrote extended backtrace to /private/tmp/nix-build-emacs-straight-packages.json.drv-0/tmp.CteB72t6MK/local/logs/cli.doom.230428142703.5905.error
       > Opening output file: Permission denied, /nix/store/93hkbiav0lc59az5nbciwmbgaz7iawxg-straight/init.el
       For full logs, run 'nix-store -l /nix/store/g2w54b87pr4sxnczv0c5p1r6war111zb-emacs-straight-packages.json.drv'.

Any clues? :)

pehdfms commented 11 months ago

for @fkrause98 and anyone else facing the same issue, the latest comment by quinn-dougherty in #303 clued me into the fact that your doomPackageDir must contain init.el, packages.el and an empty config.el file perhaps a clearer assertion could be added to check for these files?

quinn-dougherty commented 9 months ago

(this is no longer working on my machine) (edit: false positive)

quinn-dougherty commented 9 months ago

it'd be really great if building straight-emacs-env could parallelize. I have one CPU on 100% and all the others on 1% through most of it

ckiee commented 8 months ago

Let's merge this newer issue into #324. I'll respond to @quinn-dougherty there.