-
Notifications
You must be signed in to change notification settings - Fork 41
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
lib/mkFlake
: Test suite improvements and more
#183
Open
bb010g
wants to merge
8
commits into
hercules-ci:main
Choose a base branch
from
bb010g:mkFlake-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3bbcca6
lib: Update `deferredModuleWith` polyfill
bb010g bf47eae
treewide: Normalize warning & error messages
bb010g d10c772
dev: Expose module `options` in REPL
bb010g e0baa4c
moduleWithSystem: Clarify local variable names
bb010g 6130ff6
dev: Enhance debugging tools
bb010g 39e688f
dev/tests: Mock `callFlake` in eval tests
bb010g a0fda1e
dev/tests: Implement stronger flake mocking tests
bb010g 1e37f1e
lib/`mkFlake`: Document `_file` infinite recursion
bb010g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
|
||
# Separate `dev` flake | ||
|
||
Wouldn't recommend this pattern normally, but I'm trying to keep | ||
deps low for `flake-parts` until we have split dev inputs | ||
that don't carry over to dependent lock files. | ||
|
||
```sh | ||
nix develop --impure -f './dev' 'mySystem.devShells.default' | ||
nix repl -f './dev' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,36 @@ | ||
let | ||
flake-parts = builtins.getFlake (toString ../.); | ||
lib = flake-parts.inputs.nixpkgs-lib.lib; | ||
sourceInfo = inputs.flake-parts.sourceInfo; # used by pre-commit module, etc | ||
flake = builtins.getFlake (toString ./.); | ||
fmc-lib = (builtins.getFlake (toString ../.)).lib; | ||
args = { | ||
inherit self; | ||
} // flake.inputs; | ||
self = { | ||
inherit (flake) inputs; | ||
outPath = ../.; # used by pre-commit module, etc | ||
outputs = self.config.flake; | ||
} // | ||
fmc-lib.mkFlake | ||
{ inputs = args; } | ||
./flake-module.nix; | ||
inputs = flake.inputs // { inherit flake-parts; }; | ||
makeResult = specialArgs: flakeModule: result: | ||
let | ||
outputs = flake.outputs // flake-parts.lib.mkFlake | ||
{ | ||
inputs = inputs // { self = result; }; | ||
# debugging tool | ||
specialArgs = { | ||
replaceSpecialArgs = newSpecialArgs: | ||
let | ||
newSpecialArgs' = | ||
if lib.isFunction newSpecialArgs | ||
then newSpecialArgs specialArgs | ||
else newSpecialArgs; | ||
newResult = makeResult newSpecialArgs' flakeModule newResult; | ||
in | ||
newResult; | ||
} // specialArgs; | ||
} | ||
flakeModule; | ||
in | ||
outputs // sourceInfo // { | ||
inherit inputs outputs sourceInfo; | ||
_type = "flake"; | ||
}; | ||
in | ||
self.config.flake // { inherit (flake) inputs; } | ||
let | ||
# eagerly import to reproduce inline evaluation | ||
result = makeResult { } (import ./flake-module.nix) result; | ||
in | ||
result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can't we just set
config.debug = true;
?dev
is already overly complicated because it tries to work around the subflake problems. I'd like to simplify it instead of obfuscating it further.