mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-02 02:34:42 +08:00
fix(nix): migrate vendoring and make packaging advisory
This commit is contained in:
@@ -336,14 +336,15 @@ jobs:
|
|||||||
needs: changes
|
needs: changes
|
||||||
if: needs.changes.outputs.nix == 'true'
|
if: needs.changes.outputs.nix == 'true'
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
continue-on-error: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22
|
uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22
|
||||||
|
|
||||||
- name: Validate pnpm dependency hash
|
- name: Validate Nix dependency closures
|
||||||
run: nix build .#dbx-pnpm-deps --no-link --print-build-logs
|
run: nix build .#dbx-pnpm-deps .#dbx-cargo-deps --no-link --print-build-logs
|
||||||
|
|
||||||
changes:
|
changes:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
@@ -404,11 +405,15 @@ jobs:
|
|||||||
- '.github/scripts/bump-agent-versions.test.mjs'
|
- '.github/scripts/bump-agent-versions.test.mjs'
|
||||||
- '.github/workflows/agents-release.yml'
|
- '.github/workflows/agents-release.yml'
|
||||||
nix:
|
nix:
|
||||||
# This fast check validates only the fixed-output pnpm dependency closure.
|
# These advisory checks validate the pnpm and Cargo dependency closures.
|
||||||
- 'package.json'
|
- 'package.json'
|
||||||
- 'packages/**/package.json'
|
- 'packages/**/package.json'
|
||||||
- 'pnpm-lock.yaml'
|
- 'pnpm-lock.yaml'
|
||||||
- 'pnpm-workspace.yaml'
|
- 'pnpm-workspace.yaml'
|
||||||
|
- 'Cargo.toml'
|
||||||
|
- 'Cargo.lock'
|
||||||
|
- 'crates/**/Cargo.toml'
|
||||||
|
- 'src-tauri/Cargo.toml'
|
||||||
- 'flake.nix'
|
- 'flake.nix'
|
||||||
- 'flake.lock'
|
- 'flake.lock'
|
||||||
- '.github/workflows/ci.yml'
|
- '.github/workflows/ci.yml'
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ jobs:
|
|||||||
|
|
||||||
nix-packaging:
|
nix-packaging:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
continue-on-error: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
@@ -636,8 +637,9 @@ jobs:
|
|||||||
--clobber
|
--clobber
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
# Keep the release as a draft until every platform and the Nix package pass.
|
# Keep the release as a draft until every release-blocking platform job passes.
|
||||||
needs: [cleanup-release-signatures, docker-manifest, jdbc-plugin, nix-packaging, static-browser]
|
# Nix packaging is advisory and runs independently from publication.
|
||||||
|
needs: [cleanup-release-signatures, docker-manifest, jdbc-plugin, static-browser]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Publish draft release
|
- name: Publish draft release
|
||||||
|
|||||||
Generated
+16
@@ -1,5 +1,20 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"crane": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1785284101,
|
||||||
|
"narHash": "sha256-ghcXEpYEM4a7pbEkoqbn8c0ptJJqgGzuFiG3T6W5g4I=",
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"rev": "756d6d07c3818ea95d1e2cdac63fa7d02fe3e61b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
@@ -36,6 +51,7 @@
|
|||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"crane": "crane",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
crane.url = "github:ipetkov/crane";
|
||||||
rust-overlay = {
|
rust-overlay = {
|
||||||
url = "github:oxalica/rust-overlay";
|
url = "github:oxalica/rust-overlay";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
flake-utils,
|
flake-utils,
|
||||||
|
crane,
|
||||||
rust-overlay,
|
rust-overlay,
|
||||||
}:
|
}:
|
||||||
flake-utils.lib.eachDefaultSystem (
|
flake-utils.lib.eachDefaultSystem (
|
||||||
@@ -33,6 +35,14 @@
|
|||||||
"rustfmt"
|
"rustfmt"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
baseCraneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
|
||||||
|
craneLib = baseCraneLib.appendCrateRegistries [
|
||||||
|
(baseCraneLib.registryFromDownloadUrl {
|
||||||
|
indexUrl = "https://github.com/rust-lang/crates.io-index";
|
||||||
|
dl = "https://static.crates.io/crates";
|
||||||
|
fetchurlExtraArgs.curlOpts = "--retry 20 --retry-all-errors --retry-delay 1";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
# ------------------------------------------------------------------ #
|
# ------------------------------------------------------------------ #
|
||||||
# Linux-only system libraries required by Tauri / WebKit2GTK #
|
# Linux-only system libraries required by Tauri / WebKit2GTK #
|
||||||
@@ -154,13 +164,17 @@
|
|||||||
# without compiling the frontend and Rust desktop application.
|
# without compiling the frontend and Rust desktop application.
|
||||||
packages.dbx-pnpm-deps = self.packages.${system}.dbx-desktop.pnpmDeps;
|
packages.dbx-pnpm-deps = self.packages.${system}.dbx-desktop.pnpmDeps;
|
||||||
|
|
||||||
|
# Fast dependency target used by CI to validate Cargo vendoring without
|
||||||
|
# compiling the frontend and Rust desktop application.
|
||||||
|
packages.dbx-cargo-deps = self.packages.${system}.dbx-desktop.cargoVendorDir;
|
||||||
|
|
||||||
# ------------------------------------------------------------------ #
|
# ------------------------------------------------------------------ #
|
||||||
# packages.dbx-desktop — Tauri desktop application #
|
# packages.dbx-desktop — Tauri desktop application #
|
||||||
# Build with: nix build .#dbx-desktop #
|
# Build with: nix build .#dbx-desktop #
|
||||||
# #
|
# #
|
||||||
# Two-phase build strategy: #
|
# Two-phase build strategy: #
|
||||||
# 1. pnpm.fetchDeps → vendor all npm/pnpm deps offline #
|
# 1. pnpm.fetchDeps → vendor all npm/pnpm deps offline #
|
||||||
# 2. importCargoLock → vendor all Cargo deps offline #
|
# 2. Crane vendoring → vendor all Cargo deps offline #
|
||||||
# 3. pnpm build → compile Vue/TypeScript frontend #
|
# 3. pnpm build → compile Vue/TypeScript frontend #
|
||||||
# 4. cargo build -p dbx → compile Tauri Rust backend #
|
# 4. cargo build -p dbx → compile Tauri Rust backend #
|
||||||
# #
|
# #
|
||||||
@@ -187,12 +201,18 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# ── Step 2: vendor Cargo dependencies ───────────────────────────── #
|
# ── Step 2: vendor Cargo dependencies ───────────────────────────── #
|
||||||
cargoDeps = pkgs.rustPlatform.importCargoLock {
|
cargoVendorDir = craneLib.vendorCargoDeps {
|
||||||
lockFile = ./Cargo.lock;
|
cargoLock = ./Cargo.lock;
|
||||||
|
# Pin Git checkouts by their complete Cargo source identity. Unlike
|
||||||
|
# package-name/version keys, these remain stable when a package
|
||||||
|
# version inside the same checkout changes.
|
||||||
outputHashes = {
|
outputHashes = {
|
||||||
"tokio-postgres-0.7.18" = "sha256-HRbYVSD7iIwG3m1tOGoIZy0xAZwALWIpTtakVSYPIYI=";
|
"git+https://github.com/t8y2/rust_mysql_common.git?rev=77085e91e5081309d585153e3b656ce33bc1fe74#77085e91e5081309d585153e3b656ce33bc1fe74" =
|
||||||
"mysql-common-derive-0.32.2" = "sha256-8lWgsdTuLTgOmzP7tXmA9LnomOE0wjxXsCBw9NEMt2o=";
|
"sha256-8lWgsdTuLTgOmzP7tXmA9LnomOE0wjxXsCBw9NEMt2o=";
|
||||||
"mysql_async-0.37.0" = "sha256-tMFvmypIBh1GHg3cLFWmLf6N1wrwKPlzx2G/MHwtlFM=";
|
"git+https://github.com/t8y2/mysql_async.git?rev=2be6e392eb9b06d20dcd2d8ed8eae748d413c9ec#2be6e392eb9b06d20dcd2d8ed8eae748d413c9ec" =
|
||||||
|
"sha256-tMFvmypIBh1GHg3cLFWmLf6N1wrwKPlzx2G/MHwtlFM=";
|
||||||
|
"git+https://github.com/t8y2/tokio-postgres-gaussdb.git?rev=115f9fef10f0fc3669b5337955e4eb461fc349a6#115f9fef10f0fc3669b5337955e4eb461fc349a6" =
|
||||||
|
"sha256-HRbYVSD7iIwG3m1tOGoIZy0xAZwALWIpTtakVSYPIYI=";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -207,7 +227,8 @@
|
|||||||
pkgs.jq # used by preConfigure to strip packageManager
|
pkgs.jq # used by preConfigure to strip packageManager
|
||||||
pkgs.cargo-tauri # tauri CLI — needed to properly embed frontend assets
|
pkgs.cargo-tauri # tauri CLI — needed to properly embed frontend assets
|
||||||
# Hooks that wire up the vendored deps automatically:
|
# Hooks that wire up the vendored deps automatically:
|
||||||
pkgs.rustPlatform.cargoSetupHook # sets CARGO_HOME to cargoDeps
|
craneLib.configureCargoCommonVarsHook
|
||||||
|
craneLib.configureCargoVendoredDepsHook
|
||||||
pkgs.pnpmConfigHook # sets up pnpm offline store
|
pkgs.pnpmConfigHook # sets up pnpm offline store
|
||||||
pkgs.desktop-file-utils # for `desktop-file-validate`
|
pkgs.desktop-file-utils # for `desktop-file-validate`
|
||||||
pkgs.copyDesktopItems # installs desktopItem into share/applications
|
pkgs.copyDesktopItems # installs desktopItem into share/applications
|
||||||
|
|||||||
Reference in New Issue
Block a user