From 8d405037f941abaaa2f43b3de1d442bea1b807c6 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 7 Sep 2022 19:09:45 -0700 Subject: feat(tools/sendsms): build sendsms with nix via naersk I can now run `nix build .#tools.sendsms` to build the tool, or get it deployed on a machine. Change-Id: I82c733be466adb229d98414fd1229e05f355dd7d --- tools/sendsms/README.org | 8 +++++--- tools/sendsms/default.nix | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 tools/sendsms/default.nix (limited to 'tools/sendsms') diff --git a/tools/sendsms/README.org b/tools/sendsms/README.org index 8f3ffdd..755d086 100644 --- a/tools/sendsms/README.org +++ b/tools/sendsms/README.org @@ -2,7 +2,9 @@ A CLI to send SMS via [[https://console.twilio.com][twilio's API]]. -** Usage -The tool supports subcommands, which are profiles with predefined messages. +* Usage +The tool supports sub-commands, which are profiles with predefined messages. -For example, you can write a systemd unit that is triggered after a reboot to send an SMS with =sendsms reboot=. The SMS will contain the hostname and IP of a predefined interface. +For example, you can write a =systemd= unit that is triggered after a reboot to send an SMS with =sendsms reboot=. The SMS will contain the host's name and the IP of a predefined interface. +* Build +This can be build via =nix build .#tools.sendsms= from the root of the repository, or =cargo build= from inside the directory. diff --git a/tools/sendsms/default.nix b/tools/sendsms/default.nix new file mode 100644 index 0000000..6c9b79c --- /dev/null +++ b/tools/sendsms/default.nix @@ -0,0 +1,15 @@ +{ pkgs, naersk, ... }: + +naersk.lib."${pkgs.system}".buildPackage { + src = builtins.filterSource + (path: type: + type != "directory" || builtins.baseNameOf path != "target") + ./.; + + nativeBuildInputs = with pkgs; [ pkg-config ]; + buildInputs = with pkgs; [ openssl ]; + + remapPathPrefix = true; + doCheck = true; + copyLibs = true; +} -- cgit 1.4.1