diff --git a/cabal.project b/cabal.project index f3c121f8..fda6f25f 100644 --- a/cabal.project +++ b/cabal.project @@ -1,17 +1,13 @@ packages: - account/backend/ account/types/ aeson-orphans/ - backend/ beam/db/ beam/orphans/ - beam/task/backend/ beam/task/types/ common/ email/ email/mime-mail-orphans/ frontend/ - iv/backend/ iv/common/ notify-listen/notify-listen/ notify-listen/notify-listen-beam/ @@ -22,10 +18,21 @@ packages: signed-data/signed-data/ signed-data/signed-data-clientsession/ test/ + widgets/ +if (!os(ghcjs)) + packages: + account/backend/ + backend/ + beam/task/backend/ + iv/backend/ + allow-newer: postgresql-lo-stream:*, vessel:*, aeson-gadt-th:*, + attoparsec, +allow-older: + postgresql-simple, diff --git a/default.nix b/default.nix index 456c01ac..0178f74d 100644 --- a/default.nix +++ b/default.nix @@ -1,16 +1,9 @@ -{ obelisk ? import ./dep/obelisk (builtins.removeAttrs args ["pkgs" "inNixShell"] // { useGHC810 = true; }) -, pkgs ? obelisk.nixpkgs +{ obelisk ? import ./dep/obelisk (builtins.removeAttrs args ["pkgs" "inNixShell"]) +, pkgs ? obelisk.pkgs , ... } @ args: let - reflex-platform = obelisk.reflex-platform; - inherit (pkgs) lib; - haskellLib = pkgs.haskell.lib; - repos = pkgs.thunkSet ./dep; - - # Some dependency thunks needed - dep = import ./dep reflex-platform.hackGet; - #TODO: Consider whether to prefer using thunkSet here. + nix-thunk = import ./dep/nix-thunk { inherit pkgs; }; # Local packages. We override them below so that other packages can use them. rhyolitePackages = { @@ -41,8 +34,12 @@ let signed-data-clientsession = ./signed-data/signed-data-clientsession; }; + repos = nix-thunk.mapSubdirectories + nix-thunk.thunkSource + ./dep; + # srcs used for overrides - overrideSrcs = rhyolitePackages // { + haskellPackageSources = rhyolitePackages // { beam-sqlite = repos.beam + "/beam-sqlite"; beam-core = repos.beam + "/beam-core"; beam-postgres = repos.beam + "/beam-postgres"; @@ -61,7 +58,7 @@ let postgresql-simple = repos.postgresql-simple; postgresql-simple-interpolate = repos.postgresql-simple-interpolate; - # Newer versions than those in reflex-platform + # Newer versions than those in Reflex Platform gargoyle = repos.gargoyle + "/gargoyle"; gargoyle-postgresql = repos.gargoyle + "/gargoyle-postgresql"; gargoyle-postgresql-connect = repos.gargoyle + "/gargoyle-postgresql-connect"; @@ -74,78 +71,24 @@ let vessel = repos.vessel; }; - # You can use these manually if you don’t want to use rhyolite.project. - # It will be needed if you need to combine with multiple overrides. - haskellOverrides = lib.foldr lib.composeExtensions (_: _: {}) [ - (self: super: lib.mapAttrs (name: path: self.callCabal2nix name path {}) overrideSrcs) - (self: super: { - frontend = super.frontend.override { - obelisk-executable-config-lookup = self.obelisk-executable-config-lookup; - }; - beam-automigrate = haskellLib.doJailbreak super.beam-automigrate; - beam-postgres = haskellLib.dontCheck super.beam-postgres; - beam-migrate = haskellLib.dontCheck super.beam-migrate; - bytestring-trie = haskellLib.dontCheck super.bytestring-trie; - gargoyle-postgresql-nix = haskellLib.overrideCabal super.gargoyle-postgresql-nix { - librarySystemDepends = [ pkgs.postgresql ]; - }; - postgresql-simple = haskellLib.dontCheck super.postgresql-simple; - validation = haskellLib.dontCheck super.validation; - - postgresql-lo-stream = haskellLib.doJailbreak (self.callHackageDirect { - pkg = "postgresql-lo-stream"; - ver = "0.1.1.1"; - sha256 = "0ifr6i6vygckj2nikv7k7yqia495gnn27pq6viasckmmh6zx6gwi"; - } {}); - - monad-logger-extras = self.callHackageDirect { - pkg = "monad-logger-extras"; - ver = "0.1.1.1"; - sha256 = "17dr2jwg1ig1gd4hw7160vf3l5jcx5p79b2lz7k17f6v4ygx3vbz"; - } {}; - monoid-subclasses = self.callHackageDirect { - pkg = "monoid-subclasses"; - ver = "1.1"; - sha256 = "02ggjcwjdjh6cmy7zaji5mcmnq140sp33cg9rvwjgply6hkddrvb"; - } {}; - HaskellNet = self.callHackage "HaskellNet" "0.6" {}; - HaskellNet-SSL = self.callHackage "HaskellNet-SSL" "0.3.4.4" {}; - - base-orphans = self.callHackageDirect { - pkg = "base-orphans"; - ver = "0.8.6"; - sha256 = "sha256:17hplm1mgw65jbszg5z4vqk4i24ilxv8mbszr3s8lhpll5naik26"; - } {}; - - # 'locale' is broken on nix darwin which is required by postgres 'initdb' - rhyolite-beam-task-worker-backend = if pkgs.stdenv.hostPlatform.isDarwin - then - haskellLib.dontCheck super.rhyolite-beam-task-worker-backend - else - super.rhyolite-beam-task-worker-backend; - }) - ]; - in obelisk // { - inherit haskellOverrides; - - rhyolitePackages = haskellPackages: builtins.intersectAttrs rhyolitePackages (haskellPackages.extend haskellOverrides); - - haskellPackageSources = overrideSrcs; + inherit rhyolitePackages haskellPackageSources; # Function similar to obelisk.project that handles overrides for you. project = base: projectDefinition: obelisk.project base ({...}@args: let def = projectDefinition args; in def // { - overrides = lib.composeExtensions haskellOverrides (def.overrides or (_: _: {})); + inputThunks = haskellPackageSources // def.inputThunks or {}; }); # Used to build this project. Should only be needed by CI, devs. - proj = obelisk.reflex-platform.project ({ pkgs, ... }@args: { - overrides = haskellOverrides; - packages = rhyolitePackages; + proj = obelisk.project {} ({ pkgs, ... }@args: { + name = "rhyolite-test-project"; + src = ./.; + inputThunks = builtins.attrValues haskellPackageSources; + extraArgs = {}; shells = rec { ghc = builtins.attrNames rhyolitePackages; ghcjs = [ diff --git a/dep/nix-thunk/default.nix b/dep/nix-thunk/default.nix new file mode 100644 index 00000000..2b4d4ab1 --- /dev/null +++ b/dep/nix-thunk/default.nix @@ -0,0 +1,2 @@ +# DO NOT HAND-EDIT THIS FILE +import (import ./thunk.nix) \ No newline at end of file diff --git a/dep/nix-thunk/github.json b/dep/nix-thunk/github.json new file mode 100644 index 00000000..212315fe --- /dev/null +++ b/dep/nix-thunk/github.json @@ -0,0 +1,7 @@ +{ + "owner": "obsidiansystems", + "repo": "nix-thunk", + "private": false, + "rev": "3ce834d514c77bcfd889bd07cb69c1d65172d651", + "sha256": "1rvpm0wh62kzaii3d75ijgl8vr2sg3p0ifv2swjccwv3rv380vwg" +} diff --git a/dep/nix-thunk/thunk.nix b/dep/nix-thunk/thunk.nix new file mode 100644 index 00000000..20f2d28c --- /dev/null +++ b/dep/nix-thunk/thunk.nix @@ -0,0 +1,12 @@ +# DO NOT HAND-EDIT THIS FILE +let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256, ... }: + if !fetchSubmodules && !private then builtins.fetchTarball { + url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz"; inherit sha256; + } else (import (builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/3aad50c30c826430b0270fcf8264c8c41b005403.tar.gz"; + sha256 = "0xwqsf08sywd23x0xvw4c4ghq0l28w2ki22h0bdn766i16z9q2gr"; +}) {}).fetchFromGitHub { + inherit owner repo rev sha256 fetchSubmodules private; + }; + json = builtins.fromJSON (builtins.readFile ./github.json); +in fetch json \ No newline at end of file diff --git a/dep/obelisk/github.json b/dep/obelisk/github.json index f32e7a27..52ed549a 100644 --- a/dep/obelisk/github.json +++ b/dep/obelisk/github.json @@ -1,8 +1,8 @@ { "owner": "obsidiansystems", "repo": "obelisk", - "branch": "pzp", + "branch": "haskell.nix", "private": false, - "rev": "db78e4d4c20d9d51f90e00e5d9a0d5e77c0baf82", - "sha256": "1yxwvfdlv3ii17jrd3w2yiiza26d400b35x04gmpv209xk26yz3h" + "rev": "d817702be87bb1eefcf817651bb73dcbf667ba2f", + "sha256": "13h9kmcgnfp8wh1yw9ndkjm2hs0g1bw4gd0r624bsnfnbbl74xvg" } diff --git a/release.nix b/release.nix index d7bf10b9..7d048e28 100644 --- a/release.nix +++ b/release.nix @@ -6,25 +6,20 @@ , supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ] }: let - inherit (local-self) reflex-platform; inherit (local-self.nixpkgs) lib; perPlatform = lib.genAttrs supportedSystems (system: let self = import ./. (self-args // { inherit system; }); - reflex-platform = self.reflex-platform; cachePackages = - (builtins.attrValues (self.rhyolitePackages self.obelisk)) + (builtins.attrValues self.rhyolitePackages) ++ [ self.proj.ghcjs.rhyolite-frontend - (import ./. {}).proj.ghc.rhyolite-test-suite + self.proj.ghc.rhyolite-test-suite ]; - in self.rhyolitePackages self.obelisk // { - cache = reflex-platform.pinBuildInputs "rhyolite-${system}" cachePackages; + in self.proj // { + recurseForDerivations = true; }); - metaCache = reflex-platform.pinBuildInputs "rhyolite-everywhere" - (map (a: a.cache) (builtins.attrValues perPlatform)); - in perPlatform // { - inherit metaCache; + recurseForDerivations = true; }