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

add flake-compat to flake.nix and use sha256 in default.nix #7989

Merged
merged 1 commit into from
Mar 14, 2023

Conversation

sysedwinistrator
Copy link
Contributor

Motivation

Make default.nix pure

Context

Forum thread
I have no idea why default.nix was used at all when referring to the package from a flake. However, as adding flake-compat to flake.nix is the way the its (and nix') author recommend using it, I don't see the harm of doing exactly that to ensure default.nix works when called in pure evaluation mode, even if few people actually need to do this.

Advantages:

  • flake-compat is pinned and default.nix is pure

Disadvantages:

  • flake-compat has to be updated manually by updating flake input

Checklist for maintainers

Maintainers: tick if completed or explain if not relevant

  • agreed on idea
  • agreed on implementation strategy
  • tests, as appropriate
    • functional tests - tests/**.sh
    • unit tests - src/*/tests
    • integration tests - tests/nixos/*
  • documentation in the manual
  • code and comments are self-explanatory
  • commit message explains why the change was made
  • new feature or incompatible change: updated release notes

Priorities

Add 👍 to pull requests you find important.

Copy link
Member

@thufschmitt thufschmitt left a comment

Choose a reason for hiding this comment

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

Thanks, that's very sensible, indeed 👍

@thufschmitt
Copy link
Member

@sysedwinistrator any reason you marked this as a draft?

@sysedwinistrator sysedwinistrator marked this pull request as ready for review March 11, 2023 16:59
@sysedwinistrator
Copy link
Contributor Author

@sysedwinistrator any reason you marked this as a draft?

I just opened the PR while trying to help someone on the forums, and it struck me as odd that out of all projects, Nix itself doesn't use flake-compat the way it's recommended in the repo, so I actually wanted to check first whether this isn't intentional (I don't want to break my favorite package manager, do I).
Since you already approved, I guess that's not the case 😄

@thufschmitt
Copy link
Member

Ahah, makes sense! I think the main reason is that this got introduced without thinking about it too much, and for some reason no one got bitten by it yet ;)

Let's just merge it then!

@thufschmitt thufschmitt merged commit 9ec1a3a into NixOS:master Mar 14, 2023
@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/use-a-custom-nix-on-a-flake-proyect/26065/5

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.

3 participants