summaryrefslogtreecommitdiff
path: root/custom/tinc
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2015-11-04 14:22:39 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2015-11-04 14:22:39 +0100
commitdb0ee933e845c51699dabd65cf6c0a37c7215360 (patch)
treeea94095fbf26477f785f1986d8df8b2c4e7a7841 /custom/tinc
parentce793d1c224835fe5c99cfca7d03bf5aa3ecee4d (diff)
downloadnixos-db0ee933e845c51699dabd65cf6c0a37c7215360.tar
nixos-db0ee933e845c51699dabd65cf6c0a37c7215360.tar.gz
nixos-db0ee933e845c51699dabd65cf6c0a37c7215360.tar.bz2
nixos-db0ee933e845c51699dabd65cf6c0a37c7215360.tar.xz
nixos-db0ee933e845c51699dabd65cf6c0a37c7215360.zip
environment for generate_hostfile.hs
Diffstat (limited to 'custom/tinc')
-rwxr-xr-xcustom/tinc/generate_hostfile.hs5
-rw-r--r--custom/tinc/shell.nix13
2 files changed, 14 insertions, 4 deletions
diff --git a/custom/tinc/generate_hostfile.hs b/custom/tinc/generate_hostfile.hs
index 90fa11b7..6d4217fd 100755
--- a/custom/tinc/generate_hostfile.hs
+++ b/custom/tinc/generate_hostfile.hs
@@ -9,11 +9,8 @@ main = readDirectory "." >>= putStrLn . genHostFile
9genHostFile :: AnchoredDirTree String -> String 9genHostFile :: AnchoredDirTree String -> String
10genHostFile (_ :/ (Dir _ contents)) = "{\n" ++ entries ++ "\n}\n" 10genHostFile (_ :/ (Dir _ contents)) = "{\n" ++ entries ++ "\n}\n"
11 where 11 where
12 entries = concat [ genEntry name content | (File name content) <- contents, name `notElem` hidden ] 12 entries = concatMap $ [genEntry name content | (File name content) <- contents]
13 genEntry fileName fileContent = unlines . indent $ [ "\"" ++ fileName ++ "\" = ''" ] ++ indent (lines fileContent) ++ [ "'';" ] 13 genEntry fileName fileContent = unlines . indent $ [ "\"" ++ fileName ++ "\" = ''" ] ++ indent (lines fileContent) ++ [ "'';" ]
14 hidden = [ "to_nix.sh"
15 , "hosts.nix"
16 ]
17 14
18indent :: [String] -> [String] 15indent :: [String] -> [String]
19indent = map (" " ++) 16indent = map (" " ++)
diff --git a/custom/tinc/shell.nix b/custom/tinc/shell.nix
new file mode 100644
index 00000000..b514600f
--- /dev/null
+++ b/custom/tinc/shell.nix
@@ -0,0 +1,13 @@
1{ pkgs ? (import <nixpkgs> {})
2}:
3
4pkgs.stdenv.mkDerivation rec {
5 name = "tinc-env";
6 buildInputs = [ (pkgs.haskellPackages.ghcWithPackages (p:
7 with p; [ directory-tree
8 ]))
9 ];
10 shellHook = ''
11 export PROMPT_INFO="${name}"
12 '';
13}