mirror of
https://github.com/byteverse/colonnade.git
synced 2026-03-01 22:44:38 +01:00
nix
This commit is contained in:
parent
d17193baae
commit
b9ea39ffa3
8
colonnade/default.nix
Normal file
8
colonnade/default.nix
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{ frontend ? false }:
|
||||||
|
let
|
||||||
|
pname = "colonnade";
|
||||||
|
main = (import ../nix/default.nix {
|
||||||
|
inherit frontend;
|
||||||
|
});
|
||||||
|
in
|
||||||
|
main.${pname}
|
||||||
1
colonnade/shell.nix
Normal file
1
colonnade/shell.nix
Normal file
@ -0,0 +1 @@
|
|||||||
|
(import ./. {}).env
|
||||||
106
nix/default.nix
106
nix/default.nix
@ -1,47 +1,73 @@
|
|||||||
{ package, test ? true, frontend ? false }:
|
{ frontend ? false }:
|
||||||
let bootstrap = import <nixpkgs> {};
|
|
||||||
|
let _nixpkgs = import <nixpkgs> {};
|
||||||
|
nixpkgs = _nixpkgs.fetchFromGitHub {
|
||||||
|
owner = "NixOS";
|
||||||
|
repo = "nixpkgs";
|
||||||
|
rev = "5c4a404b0d0e5125070dde5c1787210149157e83";
|
||||||
|
sha256 = "0a478l0dxzy5hglavkilxjkh45zfg31q50hgkv1npninc4lpv5f7";
|
||||||
|
};
|
||||||
|
pkgs = import nixpkgs { config = {}; overlays = []; };
|
||||||
|
|
||||||
fetch-github-json = owner: repo: path:
|
fetch-github-json = owner: repo: path:
|
||||||
let commit = builtins.fromJSON (builtins.readFile path);
|
let commit = builtins.fromJSON (builtins.readFile path);
|
||||||
in bootstrap.fetchFromGitHub {
|
in pkgs.fetchFromGitHub {
|
||||||
inherit owner repo;
|
name = "${repo}-${commit.rev}";
|
||||||
inherit (commit) rev sha256;
|
inherit owner repo;
|
||||||
|
inherit (commit) rev sha256;
|
||||||
};
|
};
|
||||||
reflex-platform = import (fetch-github-json "reflex-frp" "reflex-platform" ./reflex-platform.json) {};
|
|
||||||
compiler = if frontend then "ghcjs" else "ghc";
|
reflex-platform = import (fetch-github-json "layer-3-communications" "reflex-platform" ./reflex-platform.json) {};
|
||||||
overrides = (builtins.getAttr compiler reflex-platform).override {
|
jsaddle-src = fetch-github-json "ghcjs" "jsaddle" ./jsaddle.json;
|
||||||
|
compiler = "ghc8_2_1";
|
||||||
|
|
||||||
|
filterPredicate = p: type:
|
||||||
|
let path = baseNameOf p; in !(
|
||||||
|
(type == "directory" && pkgs.lib.hasPrefix "dist" path)
|
||||||
|
|| (type == "symlink" && pkgs.lib.hasPrefix "result" path)
|
||||||
|
|| pkgs.lib.hasPrefix ".ghc" path
|
||||||
|
|| pkgs.lib.hasPrefix ".git" path
|
||||||
|
|| pkgs.lib.hasSuffix "~" path
|
||||||
|
|| pkgs.lib.hasSuffix ".o" path
|
||||||
|
|| pkgs.lib.hasSuffix ".so" path
|
||||||
|
|| pkgs.lib.hasSuffix ".nix" path);
|
||||||
|
|
||||||
|
overrides = reflex-platform.${compiler}.override {
|
||||||
overrides = self: super:
|
overrides = self: super:
|
||||||
with reflex-platform;
|
with reflex-platform;
|
||||||
let options = pkg: lib.overrideCabal pkg (drv: { doCheck = test; });
|
with reflex-platform.lib;
|
||||||
filterPredicate = p: type:
|
with reflex-platform.nixpkgs.haskell.lib;
|
||||||
let path = baseNameOf p; in
|
with reflex-platform.nixpkgs.haskellPackages;
|
||||||
!builtins.any (x: x)
|
let
|
||||||
[(type == "directory" && path == "dist")
|
cp = file: (self.callPackage (./deps + "/${file}.nix") {});
|
||||||
(type == "symlink" && path == "result")
|
build-from-json = name: str: self.callCabal2nix name str {};
|
||||||
(type == "directory" && path == ".git")];
|
build = name: path: self.callCabal2nix name (builtins.filterSource filterPredicate path) {};
|
||||||
in {
|
in
|
||||||
mkDerivation = args: super.mkDerivation (args //
|
{
|
||||||
(if nixpkgs.stdenv.isDarwin && !frontend then {
|
gtk2hs-buildtools = self.callPackage ./gtk2hs-buildtools.nix {};
|
||||||
postCompileBuildDriver = ''
|
colonnade = build "colonnade" ../colonnade;
|
||||||
echo "Patching dynamic library dependencies"
|
siphon = build "siphon" ../siphon;
|
||||||
# 1. Link all dylibs from 'dynamic-library-dirs's in package confs to $out/lib/links
|
reflex-dom-colonnade = build "reflex-dom-colonnade" ../reflex-dom-colonnade;
|
||||||
mkdir -p $out/lib/links
|
lucid-colonnade = build "lucid-colonnade" ../lucid-colonnade;
|
||||||
for d in $(grep dynamic-library-dirs $packageConfDir/*|awk '{print $2}'); do
|
blaze-colonnade = build "blaze-colonnade" ../blaze-colonnade;
|
||||||
ln -s $d/*.dylib $out/lib/links
|
yesod-colonnade = build "yesod-colonnade" ../yesod-colonnade;
|
||||||
done
|
} //
|
||||||
|
{
|
||||||
|
jsaddle = doJailbreak (build-from-json "jsaddle" "${jsaddle-src}/jsaddle");
|
||||||
|
jsaddle-webkitgtk = doJailbreak (build-from-json "jsaddle-webkitgtk" "${jsaddle-src}/jsaddle-webkitgtk");
|
||||||
|
jsaddle-webkit2gtk = doJailbreak (build-from-json "jsaddle-webkit2gtk" "${jsaddle-src}/jsaddle-webkit2gtk");
|
||||||
|
jsaddle-wkwebview = doJailbreak (build-from-json "jsaddle-wkwebview" "${jsaddle-src}/jsaddle-wkwebview");
|
||||||
|
jsaddle-clib = doJailbreak (build-from-json "jsaddle-clib" "${jsaddle-src}/jsaddle-clib");
|
||||||
|
jsaddle-warp = dontCheck (doJailbreak (build-from-json "jsaddle-warp" "${jsaddle-src}/jsaddle-warp"));
|
||||||
|
};
|
||||||
|
|
||||||
# 2. Patch 'dynamic-library-dirs' in package confs to point to the symlink dir
|
|
||||||
for f in $packageConfDir/*.conf; do
|
|
||||||
sed -i "s,dynamic-library-dirs: .*,dynamic-library-dirs: $out/lib/links," $f
|
|
||||||
done
|
|
||||||
|
|
||||||
# 3. Recache package database
|
|
||||||
ghc-pkg --package-db="$packageConfDir" recache
|
|
||||||
'';
|
|
||||||
} else {}));
|
|
||||||
} // import ./overrides.nix { inherit options filterPredicate lib cabal2nixResult self super; };
|
|
||||||
};
|
};
|
||||||
drv = builtins.getAttr package overrides;
|
in rec {
|
||||||
in if reflex-platform.nixpkgs.lib.inNixShell then
|
inherit reflex-platform fetch-github-json overrides nixpkgs pkgs;
|
||||||
reflex-platform.workOn overrides drv
|
colonnade = overrides.colonnade;
|
||||||
else
|
siphon = overrides.siphon;
|
||||||
drv
|
reflex-dom-colonnade = overrides.reflex-dom-colonnade;
|
||||||
|
lucid-colonnade = overrides.lucid-colonnade;
|
||||||
|
blaze-colonnade = overrides.blaze-colonnade;
|
||||||
|
yesod-colonnade = overrides.yesod-colonnade;
|
||||||
|
}
|
||||||
|
|||||||
20
nix/gtk2hs-buildtools.nix
Normal file
20
nix/gtk2hs-buildtools.nix
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{ mkDerivation, alex, array, base, Cabal, containers, directory
|
||||||
|
, filepath, happy, hashtables, pretty, process, random, stdenv
|
||||||
|
}:
|
||||||
|
mkDerivation {
|
||||||
|
pname = "gtk2hs-buildtools";
|
||||||
|
version = "0.13.4.0";
|
||||||
|
sha256 = "0f3e6ba90839efd43efe8cecbddb6478a55e2ce7788c57a0add4df477dede679";
|
||||||
|
isLibrary = true;
|
||||||
|
isExecutable = true;
|
||||||
|
enableSeparateDataOutput = true;
|
||||||
|
libraryHaskellDepends = [
|
||||||
|
array base Cabal containers directory filepath hashtables pretty
|
||||||
|
process random
|
||||||
|
];
|
||||||
|
libraryToolDepends = [ alex happy ];
|
||||||
|
executableHaskellDepends = [ base ];
|
||||||
|
homepage = "http://projects.haskell.org/gtk2hs/";
|
||||||
|
description = "Tools to build the Gtk2Hs suite of User Interface libraries";
|
||||||
|
license = stdenv.lib.licenses.gpl2;
|
||||||
|
}
|
||||||
6
nix/jsaddle.json
Normal file
6
nix/jsaddle.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"owner": "ghcjs",
|
||||||
|
"repo": "jsaddle",
|
||||||
|
"rev": "b423436565fce7f69a65d843c71fc52dc455bf54",
|
||||||
|
"sha256": "09plndkh5wnbqi34x3jpaz0kjdjgyf074faf5xk97rsm81vhz8kk"
|
||||||
|
}
|
||||||
@ -1,5 +1,8 @@
|
|||||||
{ test ? "true" }:
|
{ frontend ? false }:
|
||||||
let parseBool = str: with builtins;
|
let
|
||||||
let json = fromJSON str; in if isBool json then json else throw "nix parseBool: ${str} is not a bool.";
|
pname = "reflex-dom-colonnade";
|
||||||
|
main = (import ../nix/default.nix {
|
||||||
|
inherit frontend;
|
||||||
|
});
|
||||||
in
|
in
|
||||||
import ../nix/default.nix { package = "reflex-dom-colonnade"; frontend = false; test = parseBool test; }
|
main.${pname}
|
||||||
|
|||||||
1
reflex-dom-colonnade/shell.nix
Normal file
1
reflex-dom-colonnade/shell.nix
Normal file
@ -0,0 +1 @@
|
|||||||
|
(import ./. {}).env
|
||||||
Loading…
Reference in New Issue
Block a user