Skip to content

Commit f97fab7

Browse files
chore: Pre release maintenance (#430)
* chore(nix): niv update * chore(cargo): Add shortcut for stackablectl * chore: Downgrade itertools ``` cargo update -p stackable-operator && make regenerate-nix ``` Trying to get rid of this problem: ``` error: hash mismatch in fixed-output derivation '/nix/store/pxj0czc4m04yswlrbzyhl1sa3ys1zksx-operator-rs-a16cafb.drv': specified: sha256-uP2GHSnjamcyvbV6garMP3WXVBm4vqkF3Rk6SZRjeQY= got: sha256-hmqUfsBYzcnjKJRX1nftgKvXbVU1Gzsy74ZlBb/L1c0= error: Cannot build '/nix/store/lmxxypxlm2icg5pfqa3gxbq3izhp16w3-rust_k8s-version-0.1.3.drv'. Reason: 1 dependency failed. Output paths: /nix/store/k45947bczra1x66f45pir1y7wi83z9zg-rust_k8s-version-0.1.3 /nix/store/q3ib7s2bf28vy8wbwz950ah24vqn8r3b-rust_k8s-version-0.1.3-lib error: Cannot build '/nix/store/9qb0g9pmjk8r6kjq6q7dc0m9rpv27bx9-rust_stackablectl-1.2.2.drv'. Reason: 1 dependency failed. Output paths: /nix/store/crbd5qa5rgh5fyi9qjryvmfy0382vw2p-rust_stackablectl-1.2.2 /nix/store/rwfzrl7hn67xfcrv34g5fshw401iznky-rust_stackablectl-1.2.2-lib ``` * chore: Bump stackable-operator * chore(nix): add crate2nix to the shell so we use the same version * chore(nix): remove crate-hashes and regenerate * chore(nix): Hard-code go version to 1.26 * chore(nix): Formatting * Apply suggestions from code review Co-authored-by: Techassi <git@techassi.dev> --------- Co-authored-by: Techassi <git@techassi.dev>
1 parent 3bb809c commit f97fab7

File tree

9 files changed

+143
-114
lines changed

9 files changed

+143
-114
lines changed

.cargo/config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[alias]
22
xtask = "run --package xtask --"
3+
stackablectl = "run --bin stackablectl --"

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
fail_fast: true
3+
exclude: ^(Cargo\.nix|crate-hashes\.json|nix/.*)$
34

45
default_language_version:
56
node: system

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.nix

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ serde_json = "1.0"
4949
serde_yaml = "0.9"
5050
sha2 = "0.10"
5151
snafu = { version = "0.9", features = ["futures"] }
52-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.107.0", default-features = false, features = ["crds", "kube-ws"] }
52+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.108.0", default-features = false, features = ["crds", "kube-ws"] }
5353
tera = "1.20"
5454
termion = "4.0"
5555
tokio = { version = "1.38", features = ["rt-multi-thread", "macros", "fs", "process", "io-std"] }

crate-hashes.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

default.nix

Lines changed: 73 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
{ sources ? import ./nix/sources.nix # managed by https://github.com/nmattia/niv
2-
, nixpkgs ? sources.nixpkgs
3-
, pkgs ? import nixpkgs {
1+
{
2+
sources ? import ./nix/sources.nix, # managed by https://github.com/nmattia/niv
3+
nixpkgs ? sources.nixpkgs,
4+
pkgs ? import nixpkgs {
45
overlays = [
56
# gomod2nix must be imported as a nixpkgs overlay
6-
(import (sources.gomod2nix+"/overlay.nix"))
7+
(import (sources.gomod2nix + "/overlay.nix"))
78
];
8-
}
9-
, release ? true
10-
, cargo ? import ./Cargo.nix {
9+
},
10+
release ? true,
11+
cargo ? import ./Cargo.nix {
1112
inherit nixpkgs pkgs release;
1213
defaultCrateOverrides = pkgs.defaultCrateOverrides // {
1314
stackable-cockpit-web = attrs: {
14-
nativeBuildInputs = [ pkgs.nodePackages.yarn pkgs.nodejs_20 ];
15-
preConfigure =
16-
''
17-
[[ ! -e node_modules ]] || rm -r node_modules
18-
ln -s ${web.nodeModules} node_modules
19-
'';
15+
nativeBuildInputs = [
16+
pkgs.nodePackages.yarn
17+
pkgs.nodejs_20
18+
];
19+
preConfigure = ''
20+
[[ ! -e node_modules ]] || rm -r node_modules
21+
ln -s ${web.nodeModules} node_modules
22+
'';
2023
};
2124
helm-sys = attrs: {
2225
GO_HELM_WRAPPER = goHelmWrapper + "/bin";
@@ -26,59 +29,66 @@
2629
utoipa-swagger-ui = attrs: rec {
2730
# utoipa-swagger-ui tries to redownload swagger-ui, which is blocked by Nix's sandboxing
2831
# so we download it instead, and tell it to use that
29-
SWAGGER_UI_DOWNLOAD_URL = "file://${pkgs.fetchurl {
30-
url = "https://github.com/swagger-api/swagger-ui/archive/refs/tags/v5.17.3.zip";
31-
hash = "sha256-zrb8feuuDzt/g6y7Tucfh+Y2BWZov0soyNPR5LBqKx4=";
32-
}}";
32+
SWAGGER_UI_DOWNLOAD_URL = "file://${
33+
pkgs.fetchurl {
34+
url = "https://github.com/swagger-api/swagger-ui/archive/refs/tags/v5.17.3.zip";
35+
hash = "sha256-zrb8feuuDzt/g6y7Tucfh+Y2BWZov0soyNPR5LBqKx4=";
36+
}
37+
}";
3338
};
3439
};
35-
}
36-
, meta ? pkgs.lib.importJSON ./nix/meta.json
37-
, dockerName ? "oci.stackable.tech/sandbox/${meta.operator.name}"
38-
, dockerTag ? null
39-
, web ? js2nix.buildEnv {
40+
},
41+
meta ? pkgs.lib.importJSON ./nix/meta.json,
42+
dockerName ? "oci.stackable.tech/sandbox/${meta.operator.name}",
43+
dockerTag ? null,
44+
web ? js2nix.buildEnv {
4045
# js2nix doesn't import peer dependencies, so we use overlays to patch them in explicitly
4146
# https://github.com/canva-public/js2nix/blob/d37912f6cc824e7f41bea7a481af1739ca195c8f/docs/usage.md#overriding
4247
package-json = ./web/package.json;
4348
yarn-lock = ./yarn.lock;
4449
overlays = [
4550
(self: super: {
4651
# TODO: remove once this https://github.com/canva-public/js2nix/issues/20 is resolved
47-
buildNodeModule = pkgs.lib.makeOverridable
48-
(args: (super.buildNodeModule args).override { doCheck = false; });
52+
buildNodeModule = pkgs.lib.makeOverridable (
53+
args: (super.buildNodeModule args).override { doCheck = false; }
54+
);
4955
})
5056
];
51-
}
52-
, goHelmWrapper ? pkgs.buildGoApplication {
57+
},
58+
goHelmWrapper ? pkgs.buildGoApplication {
59+
go = pkgs.go_1_26;
5360
pname = "go-helm-wrapper";
5461
version = "0.0";
55-
src = pkgs.runCommand "go-helm-wrapper-src" {}
56-
''
57-
mkdir $out
58-
cp ${./go.mod} $out/go.mod
59-
cp ${./go.sum} $out/go.sum
60-
cp -r ${./rust/helm-sys/go-helm-wrapper} $out/go-helm-wrapper
61-
'';
62+
src = pkgs.runCommand "go-helm-wrapper-src" { } ''
63+
mkdir $out
64+
cp ${./go.mod} $out/go.mod
65+
cp ${./go.sum} $out/go.sum
66+
cp -r ${./rust/helm-sys/go-helm-wrapper} $out/go-helm-wrapper
67+
'';
6268
pwd = ./rust/helm-sys/go-helm-wrapper;
6369
modules = ./gomod2nix.toml;
6470
ldflags = "-buildmode c-archive";
6571
allowGoReference = true;
66-
postBuild =
67-
''
68-
for pkg in $(getGoDirs ""); do
69-
buildFlags="-buildmode c-archive -o $GOPATH/bin/libgo-helm-wrapper.a" buildGoDir build "$pkg"
70-
done
71-
'';
72-
}
73-
, js2nix ? pkgs.callPackage sources.js2nix { nodejs = pkgs.nodejs_20; }
74-
, gomod2nix ? pkgs.callPackage sources.gomod2nix {}
72+
postBuild = ''
73+
for pkg in $(getGoDirs ""); do
74+
buildFlags="-buildmode c-archive -o $GOPATH/bin/libgo-helm-wrapper.a" buildGoDir build "$pkg"
75+
done
76+
'';
77+
},
78+
js2nix ? pkgs.callPackage sources.js2nix { nodejs = pkgs.nodejs_20; },
79+
gomod2nix ? pkgs.callPackage sources.gomod2nix { },
7580
}:
7681
rec {
77-
inherit cargo sources pkgs meta;
82+
inherit
83+
cargo
84+
sources
85+
pkgs
86+
meta
87+
;
7888
build = cargo.workspaceMembers.stackable-cockpitd.build.override {
7989
features = [ "ui" ];
8090
};
81-
entrypoint = build+"/bin/stackable-cockpitd";
91+
entrypoint = build + "/bin/stackable-cockpitd";
8292
# crds = pkgs.runCommand "${meta.operator.name}-crds.yaml" {}
8393
# ''
8494
# ${entrypoint} crd > $out
@@ -89,7 +99,9 @@ rec {
8999
tag = dockerTag;
90100
contents = [
91101
# Common debugging tools
92-
pkgs.bashInteractive pkgs.coreutils pkgs.util-linuxMinimal
102+
pkgs.bashInteractive
103+
pkgs.coreutils
104+
pkgs.util-linuxMinimal
93105
# Kerberos 5 must be installed globally to load plugins correctly
94106
pkgs.krb5
95107
# Make the whole cargo workspace available on $PATH
@@ -101,9 +113,14 @@ rec {
101113
fileRefVars = {
102114
PRODUCT_CONFIG = deploy/config-spec/properties.yaml;
103115
};
104-
in pkgs.lib.concatLists (pkgs.lib.mapAttrsToList (env: path: pkgs.lib.optional (pkgs.lib.pathExists path) "${env}=${path}") fileRefVars);
116+
in
117+
pkgs.lib.concatLists (
118+
pkgs.lib.mapAttrsToList (
119+
env: path: pkgs.lib.optional (pkgs.lib.pathExists path) "${env}=${path}"
120+
) fileRefVars
121+
);
105122
Entrypoint = [ entrypoint ];
106-
Cmd = [];
123+
Cmd = [ ];
107124
};
108125
};
109126
docker = pkgs.linkFarm "stackable-cockpit-docker" [
@@ -130,18 +147,15 @@ rec {
130147
];
131148

132149
# need to use vendored crate2nix because of https://github.com/kolloch/crate2nix/issues/264
133-
crate2nix = import sources.crate2nix {};
150+
crate2nix = import sources.crate2nix { };
134151
tilt = pkgs.tilt;
135152

136-
137-
138-
regenerateNixLockfiles = pkgs.writeScriptBin "regenerate-nix-lockfiles"
139-
''
140-
#!/usr/bin/env bash
141-
set -euo pipefail
142-
echo Running crate2nix
143-
${crate2nix}/bin/crate2nix generate
144-
echo Running gomod2nix
145-
${gomod2nix}/bin/gomod2nix
146-
'';
153+
regenerateNixLockfiles = pkgs.writeScriptBin "regenerate-nix-lockfiles" ''
154+
#!/usr/bin/env bash
155+
set -euo pipefail
156+
echo Running crate2nix
157+
${crate2nix}/bin/crate2nix generate
158+
echo Running gomod2nix
159+
${gomod2nix}/bin/gomod2nix
160+
'';
147161
}

0 commit comments

Comments
 (0)