{ description = "SIP Discord interconnect"; inputs = { utils.url = "github:numtide/flake-utils"; devshell.url = "github:numtide/devshell"; naersk.url = "github:nix-community/naersk"; rust-overlay.url = "github:oxalica/rust-overlay"; }; outputs = { self, nixpkgs, utils, naersk, devshell, rust-overlay, }: utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; overlays = [(import rust-overlay)]; }; 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; }; in rec { packages.default = naersk-lib.buildPackage { pname = "discosip"; root = ./.; buildInputs = with pkgs; [libopus pkgconfig]; }; 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 { devshell.packages = with pkgs; [ (rust.override {extensions = ["rls"];}) ffmpeg (callPackage ./pjsip {inherit (darwin.apple_sdk.frameworks) AppKit;}) opusTools 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"; } ]; }; formatter = pkgs.alejandra; }); }