Skip to content

microhs: init at 0.14.21.0 - #458599

Merged
wolfgangwalther merged 1 commit into
NixOS:masterfrom
steeleduncan:microhs
Nov 5, 2025
Merged

microhs: init at 0.14.21.0#458599
wolfgangwalther merged 1 commit into
NixOS:masterfrom
steeleduncan:microhs

Conversation

@steeleduncan

@steeleduncan steeleduncan commented Nov 4, 2025

Copy link
Copy Markdown
Contributor

MicroHS is a Haskell compiler and interpreter

This exists as an autogenerated haskell package haskellPackages.MicroHs, but this package builds it independently of GHC, using the bootstrap functionality to build it from just a C compiler. This gives an alternate, easily auditable, lightweight haskell compiler and interpreter, that does not rely on the GHC toolchain at all

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Nov 4, 2025
@mdaniels5757

Copy link
Copy Markdown
Member

Re-running CI due to a since-fixed unrelated treefmt-nix failure

@mdaniels5757 mdaniels5757 reopened this Nov 5, 2025
Comment thread pkgs/by-name/mi/microhs/package.nix Outdated
Comment thread pkgs/by-name/mi/microhs/test-hello-world.nix Outdated
Comment thread pkgs/by-name/mi/microhs/test-hello-world.nix Outdated
Comment thread pkgs/by-name/mi/microhs/package.nix Outdated
@wolfgangwalther

Copy link
Copy Markdown
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 458599
Commit: 0953bfa67f06e2aa51b5a60b17c4b627e4037d84


x86_64-linux

✅ 1 package built:
  • microhs

aarch64-linux

✅ 1 package built:
  • microhs

x86_64-darwin

✅ 1 package built:
  • microhs

aarch64-darwin

✅ 1 package built:
  • microhs

@steeleduncan
steeleduncan marked this pull request as ready for review November 5, 2025 14:05
@steeleduncan
steeleduncan marked this pull request as draft November 5, 2025 14:08
@steeleduncan
steeleduncan marked this pull request as ready for review November 5, 2025 14:08

@acid-bong acid-bong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the rest (except for the test, i don't know Haskell enough to check it) looks great

Comment thread pkgs/by-name/mi/microhs/package.nix Outdated

@wolfgangwalther wolfgangwalther left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Except for the unused input, LGTM.

Thank you :)

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Nov 5, 2025
@wolfgangwalther
wolfgangwalther added this pull request to the merge queue Nov 5, 2025
auto-merge was automatically disabled November 5, 2025 18:59

Pull Request is not mergeable

Merged via the queue into NixOS:master with commit c237ca1 Nov 5, 2025
27 of 31 checks passed
@sternenseemann

sternenseemann commented Nov 5, 2025 via email

Copy link
Copy Markdown
Member

@steeleduncan
steeleduncan deleted the microhs branch November 5, 2025 19:16
@wolfgangwalther

Copy link
Copy Markdown
Contributor

The reasoning in the PR body says that this is bootstrapped without GHC, just from a C compiler. That would be the reason, I guess?

I thought it was a good one - if you think otherwise and think we should not do that, we can revert instead.

@steeleduncan

Copy link
Copy Markdown
Contributor Author

Yes, my reason was that this packages builds a Haskell interpreter/compiler without GHC or any part of that ecosystem.

Functionally the resulting binary should be the same as provided by haskellPackages.MicroHs though, the only difference being in the route taken to that binary. I can't find any obvious precedent in nixpkgs for that though, so I can see that may not be sufficient reason to include it!

@sternenseemann

Copy link
Copy Markdown
Member

That seems fine, though I must say that I don't find it much more compelling than using GHC given that the origin of mhs is just a generated C file. Without being able to build packages using mhs, this doesn't really move anything forward, though we can develop this in the future.

W.r.t. bootstrapping, using hugs would be much more interesting and as far as I know, @AlexandreTunstall has worked on that already.

@steeleduncan

Copy link
Copy Markdown
Contributor Author

Yes, that is true. That C file is a blob of SKI combinators, which aren't very auditable. I'm working on a patch to the derivation to bootstrap that C file using Hugs

When you mention bootstrapping via hugs, I assume you mean bootstrapping GHC though? That would be great!

@AlexandreTunstall

AlexandreTunstall commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

As great as it would be to bootstrap GHC via Hugs, that's something nobody has managed to do yet. MicroHs via Hugs, on the other hand, is quite easy and I already have a working version that first needed #443281 merged. You can expect a PR soon (once I rebase my branch to overwrite this drv 🙃).

@steeleduncan I assume you would like me to leave you in the package maintainer list?

@sternenseemann

Copy link
Copy Markdown
Member

MicroHs via Hugs

Is also what I meant!

@steeleduncan

Copy link
Copy Markdown
Contributor Author

@AlexandreTunstall I was working on doing the same, but ran into the build problem with hugs. I'll drop that though if you are going to be updating this derivation

You are more than welcome to remove me from maintainers list, I don't mind either way

To avoid any duplication of efforts, what are your plans with MicroCabal? Once MicroHs was properly bootstrapped my plan was to use that in a MicroCabal derivation that doesn't rely on the prebuilt blob in the MicroHs repository. That would probably require a wrapper or an upstream patch for MicroCabal though as it doesn't have a equivalent of Paths_MicroHs.hs that can be overwritten at build time

@AlexandreTunstall

Copy link
Copy Markdown
Contributor

To avoid any duplication of efforts, what are your plans with MicroCabal?

I'm not sure what the trouble is, because I have a usable source-built MicroCabal in #460845, though it admittedly did need a bit of patching.

@steeleduncan

Copy link
Copy Markdown
Contributor Author

To avoid any duplication of efforts, what are your plans with MicroCabal?

I'm not sure what the trouble is, because I have a usable source-built MicroCabal in #460845, though it admittedly did need a bit of patching.

I was referring to changes you made re getMhsDir in #460845

hello-world = callPackage ./test-hello-world.nix { microhs = finalAttrs.finalPackage; };
};

meta = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Given that this is "built" from generated code that has equivalent properties to bytecode, could you set the appropriate sourceProvenance?

It'd also be great if the description mentioned the purpose/difference of this package.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This formula has been superseded now in #460845 which bootstraps without the generated blob using hugs (recently fixed in nixpkgs)

Once that is merged this will be deleted, so I wasn't planning on making any changes to this formula

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd prefer this to be done regardless as it's not certain when/if that PR is merged.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see no reason it shouldn't be merged, and that PR is a superior approach to this one, so I'd rather contribute to it to help get it over the line!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants