Skip to content

Commit

Permalink
Update nix flake for rust rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
IceDBorn committed May 9, 2024
1 parent 5534726 commit 56a0698
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 390 deletions.
34 changes: 11 additions & 23 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,27 @@
(substring 4 2 longDate)
(substring 6 2 longDate)
]);

read = builtins.readFile;
write = builtins.toFile;

firefoxJSON = write "firefox.json" (read native/native-messaging-hosts/firefox.json);
in {
packages = forAllSystems (system: {
default = with pkgsFor.${system};
stdenv.mkDerivation {
rustPlatform.buildRustPackage {
name = "pipewire-screenaudio";
version = mkDate (self.lastModifiedDate or "19700101") + "_"
+ (self.shortRev or "dirty");

src = self;

src = ./native/connector-rs;
buildInputs = [ gawk hexdump jq pipewire ];
cargoHash = "sha256-+mLsrKt7WRyO++B0rFoRb/JodBPxhZCdg2qZguKzqUI=";

installPhase = ''
runHook preInstall
# Replace jq with its absolute path
substituteInPlace native/connector/virtmic.sh --replace jq ${pkgs.jq}/bin/jq
substituteInPlace native/connector/pipewire-screen-audio-connector.sh --replace jq ${pkgs.jq}/bin/jq
substituteInPlace native/connector/connect-and-monitor.sh --replace jq ${pkgs.jq}/bin/jq
substituteInPlace native/connector/util.sh --replace jq ${pkgs.jq}/bin/jq
# Install files
mkdir -p $out/lib/out
install -Dm755 native/connector/pipewire-screen-audio-connector.sh $out/lib/connector/pipewire-screen-audio-connector.sh
install -Dm755 native/connector/virtmic.sh $out/lib/connector/virtmic.sh
install -Dm755 native/connector/connect-and-monitor.sh $out/lib/connector/connect-and-monitor.sh
install -Dm755 native/connector/util.sh $out/lib/connector/util.sh
postInstall = ''
# Firefox manifest
substituteInPlace native/native-messaging-hosts/firefox.json --replace /usr/lib/pipewire-screenaudio $out/lib
install -Dm644 native/native-messaging-hosts/firefox.json $out/lib/mozilla/native-messaging-hosts/com.icedborn.pipewirescreenaudioconnector.json
runHook postInstall
install -Dm644 ${firefoxJSON} "$out/lib/mozilla/native-messaging-hosts/com.icedborn.pipewirescreenaudioconnector.json"
substituteInPlace "$out/lib/mozilla/native-messaging-hosts/com.icedborn.pipewirescreenaudioconnector.json" --replace "/usr/lib/pipewire-screenaudio/connector-rs/target/debug" "$out/bin"
'';
};
});
Expand Down
159 changes: 0 additions & 159 deletions native/connector/connect-and-monitor.sh

This file was deleted.

109 changes: 0 additions & 109 deletions native/connector/pipewire-screen-audio-connector.sh

This file was deleted.

0 comments on commit 56a0698

Please sign in to comment.