Files
nixpkgs/pkgs/by-name/ya/yaml2nix/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

56 lines
1.3 KiB
Nix

{
lib,
rustPlatform,
fetchFromGitHub,
nix-update-script,
testers,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "yaml2nix";
version = "0.3.0";
src = fetchFromGitHub {
owner = "euank";
repo = "yaml2nix";
tag = "v${finalAttrs.version}";
hash = "sha256-DkHWWpvBco2yodyOk40LjTNcoaJ1bFKf0JY9OwWgy5M=";
};
cargoHash = "sha256-3N0V/5lqiE2lTXu9oUsO3FOXhWqkNlomceqIVDGGuOM=";
passthru = {
tests.convert = testers.runCommand {
name = "${finalAttrs.pname}-convert-test";
nativeBuildInputs = [ finalAttrs.finalPackage ];
script = ''
cat <<EOF > test.yaml
foo: "bar"
baz:
- qux
EOF
cat <<EOF > expected.nix
{ foo = "bar"; baz = [ "qux" ]; }
EOF
yaml2nix test.yaml > test.nix
diff test.nix expected.nix && touch $out
'';
};
updateScript = nix-update-script { };
};
meta = {
description = "Command line tool to convert YAML into a Nix expression";
homepage = "https://github.com/euank/yaml2nix";
changelog = "https://github.com/euank/yaml2nix/releases/tag/${finalAttrs.src.tag}";
maintainers = with lib.maintainers; [
gepbird
];
license = lib.licenses.gpl3Plus;
platforms = lib.platforms.unix;
mainProgram = "yaml2nix";
};
})