-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpackage.nix
44 lines (36 loc) · 930 Bytes
/
package.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{ lib
, stdenvNoCC
, python3
, ansible
, pkgs
, vars
, as-sets
}:
stdenvNoCC.mkDerivation {
pname = "routing-rocks-policy";
version = "2.1.17";
src = ./.;
buildInputs = [
ansible
python3
];
dontBuild = true;
as_set_file = pkgs.writeText "as-sets.conf" as-sets;
var_file = pkgs.writeText "vars.yml" vars;
installPhase = ''
runHook preInstall
export HOME=$(pwd)
export ANSIBLE_REMOTE_TEMP="/tmp/.ansible"
mkdir -p $out
${pkgs.ansible}/bin/ansible -c local -m include_role -a "name=$(pwd)" -e @$var_file \
-e bird_config_dir=$out -e skip_handler=true -e owner=$(whoami) localhost
cp $as_set_file $out/bird.d/as-sets/as-sets.conf
runHook postInstall
'';
meta = with lib; {
description = "routing-rocks routing policy";
homepage = "https://github.com/czerwonk/routing-rocks-policy-role";
license = licenses.mit;
platforms = platforms.unix;
};
}