-
-
Notifications
You must be signed in to change notification settings - Fork 7
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.nix: init #65
base: main
Are you sure you want to change the base?
flake.nix: init #65
Conversation
ced1433
to
a0d2253
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not against having a flake.nix in principle, but this currently duplicates all the input locking! And I'd rather not use flake inputs because then they can't be overridden by stable Nix (unless you implement it manually).
So flake.nix
should just be a tiny layer above default.nix
, like the one in nixfmt.
@infinisil, it is a tiny layer above That said, |
There is though! If you just don't specify any flake inputs and instead import the |
But that's what I want the flake for -- specifying inputs. Without any inputs, as a flake consumer, I have to use whatever's pinned, and there's no ability to override. I think the right way to go is to update npins to 0.2.4 (per the linked review), then use the import-flake to base the npins off flake.lock. |
Would |
It would be able to contain |
You can override the pinned sources using the {
inputs.ncbn.url = "github:NixOS/nixpkgs-check-by-name";
inputs.ncbn.flake = false;
outputs = { ncbn, ... }:
let
result = import ncbn {
nixpkgs = <something else>;
};
in
{
packages.ncbn = result.build;
};
} This notably has the advantage that you can even override it with a version of Nixpkgs that Flake inputs can't represent, e.g. one patched via a derivation, or fetched with a non-builtin fetcher, etc. |
Feel like I don't know enough about the pros/cons of flakes despite using them for like 4 years. I think at a minimum we shouldn't have two lock files for the same inputs. Is there any tradeoff in evaluation caching between using flakes vs npins lock file? I was trying to brush up a bit on arguments against flakes reading this, and read this:
emphasis mine. No idea if that's true or out-of-date. |
I'm returning to this PR after a couple weeks, but I'm going to be experimenting with how GitHub actions runs the code a bit so please bear it no mind until it's out of draft. |
I noticed this recently |
I like flakes. π€·π»ββοΈ
flake.nix
nix build
nix shell
nix flake check
.nix flake update
to the update scriptsdefault.nix
to acceptpkgs
as an inputtreefmtWrapper
(per the docs on treefmt-nix) that fits intonix fmt
.