Skip to content

Commit 50a53c5

Browse files
committed
ci: Add dpm.
1 parent a45201f commit 50a53c5

File tree

6 files changed

+67
-0
lines changed

6 files changed

+67
-0
lines changed

.circleci/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ commands:
2525
key: daml-{{ checksum ".circleci/install-daml" }}
2626
paths:
2727
- /home/circleci/.daml
28+
- restore_cache:
29+
key: daml-{{ checksum ".circleci/install-dpm" }}
30+
- run:
31+
command: .circleci/install-dpm
32+
- save_cache:
33+
key: daml-{{ checksum ".circleci/install-dpm" }}
34+
paths:
35+
- /home/circleci/.dpm
2836
- restore_cache:
2937
key: python-deps-{{ checksum "poetry.lock" }}-<<parameters.python_version>>
3038
- run:

.circleci/install-dpm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) 2017-2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
set -xeuo pipefail
5+
6+
dpm install 3.4.9

.envrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
# Copyright (c) 2017-2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
14
watch_dir nix
25
use flake ./nix
6+
.circleci/install-dpm

nix/dpm.nix

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{ pkgs ? import <nixpkgs> {} }:
2+
3+
let
4+
dpmPath = "europe-docker.pkg.dev/da-images/public/components/dpm";
5+
dpmVersion = "1.0.6";
6+
dpmRef = "${dpmPath}:${dpmVersion}";
7+
8+
dpmHashes = {
9+
"x86_64-linux" = "sha256-WFly1i2QRKDV5OIAOaguBrlyTO9zb5MBvZdZy3aZqwo=";
10+
"aarch64-linux" = "sha256-jEYFr7q1EXa1NUF25af39E+ZUqoWLvufIGDdrCnVi60=";
11+
"x86_64-darwin" = "sha256-nUmd3isAUmoehdeqSiak7StA8R2s+tHIvbWI/6PEg1w=";
12+
"aarch64-darwin" = "sha256-WCk/5SYrf9/GSibhqNq24JdGXODLrlp+hlFfn+d45kQ=";
13+
};
14+
dpmHash = dpmHashes.${pkgs.system} or (throw "Unsupported system: ${pkgs.system}");
15+
16+
ociPlatforms = {
17+
"x86_64-linux" = "linux/amd64";
18+
"aarch64-linux" = "linux/arm64";
19+
"x86_64-darwin" = "darwin/amd64";
20+
"aarch64-darwin" = "darwin/arm64";
21+
};
22+
ociPlatform = ociPlatforms.${pkgs.system} or (throw "Unsupported system: ${pkgs.system}");
23+
in
24+
pkgs.stdenv.mkDerivation {
25+
pname = "dpm";
26+
version = dpmVersion;
27+
28+
src = pkgs.stdenv.mkDerivation {
29+
name = "dpm-pull-${dpmRef}.${ociPlatform}";
30+
31+
nativeBuildInputs = [ pkgs.oras pkgs.cacert ];
32+
33+
buildCommand = ''
34+
set -e
35+
echo "Pulling dpm component from ${dpmRef} for platform ${ociPlatform}"
36+
oras pull --platform ${ociPlatform} -o $out ${dpmRef}
37+
'';
38+
outputHashMode = "recursive";
39+
outputHashAlgo = "sha256";
40+
outputHash = dpmHash;
41+
};
42+
43+
installPhase = ''
44+
mkdir -p $out/bin
45+
install -Dm755 $src/dpm $out/bin/dpm
46+
'';
47+
}

nix/overlays.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
canton-3 = super.callPackage ./canton-3/default.nix {};
44
daml-protos-2 = super.callPackage ./daml-protos-2/default.nix {};
55
daml-protos-3 = super.callPackage ./daml-protos-3/default.nix {};
6+
dpm = super.callPackage ./dpm.nix {};
67
protopack = super.callPackage ./protopack/default.nix {};
78
})]

nix/shell.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ let
99

1010
requiredPackages = with pkgs; ([
1111
# these packages are required both in CI and for local development
12+
dpm
1213
glibcLocales
1314
jq
1415
go

0 commit comments

Comments
 (0)