-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
build: add flake.nix #533
Open
teto
wants to merge
1
commit into
NixOS:master
Choose a base branch
from
teto:flakify
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
build: add flake.nix #533
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
description = "Generate Nix build instructions from a Cabal file"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
|
||
flake-compat = { | ||
url = "github:edolstra/flake-compat"; | ||
flake = false; | ||
}; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils, ... }: | ||
flake-utils.lib.eachDefaultSystem (system: let | ||
|
||
pkgs = nixpkgs.legacyPackages.${system}; | ||
|
||
ghc8107 = pkgs.haskell.packages."ghc8107"; | ||
|
||
# modifier used in haskellPackages.developPackage | ||
myModifier = hsPkgs: drv: | ||
pkgs.haskell.lib.addBuildTools drv ([ | ||
hsPkgs.cabal-install | ||
hsPkgs.haskell-language-server | ||
]); | ||
|
||
mkPackage = hsPkgs: | ||
hsPkgs.developPackage { | ||
root = pkgs.lib.cleanSource ./. ; | ||
name = "cabal2nix"; | ||
returnShellEnv = false; | ||
withHoogle = true; | ||
modifier = myModifier hsPkgs; | ||
}; | ||
|
||
in { | ||
packages = { | ||
cabal2nix = self.packages.${system}.cabal2nix-8107; | ||
cabal2nix-8107 = mkPackage ghc8107; | ||
}; | ||
|
||
devShell = self.packages.${system}.cabal2nix.envFunc {}; | ||
|
||
defaultPackage = self.packages.${system}.cabal2nix; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,9 @@ | ||
{ pkgs ? import <nixpkgs> {} }: | ||
|
||
(import ( | ||
let | ||
haskellPackages = pkgs.haskellPackages; | ||
ghc = haskellPackages.ghcWithHoogle (hps: [ | ||
hps.ansi-wl-pprint | ||
hps.distribution-nixpkgs | ||
hps.hackage-db | ||
hps.hopenssl | ||
hps.hpack | ||
hps.language-nix | ||
hps.lens | ||
hps.optparse-applicative | ||
hps.pretty | ||
hps.split | ||
hps.yaml | ||
hps.monad-par | ||
hps.monad-par-extras | ||
hps.tasty | ||
hps.tasty-golden | ||
]); | ||
|
||
in pkgs.stdenv.mkDerivation { | ||
name = "shell"; | ||
buildInputs = [ | ||
ghc | ||
haskellPackages.cabal-install | ||
haskellPackages.haskell-language-server | ||
(pkgs.lib.getLib pkgs.openssl) | ||
]; | ||
} | ||
lock = builtins.fromJSON (builtins.readFile ./flake.lock); | ||
in fetchTarball { | ||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.flake-compat.locked.narHash; } | ||
) { | ||
src = ./.; | ||
}).shellNix |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I don't want a flake, if any, to expose a cabal2nix package. The supported and maintained ways to get cabal2nix are hackage and nixpkgs. If you want something closer to HEAD, use
haskellPackages.cabal2nix-unstable
or override it yourself.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.
I like having the possibility to build in a sandbox from scratch (i.e. more powerful than what cabal does). It helps me check it really works. Could be useful in a CI too.
I can remove it if you dont like it.