nixpkgs/pkgs/applications/video/pyca/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

84 lines
1.7 KiB
Nix

{ lib
, python3
, buildNpmPackage
, fetchFromGitHub
, jq
, stdenv
}:
let
python = python3.override {
self = python;
packageOverrides = self: super: {
# pyCA is incompatible with SQLAlchemy 2.0
sqlalchemy = super.sqlalchemy_1_4;
};
};
frontend = buildNpmPackage rec {
pname = "pyca";
version = "4.5";
src = fetchFromGitHub {
owner = "opencast";
repo = "pyCA";
rev = "v${version}";
sha256 = "sha256-cTkWkOmgxJZlddqaSYKva2wih4Mvsdrd7LD4NggxKQk=";
};
npmDepsHash = "sha256-0U+semrNWTkNu3uQQkiJKZT1hB0/IfkL84G7/oP8XYY=";
nativeBuildInputs = [ jq python ];
postPatch = ''
${jq}/bin/jq '. += {"version": "${version}"}' < package.json > package.json.tmp
mv package.json.tmp package.json
'';
installPhase = ''
mkdir -p $out/static
cp -R pyca/ui/static/* $out/static/
'';
};
in
python3.pkgs.buildPythonApplication rec {
pname = "pyca";
version = "4.5";
src = fetchFromGitHub {
owner = "opencast";
repo = "pyCA";
rev = "v${version}";
sha256 = "sha256-cTkWkOmgxJZlddqaSYKva2wih4Mvsdrd7LD4NggxKQk=";
};
propagatedBuildInputs = with python.pkgs; [
pycurl
python-dateutil
configobj
sqlalchemy
sdnotify
psutil
flask
prometheus-client
];
postPatch = ''
sed -i -e 's#static_folder=.*#static_folder="${frontend}/static")#' pyca/ui/__init__.py
'';
passthru = {
inherit frontend;
};
meta = with lib; {
broken = stdenv.hostPlatform.isDarwin;
description = "Fully functional Opencast capture agent written in Python";
mainProgram = "pyca";
homepage = "https://github.com/opencast/pyCA";
license = licenses.lgpl3;
maintainers = with maintainers; [ pmiddend ];
};
}