on master help sign in
Don't put configs into the nix store

This breaks `nix-build --attr exe` because the backend expects the config folder to be in the result

commit5c2d99ae19f67993e2d908519e9f4e6362eb3a59 authorTom Smalley <tfsmalley@gmail.com> dateTue 30 Oct 2018, 17:04 (8 years ago) parentcaf49a2
2 files changed+15−10
default.nix+6−9 lib/command/src/Obelisk/Command/Deploy.hs+9−1
default.nix+6−9
@@ -232,17 +232,16 @@ in rec {
232232 };
233233 };
234234
235− serverExe = backend: frontend: assets: config: optimizationLevel:
235+ serverExe = backend: frontend: assets: optimizationLevel:
236236 pkgs.runCommand "serverExe" {} ''
237237 mkdir $out
238238 set -eux
239239 ln -s "${haskellLib.justStaticExecutables backend}"/bin/* $out/
240240 ln -s "${mkAssets assets}" $out/static.assets
241− cp -r ${config} $out/config
242241 ln -s ${mkAssets (compressedJs frontend optimizationLevel)} $out/frontend.jsexe.assets
243242 '';
244243
245− server = { exe, hostName, adminEmail, routeHost, enableHttps, config }@args:
244+ server = { exe, hostName, adminEmail, routeHost, enableHttps }@args:
246245 let
247246 nixos = import (pkgs.path + /nixos);
248247 in nixos {
@@ -328,15 +327,13 @@ in rec {
328327 passthru = { inherit android ios packages overrides tools shellToolOverrides withHoogle staticFiles __closureCompilerOptimizationLevel; };
329328 };
330329 in mkProject (projectDefinition args));
331− serverOn = sys: config: serverExe (projectOut sys).ghc.backend (projectOut system).ghcjs.frontend (projectOut sys).passthru.staticFiles config (projectOut sys).passthru.__closureCompilerOptimizationLevel;
330+ serverOn = sys: serverExe (projectOut sys).ghc.backend (projectOut system).ghcjs.frontend (projectOut sys).passthru.staticFiles (projectOut sys).passthru.__closureCompilerOptimizationLevel;
332331 linuxExe = serverOn "x86_64-linux";
333332 in projectOut system // {
334333 linuxExeConfigurable = linuxExe;
335− linuxExe = linuxExe (base + "/config");
336− exe = serverOn system (base + "/config") ;
337− server = args@{ hostName, adminEmail, routeHost, enableHttps, config }: let
338− injectableConfig = builtins.filterSource (path: _: !(lib.hasPrefix (toString config + "/backend") (toString path))) config;
339− in server (args // { exe = linuxExe injectableConfig; });
334+ linuxExe = linuxExe;
335+ exe = serverOn system;
336+ server = args@{ hostName, adminEmail, routeHost, enableHttps }: server (args // { exe = linuxExe; });
340337 obelisk = import (base + "/.obelisk/impl") {};
341338 };
342339 haskellPackageSets = {
lib/command/src/Obelisk/Command/Deploy.hs+9−1
@@ -101,7 +101,6 @@ deployPush deployPath getNixBuilders = do
101101 , strArg "adminEmail" adminEmail
102102 , strArg "routeHost" routeHost
103103 , boolArg "enableHttps" enableHttps
104− , rawArg "config" $ deployPath </> "config"
105104 ]
106105 , _nixBuildConfig_builders = builders
107106 }
@@ -128,6 +127,15 @@ deployPush deployPath getNixBuilders = do
128127 (Map.fromList [("NIX_SSHOPTS", unwords sshOpts)])
129128 "nix-copy-closure" ["-v", "--to", "root@" <> host, "--gzip", outputPath]
130129
130+ withSpinner "Uploading config" $ do
131+ callProcessAndLogOutput (Notice, Warning) $
132+ proc "rsync"
133+ [ "-e ssh " <> unwords sshOpts
134+ , "-qarvz"
135+ , deployPath </> "config"
136+ , "root@" <> host <> ":/var/lib/backend"
137+ ]
138+
131139 withSpinner "Switching to new configuration" $ do
132140 callProcessAndLogOutput (Notice, Warning) $
133141 proc "ssh" $ sshOpts <>