diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..3550a30f --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml index c4ca8e36..7d956c13 100644 --- a/.github/workflows/nix-build.yml +++ b/.github/workflows/nix-build.yml @@ -13,22 +13,26 @@ jobs: os: - ubuntu-latest attribute: - - release - - pre-commit-check - - nixos-21_05 - - nixos-21_11 - - nixos-22_05 + - .#devShells.x86_64-linux.default + - .#packages.x86_64-linux.default + - .#checks.x86_64-linux.pre-commit + - .#checks.x86_64-linux.nixpkgs-21_05 + - .#checks.x86_64-linux.nixpkgs-21_11 + - .#checks.x86_64-linux.nixpkgs-22_05 steps: - - uses: actions/checkout@v2.3.4 - - uses: cachix/install-nix-action@v13 + - uses: actions/checkout@v2.5.0 + - uses: cachix/install-nix-action@v18 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - name: free disk space run: | if [[ "${{matrix.os}}" == "ubuntu-latest" ]] then sudo rm -rf /opt fi - - uses: cachix/cachix-action@v10 + - uses: cachix/cachix-action@v11 with: name: validity signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' - - run: nix-build ci.nix -A ${{ matrix.attribute }} + - run: nix build "${{matrix.attribute}}" diff --git a/cabal.project b/cabal.project new file mode 100644 index 00000000..f6738314 --- /dev/null +++ b/cabal.project @@ -0,0 +1,2 @@ +packages: */*.cabal +test-show-details: direct diff --git a/ci.nix b/ci.nix deleted file mode 100644 index 3b172fa5..00000000 --- a/ci.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ sources ? import ./nix/sources.nix -, pkgs ? import ./nix/pkgs.nix { inherit sources; } -, system ? builtins.currentSystem -}: -let - versions = { - "nixos-21_05" = sources.nixpkgs-21_05; - "nixos-21_11" = sources.nixpkgs-21_11; - "nixos-22_05" = sources.nixpkgs-22_05; - }; - - mkReleaseForVersion = version: nixpkgs: - let - p = import ./nix/pkgs.nix { - inherit sources nixpkgs system; - }; - - in - p.validityRelease.overrideAttrs (old: { name = "validity-release-${version}"; }); - -in -{ - release = pkgs.validityRelease; - pre-commit-check = (import ./nix/pre-commit.nix { inherit sources; }).run; -} // builtins.mapAttrs mkReleaseForVersion versions diff --git a/default.nix b/default.nix deleted file mode 100644 index 3d338715..00000000 --- a/default.nix +++ /dev/null @@ -1,2 +0,0 @@ -let pkgs = import ./nix/pkgs.nix { }; -in pkgs.validityPackages diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..d2cf4281 --- /dev/null +++ b/flake.lock @@ -0,0 +1,222 @@ +{ + "nodes": { + "autodocodec": { + "flake": false, + "locked": { + "lastModified": 1666331698, + "narHash": "sha256-VrONoycKv3lOwN/oKet3Pix96aFNgK+PmLevzBgSsgY=", + "owner": "NorfairKing", + "repo": "autodocodec", + "rev": "fdc5171d0f904613b6a8b986a909c7a8ade4d2f1", + "type": "github" + }, + "original": { + "owner": "NorfairKing", + "ref": "flake", + "repo": "autodocodec", + "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-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" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "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" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1669735802, + "narHash": "sha256-qtG/o/i5ZWZLmXw108N2aPiVsxOcidpHJYNkT45ry9Q=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "731cc710aeebecbf45a258e977e8b68350549522", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-21_11": { + "locked": { + "lastModified": 1659446231, + "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-21.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-22_05": { + "locked": { + "lastModified": 1669677308, + "narHash": "sha256-n788Cx+W6J1CtQofJD/KUY1c2WcJx6GqyJ+++1y9B3k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f214b8c9455e90b70bafd4ed9a58d448c243e8bb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1668984258, + "narHash": "sha256-0gDMJ2T3qf58xgcSbYoXiRGUkPWmKyr5C3vcathWhKs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "cf63ade6f74bbc9d2a017290f1b2e33e8fbfa70a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1668994630, + "narHash": "sha256-1lqx6HLyw6fMNX/hXrrETG1vMvZRGm2XVC9O/Jt0T6c=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "af50806f7c6ab40df3e6b239099e8f8385f6c78b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs_2", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1669807480, + "narHash": "sha256-MwIcNG1xqkqQSNcQC5x6bFb78/H3r+hc+p7U+Kf3BxM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "84dc0bdabbcabf6617797fc43342429bf5bf663f", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "autodocodec": "autodocodec", + "nixpkgs": "nixpkgs", + "nixpkgs-21_11": "nixpkgs-21_11", + "nixpkgs-22_05": "nixpkgs-22_05", + "pre-commit-hooks": "pre-commit-hooks", + "safe-coloured-text": "safe-coloured-text", + "sydtest": "sydtest" + } + }, + "safe-coloured-text": { + "flake": false, + "locked": { + "lastModified": 1666332070, + "narHash": "sha256-Jvx1599QUkgzPhdvSOrxEKKBXF42eYv26EgXwM+RguU=", + "owner": "NorfairKing", + "repo": "safe-coloured-text", + "rev": "df6d65d1afb0140d081b685b411dcfe03ae6f789", + "type": "github" + }, + "original": { + "owner": "NorfairKing", + "ref": "flake", + "repo": "safe-coloured-text", + "type": "github" + } + }, + "sydtest": { + "flake": false, + "locked": { + "lastModified": 1669809024, + "narHash": "sha256-xPN8iPljAiZw+9j5F/uPQ6wd8w9fuBosAhQo0YPEgi4=", + "owner": "NorfairKing", + "repo": "sydtest", + "rev": "3cf59bdadf91c685983abc82e296040836724169", + "type": "github" + }, + "original": { + "owner": "NorfairKing", + "ref": "flake", + "repo": "sydtest", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..f91c765c --- /dev/null +++ b/flake.nix @@ -0,0 +1,91 @@ +{ + description = "validity"; + nixConfig = { + extra-substituters = "https://validity.cachix.org"; + extra-trusted-public-keys = "validity.cachix.org-1:CqZp6vt9ir3yB5f8GAtfkJxPZG8hKC5fhIdaQsf7eZE="; + }; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-22.11"; + nixpkgs-22_05.url = "github:NixOS/nixpkgs?ref=nixos-22.05"; + nixpkgs-21_11.url = "github:NixOS/nixpkgs?ref=nixos-21.11"; + pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix"; + autodocodec.url = "github:NorfairKing/autodocodec?ref=flake"; + autodocodec.flake = false; + safe-coloured-text.url = "github:NorfairKing/safe-coloured-text?ref=flake"; + safe-coloured-text.flake = false; + sydtest.url = "github:NorfairKing/sydtest?ref=flake"; + sydtest.flake = false; + }; + + outputs = + { self + , nixpkgs + , nixpkgs-22_05 + , nixpkgs-21_11 + , pre-commit-hooks + , autodocodec + , safe-coloured-text + , sydtest + }: + let + system = "x86_64-linux"; + pkgsFor = nixpkgs: import nixpkgs { + inherit system; + overlays = [ + self.overlays.${system} + (import (autodocodec + "/nix/overlay.nix")) + (import (safe-coloured-text + "/nix/overlay.nix")) + (import (sydtest + "/nix/overlay.nix")) + ]; + }; + pkgs = pkgsFor nixpkgs; + in + { + overlays.${system} = import ./nix/overlay.nix; + packages.${system}.default = pkgs.haskellPackages.validityRelease; + checks.${system} = + let + backwardCompatibilityCheckFor = nixpkgs: + let pkgs' = pkgsFor nixpkgs; + in pkgs'.haskellPackages.validityRelease; + allNixpkgs = { + inherit + nixpkgs-22_05 + nixpkgs-21_11; + }; + backwardCompatibilityChecks = pkgs.lib.mapAttrs (_: nixpkgs: backwardCompatibilityCheckFor nixpkgs) allNixpkgs; + in + backwardCompatibilityChecks // { + pre-commit = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + hlint.enable = true; + hpack.enable = true; + ormolu.enable = true; + nixpkgs-fmt.enable = true; + nixpkgs-fmt.excludes = [ ".*/default.nix" ]; + cabal2nix.enable = true; + }; + }; + }; + devShells.${system}.default = pkgs.haskellPackages.shellFor { + name = "validity-shell"; + packages = p: builtins.attrValues p.validityPackages; + withHoogle = true; + doBenchmark = true; + buildInputs = (with pkgs; [ + niv + zlib + cabal-install + ]) ++ (with pre-commit-hooks.packages.${system}; + [ + hlint + hpack + nixpkgs-fmt + ormolu + cabal2nix + ]); + shellHook = self.checks.${system}.pre-commit.shellHook; + }; + }; +} diff --git a/genvalidity-aeson/default.nix b/genvalidity-aeson/default.nix new file mode 100644 index 00000000..9c016a73 --- /dev/null +++ b/genvalidity-aeson/default.nix @@ -0,0 +1,25 @@ +{ mkDerivation, aeson, base, criterion, deepseq, genvalidity +, genvalidity-criterion, genvalidity-hspec, genvalidity-scientific +, genvalidity-text, genvalidity-unordered-containers +, genvalidity-vector, hspec, lib, QuickCheck, validity +, validity-aeson +}: +mkDerivation { + pname = "genvalidity-aeson"; + version = "1.1.0.0"; + src = ./.; + libraryHaskellDepends = [ + aeson base genvalidity genvalidity-scientific genvalidity-text + genvalidity-unordered-containers genvalidity-vector QuickCheck + validity validity-aeson + ]; + testHaskellDepends = [ + aeson base deepseq genvalidity genvalidity-hspec hspec + ]; + benchmarkHaskellDepends = [ + aeson base criterion genvalidity-criterion + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "GenValidity support for aeson"; + license = lib.licenses.mit; +} diff --git a/genvalidity-bytestring/default.nix b/genvalidity-bytestring/default.nix new file mode 100644 index 00000000..2516adb2 --- /dev/null +++ b/genvalidity-bytestring/default.nix @@ -0,0 +1,24 @@ +{ mkDerivation, base, bytestring, criterion, deepseq, genvalidity +, genvalidity-criterion, genvalidity-hspec, hspec, lib, QuickCheck +, random, validity, validity-bytestring +}: +mkDerivation { + pname = "genvalidity-bytestring"; + version = "1.0.0.1"; + src = ./.; + libraryHaskellDepends = [ + base bytestring genvalidity QuickCheck random validity + validity-bytestring + ]; + testHaskellDepends = [ + base bytestring deepseq genvalidity genvalidity-hspec hspec + QuickCheck validity + ]; + benchmarkHaskellDepends = [ + base bytestring criterion genvalidity genvalidity-criterion + QuickCheck + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "GenValidity support for ByteString"; + license = lib.licenses.mit; +} diff --git a/genvalidity-case-insensitive/default.nix b/genvalidity-case-insensitive/default.nix new file mode 100644 index 00000000..d92f119e --- /dev/null +++ b/genvalidity-case-insensitive/default.nix @@ -0,0 +1,22 @@ +{ mkDerivation, base, case-insensitive, criterion, genvalidity +, genvalidity-criterion, genvalidity-hspec, hspec, lib, QuickCheck +, validity-case-insensitive +}: +mkDerivation { + pname = "genvalidity-case-insensitive"; + version = "0.0.0.1"; + src = ./.; + libraryHaskellDepends = [ + base case-insensitive genvalidity validity-case-insensitive + ]; + testHaskellDepends = [ + base case-insensitive genvalidity-hspec hspec + ]; + benchmarkHaskellDepends = [ + base case-insensitive criterion genvalidity genvalidity-criterion + QuickCheck + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "GenValidity support for case-insensitive"; + license = lib.licenses.mit; +} diff --git a/genvalidity-containers/default.nix b/genvalidity-containers/default.nix new file mode 100644 index 00000000..bb3f7871 --- /dev/null +++ b/genvalidity-containers/default.nix @@ -0,0 +1,23 @@ +{ mkDerivation, base, containers, criterion, genvalidity +, genvalidity-criterion, genvalidity-hspec, genvalidity-property +, hspec, lib, QuickCheck, validity, validity-containers +}: +mkDerivation { + pname = "genvalidity-containers"; + version = "1.0.0.1"; + src = ./.; + libraryHaskellDepends = [ + base containers genvalidity QuickCheck validity validity-containers + ]; + testHaskellDepends = [ + base containers genvalidity genvalidity-hspec genvalidity-property + hspec QuickCheck validity validity-containers + ]; + benchmarkHaskellDepends = [ + base containers criterion genvalidity genvalidity-criterion + QuickCheck + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "GenValidity support for containers"; + license = lib.licenses.mit; +} diff --git a/genvalidity-criterion/default.nix b/genvalidity-criterion/default.nix new file mode 100644 index 00000000..4b6840af --- /dev/null +++ b/genvalidity-criterion/default.nix @@ -0,0 +1,17 @@ +{ mkDerivation, base, criterion, deepseq, genvalidity, lib +, QuickCheck, vector +}: +mkDerivation { + pname = "genvalidity-criterion"; + version = "1.1.0.0"; + src = ./.; + libraryHaskellDepends = [ + base criterion deepseq genvalidity QuickCheck vector + ]; + benchmarkHaskellDepends = [ + base criterion genvalidity QuickCheck + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Criterion benchmarks for generators"; + license = lib.licenses.mit; +} diff --git a/genvalidity-hspec-aeson/default.nix b/genvalidity-hspec-aeson/default.nix new file mode 100644 index 00000000..b541eef8 --- /dev/null +++ b/genvalidity-hspec-aeson/default.nix @@ -0,0 +1,21 @@ +{ mkDerivation, aeson, base, bytestring, deepseq, genvalidity +, genvalidity-aeson, genvalidity-hspec, genvalidity-property +, genvalidity-text, hspec, lib, QuickCheck, text, validity +}: +mkDerivation { + pname = "genvalidity-hspec-aeson"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + aeson base bytestring deepseq genvalidity genvalidity-hspec hspec + QuickCheck + ]; + testHaskellDepends = [ + aeson base genvalidity genvalidity-aeson genvalidity-hspec + genvalidity-property genvalidity-text hspec QuickCheck text + validity + ]; + homepage = "http://cs-syd.eu"; + description = "Standard spec's for aeson-related instances"; + license = lib.licenses.mit; +} diff --git a/genvalidity-hspec-aeson/genvalidity-hspec-aeson.cabal b/genvalidity-hspec-aeson/genvalidity-hspec-aeson.cabal index 1d74c170..0a52a550 100644 --- a/genvalidity-hspec-aeson/genvalidity-hspec-aeson.cabal +++ b/genvalidity-hspec-aeson/genvalidity-hspec-aeson.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-hspec-binary/default.nix b/genvalidity-hspec-binary/default.nix new file mode 100644 index 00000000..97ed1b74 --- /dev/null +++ b/genvalidity-hspec-binary/default.nix @@ -0,0 +1,18 @@ +{ mkDerivation, base, binary, deepseq, genvalidity +, genvalidity-hspec, genvalidity-property, hspec, lib, QuickCheck +, validity +}: +mkDerivation { + pname = "genvalidity-hspec-binary"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + base binary deepseq genvalidity genvalidity-hspec hspec QuickCheck + ]; + testHaskellDepends = [ + base binary genvalidity genvalidity-property hspec validity + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Standard spec's for binary-related Instances"; + license = lib.licenses.mit; +} diff --git a/genvalidity-hspec-binary/genvalidity-hspec-binary.cabal b/genvalidity-hspec-binary/genvalidity-hspec-binary.cabal index 9731b113..a4d6109e 100644 --- a/genvalidity-hspec-binary/genvalidity-hspec-binary.cabal +++ b/genvalidity-hspec-binary/genvalidity-hspec-binary.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-hspec-cereal/default.nix b/genvalidity-hspec-cereal/default.nix new file mode 100644 index 00000000..08eced89 --- /dev/null +++ b/genvalidity-hspec-cereal/default.nix @@ -0,0 +1,19 @@ +{ mkDerivation, base, cereal, deepseq, genvalidity +, genvalidity-hspec, genvalidity-property, hspec, lib, QuickCheck +, validity +}: +mkDerivation { + pname = "genvalidity-hspec-cereal"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + base cereal deepseq genvalidity genvalidity-hspec hspec QuickCheck + ]; + testHaskellDepends = [ + base cereal genvalidity genvalidity-property hspec QuickCheck + validity + ]; + homepage = "http://cs-syd.eu"; + description = "Standard spec's for cereal-related instances"; + license = lib.licenses.mit; +} diff --git a/genvalidity-hspec-cereal/genvalidity-hspec-cereal.cabal b/genvalidity-hspec-cereal/genvalidity-hspec-cereal.cabal index c794ca10..7532873c 100644 --- a/genvalidity-hspec-cereal/genvalidity-hspec-cereal.cabal +++ b/genvalidity-hspec-cereal/genvalidity-hspec-cereal.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-hspec-hashable/default.nix b/genvalidity-hspec-hashable/default.nix new file mode 100644 index 00000000..27efafba --- /dev/null +++ b/genvalidity-hspec-hashable/default.nix @@ -0,0 +1,20 @@ +{ mkDerivation, base, genvalidity, genvalidity-hspec +, genvalidity-property, hashable, hspec, hspec-core, lib +, QuickCheck, validity +}: +mkDerivation { + pname = "genvalidity-hspec-hashable"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity genvalidity-hspec genvalidity-property hashable + hspec QuickCheck validity + ]; + testHaskellDepends = [ + base genvalidity genvalidity-hspec genvalidity-property hashable + hspec hspec-core QuickCheck validity + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Standard spec's for Hashable instances"; + license = lib.licenses.mit; +} diff --git a/genvalidity-hspec-hashable/genvalidity-hspec-hashable.cabal b/genvalidity-hspec-hashable/genvalidity-hspec-hashable.cabal index 295dcedc..0b3bb60f 100644 --- a/genvalidity-hspec-hashable/genvalidity-hspec-hashable.cabal +++ b/genvalidity-hspec-hashable/genvalidity-hspec-hashable.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-hspec-optics/default.nix b/genvalidity-hspec-optics/default.nix new file mode 100644 index 00000000..86ff1464 --- /dev/null +++ b/genvalidity-hspec-optics/default.nix @@ -0,0 +1,18 @@ +{ mkDerivation, base, genvalidity, genvalidity-hspec +, genvalidity-property, hspec, lib, microlens, QuickCheck, validity +}: +mkDerivation { + pname = "genvalidity-hspec-optics"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity genvalidity-hspec hspec microlens QuickCheck + ]; + testHaskellDepends = [ + base genvalidity genvalidity-hspec genvalidity-property hspec + microlens validity + ]; + homepage = "http://cs-syd.eu"; + description = "Standard spec's for lens"; + license = lib.licenses.mit; +} diff --git a/genvalidity-hspec-optics/genvalidity-hspec-optics.cabal b/genvalidity-hspec-optics/genvalidity-hspec-optics.cabal index e2b7d959..25a00435 100644 --- a/genvalidity-hspec-optics/genvalidity-hspec-optics.cabal +++ b/genvalidity-hspec-optics/genvalidity-hspec-optics.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-hspec-persistent/default.nix b/genvalidity-hspec-persistent/default.nix new file mode 100644 index 00000000..2f7d4edd --- /dev/null +++ b/genvalidity-hspec-persistent/default.nix @@ -0,0 +1,19 @@ +{ mkDerivation, base, genvalidity, genvalidity-hspec +, genvalidity-property, genvalidity-text, hspec, lib, persistent +, QuickCheck, text, validity +}: +mkDerivation { + pname = "genvalidity-hspec-persistent"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity genvalidity-hspec hspec persistent QuickCheck text + ]; + testHaskellDepends = [ + base genvalidity genvalidity-hspec genvalidity-property + genvalidity-text hspec persistent QuickCheck text validity + ]; + homepage = "http://cs-syd.eu"; + description = "Standard spec's for persistent-related instances"; + license = lib.licenses.mit; +} diff --git a/genvalidity-hspec-persistent/genvalidity-hspec-persistent.cabal b/genvalidity-hspec-persistent/genvalidity-hspec-persistent.cabal index d4fdcd3a..7bf9b746 100644 --- a/genvalidity-hspec-persistent/genvalidity-hspec-persistent.cabal +++ b/genvalidity-hspec-persistent/genvalidity-hspec-persistent.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-hspec/default.nix b/genvalidity-hspec/default.nix new file mode 100644 index 00000000..a14b3334 --- /dev/null +++ b/genvalidity-hspec/default.nix @@ -0,0 +1,18 @@ +{ mkDerivation, base, genvalidity, genvalidity-property, hspec +, hspec-core, lib, QuickCheck, transformers, validity +}: +mkDerivation { + pname = "genvalidity-hspec"; + version = "1.0.0.2"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity genvalidity-property hspec hspec-core QuickCheck + transformers validity + ]; + testHaskellDepends = [ + base genvalidity hspec hspec-core QuickCheck + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Standard spec's for GenValidity instances"; + license = lib.licenses.mit; +} diff --git a/genvalidity-hspec/src/Test/Validity/Applicative.hs b/genvalidity-hspec/src/Test/Validity/Applicative.hs index 2f38b8e5..1c84ed76 100644 --- a/genvalidity-hspec/src/Test/Validity/Applicative.hs +++ b/genvalidity-hspec/src/Test/Validity/Applicative.hs @@ -17,6 +17,7 @@ where import Data.Data import Data.GenValidity import Data.Kind +import GHC.Stack import Test.Hspec import Test.QuickCheck import Test.Validity.Functions @@ -93,14 +94,15 @@ seqlTypeStr = -- > applicativeSpecOnArbitrary @[] applicativeSpec :: forall (f :: Type -> Type). - ( Eq (f Int), + ( HasCallStack, + Eq (f Int), Show (f Int), Applicative f, Typeable f, GenValid (f Int) ) => Spec -applicativeSpec = applicativeSpecWithInts @f genValid +applicativeSpec = withFrozenCallStack $ applicativeSpecWithInts @f genValid -- | Standard test spec for properties of Applicative instances for values generated with Arbitrary instances -- @@ -109,31 +111,38 @@ applicativeSpec = applicativeSpecWithInts @f genValid -- > applicativeSpecOnArbitrary @[] applicativeSpecOnArbitrary :: forall (f :: Type -> Type). - (Eq (f Int), Show (f Int), Applicative f, Typeable f, Arbitrary (f Int)) => + ( HasCallStack, + Eq (f Int), + Show (f Int), + Applicative f, + Typeable f, + Arbitrary (f Int) + ) => Spec -applicativeSpecOnArbitrary = applicativeSpecWithInts @f arbitrary +applicativeSpecOnArbitrary = withFrozenCallStack $ applicativeSpecWithInts @f arbitrary applicativeSpecWithInts :: forall (f :: Type -> Type). - (Show (f Int), Eq (f Int), Applicative f, Typeable f) => + (HasCallStack, Show (f Int), Eq (f Int), Applicative f, Typeable f) => Gen (f Int) -> Spec applicativeSpecWithInts gen = - applicativeSpecOnGens - @f - @Int - genValid - "int" - gen - (unwords [nameOf @f, "of ints"]) - gen - (unwords [nameOf @f, "of ints"]) - ((+) <$> genValid) - "increments" - (pure <$> ((+) <$> genValid)) - (unwords [nameOf @f, "of increments"]) - (pure <$> ((*) <$> genValid)) - (unwords [nameOf @f, "of scalings"]) + withFrozenCallStack $ + applicativeSpecOnGens + @f + @Int + genValid + "int" + gen + (unwords [nameOf @f, "of ints"]) + gen + (unwords [nameOf @f, "of ints"]) + ((+) <$> genValid) + "increments" + (pure <$> ((+) <$> genValid)) + (unwords [nameOf @f, "of increments"]) + (pure <$> ((*) <$> genValid)) + (unwords [nameOf @f, "of scalings"]) -- | Standard test spec for properties of Applicative instances for values generated by given generators (and names for those generator). -- @@ -158,7 +167,8 @@ applicativeSpecWithInts gen = -- > "appends in a Just" applicativeSpecOnGens :: forall (f :: Type -> Type) (a :: Type) (b :: Type) (c :: Type). - ( Show a, + ( HasCallStack, + Show a, Show (f a), Eq (f a), Show (f b), @@ -185,99 +195,100 @@ applicativeSpecOnGens :: String -> Spec applicativeSpecOnGens gena genaname gen genname genb genbname genfa genfaname genffa genffaname genffb genffbname = - parallel $ - describe ("Applicative " ++ nameOf @f) $ do - describe (unwords [pureTypeStr @f, "and", seqTypeStr @f]) $ do - it - ( unwords - [ "satisfy the identity law: 'pure id <*> v = v' for", - genDescr @(f a) genname - ] - ) - $ equivalentOnGen (pure id <*>) id gen shrinkNothing - it - ( unwords - [ "satisfy the composition law: 'pure (.) <*> u <*> v <*> w = u <*> (v <*> w)' for", - genDescr @(f (b -> c)) genffbname, - "composed with", - genDescr @(f (a -> b)) genffaname, - "and applied to", - genDescr @(f a) genname - ] - ) - $ equivalentOnGens3 - ( \(Anon u) (Anon v) w -> - pure (.) <*> (u :: f (b -> c)) <*> (v :: f (a -> b)) - <*> (w :: f a) :: - f c + withFrozenCallStack $ + parallel $ + describe ("Applicative " ++ nameOf @f) $ do + describe (unwords [pureTypeStr @f, "and", seqTypeStr @f]) $ do + it + ( unwords + [ "satisfy the identity law: 'pure id <*> v = v' for", + genDescr @(f a) genname + ] + ) + $ equivalentOnGen (pure id <*>) id gen shrinkNothing + it + ( unwords + [ "satisfy the composition law: 'pure (.) <*> u <*> v <*> w = u <*> (v <*> w)' for", + genDescr @(f (b -> c)) genffbname, + "composed with", + genDescr @(f (a -> b)) genffaname, + "and applied to", + genDescr @(f a) genname + ] + ) + $ equivalentOnGens3 + ( \(Anon u) (Anon v) w -> + pure (.) <*> (u :: f (b -> c)) <*> (v :: f (a -> b)) + <*> (w :: f a) :: + f c + ) + (\(Anon u) (Anon v) w -> u <*> (v <*> w) :: f c) + ((,,) <$> (Anon <$> genffb) <*> (Anon <$> genffa) <*> gen) + shrinkNothing + it + ( unwords + [ "satisfy the homomorphism law: 'pure f <*> pure x = pure (f x)' for", + genDescr @(a -> b) genfaname, + "sequenced with", + genDescr @a genaname + ] + ) + $ equivalentOnGens2 + (\(Anon f) x -> pure f <*> pure x :: f b) + (\(Anon f) x -> pure $ f x :: f b) + ((,) <$> (Anon <$> genfa) <*> gena) + shrinkNothing + it + ( unwords + [ "satisfy the interchange law: 'u <*> pure y = pure ($ y) <*> u' for", + genDescr @(f (a -> b)) genffaname, + "sequenced with", + genDescr @a genaname + ] + ) + $ equivalentOnGens2 + (\(Anon u) y -> u <*> pure y :: f b) + (\(Anon u) y -> pure ($ y) <*> u :: f b) + ((,) <$> (Anon <$> genffa) <*> gena) + shrinkNothing + it + ( unwords + [ "satisfy the law about the functor instance: fmap f x = pure f <*> x for", + genDescr @(a -> b) genfaname, + "mapped over", + genDescr @(f a) genname + ] + ) + $ equivalentOnGens2 + (\(Anon f) x -> fmap f x) + (\(Anon f) x -> pure f <*> x) + ((,) <$> (Anon <$> genfa) <*> gen) + shrinkNothing + describe (seqrTypeStr @f) $ + it + ( unwords + [ "is equivalent to its default implementation 'u Type> v = pure (const id) <*> u <*> v' for", + genDescr @(f a) genname, + "in front of", + genDescr @b genbname + ] + ) + $ equivalentOnGens2 + (\u v -> u *> v) + (\u v -> pure (const id) <*> u <*> v) + ((,) <$> gen <*> genb) + shrinkNothing + describe (seqlTypeStr @f) $ + it + ( unwords + [ "is equivalent to its default implementation 'u <* v = pure const <*> u <*> v' for", + genDescr @b genbname, + "behind", + genDescr @(f a) genname + ] ) - (\(Anon u) (Anon v) w -> u <*> (v <*> w) :: f c) - ((,,) <$> (Anon <$> genffb) <*> (Anon <$> genffa) <*> gen) - shrinkNothing - it - ( unwords - [ "satisfy the homomorphism law: 'pure f <*> pure x = pure (f x)' for", - genDescr @(a -> b) genfaname, - "sequenced with", - genDescr @a genaname - ] - ) - $ equivalentOnGens2 - (\(Anon f) x -> pure f <*> pure x :: f b) - (\(Anon f) x -> pure $ f x :: f b) - ((,) <$> (Anon <$> genfa) <*> gena) - shrinkNothing - it - ( unwords - [ "satisfy the interchange law: 'u <*> pure y = pure ($ y) <*> u' for", - genDescr @(f (a -> b)) genffaname, - "sequenced with", - genDescr @a genaname - ] - ) - $ equivalentOnGens2 - (\(Anon u) y -> u <*> pure y :: f b) - (\(Anon u) y -> pure ($ y) <*> u :: f b) - ((,) <$> (Anon <$> genffa) <*> gena) - shrinkNothing - it - ( unwords - [ "satisfy the law about the functor instance: fmap f x = pure f <*> x for", - genDescr @(a -> b) genfaname, - "mapped over", - genDescr @(f a) genname - ] - ) - $ equivalentOnGens2 - (\(Anon f) x -> fmap f x) - (\(Anon f) x -> pure f <*> x) - ((,) <$> (Anon <$> genfa) <*> gen) - shrinkNothing - describe (seqrTypeStr @f) $ - it - ( unwords - [ "is equivalent to its default implementation 'u Type> v = pure (const id) <*> u <*> v' for", - genDescr @(f a) genname, - "in front of", - genDescr @b genbname - ] - ) - $ equivalentOnGens2 - (\u v -> u *> v) - (\u v -> pure (const id) <*> u <*> v) - ((,) <$> gen <*> genb) - shrinkNothing - describe (seqlTypeStr @f) $ - it - ( unwords - [ "is equivalent to its default implementation 'u <* v = pure const <*> u <*> v' for", - genDescr @b genbname, - "behind", - genDescr @(f a) genname - ] - ) - $ equivalentOnGens2 - (\u v -> u <* v) - (\u v -> pure const <*> u <*> v) - ((,) <$> gen <*> genb) - shrinkNothing + $ equivalentOnGens2 + (\u v -> u <* v) + (\u v -> pure const <*> u <*> v) + ((,) <$> gen <*> genb) + shrinkNothing diff --git a/genvalidity-hspec/src/Test/Validity/Utils.hs b/genvalidity-hspec/src/Test/Validity/Utils.hs index d9ddbb9a..4e8c1761 100644 --- a/genvalidity-hspec/src/Test/Validity/Utils.hs +++ b/genvalidity-hspec/src/Test/Validity/Utils.hs @@ -69,6 +69,7 @@ instance Functor Anon where -- but it has been copied here for convenience. -- https://github.com/hspec/hspec/commit/020c7ecc4a73c24af38e9fab049f60bb9aec6981#diff-29cb22f0ef6e98086a71fc045847bd21L22 mapSpecTree' :: (SpecTree a -> SpecTree b) -> SpecM a r -> SpecM b r + #if MIN_VERSION_hspec(2,10,0) mapSpecTree' f (SpecM specs) = SpecM (mapWriterT (fmap (second (fmap (map f)))) specs) #else diff --git a/genvalidity-network-uri/default.nix b/genvalidity-network-uri/default.nix new file mode 100644 index 00000000..7376a306 --- /dev/null +++ b/genvalidity-network-uri/default.nix @@ -0,0 +1,25 @@ +{ mkDerivation, base, criterion, genvalidity, genvalidity-criterion +, genvalidity-sydtest, iproute, lib, network-uri, QuickCheck +, sydtest, sydtest-discover, validity, validity-network-uri +}: +mkDerivation { + pname = "genvalidity-network-uri"; + version = "0.1.0.0"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity iproute network-uri QuickCheck validity + validity-network-uri + ]; + testHaskellDepends = [ + base genvalidity genvalidity-sydtest network-uri QuickCheck sydtest + validity-network-uri + ]; + testToolDepends = [ sydtest-discover ]; + benchmarkHaskellDepends = [ + base criterion genvalidity genvalidity-criterion network-uri + QuickCheck + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "GenValidity support for URI"; + license = lib.licenses.mit; +} diff --git a/genvalidity-path/default.nix b/genvalidity-path/default.nix new file mode 100644 index 00000000..ba7a84ff --- /dev/null +++ b/genvalidity-path/default.nix @@ -0,0 +1,18 @@ +{ mkDerivation, base, criterion, genvalidity, genvalidity-criterion +, genvalidity-hspec, hspec, lib, path, QuickCheck, validity-path +}: +mkDerivation { + pname = "genvalidity-path"; + version = "1.0.0.1"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity path QuickCheck validity-path + ]; + testHaskellDepends = [ base genvalidity-hspec hspec path ]; + benchmarkHaskellDepends = [ + base criterion genvalidity genvalidity-criterion path QuickCheck + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "GenValidity support for Path"; + license = lib.licenses.mit; +} diff --git a/genvalidity-persistent/default.nix b/genvalidity-persistent/default.nix new file mode 100644 index 00000000..7dbee489 --- /dev/null +++ b/genvalidity-persistent/default.nix @@ -0,0 +1,25 @@ +{ mkDerivation, base, containers, criterion, deepseq, genvalidity +, genvalidity-containers, genvalidity-criterion, genvalidity-hspec +, hspec, lib, persistent, persistent-template, QuickCheck +, validity-containers, validity-persistent +}: +mkDerivation { + pname = "genvalidity-persistent"; + version = "1.0.0.1"; + src = ./.; + libraryHaskellDepends = [ + base containers genvalidity genvalidity-containers persistent + QuickCheck validity-containers validity-persistent + ]; + testHaskellDepends = [ + base genvalidity genvalidity-hspec hspec persistent + persistent-template QuickCheck validity-containers + ]; + benchmarkHaskellDepends = [ + base criterion deepseq genvalidity genvalidity-criterion persistent + persistent-template + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "GenValidity support for Persistent"; + license = lib.licenses.mit; +} diff --git a/genvalidity-property/default.nix b/genvalidity-property/default.nix new file mode 100644 index 00000000..aa07a0b2 --- /dev/null +++ b/genvalidity-property/default.nix @@ -0,0 +1,15 @@ +{ mkDerivation, base, genvalidity, hspec, lib, pretty-show +, QuickCheck, validity +}: +mkDerivation { + pname = "genvalidity-property"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity hspec pretty-show QuickCheck validity + ]; + testHaskellDepends = [ base genvalidity hspec QuickCheck ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Standard properties for functions on `Validity` types"; + license = lib.licenses.mit; +} diff --git a/genvalidity-property/genvalidity-property.cabal b/genvalidity-property/genvalidity-property.cabal index ee4168d6..ad212b66 100644 --- a/genvalidity-property/genvalidity-property.cabal +++ b/genvalidity-property/genvalidity-property.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-scientific/default.nix b/genvalidity-scientific/default.nix new file mode 100644 index 00000000..061aa66f --- /dev/null +++ b/genvalidity-scientific/default.nix @@ -0,0 +1,17 @@ +{ mkDerivation, base, genvalidity, genvalidity-hspec, hspec, lib +, QuickCheck, scientific, validity, validity-scientific +}: +mkDerivation { + pname = "genvalidity-scientific"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity QuickCheck scientific validity validity-scientific + ]; + testHaskellDepends = [ + base genvalidity genvalidity-hspec hspec QuickCheck scientific + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "GenValidity support for Scientific"; + license = lib.licenses.mit; +} diff --git a/genvalidity-scientific/genvalidity-scientific.cabal b/genvalidity-scientific/genvalidity-scientific.cabal index 7c76a0fe..3f1fd314 100644 --- a/genvalidity-scientific/genvalidity-scientific.cabal +++ b/genvalidity-scientific/genvalidity-scientific.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-sydtest-aeson/default.nix b/genvalidity-sydtest-aeson/default.nix new file mode 100644 index 00000000..9e4c17de --- /dev/null +++ b/genvalidity-sydtest-aeson/default.nix @@ -0,0 +1,21 @@ +{ mkDerivation, aeson, base, bytestring, deepseq, genvalidity +, genvalidity-aeson, genvalidity-sydtest, genvalidity-text, lib +, QuickCheck, sydtest, sydtest-discover, text, validity +}: +mkDerivation { + pname = "genvalidity-sydtest-aeson"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + aeson base bytestring deepseq genvalidity genvalidity-sydtest + QuickCheck sydtest + ]; + testHaskellDepends = [ + aeson base genvalidity genvalidity-aeson genvalidity-sydtest + genvalidity-text QuickCheck sydtest text validity + ]; + testToolDepends = [ sydtest-discover ]; + homepage = "http://cs-syd.eu"; + description = "Standard spec's for aeson-related instances in sydtest"; + license = lib.licenses.mit; +} diff --git a/genvalidity-sydtest-aeson/genvalidity-sydtest-aeson.cabal b/genvalidity-sydtest-aeson/genvalidity-sydtest-aeson.cabal index 5b047dba..330d19d0 100644 --- a/genvalidity-sydtest-aeson/genvalidity-sydtest-aeson.cabal +++ b/genvalidity-sydtest-aeson/genvalidity-sydtest-aeson.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-sydtest-hashable/default.nix b/genvalidity-sydtest-hashable/default.nix new file mode 100644 index 00000000..a0203038 --- /dev/null +++ b/genvalidity-sydtest-hashable/default.nix @@ -0,0 +1,20 @@ +{ mkDerivation, base, genvalidity, genvalidity-sydtest, hashable +, lib, QuickCheck, sydtest, sydtest-discover, validity +}: +mkDerivation { + pname = "genvalidity-sydtest-hashable"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity genvalidity-sydtest hashable QuickCheck sydtest + validity + ]; + testHaskellDepends = [ + base genvalidity genvalidity-sydtest hashable QuickCheck sydtest + validity + ]; + testToolDepends = [ sydtest-discover ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Standard spec's for Hashable instances for sydtest"; + license = lib.licenses.mit; +} diff --git a/genvalidity-sydtest-hashable/genvalidity-sydtest-hashable.cabal b/genvalidity-sydtest-hashable/genvalidity-sydtest-hashable.cabal index 4250b8f8..68410045 100644 --- a/genvalidity-sydtest-hashable/genvalidity-sydtest-hashable.cabal +++ b/genvalidity-sydtest-hashable/genvalidity-sydtest-hashable.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-sydtest-lens/default.nix b/genvalidity-sydtest-lens/default.nix new file mode 100644 index 00000000..d5acccb2 --- /dev/null +++ b/genvalidity-sydtest-lens/default.nix @@ -0,0 +1,18 @@ +{ mkDerivation, base, genvalidity, genvalidity-sydtest, lib +, microlens, QuickCheck, sydtest, sydtest-discover, validity +}: +mkDerivation { + pname = "genvalidity-sydtest-lens"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity genvalidity-sydtest microlens QuickCheck sydtest + ]; + testHaskellDepends = [ + base genvalidity genvalidity-sydtest microlens sydtest validity + ]; + testToolDepends = [ sydtest-discover ]; + homepage = "http://cs-syd.eu"; + description = "Standard spec's for lens for sydtest"; + license = lib.licenses.mit; +} diff --git a/genvalidity-sydtest-lens/genvalidity-sydtest-lens.cabal b/genvalidity-sydtest-lens/genvalidity-sydtest-lens.cabal index 5fe821d6..ea370c8c 100644 --- a/genvalidity-sydtest-lens/genvalidity-sydtest-lens.cabal +++ b/genvalidity-sydtest-lens/genvalidity-sydtest-lens.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-sydtest-persistent/default.nix b/genvalidity-sydtest-persistent/default.nix new file mode 100644 index 00000000..2c43ef2b --- /dev/null +++ b/genvalidity-sydtest-persistent/default.nix @@ -0,0 +1,21 @@ +{ mkDerivation, base, genvalidity, genvalidity-sydtest +, genvalidity-text, lib, persistent, QuickCheck, sydtest +, sydtest-discover, text, validity +}: +mkDerivation { + pname = "genvalidity-sydtest-persistent"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity genvalidity-sydtest persistent QuickCheck sydtest + text + ]; + testHaskellDepends = [ + base genvalidity genvalidity-sydtest genvalidity-text persistent + QuickCheck sydtest text validity + ]; + testToolDepends = [ sydtest-discover ]; + homepage = "http://cs-syd.eu"; + description = "Standard spec's for persistent-related instances for sydtest"; + license = lib.licenses.mit; +} diff --git a/genvalidity-sydtest-persistent/genvalidity-sydtest-persistent.cabal b/genvalidity-sydtest-persistent/genvalidity-sydtest-persistent.cabal index c1add853..8451dbb5 100644 --- a/genvalidity-sydtest-persistent/genvalidity-sydtest-persistent.cabal +++ b/genvalidity-sydtest-persistent/genvalidity-sydtest-persistent.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-sydtest/default.nix b/genvalidity-sydtest/default.nix new file mode 100644 index 00000000..06f20b90 --- /dev/null +++ b/genvalidity-sydtest/default.nix @@ -0,0 +1,16 @@ +{ mkDerivation, base, genvalidity, lib, pretty-show, QuickCheck +, sydtest, sydtest-discover, validity +}: +mkDerivation { + pname = "genvalidity-sydtest"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity pretty-show QuickCheck sydtest validity + ]; + testHaskellDepends = [ base genvalidity QuickCheck sydtest ]; + testToolDepends = [ sydtest-discover ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Standard properties for functions on `Validity` types for the sydtest framework"; + license = lib.licenses.mit; +} diff --git a/genvalidity-sydtest/genvalidity-sydtest.cabal b/genvalidity-sydtest/genvalidity-sydtest.cabal index c2e7914f..f6dbf54c 100644 --- a/genvalidity-sydtest/genvalidity-sydtest.cabal +++ b/genvalidity-sydtest/genvalidity-sydtest.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-text/default.nix b/genvalidity-text/default.nix new file mode 100644 index 00000000..73ba6cef --- /dev/null +++ b/genvalidity-text/default.nix @@ -0,0 +1,22 @@ +{ mkDerivation, array, base, criterion, genvalidity +, genvalidity-criterion, genvalidity-hspec, hspec, lib, QuickCheck +, random, text, validity, validity-text +}: +mkDerivation { + pname = "genvalidity-text"; + version = "1.0.0.1"; + src = ./.; + libraryHaskellDepends = [ + array base genvalidity QuickCheck random text validity + validity-text + ]; + testHaskellDepends = [ + base genvalidity genvalidity-hspec hspec QuickCheck text + ]; + benchmarkHaskellDepends = [ + base criterion genvalidity genvalidity-criterion QuickCheck text + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "GenValidity support for Text"; + license = lib.licenses.mit; +} diff --git a/genvalidity-time/default.nix b/genvalidity-time/default.nix new file mode 100644 index 00000000..6bb72788 --- /dev/null +++ b/genvalidity-time/default.nix @@ -0,0 +1,18 @@ +{ mkDerivation, base, criterion, genvalidity, genvalidity-criterion +, genvalidity-hspec, hspec, lib, QuickCheck, time, validity-time +}: +mkDerivation { + pname = "genvalidity-time"; + version = "1.0.0.1"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity QuickCheck time validity-time + ]; + testHaskellDepends = [ base genvalidity-hspec hspec time ]; + benchmarkHaskellDepends = [ + base criterion genvalidity-criterion time + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "GenValidity support for time"; + license = lib.licenses.mit; +} diff --git a/genvalidity-unordered-containers/default.nix b/genvalidity-unordered-containers/default.nix new file mode 100644 index 00000000..9e94956e --- /dev/null +++ b/genvalidity-unordered-containers/default.nix @@ -0,0 +1,20 @@ +{ mkDerivation, base, genvalidity, genvalidity-hspec, hashable +, hspec, lib, QuickCheck, unordered-containers, validity +, validity-unordered-containers +}: +mkDerivation { + pname = "genvalidity-unordered-containers"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity hashable QuickCheck unordered-containers validity + validity-unordered-containers + ]; + testHaskellDepends = [ + base genvalidity genvalidity-hspec hspec unordered-containers + validity + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "GenValidity support for unordered-containers"; + license = lib.licenses.mit; +} diff --git a/genvalidity-unordered-containers/genvalidity-unordered-containers.cabal b/genvalidity-unordered-containers/genvalidity-unordered-containers.cabal index 05a0e411..9dcf65d9 100644 --- a/genvalidity-unordered-containers/genvalidity-unordered-containers.cabal +++ b/genvalidity-unordered-containers/genvalidity-unordered-containers.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity-uuid/default.nix b/genvalidity-uuid/default.nix new file mode 100644 index 00000000..d3b387cb --- /dev/null +++ b/genvalidity-uuid/default.nix @@ -0,0 +1,21 @@ +{ mkDerivation, base, criterion, genvalidity, genvalidity-criterion +, genvalidity-hspec, hspec, lib, QuickCheck, uuid, validity +, validity-uuid +}: +mkDerivation { + pname = "genvalidity-uuid"; + version = "1.0.0.1"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity QuickCheck uuid validity validity-uuid + ]; + testHaskellDepends = [ + base genvalidity genvalidity-hspec hspec QuickCheck uuid + ]; + benchmarkHaskellDepends = [ + base criterion genvalidity genvalidity-criterion QuickCheck uuid + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "GenValidity support for UUID"; + license = lib.licenses.mit; +} diff --git a/genvalidity-vector/default.nix b/genvalidity-vector/default.nix new file mode 100644 index 00000000..33ddef2f --- /dev/null +++ b/genvalidity-vector/default.nix @@ -0,0 +1,17 @@ +{ mkDerivation, base, genvalidity, genvalidity-hspec, hspec, lib +, QuickCheck, validity, validity-vector, vector +}: +mkDerivation { + pname = "genvalidity-vector"; + version = "1.0.0.0"; + src = ./.; + libraryHaskellDepends = [ + base genvalidity QuickCheck validity validity-vector vector + ]; + testHaskellDepends = [ + base genvalidity genvalidity-hspec hspec vector + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "GenValidity support for vector"; + license = lib.licenses.mit; +} diff --git a/genvalidity-vector/genvalidity-vector.cabal b/genvalidity-vector/genvalidity-vector.cabal index 2f7d43a8..ce3e6738 100644 --- a/genvalidity-vector/genvalidity-vector.cabal +++ b/genvalidity-vector/genvalidity-vector.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/genvalidity/default.nix b/genvalidity/default.nix new file mode 100644 index 00000000..07ef5923 --- /dev/null +++ b/genvalidity/default.nix @@ -0,0 +1,13 @@ +{ mkDerivation, base, hspec, hspec-core, lib, QuickCheck, random +, validity +}: +mkDerivation { + pname = "genvalidity"; + version = "1.1.0.0"; + src = ./.; + libraryHaskellDepends = [ base QuickCheck random validity ]; + testHaskellDepends = [ base hspec hspec-core QuickCheck ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Testing utilities for the validity library"; + license = lib.licenses.mit; +} diff --git a/nix/overlay.nix b/nix/overlay.nix index 26801da0..d2b13632 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -1,67 +1,71 @@ -final: -previous: +final: prev: +with final.lib; with final.haskell.lib; { - validityPackages = - let validityPkg = name: - doBenchmark (buildStrictly (final.haskellPackages.callCabal2nixWithOptions name (final.gitignoreSource (../. + "/${name}")) "--no-hpack" { })); - in - final.lib.genAttrs [ - "genvalidity" - "genvalidity-aeson" - "genvalidity-bytestring" - "genvalidity-case-insensitive" - "genvalidity-containers" - "genvalidity-criterion" - "genvalidity-hspec" - "genvalidity-hspec-aeson" - "genvalidity-hspec-binary" - "genvalidity-hspec-cereal" - "genvalidity-hspec-hashable" - "genvalidity-hspec-optics" - "genvalidity-hspec-persistent" - "genvalidity-network-uri" - "genvalidity-path" - "genvalidity-persistent" - "genvalidity-property" - "genvalidity-scientific" - "genvalidity-sydtest" - "genvalidity-sydtest-aeson" - "genvalidity-sydtest-lens" - "genvalidity-sydtest-persistent" - "genvalidity-text" - "genvalidity-time" - "genvalidity-unordered-containers" - "genvalidity-uuid" - "genvalidity-vector" - "validity" - "validity-aeson" - "validity-bytestring" - "validity-case-insensitive" - "validity-containers" - "validity-network-uri" - "validity-path" - "validity-persistent" - "validity-primitive" - "validity-scientific" - "validity-text" - "validity-time" - "validity-unordered-containers" - "validity-uuid" - "validity-vector" - ] - validityPkg; - validityRelease = - final.symlinkJoin { - name = "validity-release"; - paths = final.lib.attrValues final.validityPackages; - }; + haskellPackages = prev.haskellPackages.override (old: { + overrides = final.lib.composeExtensions (old.overrides or (_: _: { })) + ( + self: super: + let + validityPkg = name: + doBenchmark (buildStrictly (self.callPackage (../${name}/default.nix) { })); + validityPackages = + final.lib.genAttrs [ + "genvalidity" + "genvalidity-aeson" + "genvalidity-bytestring" + "genvalidity-case-insensitive" + "genvalidity-containers" + "genvalidity-criterion" + "genvalidity-hspec" + "genvalidity-hspec-aeson" + "genvalidity-hspec-binary" + "genvalidity-hspec-cereal" + "genvalidity-hspec-hashable" + "genvalidity-hspec-optics" + "genvalidity-hspec-persistent" + "genvalidity-network-uri" + "genvalidity-path" + "genvalidity-persistent" + "genvalidity-property" + "genvalidity-scientific" + "genvalidity-sydtest" + "genvalidity-sydtest-aeson" + "genvalidity-sydtest-lens" + "genvalidity-sydtest-persistent" + "genvalidity-text" + "genvalidity-time" + "genvalidity-unordered-containers" + "genvalidity-uuid" + "genvalidity-vector" + "validity" + "validity-aeson" + "validity-bytestring" + "validity-case-insensitive" + "validity-containers" + "validity-network-uri" + "validity-path" + "validity-persistent" + "validity-primitive" + "validity-scientific" + "validity-text" + "validity-time" + "validity-unordered-containers" + "validity-uuid" + "validity-vector" + ] + validityPkg; + in + { + inherit validityPackages; - haskellPackages = previous.haskellPackages.override (old: { - overrides = final.lib.composeExtensions (old.overrides or (_: _: { })) ( - self: super: - final.validityPackages - ); + validityRelease = + final.symlinkJoin { + name = "validity-release"; + paths = final.lib.attrValues self.validityPackages; + }; + } // validityPackages + ); }); } diff --git a/nix/pkgs.nix b/nix/pkgs.nix deleted file mode 100644 index 6a2a9931..00000000 --- a/nix/pkgs.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ sources ? import ./sources.nix -, nixpkgs ? sources.nixpkgs -, system ? builtins.currentSystem -}: -let - pkgs = - import nixpkgs { - inherit system; - overlays = [ - (final: previous: { inherit (import sources.gitignore { inherit (final) lib; }) gitignoreSource; }) - (import (sources.autodocodec + "/nix/overlay.nix")) - (import (sources.safe-coloured-text + "/nix/overlay.nix")) - (import (sources.sydtest + "/nix/overlay.nix")) - (import ./overlay.nix) - ]; - config.allowUnfree = true; - }; -in -pkgs diff --git a/nix/pre-commit.nix b/nix/pre-commit.nix deleted file mode 100644 index a5ad66a3..00000000 --- a/nix/pre-commit.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ sources ? import ./sources.nix }: -let - pre-commit-hooks = import sources.pre-commit-hooks; -in -{ - run = pre-commit-hooks.run { - src = ../.; - hooks = { - hlint.enable = true; - hpack.enable = true; - nixpkgs-fmt.enable = true; - ormolu.enable = true; - }; - }; - tools = with pre-commit-hooks; [ - hlint - hpack - nixpkgs-fmt - ormolu - ]; -} diff --git a/nix/sources.json b/nix/sources.json deleted file mode 100644 index bd540d01..00000000 --- a/nix/sources.json +++ /dev/null @@ -1,122 +0,0 @@ -{ - "autodocodec": { - "branch": "master", - "description": "self(auto)- documenting encoders and decoders", - "homepage": "", - "owner": "NorfairKing", - "repo": "autodocodec", - "rev": "98135d2b24c4c52f56f53c6650a169aeec61c7f1", - "sha256": "0srbn65343a213690samf7pf2q0kvnngpv6wn0srm57dpv0f68hn", - "type": "tarball", - "url": "https://github.com/NorfairKing/autodocodec/archive/98135d2b24c4c52f56f53c6650a169aeec61c7f1.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "gitignore": { - "branch": "master", - "description": "Nix function for filtering local git sources", - "homepage": "", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", - "sha256": "07vg2i9va38zbld9abs9lzqblz193vc5wvqd6h7amkmwf66ljcgh", - "type": "tarball", - "url": "https://github.com/hercules-ci/gitignore.nix/archive/a20de23b925fd8264fd7fad6454652e142fd7f73.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "niv": { - "branch": "master", - "description": "Easy dependency management for Nix projects", - "homepage": "https://github.com/nmattia/niv", - "owner": "nmattia", - "repo": "niv", - "rev": "82e5cd1ad3c387863f0545d7591512e76ab0fc41", - "sha256": "090l219mzc0gi33i3psgph6s2pwsc8qy4lyrqjdj4qzkvmaj65a7", - "type": "tarball", - "url": "https://github.com/nmattia/niv/archive/82e5cd1ad3c387863f0545d7591512e76ab0fc41.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "nixpkgs": { - "branch": "nixos-22.05", - "description": "Nix Packages collection", - "homepage": "", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "16236dd7e33ba4579ccd3ca8349396b2f9c960fe", - "sha256": "0iafk97iamv1f47m2cdjh6gq2n8l4fljrznfzgjf22y9wk7vx5im", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/16236dd7e33ba4579ccd3ca8349396b2f9c960fe.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "nixpkgs-21_05": { - "branch": "nixos-21.05", - "description": "Nix Packages collection", - "homepage": "", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf", - "sha256": "12q00nbd7fb812zchbcnmdg3pw45qhxm74hgpjmshc2dfmgkjh4n", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/022caabb5f2265ad4006c1fa5b1ebe69fb0c3faf.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "nixpkgs-21_11": { - "branch": "nixos-21.11", - "description": "Nix Packages collection", - "homepage": "", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "eabc38219184cc3e04a974fe31857d8e0eac098d", - "sha256": "04ffwp2gzq0hhz7siskw6qh9ys8ragp7285vi1zh8xjksxn1msc5", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/eabc38219184cc3e04a974fe31857d8e0eac098d.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "nixpkgs-22_05": { - "branch": "nixos-22.05", - "description": "Nix Packages collection", - "homepage": "", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "16236dd7e33ba4579ccd3ca8349396b2f9c960fe", - "sha256": "0iafk97iamv1f47m2cdjh6gq2n8l4fljrznfzgjf22y9wk7vx5im", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/16236dd7e33ba4579ccd3ca8349396b2f9c960fe.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "pre-commit-hooks": { - "branch": "master", - "description": "Seamless integration of https://pre-commit.com git hooks with Nix.", - "homepage": "", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "8cb8ea5f1c7bc2984f460587fddd5f2e558f6eb8", - "sha256": "0ll3dbqbsj6cawvjj66c1h8635qwbrhp8i34lzhbc2rnmzfp2j0x", - "type": "tarball", - "url": "https://github.com/cachix/pre-commit-hooks.nix/archive/8cb8ea5f1c7bc2984f460587fddd5f2e558f6eb8.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "safe-coloured-text": { - "branch": "master", - "description": null, - "homepage": "https://cs-syd.eu/posts/2021-03-07-safe-coloured-text", - "owner": "NorfairKing", - "repo": "safe-coloured-text", - "rev": "675cb01fce5f46718416d7746de5b856ed90a63f", - "sha256": "18lf28k51f24smkyba0dfv1hqz3jxfqr81w70zjvbw77z5q0vxf6", - "type": "tarball", - "url": "https://github.com/NorfairKing/safe-coloured-text/archive/675cb01fce5f46718416d7746de5b856ed90a63f.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "sydtest": { - "branch": "master", - "description": "A modern testing framework for Haskell with good defaults and advanced testing features.", - "homepage": "", - "owner": "NorfairKing", - "repo": "sydtest", - "rev": "9db39de44641f28a2c26de80fcfe08616fcf3054", - "sha256": "1zxd0iswsynasw8d4zqri3dzns9sk4x1hrrl602agkd5dblmgq43", - "type": "tarball", - "url": "https://github.com/NorfairKing/sydtest/archive/9db39de44641f28a2c26de80fcfe08616fcf3054.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - } -} diff --git a/nix/sources.nix b/nix/sources.nix deleted file mode 100644 index 7c6186d8..00000000 --- a/nix/sources.nix +++ /dev/null @@ -1,179 +0,0 @@ -# This file has been generated by Niv. - -let - - # - # The fetchers. fetch_ fetches specs of type . - # - - fetch_file = pkgs: name: spec: - let - name' = sanitizeName name + "-src"; - in - if spec.builtin or true then - builtins_fetchurl { inherit (spec) url sha256; name = name'; } - else - pkgs.fetchurl { inherit (spec) url sha256; name = name'; }; - - fetch_tarball = pkgs: name: spec: - let - name' = sanitizeName name + "-src"; - in - if spec.builtin or true then - builtins_fetchTarball { name = name'; inherit (spec) url sha256; } - else - pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; - - fetch_git = name: spec: - let - ref = - if spec ? ref then spec.ref else - if spec ? branch then "refs/heads/${spec.branch}" else - if spec ? tag then "refs/tags/${spec.tag}" else - abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"; - submodules = if spec ? submodules then spec.submodules else false; - in - builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; } - // (if builtins.compareVersions builtins.nixVersion "2.4" >= 0 then { inherit submodules; } else { }); - - fetch_local = spec: spec.path; - - fetch_builtin-tarball = name: throw - ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`. - $ niv modify ${name} -a type=tarball -a builtin=true''; - - fetch_builtin-url = name: throw - ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`. - $ niv modify ${name} -a type=file -a builtin=true''; - - # - # Various helpers - # - - # https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695 - sanitizeName = name: - ( - concatMapStrings (s: if builtins.isList s then "-" else s) - ( - builtins.split "[^[:alnum:]+._?=-]+" - ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name) - ) - ); - - # The set of packages used when specs are fetched using non-builtins. - mkPkgs = sources: system: - let - sourcesNixpkgs = - import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; }; - hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; - hasThisAsNixpkgsPath = == ./.; - in - if builtins.hasAttr "nixpkgs" sources - then sourcesNixpkgs - else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then - import { } - else - abort - '' - Please specify either (through -I or NIX_PATH=nixpkgs=...) or - add a package called "nixpkgs" to your sources.json. - ''; - - # The actual fetching function. - fetch = pkgs: name: spec: - - if ! builtins.hasAttr "type" spec then - abort "ERROR: niv spec ${name} does not have a 'type' attribute" - else if spec.type == "file" then fetch_file pkgs name spec - else if spec.type == "tarball" then fetch_tarball pkgs name spec - else if spec.type == "git" then fetch_git name spec - else if spec.type == "local" then fetch_local spec - else if spec.type == "builtin-tarball" then fetch_builtin-tarball name - else if spec.type == "builtin-url" then fetch_builtin-url name - else - abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}"; - - # If the environment variable NIV_OVERRIDE_${name} is set, then use - # the path directly as opposed to the fetched source. - replace = name: drv: - let - saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name; - ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}"; - in - if ersatz == "" then drv else - # this turns the string into an actual Nix path (for both absolute and - # relative paths) - if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}"; - - # Ports of functions for older nix versions - - # a Nix version of mapAttrs if the built-in doesn't exist - mapAttrs = builtins.mapAttrs or ( - f: set: with builtins; - listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)) - ); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 - range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 - stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 - stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); - concatMapStrings = f: list: concatStrings (map f list); - concatStrings = builtins.concatStringsSep ""; - - # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331 - optionalAttrs = cond: as: if cond then as else { }; - - # fetchTarball version that is compatible between all the versions of Nix - builtins_fetchTarball = { url, name ? null, sha256 }@attrs: - let - inherit (builtins) lessThan nixVersion fetchTarball; - in - if lessThan nixVersion "1.12" then - fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) - else - fetchTarball attrs; - - # fetchurl version that is compatible between all the versions of Nix - builtins_fetchurl = { url, name ? null, sha256 }@attrs: - let - inherit (builtins) lessThan nixVersion fetchurl; - in - if lessThan nixVersion "1.12" then - fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) - else - fetchurl attrs; - - # Create the final "sources" from the config - mkSources = config: - mapAttrs - ( - name: spec: - if builtins.hasAttr "outPath" spec - then - abort - "The values in sources.json should not have an 'outPath' attribute" - else - spec // { outPath = replace name (fetch config.pkgs name spec); } - ) - config.sources; - - # The "config" used by the fetchers - mkConfig = - { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null - , sources ? if isNull sourcesFile then { } else builtins.fromJSON (builtins.readFile sourcesFile) - , system ? builtins.currentSystem - , pkgs ? mkPkgs sources system - }: rec { - # The sources, i.e. the attribute set of spec name to spec - inherit sources; - - # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers - inherit pkgs; - }; - -in -mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); } diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 6893c173..00000000 --- a/shell.nix +++ /dev/null @@ -1,13 +0,0 @@ -let - sources = import ./nix/sources.nix; - pkgs = import ./nix/pkgs.nix { }; - pre-commit = import ./nix/pre-commit.nix { inherit sources; }; -in -pkgs.haskell.lib.buildStackProject { - name = "validity-shell"; - buildInputs = with pkgs; [ - (import sources.niv { }).niv - zlib - ] ++ pre-commit.tools; - shellHook = pre-commit.run.shellHook; -} diff --git a/stack.yaml b/stack.yaml index e5b2bd6e..70c72072 100644 --- a/stack.yaml +++ b/stack.yaml @@ -68,6 +68,7 @@ extra-deps: ghc-options: "$locals": -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wpartial-fields -Widentities -Wredundant-constraints -Wcpp-undef - +system-ghc: true nix: - shell-file: shell.nix + enable: false +with-hpack: hpack diff --git a/validity-aeson/default.nix b/validity-aeson/default.nix new file mode 100644 index 00000000..ae2b6454 --- /dev/null +++ b/validity-aeson/default.nix @@ -0,0 +1,17 @@ +{ mkDerivation, aeson, base, hspec, lib, validity +, validity-scientific, validity-text, validity-unordered-containers +, validity-vector +}: +mkDerivation { + pname = "validity-aeson"; + version = "0.2.0.5"; + src = ./.; + libraryHaskellDepends = [ + aeson base validity validity-scientific validity-text + validity-unordered-containers validity-vector + ]; + testHaskellDepends = [ aeson base hspec validity ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity instances for aeson"; + license = lib.licenses.mit; +} diff --git a/validity-bytestring/default.nix b/validity-bytestring/default.nix new file mode 100644 index 00000000..e51ad567 --- /dev/null +++ b/validity-bytestring/default.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, bytestring, lib, validity }: +mkDerivation { + pname = "validity-bytestring"; + version = "0.4.1.1"; + src = ./.; + libraryHaskellDepends = [ base bytestring validity ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity instances for bytestring"; + license = lib.licenses.mit; +} diff --git a/validity-bytestring/validity-bytestring.cabal b/validity-bytestring/validity-bytestring.cabal index 4544730e..43b47b15 100644 --- a/validity-bytestring/validity-bytestring.cabal +++ b/validity-bytestring/validity-bytestring.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/validity-case-insensitive/default.nix b/validity-case-insensitive/default.nix new file mode 100644 index 00000000..897d677d --- /dev/null +++ b/validity-case-insensitive/default.nix @@ -0,0 +1,15 @@ +{ mkDerivation, base, case-insensitive, genvalidity-hspec, hspec +, lib, validity +}: +mkDerivation { + pname = "validity-case-insensitive"; + version = "0.0.0.0"; + src = ./.; + libraryHaskellDepends = [ base case-insensitive validity ]; + testHaskellDepends = [ + base case-insensitive genvalidity-hspec hspec validity + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity instances for case-insensitive"; + license = lib.licenses.mit; +} diff --git a/validity-case-insensitive/validity-case-insensitive.cabal b/validity-case-insensitive/validity-case-insensitive.cabal index aefa0e75..62f31d7d 100644 --- a/validity-case-insensitive/validity-case-insensitive.cabal +++ b/validity-case-insensitive/validity-case-insensitive.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.6. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/validity-containers/default.nix b/validity-containers/default.nix new file mode 100644 index 00000000..910485b8 --- /dev/null +++ b/validity-containers/default.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, containers, lib, validity }: +mkDerivation { + pname = "validity-containers"; + version = "0.5.0.4"; + src = ./.; + libraryHaskellDepends = [ base containers validity ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity instances for containers"; + license = lib.licenses.mit; +} diff --git a/validity-containers/validity-containers.cabal b/validity-containers/validity-containers.cabal index ae2a7add..2a498ca4 100644 --- a/validity-containers/validity-containers.cabal +++ b/validity-containers/validity-containers.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/validity-network-uri/default.nix b/validity-network-uri/default.nix new file mode 100644 index 00000000..f4acad63 --- /dev/null +++ b/validity-network-uri/default.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, lib, network-uri, validity }: +mkDerivation { + pname = "validity-network-uri"; + version = "0.0.0.0"; + src = ./.; + libraryHaskellDepends = [ base network-uri validity ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity instances for URI"; + license = lib.licenses.mit; +} diff --git a/validity-path/default.nix b/validity-path/default.nix new file mode 100644 index 00000000..6a27600c --- /dev/null +++ b/validity-path/default.nix @@ -0,0 +1,15 @@ +{ mkDerivation, base, filepath, genvalidity-hspec, hspec, lib, path +, validity +}: +mkDerivation { + pname = "validity-path"; + version = "0.4.0.1"; + src = ./.; + libraryHaskellDepends = [ base filepath path validity ]; + testHaskellDepends = [ + base filepath genvalidity-hspec hspec path validity + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity instances for Path"; + license = lib.licenses.mit; +} diff --git a/validity-path/validity-path.cabal b/validity-path/validity-path.cabal index e99187dd..2000a1f1 100644 --- a/validity-path/validity-path.cabal +++ b/validity-path/validity-path.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/validity-persistent/default.nix b/validity-persistent/default.nix new file mode 100644 index 00000000..b9cad43c --- /dev/null +++ b/validity-persistent/default.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, hspec, lib, persistent, validity }: +mkDerivation { + pname = "validity-persistent"; + version = "0.0.0.0"; + src = ./.; + libraryHaskellDepends = [ base hspec persistent validity ]; + homepage = "http://cs-syd.eu"; + description = "Validity instances for persistent-related types"; + license = lib.licenses.mit; +} diff --git a/validity-persistent/validity-persistent.cabal b/validity-persistent/validity-persistent.cabal index 3ed7660d..ce02a81c 100644 --- a/validity-persistent/validity-persistent.cabal +++ b/validity-persistent/validity-persistent.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/validity-primitive/default.nix b/validity-primitive/default.nix new file mode 100644 index 00000000..4d22dc16 --- /dev/null +++ b/validity-primitive/default.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, lib, primitive, validity }: +mkDerivation { + pname = "validity-primitive"; + version = "0.0.0.1"; + src = ./.; + libraryHaskellDepends = [ base primitive validity ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity instances for primitive"; + license = lib.licenses.mit; +} diff --git a/validity-primitive/validity-primitive.cabal b/validity-primitive/validity-primitive.cabal index a7b24fcf..e41330bc 100644 --- a/validity-primitive/validity-primitive.cabal +++ b/validity-primitive/validity-primitive.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/validity-scientific/default.nix b/validity-scientific/default.nix new file mode 100644 index 00000000..6312d1e8 --- /dev/null +++ b/validity-scientific/default.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, lib, scientific, validity }: +mkDerivation { + pname = "validity-scientific"; + version = "0.2.0.3"; + src = ./.; + libraryHaskellDepends = [ base scientific validity ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity instances for scientific"; + license = lib.licenses.mit; +} diff --git a/validity-scientific/validity-scientific.cabal b/validity-scientific/validity-scientific.cabal index db1efa51..182bc7a2 100644 --- a/validity-scientific/validity-scientific.cabal +++ b/validity-scientific/validity-scientific.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/validity-text/default.nix b/validity-text/default.nix new file mode 100644 index 00000000..8f813f6f --- /dev/null +++ b/validity-text/default.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, bytestring, lib, text, validity }: +mkDerivation { + pname = "validity-text"; + version = "0.3.1.3"; + src = ./.; + libraryHaskellDepends = [ base bytestring text validity ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity instances for text"; + license = lib.licenses.mit; +} diff --git a/validity-time/default.nix b/validity-time/default.nix new file mode 100644 index 00000000..78c69936 --- /dev/null +++ b/validity-time/default.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, lib, time, validity }: +mkDerivation { + pname = "validity-time"; + version = "0.5.0.0"; + src = ./.; + libraryHaskellDepends = [ base time validity ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity instances for time"; + license = lib.licenses.mit; +} diff --git a/validity-time/validity-time.cabal b/validity-time/validity-time.cabal index 00599550..e33a2040 100644 --- a/validity-time/validity-time.cabal +++ b/validity-time/validity-time.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/validity-unordered-containers/default.nix b/validity-unordered-containers/default.nix new file mode 100644 index 00000000..750005d5 --- /dev/null +++ b/validity-unordered-containers/default.nix @@ -0,0 +1,13 @@ +{ mkDerivation, base, hashable, lib, unordered-containers, validity +}: +mkDerivation { + pname = "validity-unordered-containers"; + version = "0.2.0.3"; + src = ./.; + libraryHaskellDepends = [ + base hashable unordered-containers validity + ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity instances for unordered-containers"; + license = lib.licenses.mit; +} diff --git a/validity-unordered-containers/validity-unordered-containers.cabal b/validity-unordered-containers/validity-unordered-containers.cabal index b754af49..af675a99 100644 --- a/validity-unordered-containers/validity-unordered-containers.cabal +++ b/validity-unordered-containers/validity-unordered-containers.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/validity-uuid/default.nix b/validity-uuid/default.nix new file mode 100644 index 00000000..4d43a8cb --- /dev/null +++ b/validity-uuid/default.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, lib, uuid, validity }: +mkDerivation { + pname = "validity-uuid"; + version = "0.1.0.3"; + src = ./.; + libraryHaskellDepends = [ base uuid validity ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity instances for uuid"; + license = lib.licenses.mit; +} diff --git a/validity-uuid/validity-uuid.cabal b/validity-uuid/validity-uuid.cabal index 49b55b08..7d0d35f3 100644 --- a/validity-uuid/validity-uuid.cabal +++ b/validity-uuid/validity-uuid.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/validity-vector/default.nix b/validity-vector/default.nix new file mode 100644 index 00000000..e4223cf1 --- /dev/null +++ b/validity-vector/default.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, hashable, lib, validity, vector }: +mkDerivation { + pname = "validity-vector"; + version = "0.2.0.3"; + src = ./.; + libraryHaskellDepends = [ base hashable validity vector ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity instances for vector"; + license = lib.licenses.mit; +} diff --git a/validity-vector/validity-vector.cabal b/validity-vector/validity-vector.cabal index f2368bc2..1b8e2594 100644 --- a/validity-vector/validity-vector.cabal +++ b/validity-vector/validity-vector.cabal @@ -1,6 +1,6 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4. +-- This file has been generated from package.yaml by hpack version 0.34.7. -- -- see: https://github.com/sol/hpack diff --git a/validity/default.nix b/validity/default.nix new file mode 100644 index 00000000..c51dd9b0 --- /dev/null +++ b/validity/default.nix @@ -0,0 +1,11 @@ +{ mkDerivation, base, hspec, lib }: +mkDerivation { + pname = "validity"; + version = "0.12.0.1"; + src = ./.; + libraryHaskellDepends = [ base ]; + testHaskellDepends = [ base hspec ]; + homepage = "https://github.com/NorfairKing/validity#readme"; + description = "Validity typeclass"; + license = lib.licenses.mit; +}