Unverified Commit 0f2ec872 authored by Michael Daniels's avatar Michael Daniels Committed by GitHub
Browse files

rauthy: 0.34.3 -> 0.35.1 (#509512)

parents be2ab561 d448ac68
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
diff --git a/frontend/svelte.config.js b/frontend/svelte.config.js
index 397fe4d4..3a08f7a2 100644
--- a/frontend/svelte.config.js
+++ b/frontend/svelte.config.js
@@ -12,8 +12,8 @@ const config = {
         },
         adapter: adapter({
             fallback: null,
-            pages: '../templates/html',
-            assets: '../static/v1',
+            pages: 'dist/templates/html',
+            assets: 'dist/static/v1',
             precompress: true,
             strict: true,
         }),
+35 −90
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  fetchNpmDeps,
  rustPlatform,
  buildNpmPackage,
  npmHooks,
  nodejs,
  nix-update-script,
  writableTmpDirAsHomeHook,
  pkg-config,
  perl,
  wasm-pack,
  wasm-bindgen-cli_0_2_108,
  wasm-bindgen-cli_0_2_118,
  binaryen,
  lld,
  rust-jemalloc-sys-unprefixed,
}:
let
  version = "0.34.3";
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "rauthy";
  version = "0.35.1";

  src = fetchFromGitHub {
    owner = "sebadob";
    repo = "rauthy";
    tag = "v${version}";
    hash = "sha256-ey6y/EGmz/80s0nbxsk6li9KCJV5IAtBp5QqAj7a6R0=";
  };

  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit src pname version;
    hash = "sha256-mkIHup/6aA9QDPlekhdZiXWryhetsJMxl3HAXsabACQ=";
    tag = "v${finalAttrs.version}";
    hash = "sha256-m9MRKBoRbHSXgK1nsxoI1laY2pDybnSaTeihKy6+1AU=";
  };

  # Wasm modules are needed to build the frontend and are part of the main Rust repo.
  #
  # We use rustPlatform.buildRustPackage to get the correct environment for wasm-pack.
  # Since the "wasm-modules" crate has no binary output, cargoInstallPostBuildHook fails,
  # so we disable the cargo install phase.
  wasmModules = rustPlatform.buildRustPackage {
    inherit version src cargoDeps;
    pname = "${pname}-wasm-modules";

  nativeBuildInputs = [
      writableTmpDirAsHomeHook
      wasm-pack
      wasm-bindgen-cli_0_2_108
    binaryen
    lld
    nodejs
    npmHooks.npmConfigHook
    perl
    wasm-bindgen-cli_0_2_118
    wasm-pack
  ];

    buildPhase = ''
      runHook preBuild

      mkdir -p $out/wasm
      cd src/wasm-modules

      wasm-pack -v build --out-dir $out/wasm/spow --no-pack --out-name spow --features spow
      wasm-pack -v build --out-dir $out/wasm/md --no-pack --out-name md --features md

      runHook postBuild
    '';

    dontCargoInstall = true;

    # Skip checks here; they will run in the main package.
    doCheck = false;
  };

  frontend = buildNpmPackage {
    inherit version src;
    pname = "${pname}-frontend";

    sourceRoot = "${src.name}/frontend";

    patches = [
      ./0001-build-svelte-files-inside-the-current-directory.patch
    ];

    patchFlags = [
      "-p2"
    ];
  buildInputs = [ rust-jemalloc-sys-unprefixed ];

    npmDepsHash = "sha256-N/tFwQNWMudFtetIKfirXDvWH3CfRwjdpBcxkXZsVig=";
  npmRoot = "frontend";

    preBuild = ''
      mkdir -p ./src/wasm/
      cp -r ${wasmModules}/wasm/* ./src/wasm/
    '';
  npmDeps = fetchNpmDeps {
    src = "${finalAttrs.src}/frontend";
    hash = "sha256-MVfon/jKtXfgm6YBkeNx3CGloR7bzqgExUckoLMW8B4=";
  };
in
rustPlatform.buildRustPackage (finalAttrs: {
  inherit
    pname
    version
    src
    cargoDeps
    ;

  nativeBuildInputs = [
    pkg-config
    perl
  ];

  buildInputs = [ rust-jemalloc-sys-unprefixed ];
  cargoHash = "sha256-GHU1vCSAf3SUaqTpymQzQqX3FSVNvJtYD3Av4Dsm+Rc=";

  preBuild = ''
    cp -r ${frontend}/lib/node_modules/frontend/dist/templates/html/ templates/html
    cp -r ${frontend}/lib/node_modules/frontend/dist/static/ static
    pushd src/wasm-modules
    wasm-pack build -d ../../frontend/src/wasm/spow --no-pack --out-name spow --features spow
    wasm-pack build -d ../../frontend/src/wasm/md --no-pack --out-name md --features md
    popd
    pushd "$npmRoot"
    npm run build
    popd
  '';

  # Tests fail and appear unmaintained upstream.
  doCheck = false;

  passthru = {
    inherit frontend;

    updateScript = nix-update-script {
      extraArgs = [
        "--subpackage=frontend"
      ];
    };
    updateScript = nix-update-script { };
  };

  meta = {
@@ -125,7 +68,9 @@ rustPlatform.buildRustPackage (finalAttrs: {
    homepage = "https://github.com/sebadob/rauthy";
    changelog = "https://github.com/sebadob/rauthy/blob/${finalAttrs.src.tag}/CHANGELOG.md";
    license = lib.licenses.asl20;
    platforms = lib.platforms.linux;
    maintainers = with lib.maintainers; [ angelodlfrtr ];
    maintainers = with lib.maintainers; [
      angelodlfrtr
      ungeskriptet
    ];
  };
})