From db0ee933e845c51699dabd65cf6c0a37c7215360 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 4 Nov 2015 14:22:39 +0100 Subject: environment for generate_hostfile.hs --- custom/tinc/generate_hostfile.hs | 5 +---- custom/tinc/shell.nix | 13 +++++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 custom/tinc/shell.nix (limited to 'custom') 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 genHostFile :: AnchoredDirTree String -> String genHostFile (_ :/ (Dir _ contents)) = "{\n" ++ entries ++ "\n}\n" where - entries = concat [ genEntry name content | (File name content) <- contents, name `notElem` hidden ] + entries = concatMap $ [genEntry name content | (File name content) <- contents] genEntry fileName fileContent = unlines . indent $ [ "\"" ++ fileName ++ "\" = ''" ] ++ indent (lines fileContent) ++ [ "'';" ] - hidden = [ "to_nix.sh" - , "hosts.nix" - ] indent :: [String] -> [String] indent = 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 @@ +{ pkgs ? (import {}) +}: + +pkgs.stdenv.mkDerivation rec { + name = "tinc-env"; + buildInputs = [ (pkgs.haskellPackages.ghcWithPackages (p: + with p; [ directory-tree + ])) + ]; + shellHook = '' + export PROMPT_INFO="${name}" + ''; +} -- cgit v1.2.3