on decrease-android-validity help sign in
38 lines 1.4 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 '' + nixpkgs.lib.optionalString (!(builtins.isNull config)) ''
14 if ! mkdir $out/config; then
15 2>&1 echo config directory already exists or could not be created
16 exit 1
17 fi
18 cp -a "${config}"/* "$out/config"
19 find "$out/config" -type f -printf '%P\0' >"$out/config.files"
20 '');
21in with nixpkgs.haskell.lib; {
22 haskellOverlay = self: super: {
23 obelisk-executable-config-lookup = self.callPackage (filterGitSource ./lookup) {};
24 };
25 platforms = {
26 android = {
27 # Inject the given config directory into an android assets folder
28 inject = injectConfig;
29 };
30 ios = {
31 # Inject the given config directory into an iOS app
32 inject = injectConfig;
33 };
34 web = {
35 inject = self: self.callCabal2nix "obelisk-executable-config-inject" (filterGitSource ./inject) {};
36 };
37 };