summary refs log tree commit diff
path: root/pkgs/build-support/writers/default.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-03-20 18:46:43 +0100
committertv <tv@krebsco.de>2019-03-20 18:47:48 +0100
commit7437268cd4962cb003198211063cfcda2703e01a (patch)
tree9ede494eb5e00831f302f00756b89396a03809cc /pkgs/build-support/writers/default.nix
parent3b7c3cbdd06fed81c50086deab8899b274d78d68 (diff)
downloadnixpkgs-7437268cd4962cb003198211063cfcda2703e01a.tar
nixpkgs-7437268cd4962cb003198211063cfcda2703e01a.tar.gz
nixpkgs-7437268cd4962cb003198211063cfcda2703e01a.tar.bz2
nixpkgs-7437268cd4962cb003198211063cfcda2703e01a.tar.lz
nixpkgs-7437268cd4962cb003198211063cfcda2703e01a.tar.xz
nixpkgs-7437268cd4962cb003198211063cfcda2703e01a.tar.zst
nixpkgs-7437268cd4962cb003198211063cfcda2703e01a.zip
build-support writers: add writeNginxConfig
Diffstat (limited to 'pkgs/build-support/writers/default.nix')
-rw-r--r--pkgs/build-support/writers/default.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/build-support/writers/default.nix b/pkgs/build-support/writers/default.nix
index 6e932ce860f..3454450c1f3 100644
--- a/pkgs/build-support/writers/default.nix
+++ b/pkgs/build-support/writers/default.nix
@@ -178,6 +178,16 @@ rec {
   writeJSBin = name:
     writeJS "/bin/${name}";
 
+  writeNginxConfig = name: text: pkgs.runCommand name {
+    inherit text;
+    passAsFile = [ "text" ];
+  } /* sh */ ''
+    cp "$textPath" $out
+    ${pkgs.nginx-config-formatter}/bin/nginxfmt $out
+    ${pkgs.gnused}/bin/sed -i '/^$/d' $out
+    ${pkgs.gixy}/bin/gixy $out
+  '';
+
   # writePerl takes a name an attributeset with libraries and some perl sourcecode and
   # returns an executable
   #