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

Expose finalPackages #68

Merged
merged 12 commits into from
Feb 8, 2023
Merged

Expose finalPackages #68

merged 12 commits into from
Feb 8, 2023

Conversation

roberth
Copy link
Collaborator

@roberth roberth commented Feb 8, 2023

#52

Access to finalPackages was useful for some troubleshooting.
This also adds the docs to CI and adds a script to preview the docs locally.

flake-module.nix Outdated
type = types.raw;
readOnly = true;
internal = true;
default = lib.composeManyExtensions [
Copy link
Owner

Choose a reason for hiding this comment

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

@roberth Why do finalPackages and finalOverlay use default (in options) to define their values, unlike outputs which uses config to do it? What is the difference between the two, in general?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The difference is the mkOverride priority that is assigned to the definition. In case of a readOnly = true option, it doesn't really matter which one you use, because only one definition is allowed anyway, making override priorities irrelevant.

I think placing definitions in config is a good habit though, so I'll change this.

Copy link
Owner

Choose a reason for hiding this comment

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

I think placing definitions in config is a good habit though, so I'll change this.

Cool; it would also minimize the diff in this PR, I imagine, since all config stuff lives in haskell-project.nix.

Copy link
Collaborator Author

@roberth roberth Feb 8, 2023

Choose a reason for hiding this comment

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

To move it back, I'd have to change haskell-project.nix to a module instead of a function to a config value. Basically this https://github.com/srid/haskell-flake/pull/63/files#r1100250488

I guess why not

runtest.sh Outdated
Comment on lines 19 to 22
nix --option sandbox false \
build --override-input haskell-flake path:${FLAKE} \
-L --show-trace \
github:hercules-ci/flake.parts-website#checks.x86_64-linux.linkcheck
Copy link
Owner

Choose a reason for hiding this comment

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

I'd remove -L --show-trace since they are not used in the commands above (or is there a reason for their inclusion, aside from debugging purposes?). Also, must sandbox be disabled for this build?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The sandbox was disabled in an earlier command, so I assumed that you run this in a setup where that's necessary. This build works fine in the sandbox, but I've only ever built it in a nice NixOS-based sandbox.

The verbosity is helpful when this runs in CI. You'll only look at it when it fails, and then you want all the info. Module system errors tend to need --show-trace, at least until we have

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A proper CI solves this problem in the UI, but admittedly consuming an unpinned input like the site here isn't possible yet in Hercules.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Anyway, I've changed it so that logs only appear when there's a problem. Still not great if the builder hangs, but that's unlikely to be a problem here.

1000 lines should generally be enough to show the whole log.
If more, you'll be iterating the problem anyway; it doesn't log
that much and extra log lines are proportional to the problems found.
flake-module.nix Outdated
@@ -71,7 +71,7 @@ in
};
};
};
projectSubmodule = types.submodule (args@{ name, config, lib, ... }:
projectSubmodule = types.submoduleWith { specialArgs = { inherit pkgs self; }; modules = [ ./haskell-project.nix (args@{ name, config, lib, ... }:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All this happening on a single line is ugly, but I think almost all of the things that would otherwise be reindented below can move to the haskell-project.nix module later. Doing that here would cause a large diff (again).

srid and others added 5 commits February 8, 2023 12:08
Keep all project config in haskell-project.nix
- `-e` is not recognized by macOS's zsh's echo command
- Use current system when building the check
@srid srid merged commit 1e355a1 into master Feb 8, 2023
@srid srid deleted the expose-finalPackages branch February 8, 2023 22:15

finalPackages = mkOption {
type = types.attrsOf raw;
readOnly = true;
Copy link
Owner

@srid srid Feb 8, 2023

Choose a reason for hiding this comment

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

It looks like readonly has no effect, because I can still set finalPackages.foo = ./.; (even finalPackages = ./.;) in test/flake.nix?

Or does it just silently ignore user values?

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.

2 participants