diff --git a/default.nix b/default.nix index cb10ddc..b0abfc3 100644 --- a/default.nix +++ b/default.nix @@ -23,7 +23,7 @@ deps = fetchMixDeps { pname = "mix-deps-${pname}"; inherit version src; - sha256 = "sha256-4g5lUlr5+l+mNVp0InZkx6X31g2cckI8NNQp37QgBis="; + sha256 = "sha256-/9Ushiv0z1wJL9FwebUF4gem8IOwlUPnQuDBiXV0Ib8="; }; hash = builtins.substring 11 32 "${./mix.lock}"; in diff --git a/flake.nix b/flake.nix index 2ccc78f..f371f6e 100644 --- a/flake.nix +++ b/flake.nix @@ -50,8 +50,10 @@ systemd.user.services.frajtano = { Unit.Description = "frajtano"; Unit.After = ["default.target"]; + Service.Type = "notify"; Service.Environment = ["'FRAJTANO_DIR=${cfg.dir}'"]; - Service.ExecStart = "${self.packages.${pkgs.system}.default}/bin/frajtano start"; + Service.ExecSearchPath = ["${self.packages.${pkgs.system}.default}/bin"]; + Service.ExecStart = "frajtano start"; Install.WantedBy = ["default.target"]; }; diff --git a/lib/frajtano.ex b/lib/frajtano.ex index f8667be..c112834 100644 --- a/lib/frajtano.ex +++ b/lib/frajtano.ex @@ -22,6 +22,7 @@ defmodule Frajtano.Supervisor do Frajtano.Agent, {Task.Supervisor, name: Frajtano.ClientSupervisor}, {Frajtano.Listener, [Application.fetch_env!(:frajtano, :listen_path)]}, + :systemd.ready(), ] Supervisor.init(children, strategy: :one_for_one) diff --git a/mix.exs b/mix.exs index 68d63c6..b63208b 100644 --- a/mix.exs +++ b/mix.exs @@ -22,6 +22,7 @@ defmodule Frajtano.MixProject do [ {:muontrap, "~> 1.0"}, {:temp, "~> 0.4"}, + {:systemd, "~> 0.6"}, ] end end diff --git a/mix.lock b/mix.lock index 996ae01..5dd38a8 100644 --- a/mix.lock +++ b/mix.lock @@ -1,5 +1,7 @@ %{ "elixir_make": {:hex, :elixir_make, "0.8.4", "4960a03ce79081dee8fe119d80ad372c4e7badb84c493cc75983f9d3bc8bde0f", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.0", [hex: :certifi, repo: "hexpm", optional: true]}], "hexpm", "6e7f1d619b5f61dfabd0a20aa268e575572b542ac31723293a4c1a567d5ef040"}, + "enough": {:hex, :enough, "0.1.0", "0254710c52d324e2dadde54cb56fbb80a792c2eb285669b8379efd0752bf89f0", [:rebar3], [], "hexpm", "0460c7abda5f5e0ea592b12bc6976b8a5c4b96e42f332059cd396525374bf9a1"}, "muontrap": {:hex, :muontrap, "1.5.0", "bf5c273872379968615a39974458328209ac97fa1f588396192131ff973d1ca2", [:make, :mix], [{:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "daf605e877f60b5be9215e3420d7971fc468677b29921e40915b15fd928273d4"}, + "systemd": {:hex, :systemd, "0.6.2", "aaa24f1e3e6cb978c45369768b1abd766a0dbff637ed61254ca64797bcec9963", [:rebar3], [{:enough, "~> 0.1.0", [hex: :enough, repo: "hexpm", optional: false]}], "hexpm", "5062b911800c1ab05157c7bf9a9fbe23dd24c58891c87fd12d2e3ed8fc1708b8"}, "temp": {:hex, :temp, "0.4.9", "eb6355bfa7925a568b3d9eb3bb57e89aa6d2b78bfe8dfb6b698e090631b7f41f", [:mix], [], "hexpm", "bc8bf7b27d9105bef933ef4bf4ba37ac6b899dbeba329deaa88c60b62d6b4b6d"}, }