diff --git a/pkgs/durdraw/default.nix b/pkgs/durdraw/default.nix index e3bf2de..edb0d3f 100644 --- a/pkgs/durdraw/default.nix +++ b/pkgs/durdraw/default.nix @@ -18,8 +18,8 @@ python3Packages.buildPythonApplication rec { hash = "sha256-a+4DGWBD5XLaNAfTN/fmI/gALe76SCoWrnjyglNhVPY="; }; - build-system = with python3Packages; [ - setuptools + build-system = [ + python3Packages.setuptools ]; dependencies = []; diff --git a/pkgs/venmic/default.nix b/pkgs/venmic/default.nix new file mode 100644 index 0000000..82aed43 --- /dev/null +++ b/pkgs/venmic/default.nix @@ -0,0 +1,101 @@ +{ cmake +, cacert +, cpm-cmake +, git +, pkg-config +, pulseaudio +, pipewire +, fetchFromGitHub +, stdenv +}: + +# See +# https://github.com/NixOS/nixpkgs/blob/nixos-25.05/pkgs/development/compilers/codon/default.nix#L136 +# for an example of an CPM/CMake project built with Nix. + +let + version = "6.1.0"; + depsDir = "deps"; + + src = fetchFromGitHub { + owner = "Vencord"; + repo = "venmic"; + rev = "v${version}"; + hash = "sha256-0UP8a2bfhWGsB2Lg/GeIBu4zw1zHnXbitT8vU+DLeEY="; + }; + + venmic-deps = stdenv.mkDerivation { + name = "venmic-deps-${version}.tar.gz"; + + inherit src; + + nativeBuildInputs = [ + cmake + cacert + cpm-cmake + git + # Pkg-config is implicitly used by CMake and will fail to find libs + # without it. + pkg-config + ]; + + buildInputs = [ + pulseaudio + pipewire + ]; + + dontBuild = true; + + cmakeFlags = [ + "-DCPM_DOWNLOAD_ALL=ON" + "-DCPM_SOURCE_CACHE=${depsDir}" + ]; + + installPhase = '' + # Build a reproducible tarball, per + # https://reproducible-builds.org/docs/archives. + tar --owner=0 --group=0 --numeric-owner --format=gnu \ + --sort=name --mtime="@$SOURCE_DATE_EPOCH" \ + -czf $out \ + "${depsDir}" + ''; + + outputHashAlgo = "sha256"; + outputHash = "sha256-KIkf3bg1+vbGaYo/QTtOF7bUQVZH8vrBPNejk3EbNuA="; + }; + + venmic = stdenv.mkDerivation { + pname = "venmic"; + inherit version src; + + postUnpack = '' + # Bring in the cached CPM deps. + mkdir -p $sourceRoot/build + tar xzf ${venmic-deps} -C $sourceRoot/build + + # Bring in CPM itself — Venmic tries to download it itself. + rm $sourceRoot/cmake/cpm.cmake + ln -s ${cpm-cmake}/share/cpm/CPM.cmake $sourceRoot/cmake/cpm.cmake + ''; + + cmakeFlags = [ + "-DCPM_SOURCE_CACHE=${depsDir}" + "-Dvenmic_prefer_remote=OFF" + ]; + + nativeBuildInputs = [ + cmake + cpm-cmake + git + # Pkg-config is implicitly used by CMake and will fail to find libs + # without it. + pkg-config + ]; + + buildInputs = [ + pulseaudio + pipewire + ]; + }; + +in venmic