Skip to content

Commit

Permalink
* Drop TypeCompose as a dependency,
Browse files Browse the repository at this point in the history
   and use Data.Functor.Compose
   from base.
* use hpack to generate cabal
* build with Nix
* bump stack to use lts-20.4
* bump version to 0.5.0.2
  • Loading branch information
smunix committed Jan 2, 2023
1 parent 22afc3e commit 3da63f5
Show file tree
Hide file tree
Showing 14 changed files with 477 additions and 90 deletions.
8 changes: 8 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if ! has nix_direnv_version || ! nix_direnv_version 2.2.0; then
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.0/direnvrc" "sha256-5EwyKnkJNQeXrRkYbwwRBcXbibosCJqyIUuz9Xq+LRc="
fi

nix_direnv_watch_file devenv.nix
nix_direnv_watch_file devenv.lock
nix_direnv_watch_file devenv.yaml
use flake . --impure
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
.stack-work
.devenv
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
HEAD
- Drop TypeCompose dependency
- Reorganize directory structure and make typed interface the central one.
- Add serialise instances.
- Drop Generic/Generic1/Typeable/Typeable1 instances for older GHCs
Expand Down
3 changes: 3 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
src = builtins.fetchGit ./.;
}).defaultNix
234 changes: 234 additions & 0 deletions flake.lock

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

71 changes: 71 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=haskell-updates";
devenv.url = "github:cachix/devenv";
nix-filter.url = "github:numtide/nix-filter";
};

outputs = { self, nixpkgs, devenv, nix-filter, ... }@inputs:
with nix-filter.lib;
let
config = { allowBroken = true; };
overlays.default = final: previous: {
haskellPackages = with final.haskell.lib;
previous.haskellPackages.extend (hfinal: hprevous:
with hfinal; {
spatial-math = callCabal2nix "spatial-math" (filter {
root = self;
exclude = [ "stack.yaml" (matchExt "cabal") ];
}) { };
});
};
systems = [
"x86_64-linux"
# "i686-linux"
"x86_64-darwin"
# "aarch64-linux"
# "aarch64-darwin"
];
forAllSystems = f:
builtins.listToAttrs (map (name: {
inherit name;
value = f name;
}) systems);
in {
packages = forAllSystems (system:
let
pkgs = import nixpkgs {
inherit config system;
overlays = [ overlays.default ];
};
in {
default = pkgs.haskellPackages.spatial-math;
});
devShells = forAllSystems (system:
let
pkgs = import nixpkgs {
inherit config system;
overlays = [ overlays.default ];
};
in {
default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = with pkgs.haskellPackages; with pkgs; [{
env = { name = "spatial-math"; };
packages =
[ (ghcWithPackages (p: with p; [ haskell-language-server spatial-math ])) ];
scripts = {
run-ghcid.exec = "${ghcid}/bin/ghcid -W -a -c 'cabal repl lib:spatial-math'";
setUp.exec = ''
${hpack}/bin/hpack -f package.yaml
${implicit-hie}/bin/gen-hie --cabal &> hie.yaml
'';
};
enterShell = "
setUp
";
}];
};
});
};
}
51 changes: 51 additions & 0 deletions package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: spatial-math
version: 0.5.0.2
synopsis: 3d math including quaternions/euler angles/dcms and utility functions
license: BSD3
license-file: LICENSE
author: Greg Horn
maintainer: gregmainland@gmail.com
copyright: Copyright (c) 2012-2019, Greg Horn
category: Math
github: ghorn/spatial-math
test-with: GHC==9.2

extra-source-files:
- README.md
- changelog.txt

library:
source-dirs: src
dependencies:
- base
- ghc-prim
- cereal
- binary
- serialise
- linear
- lens
ghc-options: -Wall -Werror

tests:
doctests:
main: doctests.hs
source-dirs: tests
when:
- condition: false
other-modules: Main
dependencies:
- base
- doctest
ghc-options: -O2 -threaded -Wall -Werror
build-tools: doctest-discover

unit-tests:
main: Main.hs
source-dirs: tests
dependencies:
- base
- spatial-math
- QuickCheck
- test-framework
- test-framework-quickcheck2
ghc-options: -O2 -Wall -Werror
3 changes: 3 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
src = builtins.fetchGit ./.;
}).shellNix
Loading

0 comments on commit 3da63f5

Please sign in to comment.