1/* This makes a keter bundle as described on the github page:
2 https://github.com/snoyberg/keter#bundling-your-app-for-keter
3*/
4{ keterDomain
5, keterExecutable
6, gnutar
7, writeTextFile
8, lib
9, stdenv
10, ...
11}:
12
13let
14 str.stanzas = [{
15 # we just use nix as an absolute path so we're not bundling any binaries
16 type = "webapp";
17 /* Note that we're not actually putting the executable in the bundle,
18 we already can use the nix store for copying, so we just
19 symlink to the app. */
20 exec = keterExecutable;
21 host = keterDomain;
22 }];
23 configFile = writeTextFile {
24 name = "keter.yml";
25 text = (lib.generators.toYAML { } str);
26 };
27
28in
29stdenv.mkDerivation {
30 name = "keter-bundle";
31 buildCommand = ''
32 mkdir -p config
33 cp ${configFile} config/keter.yaml
34
35 echo 'create a gzipped tarball'
36 mkdir -p $out
37 tar -zcvf $out/bundle.tar.gz.keter ./.
38 '';
39 buildInputs = [ gnutar ];
40}