4da1e64c03
This shows how people can use tvix_serde to deserialise configuration structs for their programs from Nix code. Change-Id: I71bf4e03dce19dddafe67dd729b4e4b10719a739 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7945 Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
22 lines
414 B
Nix
22 lines
414 B
Nix
# This is content for the `Data` struct, written in intentionally
|
|
# convoluted Nix code.
|
|
let
|
|
mkFlavour = flavour: name: {
|
|
inherit name;
|
|
value = flavour;
|
|
};
|
|
|
|
tasty = mkFlavour "Tasty";
|
|
okay = mkFlavour "Okay";
|
|
eww = mkFlavour "Eww";
|
|
in
|
|
{
|
|
name = "exhaustive list of foods";
|
|
|
|
foods = builtins.listToAttrs [
|
|
(tasty "beef")
|
|
(okay "tomatoes")
|
|
(eww "olives")
|
|
(tasty "coffee")
|
|
];
|
|
}
|