Skip to content
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

Added a flake build instead of shell.nix #119

Merged
merged 1 commit into from
Oct 11, 2023
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ cabal.sandbox.config
.*.swp
*.log
*.dump-hi
.direnv/
.envrc
dist-newstyle/
result/
61 changes: 61 additions & 0 deletions flake.lock

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

82 changes: 82 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
description = "mat-chalmers goes flakes";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
Rembane marked this conversation as resolved.
Show resolved Hide resolved
flake-utils.url = "github:numtide/flake-utils";
};

nixConfig.allow-import-from-derivation = true; # cabal2nix uses IFD

outputs = { self, nixpkgs, flake-utils }:
let
ghcVer = "ghc945";
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 = mat;
mat = pkgs.haskell.packages.${ghcVer}.mat;
};

checks = {
inherit (self.packages.${system}) mat;
};

# for debugging
# inherit pkgs;

devShells.default =
let haskellPackages = pkgs.haskell.packages.${ghcVer};
in
haskellPackages.shellFor {
packages = p: [ self.packages.${system}.mat ];
withHoogle = true;
buildInputs =
[ pkgs.docker ] ++
(with haskellPackages; [
haskell-language-server
Jassob marked this conversation as resolved.
Show resolved Hide resolved
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
{
mat = hprev.callCabal2nix "mat" ./. { };

# 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;
});
};
};
}
8 changes: 4 additions & 4 deletions mat-chalmers.cabal
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
cabal-version: 3.0
Jassob marked this conversation as resolved.
Show resolved Hide resolved
name: mat-chalmers
version: 0.1.0.0
license: MIT
Expand All @@ -6,7 +7,6 @@ author: Adam Sandberg Eriksson
maintainer: [email protected]
category: Web
build-type: Simple
cabal-version: >=1.10
Tested-With: GHC ==9.4.5
data-files:
static/style.css
Expand Down Expand Up @@ -38,7 +38,7 @@ library
, css-text >= 0.1.3.0 && < 0.2
, exceptions >= 0.10.5 && < 0.11.0
, heredoc == 0.2.0.0
, http-client >= 0.7.14 && < 0.8
, http-client >= 0.7.13.1 && < 0.8
, http-client-tls >= 0.3.6.1 && <= 0.4
, logging-effect >= 1.4.0 && <= 2.0
, microlens-platform >= 0.4.3.3 && < 0.5
Expand All @@ -61,7 +61,7 @@ executable mat-chalmers
, base
, bytestring
, file-embed
, http-client-tls
, http-client-tls >= 0.3.5.3
, microlens-platform
, logging-effect
, mtl
Expand All @@ -83,4 +83,4 @@ Test-Suite test-mat
, hspec >= 2.10.10 && < 3.0
, HUnit >= 1.6.2.0 && < 2.0
, text
, thyme
, thyme >= 0.3.5.5
44 changes: 0 additions & 44 deletions shell.nix

This file was deleted.

Loading