title: Deploying static files with NixOps
body: <p>I've got a program which depends on the <code>static</code> and <code>config</code> directories being available on the server along with the binary. The default build phases for NixOps doesn't include these files, as far as I can tell it just compiles the binary and then copies the binary to the server.</p>
  
  <p>How can I modify the build phases such that the <code>static</code> and <code>config</code> directories are available on the server? I tried adding:</p>
  
  <pre><code>preInstall = ''
    echo "copying static and config files"
    cp -a ../static $out/static
    cp -a ../config $out/config
  '';
  </code></pre>
  
  <p>But that doesn't seem to actually copy the files over, and I never see the <code>echo</code> command executed. <a href="https://gist.github.com/bsima/b79d1beae8efc53a99146f7eceb1f5ec" rel="noreferrer">Here</a> is a gist of the configuration file used by NixOps. The error on the server is:</p>
  
  <pre><code>[root@pprjam:~]# systemctl status pprjam
  ● pprjam.service - pprjam webapp
     Loaded: loaded (/nix/store/z2s52f39p3dx8q9b06rkaqqw5mhdvnmq-unit-pprjam.service/pprjam.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2018-02-17 01:29:57 UTC; 1min 27s ago
    Process: 6917 ExecStart=/nix/store/khilhwldcbm0xm3a3bzhy6f0kwdk8w1p-pprjam-0.0.0/bin/pprjam (code=exited, status=1/FAILURE)
   Main PID: 6917 (code=exited, status=1/FAILURE)
  
  Feb 17 01:29:51 pprjam systemd[1]: Started pprjam webapp.
  Feb 17 01:29:56 pprjam pprjam[6917]: pprjam: static: getDirectoryContents:openDirStream: does not exist (No such file or directory)
  Feb 17 01:29:57 pprjam systemd[1]: pprjam.service: Main process exited, code=exited, status=1/FAILURE
  Feb 17 01:29:57 pprjam systemd[1]: pprjam.service: Unit entered failed state.
  Feb 17 01:29:57 pprjam systemd[1]: pprjam.service: Failed with result 'exit-code'.
  </code></pre>