summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorRyan Mulligan <ryan@ryantm.com>2015-07-13 06:56:53 -0700
committerRyan Mulligan <ryan@ryantm.com>2015-07-14 06:42:02 -0700
commitd6cee31b04d038785139360fee8988c422baeb53 (patch)
treeb817388575583a907fef483dbe29cf33d61a8520 /nixos
parent6c6a06b99f0263b82323824d6eebb4ba77c503dd (diff)
downloadnixlib-d6cee31b04d038785139360fee8988c422baeb53.tar
nixlib-d6cee31b04d038785139360fee8988c422baeb53.tar.gz
nixlib-d6cee31b04d038785139360fee8988c422baeb53.tar.bz2
nixlib-d6cee31b04d038785139360fee8988c422baeb53.tar.lz
nixlib-d6cee31b04d038785139360fee8988c422baeb53.tar.xz
nixlib-d6cee31b04d038785139360fee8988c422baeb53.tar.zst
nixlib-d6cee31b04d038785139360fee8988c422baeb53.zip
heyefi service: init
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/networking/heyefi.nix87
2 files changed, 88 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index f74b16f678fd..a03cd732c17e 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -286,6 +286,7 @@
   ./services/networking/gogoclient.nix
   ./services/networking/gvpe.nix
   ./services/networking/haproxy.nix
+  ./services/networking/heyefi.nix
   ./services/networking/hostapd.nix
   ./services/networking/i2pd.nix
   ./services/networking/i2p.nix
diff --git a/nixos/modules/services/networking/heyefi.nix b/nixos/modules/services/networking/heyefi.nix
new file mode 100644
index 000000000000..741851a8ff47
--- /dev/null
+++ b/nixos/modules/services/networking/heyefi.nix
@@ -0,0 +1,87 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+  cfg = config.services.heyefi;
+in
+
+{
+
+  ###### interface
+
+  options = {
+
+    services.heyefi = {
+
+      cardMacaddress = mkOption {
+        default = "";
+        description = ''
+          An Eye-Fi card MAC address.
+          '';
+      };
+
+      uploadKey = mkOption {
+        default = "";
+        description = ''
+          An Eye-Fi card's upload key.
+          '';
+      };
+
+      uploadDir = mkOption {
+        example = /home/ryantm/picture;
+        description = ''
+          The directory to upload the files to.
+          '';
+      };
+
+      enable = mkOption {
+        default = false;
+        description = ''
+          Enable heyefi, an Eye-Fi upload server.
+        '';
+      };
+
+      user = mkOption {
+        default = "root";
+        description = ''
+          heyefi will be run under this user (user must exist,
+          this can be your user name).
+        '';
+      };
+
+    };
+
+  };
+
+
+  ###### implementation
+
+  config = mkIf cfg.enable {
+
+    systemd.services.heyefi =
+      {
+        description = "heyefi service";
+        after = [ "network.target" ];
+        wantedBy = [ "multi-user.target" ];
+        serviceConfig = {
+          User = "${cfg.user}";
+          Restart = "always";
+          ExecStart = "${pkgs.heyefi}/bin/heyefi";
+        };
+
+      };
+
+    environment.etc."heyefi/heyefi.config".text =
+      ''
+        # /etc/heyefi/heyefi.conf: DO NOT EDIT -- this file has been generated automatically.
+        cards = [["${config.services.heyefi.cardMacaddress}","${config.services.heyefi.uploadKey}"]]
+        upload_dir = "${toString config.services.heyefi.uploadDir}"
+      '';
+
+    environment.systemPackages = [ pkgs.heyefi ];
+
+  };
+
+}