From dbe3021a0f64c1ce969b5e0e2633d217414d5fbc Mon Sep 17 00:00:00 2001 From: Providence Salumu Date: Sun, 1 Jan 2023 22:25:36 -0500 Subject: [PATCH] - bump version to 0.7.7.1 - build with spatial-math 0.5.0.2 - build with Nix - tested with GHC-924 --- .envrc | 8 + cabal.project | 3 + default.nix | 4 + flake.lock | 481 ++++++++++++++++++++ flake.nix | 82 ++++ not-gloss-examples/not-gloss-examples.cabal | 4 +- not-gloss-examples/src/Play.hs | 3 +- not-gloss/not-gloss.cabal | 4 +- not-gloss/src/Vis/VisObject.hs | 3 +- shell.nix | 4 + 10 files changed, 590 insertions(+), 6 deletions(-) create mode 100644 .envrc create mode 100644 cabal.project create mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..4085162 --- /dev/null +++ b/.envrc @@ -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 diff --git a/cabal.project b/cabal.project new file mode 100644 index 0000000..a566693 --- /dev/null +++ b/cabal.project @@ -0,0 +1,3 @@ +packages: + not-gloss + not-gloss-examples diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..1ef8a22 --- /dev/null +++ b/default.nix @@ -0,0 +1,4 @@ +(import (fetchTarball + "https://github.com/edolstra/flake-compat/archive/master.tar.gz") { + src = builtins.fetchGit ./.; + }).defaultNix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..23918ac --- /dev/null +++ b/flake.lock @@ -0,0 +1,481 @@ +{ + "nodes": { + "devenv": { + "inputs": { + "flake-compat": "flake-compat", + "nix": "nix", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1672520044, + "narHash": "sha256-l7uwQ0DZ8k2/1srLozqjiiGWg91NBCTTj0uqbOILUQ4=", + "owner": "cachix", + "repo": "devenv", + "rev": "493738c368612aec1f63ad9f28aa7726e057f411", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "devenv_2": { + "inputs": { + "flake-compat": "flake-compat_2", + "nix": "nix_2", + "nixpkgs": "nixpkgs_3", + "pre-commit-hooks": "pre-commit-hooks_2" + }, + "locked": { + "lastModified": 1672520044, + "narHash": "sha256-l7uwQ0DZ8k2/1srLozqjiiGWg91NBCTTj0uqbOILUQ4=", + "owner": "cachix", + "repo": "devenv", + "rev": "493738c368612aec1f63ad9f28aa7726e057f411", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1668681692, + "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "009399224d5e398d03b22badca40a37ac85412a1", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "devenv", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "spatial-math", + "devenv", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "lowdown-src_2": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1671638174, + "narHash": "sha256-FeEmVix8l/HglWtRgeHOfjqEm2etvp+MLYd1C/raq3Y=", + "owner": "domenkozar", + "repo": "nix", + "rev": "51b770e985f9e1b84fb5e03a983ef1e19f18c3e9", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "relaxed-flakes", + "repo": "nix", + "type": "github" + } + }, + "nix-filter": { + "locked": { + "lastModified": 1666547822, + "narHash": "sha256-razwnAybPHyoAyhkKCwXdxihIqJi1G6e1XP4FQOJTEs=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "1a3b735e13e90a8d2fd5629f2f8363bd7ffbbec7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, + "nix-filter_2": { + "locked": { + "lastModified": 1666547822, + "narHash": "sha256-razwnAybPHyoAyhkKCwXdxihIqJi1G6e1XP4FQOJTEs=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "1a3b735e13e90a8d2fd5629f2f8363bd7ffbbec7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, + "nix_2": { + "inputs": { + "lowdown-src": "lowdown-src_2", + "nixpkgs": [ + "spatial-math", + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression_2" + }, + "locked": { + "lastModified": 1671638174, + "narHash": "sha256-FeEmVix8l/HglWtRgeHOfjqEm2etvp+MLYd1C/raq3Y=", + "owner": "domenkozar", + "repo": "nix", + "rev": "51b770e985f9e1b84fb5e03a983ef1e19f18c3e9", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "relaxed-flakes", + "repo": "nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1672428209, + "narHash": "sha256-eejhqkDz2cb2vc5VeaWphJz8UXNuoNoM8/Op8eWv2tQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-regression_2": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1671271954, + "narHash": "sha256-cSvu+bnvN08sOlTBWbBrKaBHQZq8mvk8bgpt0ZJ2Snc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d513b448cc2a6da2c8803e3c197c9fc7e67b19e3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_2": { + "locked": { + "lastModified": 1671271954, + "narHash": "sha256-cSvu+bnvN08sOlTBWbBrKaBHQZq8mvk8bgpt0ZJ2Snc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d513b448cc2a6da2c8803e3c197c9fc7e67b19e3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1672618378, + "narHash": "sha256-j6zSlewBdQjNeVGzftLVllWB29rty20yxu+MaJSS9Yw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "cd202151e97f9308f5d4119deec062ce6fe741ba", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "haskell-updates", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1672428209, + "narHash": "sha256-eejhqkDz2cb2vc5VeaWphJz8UXNuoNoM8/Op8eWv2tQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1672565901, + "narHash": "sha256-EFRqYqKy+SN1vLvPd9E+8ofuUkvBO8xKlogeXkp0Sjw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7584aa9bcad4deb76c7da4f46e9aa671d2b88cf8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "haskell-updates", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": [ + "devenv", + "flake-compat" + ], + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1672050129, + "narHash": "sha256-GBQMcvJUSwAVOpDjVKzB6D5mmHI7Y4nFw+04bnS9QrM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "67d98f02443b9928bc77f1267741dcfdd3d7b65c", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pre-commit-hooks_2": { + "inputs": { + "flake-compat": [ + "spatial-math", + "devenv", + "flake-compat" + ], + "flake-utils": "flake-utils_2", + "gitignore": "gitignore_2", + "nixpkgs": [ + "spatial-math", + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_2" + }, + "locked": { + "lastModified": 1672050129, + "narHash": "sha256-GBQMcvJUSwAVOpDjVKzB6D5mmHI7Y4nFw+04bnS9QrM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "67d98f02443b9928bc77f1267741dcfdd3d7b65c", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "nix-filter": "nix-filter", + "nixpkgs": "nixpkgs_2", + "spatial-math": "spatial-math" + } + }, + "spatial-math": { + "inputs": { + "devenv": "devenv_2", + "nix-filter": "nix-filter_2", + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1672629019, + "narHash": "sha256-2IeTv2YwIxq6973fe/iDEGVFUPWRfK7iRxsWScQWjHU=", + "owner": "smunix", + "repo": "spatial-math", + "rev": "75464904f200e13de09561af9a73fe87ac1f9e1a", + "type": "github" + }, + "original": { + "owner": "smunix", + "ref": "fix.no-TypeCompose", + "repo": "spatial-math", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7e3115f --- /dev/null +++ b/flake.nix @@ -0,0 +1,82 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs?ref=haskell-updates"; + devenv.url = "github:cachix/devenv"; + nix-filter.url = "github:numtide/nix-filter"; + spatial-math.url = "github:smunix/spatial-math?ref=fix.no-TypeCompose"; + }; + + outputs = { self, nixpkgs, devenv, nix-filter, ... }@inputs: + with nix-filter.lib; + let + systems = [ + "x86_64-linux" + # "i686-linux" + "x86_64-darwin" + # "aarch64-linux" + # "aarch64-darwin" + ]; + config = { }; + forAllSystems = f: + builtins.listToAttrs (map (name: { + inherit name; + value = f name; + }) systems); + overlays.default = final: previous: + with final.haskell.lib; { + haskellPackages = previous.haskellPackages.extend (hfinal: hprevious: + with hfinal; { + not-gloss = callCabal2nix "not-gloss" + (filter { root = "${self}/not-gloss"; }) { }; + not-gloss-examples = callCabal2nix "not-gloss-examples" + (filter { root = "${self}/not-gloss-examples"; }) { }; + }); + }; + in { + inherit overlays; + packages = forAllSystems (system: + let + pkgs = import nixpkgs { + inherit config system; + overlays = + [ inputs.spatial-math.overlays.default overlays.default ]; + }; + in { + default = pkgs.haskellPackages.not-gloss; + inherit (pkgs.haskellPackages) not-gloss not-gloss-examples; + }); + devShells = forAllSystems (system: + let + pkgs = import nixpkgs { + inherit config system; + overlays = + [ inputs.spatial-math.overlays.default overlays.default ]; + }; + in { + default = devenv.lib.mkShell { + inherit inputs pkgs; + modules = with pkgs.haskellPackages; + with pkgs; [{ + env.name = "not-gloss"; + enterShell = '' + setUp + ''; + packages = [ + (ghcWithPackages (p: + with p; [ + haskell-language-server + not-gloss + not-gloss-examples + ])) + ]; + pre-commit.hooks = { nixfmt.enable = true; }; + scripts = { + setUp.exec = '' + ${implicit-hie}/bin/gen-hie --cabal &> hie.yaml + ''; + }; + }]; + }; + }); + }; +} diff --git a/not-gloss-examples/not-gloss-examples.cabal b/not-gloss-examples/not-gloss-examples.cabal index 3f5fb74..4a82b68 100644 --- a/not-gloss-examples/not-gloss-examples.cabal +++ b/not-gloss-examples/not-gloss-examples.cabal @@ -1,5 +1,5 @@ name: not-gloss-examples -version: 0.5.1.1 +version: 0.5.1.2 stability: Experimental synopsis: examples for not-gloss license: BSD3 @@ -37,7 +37,7 @@ executable not-gloss-simulate executable not-gloss-game main-is: src/Play.hs build-depends: not-gloss >= 0.7.6.2, - spatial-math >= 0.2.0 && < 0.3, + spatial-math >= 0.5.0.2, linear >= 1.3.1, GLUT, containers, diff --git a/not-gloss-examples/src/Play.hs b/not-gloss-examples/src/Play.hs index 1dda134..e88917f 100644 --- a/not-gloss-examples/src/Play.hs +++ b/not-gloss-examples/src/Play.hs @@ -13,7 +13,8 @@ import Graphics.UI.GLUT ( Cursor(..), Key(..), KeyState(..), Modifiers(..), Posi ) import qualified Graphics.UI.GLUT as GLUT -import SpatialMath ( Euler(..), rotateXyzAboutZ, rotVecByEulerB2A ) +import SpatialMath ( Euler(..) ) +import SpatialMath.Untyped ( rotateXyzAboutZ, rotVecByEulerB2A ) import Vis import Control.Monad ( when ) diff --git a/not-gloss/not-gloss.cabal b/not-gloss/not-gloss.cabal index f43c081..93cb2e3 100644 --- a/not-gloss/not-gloss.cabal +++ b/not-gloss/not-gloss.cabal @@ -1,5 +1,5 @@ name: not-gloss -version: 0.7.7.0 +version: 0.7.7.1 stability: Experimental synopsis: Painless 3D graphics, no affiliation with gloss description:{ @@ -41,7 +41,7 @@ library time >= 1.4.0, OpenGLRaw >= 3.1.0.0, OpenGL >= 3.0.0.1, - spatial-math >= 0.2.1.2, + spatial-math >= 0.5.0.2, vector, binary, vector-binary-instances > 0.2.1.0, diff --git a/not-gloss/src/Vis/VisObject.hs b/not-gloss/src/Vis/VisObject.hs index 78b66ec..918dd57 100644 --- a/not-gloss/src/Vis/VisObject.hs +++ b/not-gloss/src/Vis/VisObject.hs @@ -29,7 +29,8 @@ import Graphics.UI.GLUT ( BitmapFont(..), Capability(..), Color4(..), Face(..) , ($=) ) -import SpatialMath +import SpatialMath (Euler(..)) +import SpatialMath.Untyped import qualified Vis.GlossColor as GlossColor diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..9a25fab --- /dev/null +++ b/shell.nix @@ -0,0 +1,4 @@ +(import (fetchTarball + "https://github.com/edolstra/flake-compat/archive/master.tar.gz") { + src = builtins.fetchGit ./.; + }).shellNix