diff --git a/Cargo.nix b/Cargo.nix index 4d994547..540b478f 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -9465,7 +9465,7 @@ rec { }; "stackablectl" = rec { crateName = "stackablectl"; - version = "24.3.2"; + version = "24.3.3"; edition = "2021"; crateBin = [ { diff --git a/default.nix b/default.nix index 1ca32057..15157770 100644 --- a/default.nix +++ b/default.nix @@ -1,34 +1,14 @@ { sources ? import ./nix/sources.nix # managed by https://github.com/nmattia/niv , nixpkgs ? sources.nixpkgs , pkgs ? import nixpkgs { - overlays = [ - # gomod2nix must be imported as a nixpkgs overlay - (import (sources.gomod2nix+"/overlay.nix")) - ]; + overlays = [ + # gomod2nix must be imported as a nixpkgs overlay + (import (sources.gomod2nix+"/overlay.nix")) + ]; } -, meta ? pkgs.lib.importJSON ./nix/meta.json -, dockerName ? "docker.stackable.tech/sandbox/${meta.operator.name}" -, dockerTag ? null -}: -rec { - cargo = import ./Cargo.nix { +, cargo ? import ./Cargo.nix { inherit nixpkgs pkgs; release = false; defaultCrateOverrides = pkgs.defaultCrateOverrides // { - prost-build = attrs: { - buildInputs = [ pkgs.protobuf ]; - }; - tonic-reflection = attrs: { - buildInputs = [ pkgs.rustfmt ]; - }; - stackable-secret-operator = attrs: { - buildInputs = [ pkgs.protobuf pkgs.rustfmt ]; - }; - krb5-sys = attrs: { - nativeBuildInputs = [ pkgs.pkg-config ]; - buildInputs = [ (pkgs.enableDebugging pkgs.krb5) ]; - LIBCLANG_PATH = "${pkgs.libclang.lib}/lib"; - BINDGEN_EXTRA_CLANG_ARGS = "-I${pkgs.glibc.dev}/include -I${pkgs.clang.cc.lib}/lib/clang/${pkgs.lib.getVersion pkgs.clang.cc}/include"; - }; stackable-cockpit-web = attrs: { nativeBuildInputs = [ pkgs.nodePackages.yarn pkgs.nodejs ]; preConfigure = @@ -60,7 +40,49 @@ rec { SWAGGER_UI_DOWNLOAD_URL = "file:///invalid-path/swagger-ui.zip"; }; }; - }; + } +, meta ? pkgs.lib.importJSON ./nix/meta.json +, dockerName ? "docker.stackable.tech/sandbox/${meta.operator.name}" +, dockerTag ? null +, web ? js2nix.buildEnv { + # js2nix doesn't import peer dependencies, so we use overlays to patch them in explicitly + # https://github.com/canva-public/js2nix/blob/d37912f6cc824e7f41bea7a481af1739ca195c8f/docs/usage.md#overriding + package-json = ./web/package.json; + yarn-lock = ./yarn.lock; + overlays = [ + (self: super: { + # TODO: remove once this https://github.com/canva-public/js2nix/issues/20 is resolved + buildNodeModule = pkgs.lib.makeOverridable + (args: (super.buildNodeModule args).override { doCheck = false; }); + }) + ]; + } +, goHelmWrapper ? pkgs.buildGoApplication { + pname = "go-helm-wrapper"; + version = "0.0"; + src = pkgs.runCommand "go-helm-wrapper-src" {} + '' + mkdir $out + cp ${./go.mod} $out/go.mod + cp ${./go.sum} $out/go.sum + cp -r ${./rust/helm-sys/go-helm-wrapper} $out/go-helm-wrapper + ''; + pwd = ./rust/helm-sys/go-helm-wrapper; + modules = ./gomod2nix.toml; + ldflags = "-buildmode c-archive"; + allowGoReference = true; + postBuild = + '' + for pkg in $(getGoDirs ""); do + buildFlags="-buildmode c-archive -o $GOPATH/bin/libgo-helm-wrapper.a" buildGoDir build "$pkg" + done + ''; + } +, js2nix ? pkgs.callPackage sources.js2nix { nodejs = pkgs.nodejs-18_x; } +, gomod2nix ? pkgs.callPackage sources.gomod2nix {} +}: +rec { + inherit cargo sources pkgs meta; build = cargo.workspaceMembers.stackable-cockpitd.build.override { features = [ "ui" ]; }; @@ -117,45 +139,9 @@ rec { # need to use vendored crate2nix because of https://github.com/kolloch/crate2nix/issues/264 crate2nix = import sources.crate2nix {}; - js2nix = pkgs.callPackage sources.js2nix { nodejs = pkgs.nodejs-18_x; }; - gomod2nix = pkgs.callPackage sources.gomod2nix {}; tilt = pkgs.tilt; - web = js2nix.buildEnv { - # js2nix doesn't import peer dependencies, so we use overlays to patch them in explicitly - # https://github.com/canva-public/js2nix/blob/d37912f6cc824e7f41bea7a481af1739ca195c8f/docs/usage.md#overriding - package-json = ./web/package.json; - yarn-lock = ./yarn.lock; - overlays = [ - (self: super: { - # TODO: remove once this https://github.com/canva-public/js2nix/issues/20 is resolved - buildNodeModule = pkgs.lib.makeOverridable - (args: (super.buildNodeModule args).override { doCheck = false; }); - }) - ]; - }; - goHelmWrapper = pkgs.buildGoApplication { - pname = "go-helm-wrapper"; - version = "0.0"; - src = pkgs.runCommand "go-helm-wrapper-src" {} - '' - mkdir $out - cp ${./go.mod} $out/go.mod - cp ${./go.sum} $out/go.sum - cp -r ${./rust/helm-sys/go-helm-wrapper} $out/go-helm-wrapper - ''; - pwd = ./rust/helm-sys/go-helm-wrapper; - modules = ./gomod2nix.toml; - ldflags = "-buildmode c-archive"; - allowGoReference = true; - postBuild = - '' - for pkg in $(getGoDirs ""); do - buildFlags="-buildmode c-archive -o $GOPATH/bin/libgo-helm-wrapper.a" buildGoDir build "$pkg" - done - ''; - }; regenerateNixLockfiles = pkgs.writeScriptBin "regenerate-nix-lockfiles" '' diff --git a/nix/sources.json b/nix/sources.json index 77012238..e5dfcef3 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -17,10 +17,10 @@ "homepage": "", "owner": "nix-community", "repo": "gomod2nix", - "rev": "872b63ddd28f318489c929d25f1f0a3c6039c971", - "sha256": "1wh9rlhg2w42fsavh7wxvmw42l7m5wg290gnp571dq0qcr1z7kg1", + "rev": "4702caff8e201f4c98fe3583637a930d253447c8", + "sha256": "1s0ihw1888rxpx8f7f5agr1vkjafszpz5jna7smi6n03irfcscyf", "type": "tarball", - "url": "https://github.com/nix-community/gomod2nix/archive/872b63ddd28f318489c929d25f1f0a3c6039c971.tar.gz", + "url": "https://github.com/nix-community/gomod2nix/archive/4702caff8e201f4c98fe3583637a930d253447c8.tar.gz", "url_template": "https://github.com///archive/.tar.gz", "version": "1.5.0" }, @@ -42,10 +42,10 @@ "homepage": "", "owner": "NixOS", "repo": "nixpkgs", - "rev": "af8b9db5c00f1a8e4b83578acc578ff7d823b786", - "sha256": "0kd64p8i1gmgdjfdag2fvj4gfcsk0wa3h7w7j5l6b2yxr9plnhpm", + "rev": "e2dd4e18cc1c7314e24154331bae07df76eb582f", + "sha256": "19zbxf7rb787jvyrfhl4z9sn3aisd6xvx6ikybbi75ym9sy39jds", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/af8b9db5c00f1a8e4b83578acc578ff7d823b786.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/e2dd4e18cc1c7314e24154331bae07df76eb582f.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } diff --git a/shell.nix b/shell.nix new file mode 100644 index 00000000..6c942812 --- /dev/null +++ b/shell.nix @@ -0,0 +1,42 @@ +let + self = import ./. {}; + inherit (self) sources pkgs meta; + + cargoDependencySetOfCrate = crate: [ crate ] ++ pkgs.lib.concatMap cargoDependencySetOfCrate (crate.dependencies ++ crate.buildDependencies); + cargoDependencySet = pkgs.lib.unique (pkgs.lib.flatten (pkgs.lib.mapAttrsToList (crateName: crate: cargoDependencySetOfCrate crate.build) self.cargo.workspaceMembers)); +in pkgs.mkShell rec { + name = meta.operator.name; + + packages = with pkgs; [ + ## cargo et-al + rustup # this breaks pkg-config if it is in the nativeBuildInputs + + ## Extra dependencies for use in a pure env (nix-shell --pure) + ## These are mosuly useful for maintainers of this shell.nix + ## to ensure all the dependencies are caught. + # cacert + # vim nvim nano + ]; + + # derivation runtime dependencies + buildInputs = pkgs.lib.concatMap (crate: crate.buildInputs) cargoDependencySet; + + # build time dependencies + nativeBuildInputs = pkgs.lib.concatMap (crate: crate.nativeBuildInputs) cargoDependencySet ++ (with pkgs; [ + clang + git + # Replace llvmPackages with llvmPackages_X, where X is the latest LLVM version (at the time of writing, 16) + llvmPackages.bintools + rustup + + # additions for this repo + yarn + typescript + vite + go + ]); + + LIBCLANG_PATH = "${pkgs.libclang.lib}/lib"; + BINDGEN_EXTRA_CLANG_ARGS = "-I${pkgs.glibc.dev}/include -I${pkgs.clang}/resource-root/include"; + +} diff --git a/web/src/api/schema.d.ts b/web/src/api/schema.d.ts index d3908c02..2f72ee72 100644 --- a/web/src/api/schema.d.ts +++ b/web/src/api/schema.d.ts @@ -142,8 +142,6 @@ export interface components { pathItems: never; } -export type $defs = Record; - export type external = Record; export interface operations {