Deployment and lifecycle management for Nix
0
fork

Configure Feed

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

feat(server): working bootstrap script

+64 -6
+37
config/runtime.exs
··· 29 29 } 30 30 } 31 31 }, 32 + "clients" => %{ 33 + "type" => "object", 34 + "properties" => %{ 35 + "x86_64-linux" => %{ 36 + "type" => "object", 37 + "properties" => %{ 38 + "path" => %{ 39 + "type" => "string" 40 + } 41 + } 42 + }, 43 + "aarch64-linux" => %{ 44 + "type" => "object", 45 + "properties" => %{ 46 + "path" => %{ 47 + "type" => "string" 48 + } 49 + } 50 + }, 51 + "x86_64-darwin" => %{ 52 + "type" => "object", 53 + "properties" => %{ 54 + "path" => %{ 55 + "type" => "string" 56 + } 57 + } 58 + }, 59 + "aarch64-darwin" => %{ 60 + "type" => "object", 61 + "properties" => %{ 62 + "path" => %{ 63 + "type" => "string" 64 + } 65 + } 66 + } 67 + } 68 + }, 32 69 "database" => %{ 33 70 "type" => "object", 34 71 "properties" => %{
+1 -1
dev-server.json
··· 21 21 ], 22 22 "clients": { 23 23 "x86_64-linux": { 24 - "path": "/nix/store/path-to-client" 24 + "path": "/nix/store/2qlsz08lajq99nlacwyijb7dlmvf39g2-sower-0.3.1" 25 25 } 26 26 }, 27 27 "log_level": "debug",
+3 -3
lib/sower_web/controllers/app_controller.ex
··· 2 2 use SowerWeb, :controller 3 3 4 4 def client_script(conn, _params) do 5 - case Application.fetch_env(:sower, :client_store_path) do 6 - {:ok, client_store_path} -> 5 + case Application.fetch_env(:sower, :clients) do 6 + {:ok, clients} -> 7 7 render(conn |> put_root_layout(false), :client_script, 8 8 layout: false, 9 - client_store_path: client_store_path 9 + clients: clients 10 10 ) 11 11 12 12 :error ->
+23 -2
lib/sower_web/controllers/app_html/client_script.sh.heex
··· 2 2 3 3 # TODO: bootstrap a host by overriding cache URL and key 4 4 5 - echo "Hi" 6 - nix-store --realize <%= @client_store_path %> 5 + arch=$(uname -m) 6 + os=$(uname -s | tr [:upper:] [:lower:]) 7 + 8 + if [[ "$os" == "darwin" && "$arch" == "arm64" ]]; then 9 + arch="aarch64" 10 + fi 11 + 12 + system="${arch}-linux" 13 + echo ":: Found system ${system}" 14 + 15 + case "$system" in 16 + <%= for {arch, props} <- @clients do %> 17 + 18 + <%= arch %>) 19 + nix-store --realize <%= props |> Keyword.get(:path) %> 20 + exec <%= props |> Keyword.get(:path) %>/bin/sower "$@" 21 + ;; 22 + <% end %> 23 + *) 24 + echo "!! Unsupported system!" 25 + exit 1 26 + ;; 27 + esac