Last active
November 19, 2018 02:43
-
-
Save WhittlesJr/ecf011a9658eadf7ca491459c32f6f4c to your computer and use it in GitHub Desktop.
Trying to implement this... https://github.com/gazoscalvertos/Hass-Custom-Alarm/blob/master/guidance/configuration.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ stdenv, fetchFromGitHub }: | |
with stdenv.lib; | |
stdenv.mkDerivation rec { | |
name = "hass-custom-alarm-${version}"; | |
version = "1.3.1"; | |
src = fetchFromGitHub { | |
owner = "gazoscalvertos"; | |
repo = "Hass-Custom-Alarm"; | |
rev = "v${version}"; | |
sha256 = "1xlwsyg45kmvx3gvkv7k5imbhkxan0s573lalkcqcflf078w7555"; | |
}; | |
dontInstall = true; | |
unpackPhase = '' | |
mkdir $out | |
cp -r * $out/. | |
''; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, lib, pkgs, ... }: | |
with lib; | |
let | |
cfg = config.services.hass-custom-alarm; | |
hassConfig = config.services.home-assistant; | |
configDir = hassConfig.configDir; | |
in { | |
options.services.hass-custom-alarm = { | |
enable = mkEnableOption "Home Assistant Custom Alarm Panel"; | |
}; | |
config = mkIf cfg.enable { | |
environment.systemPackages = with pkgs; [ | |
hass-custom-alarm | |
]; | |
systemd.services.hass-custom-alarm = { | |
description = "Home Assistant Custom Alarm Panel"; | |
before = [ "home-assistant.service" ]; | |
preStart = '' | |
mkdir -p ${configDir}/custom-alarm | |
mkdir -p ${configDir}/www/alarm | |
mkdir -p ${configDir}/www/lib | |
mkdir -p ${configDir}/panels | |
mkdir -p ${configDir}/custom_components/alarm_control_panel | |
ln -s ${pkgs.hass-custom-alarm}/alarm.yaml ${configDir}/custom-alarm/alarm.yaml | |
ln -s ${pkgs.hass-custom-alarm}/www/alarm/alarm.css ${configDir}/www/alarm/alarm.css | |
ln -s ${pkgs.hass-custom-alarm}/www/lib/countdown360.js ${configDir}/www/lib/countdown360.js | |
ln -s ${pkgs.hass-custom-alarm}/www/lib/jquery-3.2.1.min.js ${configDir}/www/lib/jquery-3.2.1.min.js | |
ln -s ${pkgs.hass-custom-alarm}/panels/alarm.html ${configDir}/panels/alarm.html | |
''; | |
serviceConfig = { | |
Type = "oneshot"; | |
RemainAfterExit = true; | |
User = "hass"; | |
Group = "hass"; | |
Restart = "no"; | |
ProtectSystem = "strict"; | |
ReadWritePaths = "${configDir}"; | |
}; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment