-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Refactor flake.nix to remove flake-utils #177
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,31 @@ | ||
{ | ||
|
||
inputs.flake-utils.url = "github:numtide/flake-utils"; | ||
|
||
outputs = | ||
{ flake-utils, self }: | ||
flake-utils.lib.eachDefaultSystem ( | ||
system: | ||
let | ||
result = import ./default.nix { inherit system; }; | ||
in | ||
{ | ||
packages = result.packages // { | ||
default = result; | ||
}; | ||
{ self, nixpkgs }: | ||
let | ||
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed; | ||
|
||
apps.default = { | ||
result = forAllSystems (system: import ./default.nix { inherit system; }); | ||
in | ||
{ | ||
packages = forAllSystems ( | ||
system: | ||
let | ||
packages = result.${system}.packages; | ||
in | ||
packages // { default = packages.nixfmt; } | ||
); | ||
|
||
apps = forAllSystems (system: { | ||
default = { | ||
type = "app"; | ||
program = "${result}/bin/nixfmt"; | ||
program = nixpkgs.lib.getExe self.packages.${system}.default; | ||
}; | ||
}); | ||
|
||
checks = forAllSystems (system: result.${system}.checks); | ||
|
||
checks = result.checks; | ||
} | ||
); | ||
devShells = forAllSystems (system: { | ||
default = result.${system}.shell; | ||
}); | ||
Comment on lines
+27
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the motivation for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, sounds fine to have this :) Personally I'm using https://github.com/nix-community/nix-direnv, which also caches the shell for speed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the flake-utils part is staying, I could just put in this commit & axe the other. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good to me! |
||
}; | ||
} |
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.
You removed
flake-utils
, but addednixpkgs
(and that without aninputs
entry, which then runs into NixOS/nix#7422). And if you don't commit the lockfile as here, we'll run into further non-reproducibility. Alternatively if you do commit the lockfile, we'll have two Nixpkgs versions that need to be fetched for the flake.So, I don't think we should do this.
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.
How is the current version using the
builtins
dependencies offlake-utils
being more reproducible than using the lib from Nixpkgs? Seems most folks are used to passing ininputs.nixpkgs.follows
thru their flakes. I suppose you could get lib from npins, but really after thinking about it, might it just be simpler to manually write outx86_64-linux
, et al. forsystem.exposedFlakes
and remove all dependencies then? It’s more repetitious “code”, but has zero dependencies. I would be willing to write it out.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.
IIRC, 32-bit Linux is one of the supported systems in Hydra but is missing from
flake-utils
’sdefaultSystems
.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.
Just because in the current PR at least, Nixpkgs isn't pinned, while flake-utils is. Without committing the lockfile to pin it, people will get different results at different points in time.
That doesn't actually work, the npins-pinned Nixpkgs can't be overridden like that (see #166 for what works instead)
Actually one thing that
flake-utils
allows you is to use the https://github.com/nix-systems/nix-systems pattern, which allows consumers to work around the problem of Flakes requiring a hardcoded list of systems. This wouldn't be possible anymore if we hardcode the systems locally.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.
Okay. Fair assessments as I misunderstand the environment. Thank you for explaining as I don’t see many places with a
flake.nix
& not using Nix to pin their Nixpkgs as well (which is why it feels like Nixpkgs is always a given).