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

Overlay never using binary cache #122

Closed
jacksonludwig opened this issue Mar 14, 2021 · 37 comments
Closed

Overlay never using binary cache #122

jacksonludwig opened this issue Mar 14, 2021 · 37 comments

Comments

@jacksonludwig
Copy link

In my home manager I have the following:

{ config, pkgs, ... }:

let

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

in {
# <other config above>
    programs.emacs = {
      enable = true;
      package = unstable.emacsGcc;
      extraPackages = epkgs: with epkgs; [
          vterm
      ];
  };
# <other config after>
}

I have my channels updated (not that I think it would matter since I'm importing it directly) and have my cachix set to nix-community.

Still, though, nix refuses to pull from the cache and tries to build emacs itself. Is there anything I'm missing here?

@zetashift
Copy link

I'm having the same issue here!
Could it be because on Hydra it's erroring out? https://hydra.nix-community.org/project/emacs-overlay

@purcell
Copy link
Member

purcell commented Mar 18, 2021

At the risk of piggy-backing on a tangentially-related issue, it also seems that the jobsets don't include darwin, so MacOS users won't ever get cache hits currently. I wonder what options might exist for that, e.g. just using github actions with cachix to routinely build and push a variety of popular outputs for that platform.

@cmm
Copy link

cmm commented Mar 18, 2021

seems OK now (for emacsPgtkGcc, at least)

@adisbladis
Copy link
Member

I think I managed to find the culprit earlier today.
It was a bug in https://github.com/nix-community/queued-build-hook which I think is already fixed but we were deploying an older version.

It's been running smoothly since nix-community/infra@b0a9ac3.

I'm closing this for now. Please reopen if this issue still persists (I will monitor the build infra to see if this issue pops up again).

@adisbladis
Copy link
Member

adisbladis commented Mar 18, 2021

At the risk of piggy-backing on a tangentially-related issue, it also seems that the jobsets don't include darwin, so MacOS users won't ever get cache hits currently. I wonder what options might exist for that, e.g. just using github actions with cachix to routinely build and push a variety of popular outputs for that platform.

@purcell The nix-community org is running on infra paid for by members in the community. If someone steps up and is willing to pay for a MacOS builder we'd be happy to operate it, but right now the issue is a monetary one.

I'm reluctant to use github actions for this for various reasons:

  • We'd need to put the cache signing key in a github action, making it relatively trivial to extract.
  • There is no obvious workflow to hook it up to the hydra instance which orchestrates the builds.

@zetashift
Copy link

Works fine for me now, thank you @adisbladis !!

@mjlbach
Copy link

mjlbach commented Mar 18, 2021

@adisbladis how can you extract the nix-community cachix key from a GitHub secret? I do this for my fork of emacs-overlay (for providing mac builds for emacsGcc in case anyone is interested), and for neovim-nightly-overlay. Now you have me concerned 😅

@purcell
Copy link
Member

purcell commented Mar 18, 2021

@adisbladis Ah yes, I remember now that that was a concern.

@mjlbach Does that mean you have a cachix with Darwin emacsGcc artifacts that other people (me!) could use?

@mjlbach
Copy link

mjlbach commented Mar 18, 2021

Yes :) You have to use my fork of the overlay, but it should otherwise work!

