Skip to content

add nix flake for easier contribution for nix users #8753

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

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ bench.html

# Emacs
.projectile
/.direnv/
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ cabal v2-build Cabal-tests:unit-tests # build Cabal's unit test suite
cabal v2-build cabal-tests # etc...
```

Building Cabal for hacking with Nix (not officially supported)
--------------------------

```
nix develop # if you don't have direnv installed
cabal build cabal
```

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd add something like "Nix flake is not officially supported and as such may fall out of date. Be prepared to tweak it and please contribute fixes back" to make it less controversial and burdensome.

NOTE: Building the cabal library with nix flakes is not officially supported and as such may fall out of date. Be prepared to tweak it and please contribute fixes back.

Running tests
-------------

Expand Down
3 changes: 3 additions & 0 deletions changelog.d/pr-8753
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
synopsis: add nix flake for easier contribution for nix users
packages: cabal-install
prs: #8753
63 changes: 63 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
description = "A devshell that enables nix users to just run `cabal build cabal` and start contributing to Cabal";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};

outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-darwin" ];
perSystem = { config, self', inputs', pkgs, system, ... }: {
packages.default = pkgs.lib.trace "This flake currently only contains a devshell for use with nix develop";
devShells.default = pkgs.mkShell {
buildInputs = [ pkgs.ghc pkgs.cabal-install pkgs.zlib ];
};
};
flake = {};
};
}