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

Use flake-compat without fetchGit #1372

Closed
wants to merge 1 commit into from

Conversation

adisbladis
Copy link
Member

An alternative approach to #1371 that doesn't force you to rebuild everything on every change.

This fixes 2 different issues:

  1. Github actions Checkout does a shallow clone by default.
    We want to use a shallow clone but force a deep clone because
    builtins.fetchGit doesn't seem to work on shallow clones.

  2. It doesn't work when this repo is a store path and .git is removed.

This fixes 2 different issues:
1. Github actions Checkout does a shallow clone by default.
   We want to use a shallow clone but force a deep clone because
   builtins.fetchGit doesn't seem to work on shallow clones.

2. It doesn't work when this repo is a store path and .git is removed.
sha256 = "1n8q7v7alq802kl3b6zan6v27whi2ppbnlv8df6cz64vqf658ija"; }) {
src = builtins.fetchGit ./.;
}).defaultNix
{ pkgs ? import <nixpkgs> {} }:
Copy link
Member

Choose a reason for hiding this comment

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

Making default.nix and shell.nix depend on <nixpkgs> is a bad idea. 1) It's inefficient, since now evaluation requires at least 2 versions of Nixpkgs. 2) It goes against the whole point of flakes, which is hermetic evaluation. It reintroduces a dependency on $NIX_PATH which is what we want to get rid of.

@edolstra
Copy link
Member

I don't understand the motivation. Why would you need to rebuild everything on every change? That's what nix-shell is for right?

@edolstra
Copy link
Member

I think this would be better addressed in flake-compat, where we could have some logic to check whether src is a git tree or not. The default.nix and shell.nix files that call flake-compat should have very little logic themselves.

@nlewo
Copy link
Member

nlewo commented Jun 16, 2020

I've submitted a PR to use fetchGit if src is a git tree: edolstra/flake-compat#4

@adisbladis adisbladis closed this Jun 17, 2020
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.

None yet

3 participants