-
Notifications
You must be signed in to change notification settings - Fork 39
Avoid IFD through cabal2nix
#146
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
base: master
Are you sure you want to change the base?
Changes from 2 commits
f3f2592
82bb083
c84c36c
8ce9e69
885c04c
0128a73
e1fc560
6bcabac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { mkDerivation | ||
| , aeson | ||
| , async | ||
| , base | ||
| , data-default | ||
| , directory | ||
| , filepath | ||
| , lib | ||
| , mtl | ||
| , optics-core | ||
| , profunctors | ||
| , relude | ||
| , shower | ||
| , time | ||
| , with-utf8 | ||
| }: | ||
| mkDerivation { | ||
| pname = "haskell-template"; | ||
| version = "0.1.0.0"; | ||
| src = ./.; | ||
| isLibrary = false; | ||
| isExecutable = true; | ||
| executableHaskellDepends = [ | ||
| aeson | ||
| async | ||
| base | ||
| data-default | ||
| directory | ||
| filepath | ||
| mtl | ||
| optics-core | ||
| profunctors | ||
| relude | ||
| shower | ||
| time | ||
| with-utf8 | ||
| ]; | ||
| homepage = "https://srid.ca/haskell-template"; | ||
| description = "A template for Haskell projects using Nix"; | ||
| license = lib.licenses.mit; | ||
| mainProgram = "haskell-template"; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { mkDerivation, aeson, async, base, data-default, directory | ||
| , filepath, lib, mtl, optics-core, profunctors, relude, shower | ||
| , time, with-utf8 | ||
| }: | ||
| mkDerivation { | ||
| pname = "haskell-template"; | ||
| version = "0.1.0.0"; | ||
| src = ./.; | ||
| isLibrary = false; | ||
| isExecutable = true; | ||
| executableHaskellDepends = [ | ||
| aeson async base data-default directory filepath mtl optics-core | ||
| profunctors relude shower time with-utf8 | ||
| ]; | ||
| homepage = "https://srid.ca/haskell-template"; | ||
| description = "A template for Haskell projects using Nix"; | ||
| license = lib.licenses.mit; | ||
| mainProgram = "haskell-template"; | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,10 +5,10 @@ | |
| flake-parts.url = "github:hercules-ci/flake-parts"; | ||
| flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; | ||
| nixos-unified.url = "github:srid/nixos-unified"; | ||
| haskell-flake.url = "github:srid/haskell-flake"; | ||
| haskell-flake.url = "github:rsrohitsingh682/haskell-flake/cache-cabal2nix"; | ||
| fourmolu-nix.url = "github:jedimahdi/fourmolu-nix"; | ||
|
|
||
| git-hooks.url = "github:cachix/git-hooks.nix"; | ||
| git-hooks.url = "github:rsrohitsingh682/git-hooks.nix/cabal2nix"; | ||
|
||
| git-hooks.flake = false; | ||
| }; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -7,13 +7,21 @@ | |||||
| perSystem = { config, ... }: { | ||||||
| pre-commit.settings = { | ||||||
| hooks = { | ||||||
| nixpkgs-fmt.enable = true; | ||||||
| nixpkgs-fmt = { | ||||||
| enable = true; | ||||||
| # cabal2nix, nixpkgs-fmt both modifies default.nix, hence exlude fmt. | ||||||
| excludes = [ "cabal.nix" ]; | ||||||
|
||||||
| excludes = [ "cabal.nix" ]; | |
| excludes = [ config.pre-commit.settings.hooks.cabal2nix.settings.output_filename ]; |
(Or you could use the config from pre-commit module)
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.
Same for this as well
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.
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.
Although this was not needed. But I put it just for example.
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.
Your link is just going to this very conversation. I don't know what you are referring to.
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.
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.
How can you use it there? It'd be a cyclic dependency.
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.
This is for haskell-flake. There are in total 3 places where I am using cabal.nix
- While setting output_filename for
cabal2nixpre-commit - While setting exclude for
nixpkgs-fmt - For haskell-flake to refer to the cached
cabal2nixfile
In this particular case I was talking about 3.
ideally we can set at one place use it at all other places.
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.
Oh, right, you can just reuse the module option (3) in both the palces (1 & 2). Good idea.

Uh oh!
There was an error while loading. Please reload this page.