Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete much dead code, haskell.nix Obelisk branch #216

Open
wants to merge 4 commits into
base: iv
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -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/
Expand All @@ -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,
89 changes: 16 additions & 73 deletions default.nix
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down Expand Up @@ -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";
Expand All @@ -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";
Expand All @@ -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 = [
Expand Down
2 changes: 2 additions & 0 deletions dep/nix-thunk/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# DO NOT HAND-EDIT THIS FILE
import (import ./thunk.nix)
7 changes: 7 additions & 0 deletions dep/nix-thunk/github.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"owner": "obsidiansystems",
"repo": "nix-thunk",
"private": false,
"rev": "3ce834d514c77bcfd889bd07cb69c1d65172d651",
"sha256": "1rvpm0wh62kzaii3d75ijgl8vr2sg3p0ifv2swjccwv3rv380vwg"
}
12 changes: 12 additions & 0 deletions dep/nix-thunk/thunk.nix
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions dep/obelisk/github.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"owner": "obsidiansystems",
"repo": "obelisk",
"branch": "pzp",
"branch": "haskell.nix",
"private": false,
"rev": "db78e4d4c20d9d51f90e00e5d9a0d5e77c0baf82",
"sha256": "1yxwvfdlv3ii17jrd3w2yiiza26d400b35x04gmpv209xk26yz3h"
"rev": "d817702be87bb1eefcf817651bb73dcbf667ba2f",
"sha256": "13h9kmcgnfp8wh1yw9ndkjm2hs0g1bw4gd0r624bsnfnbbl74xvg"
}
15 changes: 5 additions & 10 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}