2022-07-01 19:38:37 +01:00
|
|
|
{
|
2022-07-06 01:29:27 +01:00
|
|
|
description = "SIP Discord interconnect";
|
|
|
|
|
2022-07-01 19:38:37 +01:00
|
|
|
inputs = {
|
|
|
|
utils.url = "github:numtide/flake-utils";
|
|
|
|
devshell.url = "github:numtide/devshell";
|
2022-07-06 01:29:27 +01:00
|
|
|
naersk.url = "github:nix-community/naersk";
|
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
2022-07-01 19:38:37 +01:00
|
|
|
};
|
2022-07-06 01:29:27 +01:00
|
|
|
|
2022-07-01 19:38:37 +01:00
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
nixpkgs,
|
|
|
|
utils,
|
2022-07-06 01:29:27 +01:00
|
|
|
naersk,
|
2022-07-01 19:38:37 +01:00
|
|
|
devshell,
|
2022-07-06 01:29:27 +01:00
|
|
|
rust-overlay,
|
2022-07-01 19:38:37 +01:00
|
|
|
}:
|
|
|
|
utils.lib.eachDefaultSystem (system: let
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
2022-07-06 01:29:27 +01:00
|
|
|
overlays = [(import rust-overlay)];
|
2022-07-01 19:38:37 +01:00
|
|
|
};
|
2022-07-06 01:29:27 +01:00
|
|
|
rust = pkgs.rust-bin.stable.latest.default;
|
|
|
|
# Override naersk to use our chosen rust version from rust-overlay
|
|
|
|
naersk-lib = naersk.lib.${system}.override {
|
|
|
|
cargo = rust;
|
|
|
|
rustc = rust;
|
2022-07-01 19:38:37 +01:00
|
|
|
};
|
2022-07-06 01:29:27 +01:00
|
|
|
in rec {
|
|
|
|
packages.default = naersk-lib.buildPackage {
|
|
|
|
pname = "discosip";
|
|
|
|
root = ./.;
|
2022-07-17 02:23:09 +01:00
|
|
|
buildInputs = with pkgs; [libopus pkgconfig];
|
2022-07-06 01:29:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
apps.default = utils.lib.mkApp {drv = packages.default;};
|
|
|
|
|
|
|
|
# Provide a dev env with rust and rls
|
|
|
|
devShells.default = let
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
overlays = [devshell.overlay];
|
|
|
|
};
|
|
|
|
in
|
|
|
|
pkgs.devshell.mkShell {
|
2022-07-17 02:23:09 +01:00
|
|
|
devshell.packages = with pkgs; [
|
2022-07-06 01:29:27 +01:00
|
|
|
(rust.override {extensions = ["rls"];})
|
|
|
|
ffmpeg
|
|
|
|
(callPackage ./pjsip {inherit (darwin.apple_sdk.frameworks) AppKit;})
|
|
|
|
opusTools
|
2022-07-17 02:23:09 +01:00
|
|
|
libopus
|
|
|
|
pkgconfig
|
|
|
|
];
|
|
|
|
# Devshell doesn't do any of the automagic that pkgs.mkshell (thanks to
|
|
|
|
# mkderivation) does. So we need to manually tell pkg-config where to find
|
|
|
|
# libopus so that we can `cargo build` in our devshell.
|
|
|
|
env = [
|
|
|
|
{
|
|
|
|
name = "PKG_CONFIG_PATH";
|
|
|
|
value = "${pkgs.libopus.dev}/lib/pkgconfig";
|
|
|
|
}
|
2022-07-06 01:29:27 +01:00
|
|
|
];
|
|
|
|
};
|
2022-07-01 19:38:37 +01:00
|
|
|
formatter = pkgs.alejandra;
|
|
|
|
});
|
|
|
|
}
|