This commit is contained in:
pingu 2023-08-28 14:40:33 +02:00
parent 40ea83e76d
commit ea1ecaed8e
6 changed files with 144 additions and 48 deletions

2
.envrc Normal file
View File

@ -0,0 +1,2 @@
nix_direnv_watch_file *.cabal
use flake

2
.gitignore vendored
View File

@ -22,4 +22,4 @@ cabal.project.local
cabal.project.local~ cabal.project.local~
.HTF/ .HTF/
.ghc.environment.* .ghc.environment.*
./.direnv

61
flake.lock Normal file
View File

@ -0,0 +1,61 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1692799911,
"narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1693099187,
"narHash": "sha256-FXCc6OIghv9k4xYOhSMZI6bj7o56S8BJKzKtTKzdUVQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "cf2004afe4d4b95a295c63c911e949e40915eedb",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

80
flake.nix Normal file
View File

@ -0,0 +1,80 @@
{
description = "Example Haskell flake showing overrides and adding stuff to the dev shell";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
nixConfig.allow-import-from-derivation = true; # cabal2nix uses IFD
outputs = { self, nixpkgs, flake-utils }:
let
ghcVer = "ghc902";
makeHaskellOverlay = overlay: final: prev: {
haskell = prev.haskell // {
packages = prev.haskell.packages // {
${ghcVer} = prev.haskell.packages."${ghcVer}".override (oldArgs: {
overrides =
prev.lib.composeExtensions (oldArgs.overrides or (_: _: { }))
(overlay prev);
});
};
};
};
out = system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
config.allowBroken = true;
};
in
{
packages = rec {
default = sample;
sample = pkgs.haskell.packages.${ghcVer}.sample;
};
checks = {
inherit (self.packages.${system}) sample;
};
# for debugging
# inherit pkgs;
devShells.default =
let haskellPackages = pkgs.haskell.packages.${ghcVer};
in
haskellPackages.shellFor {
packages = p: [ self.packages.${system}.sample ];
withHoogle = true;
buildInputs = with haskellPackages; [
haskell-language-server
cabal-install
];
# Change the prompt to show that you are in a devShell
# shellHook = "export PS1='\\e[1;34mdev > \\e[0m'";
};
};
in
flake-utils.lib.eachDefaultSystem out // {
# this stuff is *not* per-system
overlays = {
default = makeHaskellOverlay (prev: hfinal: hprev:
let hlib = prev.haskell.lib; in
{
sample = hprev.callCabal2nix "sample" ./. { };
# here's how to do hacks to the package set
# don't run the test suite
# fast-tags = hlib.dontCheck hprev.fast-tags;
#
# don't check version bounds
# friendly = hlib.doJailbreak hprev.friendly;
});
};
};
}

View File

@ -1,7 +0,0 @@
resolver: lts-19.33
extra-deps:
- clash-ghc-1.6.4
- clash-prelude-1.6.4
- clash-lib-1.6.4
- concurrent-supply-0.1.8

View File

@ -1,40 +0,0 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
packages:
- completed:
hackage: clash-ghc-1.6.4@sha256:43e4c9c949bf9623633f08bb09bb4495578b517be4e99140d9ea22dd2a9cd13b,9042
pantry-tree:
sha256: 9484d37cd6c8cb0217a02cf020b6398dbe1a68fa332472b40cfb511ce54a743a
size: 3634
original:
hackage: clash-ghc-1.6.4
- completed:
hackage: clash-prelude-1.6.4@sha256:67b5c26ad7c712e23f5d54187d691cbb007931a89b4aabd4a738c307d71b2a27,17249
pantry-tree:
sha256: b12774016a4f9bd456ecdf7bc1e5182d33ef4ac9e16db0f344d27189a26bfe2d
size: 13292
original:
hackage: clash-prelude-1.6.4
- completed:
hackage: clash-lib-1.6.4@sha256:336e57d424852f2ad9285b6fa820e634f32d39d52755d3245d5f4ac04ea37f85,13688
pantry-tree:
sha256: 750ffc9d2f5ed3690f6a2a7da46090970594dbbcf8a6b55d785e8f809b4dfbf1
size: 22460
original:
hackage: clash-lib-1.6.4
- completed:
hackage: concurrent-supply-0.1.8@sha256:9373f4868ad28936a7b93781b214ef4afdeacf377ef4ac729583073491c9f9fb,1627
pantry-tree:
sha256: bdfaa167ae3249f858ba248aea2e9b97ab9b13af6e68c73b7c3192e717e11b83
size: 400
original:
hackage: concurrent-supply-0.1.8
snapshots:
- completed:
sha256: 6d1532d40621957a25bad5195bfca7938e8a06d923c91bc52aa0f3c41181f2d4
size: 619204
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/33.yaml
original: lts-19.33