/release.nix

https://github.com/input-output-hk/cardano-sl · Nix · 86 lines · 86 code · 0 blank · 0 comment · 4 complexity · 9fe9af70c9b7cdec16462599b252d47d MD5 · raw file

  1. let
  2. commonLib = import ./lib.nix;
  3. disabled = [];
  4. in { cardano ? { outPath = ./.; rev = "abcdef"; }, ... }@args:
  5. let
  6. getArchDefault = system: let
  7. table = {
  8. x86_64-linux = import ./. { target = "x86_64-linux"; gitrev = cardano.rev; };
  9. x86_64-darwin = import ./. { target = "x86_64-darwin"; gitrev = cardano.rev; };
  10. x86_64-windows = import ./. { target = "x86_64-windows"; gitrev = cardano.rev; };
  11. };
  12. in table.${system};
  13. default = getArchDefault builtins.currentSystem;
  14. makeConnectScripts = cluster: let
  15. getScript = name: {
  16. x86_64-linux = (getArchDefault "x86_64-linux").connectScripts.${cluster}.${name};
  17. x86_64-darwin = (getArchDefault "x86_64-darwin").connectScripts.${cluster}.${name};
  18. };
  19. in {
  20. explorer = getScript "explorer";
  21. proposal-ui = getScript "proposal-ui";
  22. wallet = getScript "wallet";
  23. };
  24. wrapDockerImage = cluster: let
  25. images = (getArchDefault "x86_64-linux").dockerImages;
  26. wrapImage = image: commonLib.pkgs.runCommand "${image.name}-hydra" {} ''
  27. mkdir -pv $out/nix-support/
  28. cat <<EOF > $out/nix-support/hydra-build-products
  29. file dockerimage ${image}
  30. EOF
  31. '';
  32. in {
  33. wallet = wrapImage images.${cluster}.wallet;
  34. explorer = wrapImage images.${cluster}.explorer;
  35. };
  36. makeRelease = cluster: {
  37. name = cluster;
  38. value = {
  39. connectScripts = makeConnectScripts cluster;
  40. dockerImage = wrapDockerImage cluster;
  41. };
  42. };
  43. in
  44. commonLib.pkgs.lib.mapAttrsRecursiveCond
  45. (as: !(as ? "type" && as.type == "derivation"))
  46. (path: v: if (builtins.elem path disabled) then null else v)
  47. (commonLib.nix-tools.release-nix {
  48. _this = cardano;
  49. package-set-path = ./nix/nix-tools.nix;
  50. packages = [
  51. "cardano-sl"
  52. "cardano-sl-auxx"
  53. "cardano-sl-chain"
  54. "cardano-sl-core"
  55. "cardano-sl-crypto"
  56. "cardano-sl-db"
  57. "cardano-sl-generator"
  58. "cardano-sl-infra"
  59. "cardano-sl-faucet"
  60. "cardano-sl-networking"
  61. "cardano-sl-node"
  62. "cardano-sl-tools"
  63. "cardano-sl-util"
  64. "cardano-sl-x509"
  65. "cardano-wallet"
  66. "cardano-sl-explorer"
  67. "cardano-sl-cluster"
  68. ];
  69. extraBuilds = {
  70. inherit (default) tests demoCluster explorerFrontend faucetFrontend explorerPythonAPI;
  71. daedalus-bridge = commonLib.pkgs.lib.mapAttrs (k: v: (getArchDefault k).daedalus-bridge) {
  72. x86_64-linux = 1;
  73. x86_64-darwin = 1;
  74. x86_64-windows = 1;
  75. };
  76. } // (builtins.listToAttrs (map makeRelease [ "mainnet" "staging" "demo" "testnet" ]));
  77. required-targets = jobs: [
  78. jobs.nix-tools.exes.cardano-sl-node.x86_64-linux
  79. jobs.nix-tools.exes.cardano-sl-auxx.x86_64-linux
  80. jobs.nix-tools.exes.cardano-sl-faucet.x86_64-linux
  81. jobs.nix-tools.exes.cardano-sl-explorer.x86_64-linux
  82. jobs.nix-tools.exes.cardano-wallet.x86_64-linux
  83. jobs.nix-tools.exes.cardano-wallet.x86_64-darwin
  84. ] ++ (builtins.attrValues jobs.tests)
  85. ++ (builtins.attrValues jobs.daedalus-bridge);
  86. } (builtins.removeAttrs args ["cardano"]))