Deployment and lifecycle management for Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

stub out client download script

+37 -1
+1 -1
config/runtime.exs
··· 73 73 } 74 74 75 75 def load() do 76 - Logger.debug("Loading configuration") 77 76 {:ok, _} = Application.ensure_all_started(:jason) 78 77 {:ok, _} = Application.ensure_all_started(:logger) 78 + Logger.debug("Loading configuration") 79 79 80 80 config_file = System.get_env("SOWER_SERVER_CONFIG_FILE", "/etc/sower/server.json") 81 81
+7
dev-server.json
··· 10 10 "database": "sower_dev", 11 11 "port": 5432 12 12 }, 13 + "nix_cache": { 14 + "url": "https://cache.junco.dev/v3", 15 + "public_key": "v3:aMXMnngJoGU8dpELPyNAhADrOgrn5GiXWP90NiB4aFY=" 16 + }, 17 + "client_bin": { 18 + "x86_64-linux": "/nix/store/path-to-client" 19 + }, 13 20 "log_level": "debug" 14 21 }
+16
lib/sower_web/controllers/app_controller.ex
··· 1 + defmodule SowerWeb.AppController do 2 + use SowerWeb, :controller 3 + 4 + def client_script(conn, _params) do 5 + case Application.fetch_env(:sower, :client_store_path) do 6 + {:ok, client_store_path} -> 7 + render(conn |> put_root_layout(false), :client_script, 8 + layout: false, 9 + client_store_path: client_store_path 10 + ) 11 + 12 + :error -> 13 + html(conn |> Plug.Conn.put_status(404) |> Plug.Conn.halt(), "not found") 14 + end 15 + end 16 + end
+5
lib/sower_web/controllers/app_html.ex
··· 1 + defmodule SowerWeb.AppHTML do 2 + use SowerWeb, :html 3 + 4 + embed_templates("app_html/*") 5 + end
+6
lib/sower_web/controllers/app_html/client_script.sh.heex
··· 1 + #!/usr/bin/env bash 2 + 3 + # TODO: bootstrap a host by overriding cache URL and key 4 + 5 + echo "Hi" 6 + nix-store --realize <%= @client_store_path %>
+2
lib/sower_web/router.ex
··· 23 23 24 24 get "/", PageController, :home 25 25 26 + get "/client/script", AppController, :client_script 27 + 26 28 sign_in_route(register_path: "/register") 27 29 sign_out_route AuthController 28 30 auth_routes_for Sower.Accounts.User, to: AuthController