-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathflake.nix
43 lines (38 loc) · 1.53 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
description = "The native part of the Pipewire Screenaudio extension";
outputs = { self, nixpkgs, }:
let
forAllSystems = nixpkgs.lib.genAttrs systems;
pkgsFor = nixpkgs.legacyPackages;
read = builtins.readFile;
systems = [ "aarch64-linux" "i686-linux" "x86_64-linux" ];
write = builtins.toFile;
mkDate = longDate:
with builtins;
(concatStringsSep "-" [
(substring 0 4 longDate)
(substring 4 2 longDate)
(substring 6 2 longDate)
]);
firefoxJSON = write "firefox.json" (read native/native-messaging-hosts/firefox.json);
connectorPath = "lib/mozilla/native-messaging-hosts/com.icedborn.pipewirescreenaudioconnector.json";
in {
packages = forAllSystems (system: {
default = with pkgsFor.${system};
rustPlatform.buildRustPackage {
name = "pipewire-screenaudio";
version = mkDate (self.lastModifiedDate or "19700101") + "_"
+ (self.shortRev or "dirty");
src = ./native/connector-rs;
buildInputs = [ pipewire ];
cargoHash = "sha256-+mLsrKt7WRyO++B0rFoRb/JodBPxhZCdg2qZguKzqUI=";
postInstall = ''
# Firefox manifest
install -Dm644 ${firefoxJSON} "$out/${connectorPath}"
substituteInPlace "$out/${connectorPath}" --replace "/usr/lib/pipewire-screenaudio/connector-rs/target/debug" "$out/bin"
'';
};
});
};
}