Skip to content

Commit 38c8a37

Browse files
committed
feat: switch to flakes
1 parent 43d0a06 commit 38c8a37

10 files changed

Lines changed: 159 additions & 86 deletions

File tree

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@
33
.dir-locals-2.el
44

55
# Haskell
6-
dist-newstyle/
6+
dist-newstyle/
7+
8+
# direnv
9+
.direnv

default.nix

Lines changed: 0 additions & 22 deletions
This file was deleted.

examples/examples.cabal

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@ executable sudoku
2323
default-language: Haskell2010
2424
ghc-options: -threaded -pgmL markdown-unlit
2525
build-depends: base <5
26-
, containers ^>=0.6
27-
, markdown-unlit ^>=0.5
28-
, math-programming ^>=0.5
29-
, math-programming-glpk ^>=0.5
30-
, mtl ^>=2.2
31-
, text ^>=1.2
26+
, containers >=0.6
27+
, markdown-unlit >=0.5
28+
, math-programming >=0.5
29+
, math-programming-glpk >=0.5
30+
, mtl >=2.2
31+
, text >=1.2
3232

3333
executable 3sat
3434
main-is: Example3SAT.lhs
3535
hs-source-dirs: app
3636
default-language: Haskell2010
3737
ghc-options: -threaded -pgmL markdown-unlit
3838
build-depends: base <5
39-
, containers ^>=0.6
40-
, markdown-unlit ^>=0.5
41-
, math-programming ^>=0.5
42-
, math-programming-glpk ^>=0.5
43-
, mtl ^>=2.2
44-
, text ^>=1.2
39+
, containers >=0.6
40+
, markdown-unlit >=0.5
41+
, math-programming >=0.5
42+
, math-programming-glpk >=0.5
43+
, mtl >=2.2
44+
, text >=1.2
4545

4646

4747
executable tutorial
@@ -50,9 +50,9 @@ executable tutorial
5050
default-language: Haskell2010
5151
ghc-options: -threaded -pgmL markdown-unlit
5252
build-depends: base <5
53-
, containers ^>=0.6
54-
, markdown-unlit ^>=0.5
55-
, math-programming ^>=0.5
56-
, math-programming-glpk ^>=0.5
57-
, mtl ^>=2.2
58-
, text ^>=1.2
53+
, containers >=0.6
54+
, markdown-unlit >=0.5
55+
, math-programming >=0.5
56+
, math-programming-glpk >=0.5
57+
, mtl >=2.2
58+
, text >=1.2

flake.lock

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
description = "A collection of libraries for mathematical programming";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils, ... }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = nixpkgs.legacyPackages.${system};
13+
haskellPackages = pkgs.haskellPackages.override {
14+
overrides = self: super: {
15+
examples = self.callCabal2nix "examples" ./examples {};
16+
glpk-headers = self.callCabal2nix "glpk-headers" ./glpk-headers {};
17+
math-programming = self.callCabal2nix "math-programming" ./math-programming {};
18+
math-programming-glpk = self.callCabal2nix "math-programming-glpk" ./math-programming-glpk {};
19+
math-programming-tests = self.callCabal2nix "math-programming-tests" ./math-programming-tests {};
20+
};
21+
};
22+
in
23+
{
24+
packages.examples = haskellPackages.examples;
25+
packages.glpk-headers = haskellPackages.glpk-headers;
26+
packages.math-programming = haskellPackages.mathProgramming;
27+
packages.math-programming-glpk = haskellPackages.mathProgrammingGlpk;
28+
packages.math-programming-tests = haskellPackages.mathProgrammingTests;
29+
packages.default = self.packages.${system}.examples;
30+
defaultPackage = self.packages.${system}.default;
31+
devShells.default = pkgs.haskellPackages.shellFor {
32+
packages = p: [ haskellPackages.examples
33+
haskellPackages.glpk-headers
34+
haskellPackages.math-programming
35+
haskellPackages.math-programming-glpk
36+
haskellPackages.math-programming-tests
37+
];
38+
buildInputs = [
39+
pkgs.haskellPackages.haskell-language-server
40+
pkgs.ormolu
41+
pkgs.cabal-install
42+
];
43+
withHoogle = true;
44+
doBenchmark = true;
45+
};
46+
devShell = self.devShells.${system}.default;
47+
}
48+
);
49+
}

