Unverified Commit d50ed58e authored by Adam C. Stephens's avatar Adam C. Stephens Committed by GitHub
Browse files

kanidm: add darwin support (#402861)

parents 5db992b9 054554ba
Loading
Loading
Loading
Loading
+26 −20
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ rustPlatform.buildRustPackage rec {
    inherit hash;
  };

  KANIDM_BUILD_PROFILE = "release_nixos_${arch}";
  KANIDM_BUILD_PROFILE = "release_nixpgs_${arch}";

  patches = lib.optionals enableSecretProvisioning [
    "${patchDir}/oauth2-basic-secret-modify.patch"
@@ -59,6 +59,7 @@ rustPlatform.buildRustPackage rec {
  postPatch =
    let
      format = (formats.toml { }).generate "${KANIDM_BUILD_PROFILE}.toml";
      socket_path = if stdenv.hostPlatform.isLinux then "/run/kanidm/sock" else "/var/run/kanidm.socket";
      profile =
        {
          cpu_flags = if stdenv.hostPlatform.isx86_64 then "x86_64_legacy" else "none";
@@ -67,12 +68,12 @@ rustPlatform.buildRustPackage rec {
          client_config_path = "/etc/kanidm/config";
          resolver_config_path = "/etc/kanidm/unixd";
          resolver_unix_shell_path = "${lib.getBin bashInteractive}/bin/bash";
          server_admin_bind_path = "/run/kanidmd/sock";
          server_admin_bind_path = socket_path;
          server_config_path = "/etc/kanidm/server.toml";
          server_ui_pkg_path = "@htmx_ui_pkg_path@";
        }
        // lib.optionalAttrs (lib.versionOlder version "1.5") {
          admin_bind_path = "/run/kanidmd/sock";
          admin_bind_path = socket_path;
          default_config_path = "/etc/kanidm/server.toml";
          default_unix_shell_path = "${lib.getBin bashInteractive}/bin/bash";
          htmx_ui_pkg_path = "@htmx_ui_pkg_path@";
@@ -94,12 +95,15 @@ rustPlatform.buildRustPackage rec {
    installShellFiles
  ];

  buildInputs = [
    udev
  buildInputs =
    [
      openssl
      sqlite
      pam
      rust-jemalloc-sys
    ]
    ++ lib.optionals stdenv.hostPlatform.isLinux [
      udev
    ];

  # The UI needs to be in place before the tests are run.
@@ -125,11 +129,13 @@ rustPlatform.buildRustPackage rec {
    ''profile.release.lto="off"''
  ];

  preFixup = ''
  preFixup =
    ''
      installShellCompletion \
        --bash $releaseDir/build/completions/*.bash \
        --zsh $releaseDir/build/completions/_*

    ''
    + lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
      # PAM and NSS need fix library names
      mv $out/lib/libnss_kanidm.so $out/lib/libnss_kanidm.so.2
      mv $out/lib/libpam_kanidm.so $out/lib/pam_kanidm.so
@@ -166,7 +172,7 @@ rustPlatform.buildRustPackage rec {
      description = "Simple, secure and fast identity management platform";
      homepage = "https://github.com/kanidm/kanidm";
      license = licenses.mpl20;
      platforms = platforms.linux;
      platforms = platforms.linux ++ platforms.darwin;
      maintainers = with maintainers; [
        adamcstephens
        Flakebi