The install instructions aren't accurate since I didn't modify them from nix-community, but if you s/nix-community/mjlbach in all the right places it should work fine (and let me know if it doesn't!).

@purcell
Copy link
Member

purcell commented Mar 18, 2021

Thanks, I'll give that a go.

@thomasheartman
Copy link

Thanks for looking into this! 😄 Getting the cache up and running again is really a nice quality of life improvement.

However, I wanted to report that I'm still experiencing this today. That said, I thought I saw the cache working yesterday, so it might be something wrong with the configuration between two different systems. I use the same config as OP (just with different packages), so I'd expect it to work on my end too. Could there be any more issues/regressions that have cropped up or am I the only one experiencing this now (in which case it's probably just user error)? Thanks!

@adisbladis
Copy link
Member

That said, I thought I saw the cache working yesterday, so it might be something wrong with the configuration between two different systems.

Some cache misses are always expected as NixOS channels and the nix-community hydra instance are not in perfect sync.

It doesn't look like we have any more regressions in the build infra.

@thomasheartman
Copy link

Ah, okay, thanks for the clarification! Trying again now it seems to have worked. Thanks! 🙇

@jul1u5
Copy link

jul1u5 commented Mar 20, 2021

It was also working for me, but I just tried upgrading the system and got a cache miss. Presumably, because GitLab CI is still running on the most recent commit (or does it have nothing to do with the binary cache)?

Some cache misses are always expected as NixOS channels and the nix-community hydra instance is not in perfect sync.

In case of flakes would pinning the NixOS channel solve that? I just noticed that this project doesn't have flake.lock file, is there a reason for that?

Also, is there a way to specify an older cached commit and use it without rebuilding Emacs? I looked over https://hydra.nix-community.org/jobset/emacs-overlay/unstable-gcc-pkgs and tried using the latest evaluation that did not error (which at the time was on this commit dcb4f8e). But that didn't seem to help. Am I doing something wrong?

EDIT: I think I solved the issue with using an older cached commit, in my NixOS configuration I changed the nixpkgs revision to 1f77a4c8c74bbe896053994836790aa9bf6dc5ba (which I found in evaluation inputs).

@jacksonludwig
Copy link
Author

@jul1u5 I had to do the same.

It would be nice if there was a way to "match" this repo automatically, but idk if that's a thing.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/use-nix-community-cachix-cache-for-emacs-overlay/11710/5

@efim
Copy link

efim commented Sep 6, 2021

seems OK now (for emacsPgtkGcc, at least)

Adding note:
Today I started learning about nix-community/emacs-overlay
Added as flake into "NixOS 21.05"
emacsGcc didn't hit the cache
emacsPgtkGcc did get fully fetched from cachix

I am amazed and extremely grateful for the work that had been done in the nix world to make this all possible!

@zeorin
Copy link

zeorin commented Dec 29, 2021

I just found an elegant solution to this problem: instead of asking for the tarball of the current master branch, we should ask for the tarball of the master branch a little in the past, so that there's been time for Hydra to build the binaries and push them to cachix. Having had a cursory look at the build times, it seems they're usually done in an hour or so.

More specifically, I changed the overlay's URL in my config to https://github.com/nix-community/emacs-overlay/archive/master@{2%20hours%20ago}.tar.gz and so far I've not had a local build happen again.

If the latest commit on master is more than 2 hours old, nix will get the tarball for the lastest commit, and cachix should (and has, so far) have a binary for it.

If the latest commit on master is less than 2 hours old, nix will get the tarball for a previous (likely the previous) commit, and cachix should (and has, so far) have a binary for it. Cachix might not have binaries for the latest commit yet.

This way I'm still tracking master, I always get a cache hit, and I'm at most 2 hours behind (though since commits happen less frequently than every 2 hours usually I'm still on the very latest).

@zeorin
Copy link

zeorin commented Dec 31, 2021

Note that the above works only if your channel is at the same version as the one used for the build, so if you're still getting a cache miss with the above, try updating the channel first.

@thomasheartman
Copy link

@zeorin Nice! That seems to work well 😄 I didn't realize you could do that! can you explain the syntax? It seems to just be a URL-encoded "2 hours ago". Is that a github thing or a nix thing? Must be the former, right?

@zeorin
Copy link

zeorin commented Jan 4, 2022

@thomasheartman it's a git thing, and it turns out that GitHub supports it, too. From man gitrevisions:

       [<refname>]@{<date>}, e.g. master@{yesterday}, HEAD@{5 minutes ago}
           A ref followed by the suffix @ with a date specification enclosed
           in a brace pair (e.g.  {yesterday}, {1 month 2 weeks 3 days 1 hour
           1 second ago} or {1979-02-26 18:30:00}) specifies the value of the
           ref at a prior point in time. This suffix may only be used
           immediately following a ref name and the ref must have an existing
           log ($GIT_DIR/logs/<ref>). Note that this looks up the state of
           your local ref at a given time; e.g., what was in your local master
           branch last week. If you want to look at commits made during
           certain times, see --since and --until.

I did try it without the URL encoding, first, but that didn't work.

@thomasheartman
Copy link

Oh, cool! The more you know 😄 Thanks! That could very well come in handy at some point in the future.

@zeorin
Copy link

zeorin commented Jan 11, 2022

Note that hydra is currently broken: #204, so for the time being I've pinned it like this:

import (builtins.fetchTarball {
    url =
      "https://github.com/nixos/nixpkgs/archive/0ecf7d414811f831060cf55707c374d54fbb1dec.tar.gz";
  }) {
    config = config.nixpkgs.config;
    overlays = [
      (import (builtins.fetchTarball {
        url =
          "https://github.com/nix-community/emacs-overlay/archive/46c8425e72efd4002343df959ba1ce47381e1eca.tar.gz";
      }))
    ];
  };

@efim
Copy link

efim commented Jan 19, 2022

Will write down how to find combination of nixpkgs and emacs-overlay for which cachix has prebuilt artifact:

  • visit https://hydra.nix-community.org/project/emacs-overlay
  • select "stable" or "unstable" - which nixpkgs you use
  • select latest successful jobset
  • select variant of emacs (gcc, unstable)
  • go to "Inputs" page and check the revisions with which emacs was built
  • setting config to these revisions will hopefully yield for you update to the main system, and update to the emacs, and will result in cache hit

Suspect that everyone in this thread already knows this, but I only found out about that 6 months after first encountering this

@yuuyins
Copy link
Contributor

yuuyins commented Jul 23, 2022

select latest successful jobset
setting config to these revisions will hopefully yield for you update to the main system, and update to the emacs, and will result in cache hit

so that really isn't guaranteed to be in nix-community cache. what you can do is try in nix shell first.

example, as of 2022-07-23T07:45 UTC, latest build for emacs-overlay:unstable:emacsGitNativeComp is https://hydra.nix-community.org/build/16520543. if i try its emacs-overlay input revision f22fe28, it doesn't hit cache

$ nix shell --print-build-logs --no-write-lock-file emacs-overlay/f22fe28d687085b9c969f84b8784aca67b7340f4#emacsGitNativeComp --command sh
warning: not writing modified lock file of flake 'flake:emacs-overlay/f22fe28d687085b9c969f84b8784aca67b7340f4':
• Added input 'flake-utils':
    'github:numtide/flake-utils/7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249' (2022-07-04)
• Added input 'nixpkgs':
    'path:/nix/store/dwp21rcg5jq1dx3a1pyfdpa1lwx57wdv-source?lastModified=0&narHash=sha256-%2fcxTFSMmpAb8tBp1yVga1fj+i8LB9aAxnMjYFpRMuVs=' (1970-01-01)
emacs-git-native-comp> unpacking sources
emacs-git-native-comp> unpacking source archive /nix/store/yh30hs434j5ybcdz5gm1ix2kph8j8y80-source
emacs-git-native-comp> source root is source
emacs-git-native-comp> patching sources
emacs-git-native-comp> substituteStream(): WARNING: pattern '/bin/pwd' doesn't match anything in file './admin/charsets/Makefile.in'
emacs-git-native-comp> substituteStream(): WARNING: pattern '/bin/pwd' doesn't match anything in file './admin/grammars/Makefile.in'
emacs-git-native-comp> substituteStream(): WARNING: pattern '/bin/pwd' doesn't match anything in file './admin/unidata/Makefile.in'

only if i try one of the 2 in the end of the first page it will hit cache

$ nix shell --print-build-logs --no-write-lock-file emacs-overlay/12c96109a215d8f676a573c2ccbe93fb26d5b5db#emacsGitNativeComp --command sh
warning: not writing modified lock file of flake 'flake:emacs-overlay/12c96109a215d8f676a573c2ccbe93fb26d5b5db':
• Added input 'flake-utils':
    'github:numtide/flake-utils/7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249' (2022-07-04)
• Added input 'nixpkgs':
    'path:/nix/store/dwp21rcg5jq1dx3a1pyfdpa1lwx57wdv-source?lastModified=0&narHash=sha256-%2fcxTFSMmpAb8tBp1yVga1fj+i8LB9aAxnMjYFpRMuVs=' (1970-01-01)
[0/1 built, 1/0/1 copied (123.4/299.0 MiB), 25.6/75.7 MiB DL] fetching emacs-git-native-comp-20220720.0 from https://nix-community.cachix.org

so try that method with nix shell first before setting to your inputs

@thomasheartman
Copy link

@yuuyins Do you know if there is any way to automate that process or otherwise make it so that you don't need to do it manually everytime? Preferebly just make it so that when building, it's checked automatically and adjusted to the latest revision in the cache?

@yuuyins
Copy link
Contributor

yuuyins commented Jul 24, 2022

@thomasheartman well that's not so simple; because a flake input can have multiple derivations and how simple would it be to get a revision that has available cache for all specified derivations?

let's say you just want for one specific derivation. it would need to use cachix and and hydra apis to find which revision has cache and then put stuff into flake.cache that flake.nix inputs would reference which flake lock would then do its magic. this is a workaround; the best solution would be this integrated directly into nix flake lock so nix would automatically getting revision of cached stuff through available substituters. i did not find any issue about this on https://github.com/nixos/nix/issues

@yuuyins
Copy link
Contributor

yuuyins commented Jul 24, 2022

so that really isn't guaranteed to be in nix-community cache.

just investigating this more, this is wrong. https://hydra.nix-community.org/build/16566209

GET https://nix-community.cachix.org/vj9azsax2k2fpkkamwi3aqp20i9vlzz3.narinfo

StorePath: /nix/store/vj9azsax2k2fpkkamwi3aqp20i9vlzz3-emacs-git-native-comp-20220724.0
URL: nar/12b0dfc75fb5d2cf1bb7d0fdf598a3898d2bf59f7e973de417d50981fdb073ff.nar.xz
Compression: xz
FileHash: sha256:12b0dfc75fb5d2cf1bb7d0fdf598a3898d2bf59f7e973de417d50981fdb073ff
FileSize: 79396220
NarHash: sha256:1g0pyyg132axi2bjcs79ara9az5z8r673algz0lxgxsz5k2d3al7
NarSize: 313442312
References: 0figld4yz6k9bk30w05wxdybqq404y8j-xcb-util-0.4.0 0gzd0049bywqhzi5anbydsxil7r1lfrj-binutils-2.38 1ayz7sydm1rbkfspzy6qq5ih21d1mi3z-gnutls-3.7.6 1rsj0mw8vqlnhk59wkw4i3yal4qw19k0-libXrender-0.9.10 2ggbc04aiq9zf09g49gz9hi3wgk1i4vk-harfbuzz-3.3.2 2wx0faw05ncvgaz5jihd5pda1mzw63mb-libselinux-3.3 38ychklifhkvfjzgqr1i97916cmiwdhj-glib-2.72.3 48s4h862snj1m8dcw58rdj6mpj04188k-systemd-250.4 4ay9q1d8j82p918r49jlzsixw1bpdhm0-libX11-1.7.2 7mcrxfhl2qxx5m6cf991jv8sg9bzb7v0-freetype-2.12.1 7yxmpp55m3n1m6x3gzyrws31i5janhal-librsvg-2.54.4 8ri08j9vhgslirg2p966l830wv3qvwiy-giflib-5.2.1 a2fyr6w9zp07a5615mzmcbqn0jg78hv0-m17n-lib-1.8.0 a7zkqrfyvd9xsr6mvjwqsjb0xqnydaad-jansson-2.14 arysd09ka49dpdai09b83ndkqnilgnyh-gsettings-desktop-schemas-42.0 c8p91c6fm67f4ldza6d811wfj61far9f-libxml2-2.9.14 dwiqy7ixa584rb60lxc8hd10bjryx2ww-libpng-apng-1.6.37 dy7i1aqsf0rfm91bcif0z5m9zg6clmd7-libxcb-1.14 fcyqa5s7j42gam1qkpkb10453d85zf7q-sqlite-3.39.0 ffjvj65in9nf0jnlnjw03wbqmcq59k1c-gmp-with-cxx-6.2.1 jfqvyzcfxfgbknz45ywxv890s7hchydp-binutils-wrapper-2.38 jws83dlza8fl5w9mvk5zjaj7mmcknaa3-gtk+3-3.24.34 k3421p8w6f6pgpcmrminbw1sznrdrvkl-libSM-1.2.3 kiwdwd6zw4svi9jlr95yg1p5pgpjxn1v-gcc-11.3.0 l9lbrnhrswxy2wvjl09gmg2mry7dg0xp-libXpm-3.5.13 mg0qwr5c954qx4izf9yxahv6c93c5qgf-libXfixes-6.0.0 mhhlymrg2m70r8h94cwhv2d7a0c8l7g6-glibc-2.34-210 npcz8z6zl27lzpy0b22isd6kb4ya2llj-fontconfig-2.14.0-lib nsicd68siz5nc44q8zz5cpb1v764bvfa-libotf-0.9.16 p2mxc5x4h4578f4l0948h98xl3yqdjxj-libjpeg-turbo-2.1.3 pkv4ngqc7arfqpr1bsn1bappvms9xbfg-ncurses-6.3-p20220507 q8rdgv8x3hk9ip1v0rraywf0f8bi37nc-libXinerama-1.1.4 qaz5hkfiw2pkfjz1721kbbxb6ks9z19z-libXi-1.8 qm2lv1gpbyn0rsfai40cbvj3h4gz69yc-bash-5.1-p16 rxzkc6x3786xbm1si93b0gj5hxx9zfck-libgccjit-11.3.0 slacsfxv01gjcaqjb9i5k6v77vf80w82-gettext-0.21 vj9azsax2k2fpkkamwi3aqp20i9vlzz3-emacs-git-native-comp-20220724.0 w25nadr7247krvg5nbxr9slnhq76dakc-zlib-1.2.12 wdnxn318gyp75k34f2cscfy6g1k82ybb-libXrandr-1.5.2 wffw18z76xs7r3bwv2qy44r0gshh4qnx-gdk-pixbuf-2.42.8 wmx6zyv93xh0mkkkzdl4iv2wqmk1pixb-libtiff-4.4.0 x0cpggi73rhsm6cwfl9r8q0qvzx72ysl-libXext-1.3.4 x9zh2nh0dqwisgmj7avnysk35xm45g2y-libICE-1.0.10 xgr8zb2sj6g30qfhk7p7mv0ygxck6z8i-cairo-1.16.0 xhdf882p0a25vxz2x94xifggfxqim4n7-atk-2.38.0 yhkn33x0ncx2zfk6a6dy8cdsjhs15hzg-dbus-1.14.0-lib ylnb8y7awrjhlxr1308rchahqvmykxj6-dconf-0.40.0-lib zg4x984qw3zaxn0xy6qgjzhrk1k3h9d4-libXcomposite-0.4.5 zpvq7njsx28yjzfg4n97l83sm0gdhk4c-pango-1.50.7
Deriver: m1yz68jwhalrn5ywnl805s63ghn5hapn-emacs-git-native-comp-20220724.0.drv
Sig: nix-community.cachix.org-1:XizAZ7coWcwmxp8W/FnQRgYCKipkJ8eBbuIeVK0b7pF6x1clK8IJmOyX4VTYEvnRwDbT+/75bnKJ0HsN6CmVDg==

// GET https://nix-community.cachix.org/vj9azsax2k2fpkkamwi3aqp20i9vlzz3.narinfo
// HTTP/1.1 200 OK
// Date: Sun, 24 Jul 2022 23:37:27 GMT
// Content-Type: text/x-nix-narinfo
// Transfer-Encoding: chunked
// Connection: keep-alive
// Cache-Control: public, max-age=14400
// Last-Modified: Sun, 24 Jul 2022 23:13:07 GMT
// CF-Cache-Status: EXPIRED
// Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
// Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=Ckhc48EAN1NEuehv%2B%2FxqA%2FcFtDsYbtsCyzRjrBVRo86cv7LljJu5R%2BhDWq9klrzz3faU9VosGzJ4XroGikvbovE%2B9JiKVZhFyaUsZo0oX6fNddImf7BesYpiRfFVYEPh9Q8PoItFEzPheg%3D%3D"}],"group":"cf-nel","max_age":604800}
// NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
// Vary: Accept-Encoding
// Server: cloudflare
// CF-RAY: 73007bd9bf57a4e1-GRU
// Request duration: 0.736962s

and i can get the nar.xz

/tmp〉curldl https://nix-community.cachix.org/nar/12b0dfc75fb5d2cf1bb7d0fdf598a3898d2bf59f7e973de417d50981fdb073ff.nar.xz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 75.7M  100 75.7M    0     0  3126k      0  0:00:24  0:00:24 --:--:-- 3563k
/tmp〉ls 12b0dfc75fb5d2cf1bb7d0fdf598a3898d2bf59f7e973de417d50981fdb073ff.nar.xz
╭───┬─────────────────────────────────────────────────────────────────────────┬──────┬──────────┬────────────────╮
│ # │                                  name                                   │ type │   size   │    modified    │
├───┼─────────────────────────────────────────────────────────────────────────┼──────┼──────────┼────────────────┤
│ 0 │ 12b0dfc75fb5d2cf1bb7d0fdf598a3898d2bf59f7e973de417d50981fdb073ff.nar.xz │ file │ 75.7 MiB │ 12 seconds ago │

but for whatever the reason with nix it won't hit cache

$ nix shell -L --no-write-lock-file emacs-overlay/8105f0f88edf635dbe97dc3b40984b90b2e76029#emacsGitNativeComp
warning: not writing modified lock file of flake 'flake:emacs-overlay/8105f0f88edf635dbe97dc3b40984b90b2e76029':
• Added input 'flake-utils':
    'github:numtide/flake-utils/7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249' (2022-07-04)
• Added input 'nixpkgs':
    'path:/nix/store/dwp21rcg5jq1dx3a1pyfdpa1lwx57wdv-source?lastModified=0&narHash=sha256-%2fcxTFSMmpAb8tBp1yVga1fj+i8LB9aAxnMjYFpRMuVs=' (1970-01-01)
source> trying https://git.savannah.gnu.org/cgit/emacs.git/snapshot/emacs-9ed5c39aad09571314097be91cb28e7504614421.tar.gz
source>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
source>                                  Dload  Upload   Total   Spent    Left  Speed
[1/0/2 built] building source

@Mic92
Copy link
Member

Mic92 commented Jul 25, 2022

Maybe you have a negative cache hit stored in your nix.

$ rm -rf .cache/nix/ 

will get rid of all caches.

@yuuyins
Copy link
Contributor

yuuyins commented Jul 25, 2022

@Mic92 i got rid of that directory. then

https://hydra.nix-community.org/build/16583641

StorePath: /nix/store/zd3yywnsbhh9fpk67s3jv9198ccvjfqm-emacs-git-native-comp-20220725.0
URL: nar/c7c1998eeab33fdd2aae097757a777e83eaedae273ad7994ad87274645b2227d.nar.xz
Compression: xz
FileHash: sha256:c7c1998eeab33fdd2aae097757a777e83eaedae273ad7994ad87274645b2227d
FileSize: 79397624
NarHash: sha256:1dxx1ipydqd46z3k29w28sgsmdad6k9kf1agpy8q98f1lyhh2rz0
NarSize: 313501608
References: 0figld4yz6k9bk30w05wxdybqq404y8j-xcb-util-0.4.0 0gzd0049bywqhzi5anbydsxil7r1lfrj-binutils-2.38 1ayz7sydm1rbkfspzy6qq5ih21d1mi3z-gnutls-3.7.6 1rsj0mw8vqlnhk59wkw4i3yal4qw19k0-libXrender-0.9.10 2ggbc04aiq9zf09g49gz9hi3wgk1i4vk-harfbuzz-3.3.2 2wx0faw05ncvgaz5jihd5pda1mzw63mb-libselinux-3.3 38ychklifhkvfjzgqr1i97916cmiwdhj-glib-2.72.3 48s4h862snj1m8dcw58rdj6mpj04188k-systemd-250.4 4ay9q1d8j82p918r49jlzsixw1bpdhm0-libX11-1.7.2 7mcrxfhl2qxx5m6cf991jv8sg9bzb7v0-freetype-2.12.1 7yxmpp55m3n1m6x3gzyrws31i5janhal-librsvg-2.54.4 8ri08j9vhgslirg2p966l830wv3qvwiy-giflib-5.2.1 a2fyr6w9zp07a5615mzmcbqn0jg78hv0-m17n-lib-1.8.0 a7zkqrfyvd9xsr6mvjwqsjb0xqnydaad-jansson-2.14 arysd09ka49dpdai09b83ndkqnilgnyh-gsettings-desktop-schemas-42.0 c8p91c6fm67f4ldza6d811wfj61far9f-libxml2-2.9.14 dwiqy7ixa584rb60lxc8hd10bjryx2ww-libpng-apng-1.6.37 dy7i1aqsf0rfm91bcif0z5m9zg6clmd7-libxcb-1.14 fcyqa5s7j42gam1qkpkb10453d85zf7q-sqlite-3.39.0 ffjvj65in9nf0jnlnjw03wbqmcq59k1c-gmp-with-cxx-6.2.1 jfqvyzcfxfgbknz45ywxv890s7hchydp-binutils-wrapper-2.38 jws83dlza8fl5w9mvk5zjaj7mmcknaa3-gtk+3-3.24.34 k3421p8w6f6pgpcmrminbw1sznrdrvkl-libSM-1.2.3 kiwdwd6zw4svi9jlr95yg1p5pgpjxn1v-gcc-11.3.0 l9lbrnhrswxy2wvjl09gmg2mry7dg0xp-libXpm-3.5.13 mg0qwr5c954qx4izf9yxahv6c93c5qgf-libXfixes-6.0.0 mhhlymrg2m70r8h94cwhv2d7a0c8l7g6-glibc-2.34-210 npcz8z6zl27lzpy0b22isd6kb4ya2llj-fontconfig-2.14.0-lib nsicd68siz5nc44q8zz5cpb1v764bvfa-libotf-0.9.16 p2mxc5x4h4578f4l0948h98xl3yqdjxj-libjpeg-turbo-2.1.3 pkv4ngqc7arfqpr1bsn1bappvms9xbfg-ncurses-6.3-p20220507 q8rdgv8x3hk9ip1v0rraywf0f8bi37nc-libXinerama-1.1.4 qaz5hkfiw2pkfjz1721kbbxb6ks9z19z-libXi-1.8 qm2lv1gpbyn0rsfai40cbvj3h4gz69yc-bash-5.1-p16 rxzkc6x3786xbm1si93b0gj5hxx9zfck-libgccjit-11.3.0 slacsfxv01gjcaqjb9i5k6v77vf80w82-gettext-0.21 w25nadr7247krvg5nbxr9slnhq76dakc-zlib-1.2.12 wdnxn318gyp75k34f2cscfy6g1k82ybb-libXrandr-1.5.2 wffw18z76xs7r3bwv2qy44r0gshh4qnx-gdk-pixbuf-2.42.8 wmx6zyv93xh0mkkkzdl4iv2wqmk1pixb-libtiff-4.4.0 x0cpggi73rhsm6cwfl9r8q0qvzx72ysl-libXext-1.3.4 x9zh2nh0dqwisgmj7avnysk35xm45g2y-libICE-1.0.10 xgr8zb2sj6g30qfhk7p7mv0ygxck6z8i-cairo-1.16.0 xhdf882p0a25vxz2x94xifggfxqim4n7-atk-2.38.0 yhkn33x0ncx2zfk6a6dy8cdsjhs15hzg-dbus-1.14.0-lib ylnb8y7awrjhlxr1308rchahqvmykxj6-dconf-0.40.0-lib zd3yywnsbhh9fpk67s3jv9198ccvjfqm-emacs-git-native-comp-20220725.0 zg4x984qw3zaxn0xy6qgjzhrk1k3h9d4-libXcomposite-0.4.5 zpvq7njsx28yjzfg4n97l83sm0gdhk4c-pango-1.50.7
Deriver: kvffblgqzp3frm9bjv8pagpgvj6z1h6s-emacs-git-native-comp-20220725.0.drv
Sig: nix-community.cachix.org-1:YY2oczgTTV85qTfw3Q7yPPb4qqL0x8rOTBRnRDd5/YDRL2T6lWjsfL6e5nTLFD6+09BaILfh8Ka/dEGmuQGkDw==

// GET https://nix-community.cachix.org/zd3yywnsbhh9fpk67s3jv9198ccvjfqm.narinfo
// HTTP/1.1 200 OK
// Date: Mon, 25 Jul 2022 19:54:20 GMT
// Content-Type: text/x-nix-narinfo
// Transfer-Encoding: chunked
// Connection: keep-alive
// Cache-Control: public, max-age=14400
// Last-Modified: Mon, 25 Jul 2022 12:13:03 GMT
// CF-Cache-Status: EXPIRED
// Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
// Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=PRArDlcPfNsb50Ty72ZjXYb8KVs8dwOzhCIRxsHk41mL16JSzsREj9DXUgExFnnQehHqjU2jkHsSR6VwUwpsi9ewZANH%2FNEaOxy3miLeH5O6ml%2FxyVjFTUshvmZoRPEKpyyyMdVdR7LFBA%3D%3D"}],"group":"cf-nel","max_age":604800}
// NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
// Vary: Accept-Encoding
// Server: cloudflare
// CF-RAY: 730772670af951bf-GRU
// Request duration: 0.944063s

but same issue

$ nix shell -L --no-write-lock-file emacs-overlay/7570fbb326335edc675b5d964ed0892b508562b6#emacsGitNativeComp
warning: not writing modified lock file of flake 'flake:emacs-overlay/7570fbb326335edc675b5d964ed0892b508562b6':
• Added input 'flake-utils':
    'github:numtide/flake-utils/7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249' (2022-07-04)
• Added input 'nixpkgs':
    'path:/nix/store/dwp21rcg5jq1dx3a1pyfdpa1lwx57wdv-source?lastModified=0&narHash=sha256-%2fcxTFSMmpAb8tBp1yVga1fj+i8LB9aAxnMjYFpRMuVs=' (1970-01-01)
source> trying https://git.savannah.gnu.org/cgit/emacs.git/snapshot/emacs-14d8c6f7b13f3237aa5e54f5c16ef0a9189c0459.tar.gz
source>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
source>                                  Dload  Upload   Total   Spent    Left  Speed
[1/0/2 built, 1.0 MiB DL] building source

can't you reproduce this issue?

@Mic92
Copy link
Member

Mic92 commented Jul 25, 2022

Is it not just the case you are just using a different nixpkgs version from what CI used? The nixpkgs version is not pinned here.

@yuuyins
Copy link
Contributor

yuuyins commented Jul 25, 2022

@Mic92 yes. So we really need to have both nixpkgs and emacs-overlay pinned to the same revision as the one used by Hydra? It's not feasible to me to update nixpkgs nixos revision whenever i need to update emacs-overlay. can't i use an extra nixpkgs flake input just for emacs-overlay to use? is there an option for it? is there a way to test it in nix shell without needing to adjust my flake.nix?

@Mic92
Copy link
Member

Mic92 commented Jul 25, 2022

I think it would help if we would build emacs from the flake with nixpkgs beeing pinged, but I think @adisbladis does not like flakes for some reason.

Anyway, here you can see that cachix has emacs packages cached:
https://dl.thalheim.io/Ug6XmQIre0rtRetAr4xbJQ/2022-07-25_22-39.png

@yuuyins
Copy link
Contributor

yuuyins commented Jul 26, 2022

@Mic92

i've added the e494a908e8895b9cba18e21d5fc83362f64b3f6a to nixpkgs, and now indeed i hit cache in nix shell. so guess that was it, really needs to be in sync.

but i also just came to know it's possible to specify a nixpkgs flake input for a flake input like this. edit: this actually doesn't work for hitting the cache... for some reason only specifying top level nixpkgs input will work

    # https://hydra.nix-community.org/job/emacs-overlay/unstable/emacsGitNativeComp
    emacs-overlay-unstable-git-native-comp = {
      type = "github";
      owner = "nix-community";
      repo = "emacs-overlay";
      # https://hydra.nix-community.org/build/16583641#tabs-buildinputs
      rev = "7570fbb326335edc675b5d964ed0892b508562b6";
      inputs.nixpkgs = {
        type = "github";
        owner = "nixos";
        repo = "nixpkgs";
        rev = "e494a908e8895b9cba18e21d5fc83362f64b3f6a";
      };
    };

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-actually-override-nixpkgs-inputs-for-e-g-emacs-overlay-so-it-hits-cache/20591/1

@yuuyins
Copy link
Contributor

yuuyins commented Jul 27, 2022

@Mic92, @adisbladis. Is it possible to just generate/push the flake.lock? This way i believe when we set emacs-overlay, its inputs.nixpkgs would follow what is set in the nix-community/emacs-overlay/flake.lock? wouldn't it? edit: forgot the part in which you implied emacs-overlay isn't built from the flake..

@stfl
Copy link

stfl commented Nov 11, 2024

I am using this script to fetch the latest (2h ago) rev and extracting the relavant nixpkgs rev from the flake.lock
using httpie and jq

#!/usr/bin/env bash

overlay_url_rev="master@{2%20hours%20ago}"

rm -rf /tmp/emacs-overlay/
mkdir -p /tmp/emacs-overlay/

http -F --download \
    https://github.com/nix-community/emacs-overlay/archive/${overlay_url_rev}.tar.gz \
    | tar xzvf - -C /tmp/emacs-overlay/

overlay_filename=$(ls /tmp/emacs-overlay/)
overlay_rev=${overlay_filename##*-}

nixpkgs_rev=$(cat /tmp/emacs-overlay/${overlay_filename}/flake.lock | jq -r '.nodes.nixpkgs.locked.rev')

nix flake lock --override-input nixpkgs github:NixOS/nixpkgs/${nixpkgs_rev}
nix flake lock --override-input emacs-overlay github:nix-community/emacs-overlay/${overlay_rev}

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