math-programming-glpk/math-programming-glpk.cabal

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ library
2424
other-modules: Math.Programming.Glpk.Internal
2525
ghc-options: -Wall
2626
build-depends: base <5
27-
, glpk-headers ^>=0.5
28-
, math-programming ^>=0.5
29-
, mtl ^>=2.2
30-
, text ^>=1.2
31-
, transformers ^>=0.5
32-
, unliftio ^>=0.2
27+
, glpk-headers >=0.5
28+
, math-programming >=0.5
29+
, mtl >=2.2
30+
, text >=1.2
31+
, transformers >=0.5
32+
, unliftio >=0.2
3333

3434
test-suite math-programming-glpk-test-suite
3535
default-language: Haskell2010
@@ -40,7 +40,7 @@ test-suite math-programming-glpk-test-suite
4040
ghc-options: -threaded -with-rtsopts=-N -Wall
4141
build-depends: math-programming-glpk
4242
, base <5
43-
, math-programming ^>=0.5
44-
, math-programming-tests ^>=0.5
45-
, unliftio ^>=0.2
43+
, math-programming >=0.5
44+
, math-programming-tests >=0.5
45+
, unliftio >=0.2
4646
, hspec >=2.8 && < 3

math-programming-tests/math-programming-tests.cabal

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ library
2828
other-modules:
2929
ghc-options: -Wall
3030
build-depends: base <5
31-
, containers ^>=0.6
32-
, math-programming ^>=0.5
33-
, microlens ^>=0.4
34-
, microlens-th ^>=0.4
35-
, microlens-mtl ^>=0.2
31+
, containers >=0.6
32+
, math-programming >=0.5
33+
, microlens >=0.4
34+
, microlens-th >=0.4
35+
, microlens-mtl >=0.2
3636
, hspec >=2.8 && <3
37-
, QuickCheck ^>=2.14
38-
, random ^>=1.2
39-
, mtl ^>=2.2
40-
, text ^>=1.2
37+
, QuickCheck >=2.14
38+
, random >=1.2
39+
, mtl >=2.2
40+
, text >=1.2

math-programming/math-programming.cabal

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ library
2828
ghc-options: -Wall
2929
-- Restrictions on transformers due to https://hub.darcs.net/ross/transformers/issue/90
3030
build-depends: base <5
31-
, containers ^>=0.6
32-
, exceptions ^>=0.10
33-
, mtl ^>=2.2
34-
, text ^>=1.2
35-
, transformers ^>=0.5
31+
, containers >=0.6
32+
, exceptions >=0.10
33+
, mtl >=2.2
34+
, text >=1.2
35+
, transformers >=0.5
3636

3737
test-suite math-programming-test-suite
3838
default-language: Haskell2010
@@ -45,6 +45,6 @@ test-suite math-programming-test-suite
4545
build-depends: math-programming
4646
, base <5
4747
, hspec >=2.8 && <3
48-
, mtl ^>=2.2
49-
, QuickCheck ^>=2.14
50-
, text ^>=1.2
48+
, mtl >=2.2
49+
, QuickCheck >=2.14
50+
, text >=1.2

shell.nix

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1 @@
1-
{ sources ? import ./nix/sources.nix
2-
, pkgs ? import sources.nixpkgs { }
3-
}:
4-
let
5-
local = import ./default.nix { inherit sources pkgs; };
6-
in
7-
pkgs.haskellPackages.shellFor {
8-
packages = p: [ local.examples
9-
local.glpk-headers
10-
local.math-programming
11-
local.math-programming-glpk
12-
local.math-programming-tests
13-
];
14-
buildInputs = [ pkgs.cabal-install
15-
pkgs.cabal2nix
16-
pkgs.haskell-language-server
17-
];
18-
withHoogle = true;
19-
}
1+
(builtins.getFlake (builtins.toString ./.)).outputs.devShells.x86_64-linux

0 commit comments

Comments
 (0)