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

replace nix-shell with Nix Flake #737

Merged
merged 4 commits into from
Jan 6, 2025

Conversation

peterbecich
Copy link
Contributor

@peterbecich peterbecich commented Jan 2, 2025

This flake.nix provides the same resources as the deleted Nix files with less code to maintain, plus other tools helpfully provided by https://github.com/srid/haskell-flake.

This commit does not fix/update the docs generation via Nix; this remains TODO.

The flake.nix will build bundles for each Beam library, just as the old Nix configuration did:

$ nix flake show
...
    └───x86_64-linux
        ├───all: package 'all'
        ├───beam-core: package 'beam-core-0.10.3.1'
        ├───beam-migrate: package 'beam-migrate-0.5.3.1'
        ├───beam-postgres: package 'beam-postgres-0.5.4.1'
        ├───beam-sqlite: package 'beam-sqlite-0.5.3.1'
        ├───default: package 'all'
        └───pagila: package 'pagila-0.1.0.0'

nix build or nix build .#beam-... will build these.

Beam has no executables so there is nothing to demonstrate by nix run .#...

I need more time to understand the docs generation, which apparently requires a Beam executable. This may have been the beam-migrate executable, which no longer exists. Please review this; I will try to return the the docs as a follow-up item.

This `flake.nix` provides the same resources as the deleted Nix files with less code to maintain.

This commit does not fix/update the docs generation via Nix; this remains TODO.
@@ -0,0 +1 @@
use flake
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tracking the .envrc in version control is debated; personally I am in favor of it

Copy link
Member

Choose a reason for hiding this comment

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

Personally I would prefer not to commit to this, since a lot more people have direnv than Nix, and Nix isn't required to easily develop on this repo.

- name: "Check `nix develop` shell can run command"
run: nix develop --command "echo"
- run: nix build
- run: nix flake check
Copy link
Contributor Author

Choose a reason for hiding this comment

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

check the flake.nix and its outputs are not broken

@@ -4,8 +4,6 @@
with nixpkgs;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this file is made dead code by this PR. I want to follow-up on this later.

@peterbecich peterbecich marked this pull request as ready for review January 2, 2025 05:48
@LaurentRDC
Copy link
Member

I don't use Nix so I will leave the review of this PR to someone else

@peterbecich
Copy link
Contributor Author

@kmicklas please review. I will fix docs/default.nix later.

Copy link
Member

@kmicklas kmicklas left a comment

Choose a reason for hiding this comment

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

Thanks for getting the CI to work with this!

Personally I am a flakes conscientious objector so unfortunately I cannot really review if the flake setup looks good. However from general Nix usage this all looks very nice.

@@ -0,0 +1 @@
use flake
Copy link
Member

Choose a reason for hiding this comment

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

Personally I would prefer not to commit to this, since a lot more people have direnv than Nix, and Nix isn't required to easily develop on this repo.

.github/workflows/nix-flake.yaml Outdated Show resolved Hide resolved
flake.nix Outdated Show resolved Hide resolved

hlsCheck.enable = false;

tools = hp: {
Copy link
Member

Choose a reason for hiding this comment

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

Is hp haskellPackages? If so I would prefer it to be more explicit for readability here.

@kmicklas kmicklas merged commit 6e85470 into haskell-beam:master Jan 6, 2025
10 checks passed
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.

3 participants