Skip to content

Instantly share code, notes, and snippets.

@dwf
Created January 2, 2024 00:33
Show Gist options
  • Save dwf/e2d8173010168f4e5097d96e3390653b to your computer and use it in GitHub Desktop.
Save dwf/e2d8173010168f4e5097d96e3390653b to your computer and use it in GitHub Desktop.
Minimal example of YAML as flake output
# Copyright 2024 Google LLC.
# SPDX-License-Identifier: Apache-2.0
{
description = "Demo of generating a YAML file as a flake output";
outputs = { self, nixpkgs }: let
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
in {
packages = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
default = (pkgs.formats.yaml { }).generate "foobar.yaml" { foo = "bar"; };
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment