From d6cee31b04d038785139360fee8988c422baeb53 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Mon, 13 Jul 2015 06:56:53 -0700 Subject: [PATCH 1/3] heyefi service: init --- nixos/modules/module-list.nix | 1 + nixos/modules/services/networking/heyefi.nix | 87 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 3 files changed, 90 insertions(+) create mode 100644 nixos/modules/services/networking/heyefi.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index f74b16f678f..a03cd732c17 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 00000000000..741851a8ff4 --- /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 ]; + + }; + +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e6ad3607854..8bf28b89b5b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6523,6 +6523,8 @@ let herqq = callPackage ../development/libraries/herqq { }; + heyefi = haskellPackages.heyefi; + hidapi = callPackage ../development/libraries/hidapi { libusb = libusb1; }; From d11edff86088569e82d3947227cae96790438494 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Tue, 14 Jul 2015 06:54:51 -0700 Subject: [PATCH 2/3] heyefi service: use mkEnableOption --- nixos/modules/services/networking/heyefi.nix | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/nixos/modules/services/networking/heyefi.nix b/nixos/modules/services/networking/heyefi.nix index 741851a8ff4..0f55c1a5b8f 100644 --- a/nixos/modules/services/networking/heyefi.nix +++ b/nixos/modules/services/networking/heyefi.nix @@ -15,6 +15,8 @@ in services.heyefi = { + enable = mkEnableOption "heyefi"; + cardMacaddress = mkOption { default = ""; description = '' @@ -36,13 +38,6 @@ in ''; }; - enable = mkOption { - default = false; - description = '' - Enable heyefi, an Eye-Fi upload server. - ''; - }; - user = mkOption { default = "root"; description = '' From 9d485d9433e98a7cde0be4867d844c42ac373ad5 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Tue, 14 Jul 2015 06:56:30 -0700 Subject: [PATCH 3/3] heyefi service: make uploadDir path more generic and a string --- nixos/modules/services/networking/heyefi.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/heyefi.nix b/nixos/modules/services/networking/heyefi.nix index 0f55c1a5b8f..fc2b5a84857 100644 --- a/nixos/modules/services/networking/heyefi.nix +++ b/nixos/modules/services/networking/heyefi.nix @@ -32,7 +32,7 @@ in }; uploadDir = mkOption { - example = /home/ryantm/picture; + example = "/home/username/pictures"; description = '' The directory to upload the files to. '';