Unverified Commit abb09fa0 authored by kuflierl's avatar kuflierl Committed by GitHub
Browse files

cup-docker{,-noserver}: init at 3.4.0 (#412710)

parent 9c26edec
Loading
Loading
Loading
Loading
+98 −0
Original line number Diff line number Diff line
{
  rustPlatform,
  fetchFromGitHub,
  lib,
  stdenvNoCC,
  bun,
  nodejs-slim_latest,
  nix-update-script,
  withServer ? true,
}:
let
  pname = "cup-docker";
  version = "3.4.0";
  src = fetchFromGitHub {
    owner = "sergi0g";
    repo = "cup";
    tag = "v${version}";
    hash = "sha256-ciH3t2L2eJhk1+JXTqEJSuHve8OuVod7AuQ3iFWmKRE=";
  };
  web = stdenvNoCC.mkDerivation (finalAttrs: {
    pname = "${pname}-web";
    inherit version src;
    impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
      "GIT_PROXY_COMMAND"
      "SOCKS_SERVER"
    ];
    sourceRoot = "${finalAttrs.src.name}/web";
    nativeBuildInputs = [
      bun
      nodejs-slim_latest
    ];
    configurePhase = ''
      runHook preConfigure
      bun install --no-progress --frozen-lockfile
      substituteInPlace node_modules/.bin/{vite,tsc} \
        --replace-fail "/usr/bin/env node" "${nodejs-slim_latest}/bin/node"
      runHook postConfigure
    '';
    buildPhase = ''
      runHook preBuild
      bun run build
      runHook postBuild
    '';
    installPhase = ''
      runHook preInstall
      mkdir -p $out/dist
      cp -R ./dist $out
      runHook postInstall
    '';
    outputHash = "sha256-Ac1PJYmTQv9XrmhmF1p77vdXh8252hz0CUKxJA+VQR4=";
    outputHashAlgo = "sha256";
    outputHashMode = "recursive";
  });
in
rustPlatform.buildRustPackage {
  inherit
    src
    version
    pname
    ;

  cargoHash = "sha256-L9zugOwlPwpdtjV87dT1PH7FAMJYHYFuvfyOfPe5b2k=";

  buildNoDefaultFeatures = true;
  buildFeatures =
    [
      "cli"
    ]
    ++ lib.optional withServer [
      "server"
    ];

  preConfigure = lib.optionalString withServer ''
    cp -r ${web}/dist src/static
  '';

  passthru = {
    inherit web;
    updateScript = nix-update-script {
      extraArgs = [
        "--subpackage"
        "web"
      ];
    };
  };

  meta = {
    description = "a lightweight way to check for container image updates. written in Rust";
    homepage = "https://cup.sergi0g.dev";
    license = lib.licenses.agpl3Only;
    platforms = lib.platforms.all;
    changelog = "https://github.com/sergi0g/cup/releases";
    mainProgram = "cup";
    maintainers = with lib.maintainers; [
      kuflierl
    ];
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -369,6 +369,8 @@ with pkgs;

  copilot-language-server-fhs = copilot-language-server.fhs;

  cup-docker-noserver = cup-docker.override { withServer = false; };

  deck = callPackage ../by-name/de/deck/package.nix {
    buildGoModule = buildGo123Module;
  };