Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Every time I update my configuration running; nixos-rebuild switch, it rebuilds emacs (Gcc) from scratch (taking forver). #170

Closed
nazzacode opened this issue Aug 23, 2021 · 4 comments

Comments

@nazzacode
Copy link

nazzacode commented Aug 23, 2021

I have the following in my configuration.nix file:

# Emacs (via Overlay)
  services.emacs.package = pkgs.emacsGcc; # emacsGcc -> Native-compile emacs28

  nixpkgs.overlays = [
    (import (builtins.fetchTarball {
      url = https://github.com/nix-community/emacs-overlay/archive/master.tar.gz;
# DEL "https://github.com/nix-community/emacs-overlay/archive/b539c9174b79abaa2c24bd773c855b170cfa6951.tar.gz";
    }))
  ];

(Almost) every time I update my configuration running; nixos-rebuild switch, it rebuilds emacs from scratch (taking forver).

Whats going on?

@nazzacode nazzacode changed the title e Every time I update my configuration running; nixos-rebuild switch, it rebuilds emacs (Gcc) from scratch (taking forver). Aug 23, 2021
@evanrelf
Copy link

You need to specify a specific Git revision, along with its hash, in order to avoid re-downloading new versions of the overlay constantly.

Concretely, that means:

  1. Change the master string in the url field of builtins.fetchTarball to a specific commit hash.
  2. Add a sha256 field to builtins.fetchTarball set to 0000000000000000000000000000000000000000000000000000
  3. Try to build (nixos-rebuild switch or whatever)
  4. It will complain about the hash being incorrect (expected zeros, actually the real hash)
  5. Replace the zeros with the real hash
  6. ...
  7. Profit

@nazzacode
Copy link
Author

Ok nice! All working. Thank so much :) Probably a little more complex, but is there any way I can periodically check for updates?

@evanrelf
Copy link

is there any way I can periodically check for updates?

I know system.autoUpgrade.* options exist for periodically upgrading your system, but that's just running nixos-rebuild switch --upgrade on a systemd timer. If you have a revision pinned in your configuration.nix file, like I mentioned in my previous comment, that wouldn't get upgraded. Maaayyyybe you could get the auto-upgrade behavior with the Emacs overlay if you added the overlay as a Nix channel somehow? Then the --upgrade flag would run nix-channel --update or whatever. But I don't know how to get this overlay as a channel, and I don't think it's worth it.

Other solutions exist for automating the boring parts of these manual revision bumps, such as https://github.com/nmattia/niv.

TL;DR: Not easily; if you try it, you're on your own.

@nazzacode
Copy link
Author

Cheers for solving the problem and for all the bonus pointers. I'm gonna close the issue as I don't have time for the rabbit hole right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants