on 63c7b21 help sign in
34 lines 1.2 kB history raw
1# This module exposes a tool for several platforms that can be used to inject
2# configuration information into a canonical location. It also provides a haskell
3# package that can be used to retrieve the injected configuration on each supported
4# platform.
5{ nixpkgs
6, filterGitSource # TODO define this in obelisk
7}:
8let injectConfig = config: assets: nixpkgs.runCommand "inject-config" {} ''
9 set -x
10 mkdir -p $out
11 cp --no-preserve=mode -Lr "${assets}" $out/static
12 chmod +w "$out"
13 if ! mkdir $out/config; then
14 2>&1 echo config directory already exists or could not be created
15 exit 1
16 fi
17 cp -a "${config}"/* "$out/config"
18 '';
19in with nixpkgs.haskell.lib; {
20 haskellPackage = self: self.callPackage (filterGitSource ./lookup) {};
21 platforms = {
22 android = {
23 # Inject the given config directory into an android assets folder
24 inject = injectConfig;
25 };
26 ios = {
27 # Inject the given config directory into an iOS app
28 inject = injectConfig;
29 };
30 web = {
31 inject = self: self.callCabal2nix "obelisk-executable-config-inject" (filterGitSource ./inject) {};
32 };
33 };