on 3caa3db help sign in
33 lines 1.1 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 cp -a "${assets}" $out
11 chmod +w "$out"
12 if ! mkdir $out/config; then
13 2>&1 echo config directory already exists or could not be created
14 exit 1
15 fi
16 cp -a "${config}"/* "$out/config"
17 '';
18in with nixpkgs.haskell.lib; {
19 haskellPackage = self: self.callPackage (filterGitSource ./lookup) {};
20 platforms = {
21 android = {
22 # Inject the given config directory into an android assets folder
23 inject = injectConfig;
24 };
25 ios = {
26 # Inject the given config directory into an iOS app
27 inject = injectConfig;
28 };
29 web = {
30 inject = self: self.callCabal2nix "obelisk-executable-config-inject" (filterGitSource ./inject) {};
31 };
32 };