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

flake: switch to cached nixpkgs channel #1714

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

flake: switch to cached nixpkgs channel #1714

wants to merge 2 commits into from

Conversation

zowoq
Copy link
Contributor

@zowoq zowoq commented Feb 24, 2025

No description provided.

@@ -36,7 +36,7 @@
nixpkgs-update.inputs.mmdoc.follows = "empty";
nixpkgs-update.inputs.treefmt-nix.follows = "treefmt-nix";
nixpkgs-update.url = "github:nix-community/nixpkgs-update/infra";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
nixpkgs.url = "https://nixos.org/channels/nixos-unstable-small/nixexprs.tar.xz";
Copy link
Member

@Mic92 Mic92 Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually shallow clone are faster if you regularly switch between nixpkgs versions:

--- flake.nix
+++ flake.nix
@@ -2,7 +2,7 @@
   description = "A universal nixos installer, just needs ssh access to the target system";
 
   inputs = {
-    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small";
+    nixpkgs.url = "git+https://github.com/NixOS/nixpkgs?shallow=1&ref=nixos-unstable-small";
     flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; };
 
     # used for testing

That cache should work both locally and in buildbot. For fresh clones it's almost as fast as downloading the github archive (tested in github actions)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC github has asked projects (homebrew and others) to stop using shallow clones because they are expensive to run on the servers.

Copy link
Member

@Mic92 Mic92 Feb 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only a shallow clone on the first run because than the cache takes over and it's just a handful commit that is fetched (which should be way cheaper than the github archive, especially if the internet isn't great). For this repository no one is using this flake in CIs where we would run into this issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That isn't what I was referring to, just using it in this repo isn't the issue, other people copying the pattern is.

zowoq added 2 commits March 1, 2025 16:37
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/b89a821293c3872992137114d0db9a791243a41b?narHash=sha256-D2waFyJkaepTchTrGVAIfCd/YP%2B37bgXWg9cXwuxuT0%3D' (2025-02-26)
  → 'https://releases.nixos.org/nixos/unstable-small/nixos-25.05beta760628.624ad1673840/nixexprs.tar.xz?narHash=sha256-rKGoPQ7y4rEU7i03lq7sQDHibJ2z97DhwCcvpfR/5L0%3D' (2025-02-28)
@zowoq
Copy link
Contributor Author

zowoq commented Mar 1, 2025

unpacking 'https://releases.nixos.org/nixos/unstable-small/***/nixexprs.tar.xz' into the Git cache... takes a couple of minutes, not sure why.

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

Successfully merging this pull request may close these issues.

2 participants