xml-nix/to-xml-file.nix

11 lines
300 B
Nix
Raw Permalink Normal View History

2022-06-21 11:56:49 -07:00
{ lib, pkgs, toXML, ... }:
name: content:
let preformatXML = pkgs.writeText "${name}-preformat.xml" (toXML content);
in pkgs.stdenv.mkDerivation {
name = "${name}.xml";
phases = [ "installPhase" ];
buildInputs = with pkgs; [ xmlformat ];
installPhase = "xmlformat ${preformatXML} > $out";
}