Skip to content

Commit 6104965

Browse files
author
Fischer Bordwell
committed
Add nix support
1 parent 67e0fd9 commit 6104965

5 files changed

+49
-0
lines changed

.direnv/bin/nix-direnv-reload

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
dir="$(realpath $(dirname ${BASH_SOURCE[0]})/../..)"
3+
_nix_direnv_force_reload=1 direnv exec "$dir" true
4+
direnv reload
5+
# direnv reload updates the mtime of .envrc. Also update the timestamp of the
6+
# profile_rc file to keep track that we actually are up to date.
7+
touch $dir/.direnv/{nix,flake}-profile-*.rc
8+

.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

.envrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

flake.nix

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
description = "learn_physics_with_fp";
3+
4+
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-23.11";
5+
inputs.flake-utils.url = "github:numtide/flake-utils";
6+
7+
outputs = inputs:
8+
let
9+
overlay = final: prev: {
10+
haskell = prev.haskell // {
11+
packageOverrides = hfinal: hprev:
12+
prev.haskell.packageOverrides hfinal hprev // {
13+
learn_physics_with_fp = hfinal.callCabal2nix "learn_physics_with_fp" ./. { };
14+
};
15+
};
16+
learn_physics_with_fp = final.haskell.lib.compose.justStaticExecutables final.haskellPackages.learn_physics_with_fp;
17+
};
18+
perSystem = system:
19+
let
20+
pkgs = import inputs.nixpkgs { inherit system; overlays = [ overlay ]; };
21+
hspkgs = pkgs.haskellPackages;
22+
in
23+
{
24+
devShell = hspkgs.shellFor {
25+
withHoogle = true;
26+
packages = p: [ p.learn_physics_with_fp ];
27+
buildInputs = [
28+
hspkgs.cabal-install
29+
hspkgs.haskell-language-server
30+
hspkgs.hlint
31+
hspkgs.ormolu
32+
pkgs.bashInteractive
33+
];
34+
};
35+
defaultPackage = pkgs.learn_physics_with_fp;
36+
};
37+
in
38+
{ inherit overlay; } // inputs.flake-utils.lib.eachDefaultSystem perSystem;
39+
}

0 commit comments

Comments
 (0)