builtins.hh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* GNU Guix --- Functional package management for GNU
  2. Copyright (C) 2016, 2017 Ludovic Courtès <ludo@gnu.org>
  3. This file is part of GNU Guix.
  4. GNU Guix is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or (at
  7. your option) any later version.
  8. GNU Guix is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
  14. /* Interface to built-in derivation builders. */
  15. #pragma once
  16. #include <derivations.hh>
  17. #include <map>
  18. #include <string>
  19. namespace nix {
  20. inline bool isBuiltin(const Derivation & drv)
  21. {
  22. return string(drv.builder, 0, 8) == "builtin:";
  23. }
  24. /* Build DRV, which lives at DRVPATH. */
  25. typedef void (*derivationBuilder) (const Derivation &drv,
  26. const std::string &drvPath,
  27. const std::string &output);
  28. /* Return the built-in builder called BUILDER, or NULL if none was
  29. found. */
  30. derivationBuilder lookupBuiltinBuilder(const std::string &builder);
  31. /* Return the list of supported built-in builder names. */
  32. std::list<std::string> builtinBuilderNames();
  33. }