-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
[RFC] Nix #149
Comments
Would this go along the lines of calling |
@qoelet I have only basic Nix knowledge, so I'm not sure what is required here. If this requires to call some tool each time So, adding |
You can have nix automatically call cabal2nix like this: { haskellPackages, lib }:
haskellPackages.callCabal2nix "projectname" (lib.cleanSource ./.) {} This way the nix build basically regenerates itself from the changed cabal file on the fly. |
If you point me to the right places to implement this I can send a PR. |
@mgttlinger Attempt to add You can check the implementation and the discussion. I will be very happy if adding and maintaining nix to Haskell projects can be a very easy and simple task. |
For most non-complex projects, the following default.nix will do the trick: # default.nix
let
pkgs = import <nixpkgs> { };
in
pkgs.haskellPackages.developPackage {
root = ./.;
modifier = drv:
pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages;
[ cabal-install
ghcid
]);
} Then you can just run |
It will do the trick, however, it might be nice to expose the basic overlaying functions necessary to override packages and and add derivations (since that part can be non-trival for people new to |
let
pkgs = import <nixpkgs> { };
compilerVersion = "ghc865";
compiler = pkgs.haskell.packages."${compilerVersion}";
hies = (import (builtins.fetchTarball
"https://github.com/infinisil/all-hies/tarball/master") { }
).selection {
selector = p: { "${compilerVersion}" = p."${compilerVersion}"; };
};
in
compiler.developPackage {
root = ./.;
source-overrides = {
named = builtins.fetchTarball
"https://github.com/monadfix/named/archive/e684a00.tar.gz";
};
overrides = self: super: with pkgs.haskell.lib; {
dependent-sum = doJailbreak super.dependent-sum;
lens = appendConfigureFlag super.lens ....;
}
modifier = drv:
pkgs.haskell.lib.addBuildTools drv (with pkgs.haskellPackages;
[ cabal-install
ghcid
hies
]);
} |
summoner
to generate simple .nix
files for projects
I've updated issue description with a more detailed implementation plan and goals we want to achieve if Nix is going to be supported by Summoner. |
I'm not very experienced in Nix but I've been looking around tutorials and opinionated guides and found these two: https://discourse.nixos.org/t/nix-haskell-development-2020/6170, https://medium.com/purely-functional/nix-setup-for-haskell-with-ghcide-and-hlint-3e268343efed to work out best. They seem to offer a solution that has the right abstraction granularity and flexibility. Since I'm not very experienced with |
Worth noting that the next-gen way to handle haskell projects in nix is
with https://input-output-hk.github.io/haskell.nix/. This supports
configuring projects via `stack` or `cabal` so may be easier to integrate
with summoner since there's very few things for the user to decide for the
initial configuration.
…On Sat, Jun 27, 2020 at 11:47 AM Armando Santos ***@***.***> wrote:
I'm not very experienced in Nix but I've been looking around tutorials and
opinionated guides and found these two:
https://discourse.nixos.org/t/nix-haskell-development-2020/6170,
https://medium.com/purely-functional/nix-setup-for-haskell-with-ghcide-and-hlint-3e268343efed
to work out best. They seem to offer a solution that has the right
abstraction granularity and flexibility.
Since I'm not very experienced with nix yet nor do I understand what I
have to do to enable CI/cachix/etc.. with nix, I'll experiment in my small
repo https://github.com/bolt12/nix-hs-template where maybe I can get a
pretty simple and stable scaffolding generator with comments for different
scenarios and come back to this issue when I feel more confident!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#149 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB5DC5LSYZNHNFFT5RYI6GTRYXE33ANCNFSM4FVU47EA>
.
|
This issue tracks Nix support in Summoner. Nix seems to be widespread in the Haskell community, and some people can benefit from having Nix with established best-practices in scaffolded projects. This issue tracks both: building Summoner with Nix and generating projects with the Nix configuration.
Main goals
Below are the goals we want to achieve with implementing Nix support.
Brief implementation plan
I've created the nix branch. All parts of the implementation should be submitted as PRs to that branch. It should be rebased on
master
whenmaster
updates.Below I describe what parts of the Summoner need to be implemented or changed to support Nix:
Nix
constructor to theTool
data typeNix
question in CLI modeNix
button in TUIsummon script
command (issuesummon script nix
#349)nix
field in the default configuration produced bysummon config
nix-minimal
examplefull-batteries
exampleOpen questions
History references
Previous attempts to implement some parts of this plan
cabal2Nix
The text was updated successfully, but these errors were encountered: