Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 42 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
description = "Simple flake for build Audio Source";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

outputs = { self, nixpkgs }:
let
systems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = nixpkgs.lib.genAttrs systems;
pkgsForSystem = system: import nixpkgs { inherit system; };
in
{
formatter = forAllSystems (system: (pkgsForSystem system).nixfmt-tree);
packages = forAllSystems (system: {
audiosource = import ./nix/package.nix {
inherit (pkgsForSystem system)
stdenv
lib
pkgs
fetchFromGitHub
makeWrapper
;
};
default = self.packages.${system}.audiosource;
});
devShell = forAllSystems (
system: with (pkgsForSystem system); {
default = mkShell {
inputsFrom = [ self.packages.${system}.default ];
packages = [
nixd
nixfmt-tree
bash-language-server
];
};
}
);
};
}
51 changes: 51 additions & 0 deletions nix/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
stdenv,
lib,
pkgs,
fetchFromGitHub,
makeWrapper,
}:
let
runtimeBins = with pkgs; [
android-tools
python312
pulseaudio
];
runtimePath = builtins.concatStringsSep ":" (map (pkg: "${pkg}/bin") runtimeBins);

in
stdenv.mkDerivation (finalAttrs: {
pname = "audiosource";
version = "1.4";
outputs = [
"out"
];
src = fetchFromGitHub {
owner = "gdzx";
repo = "audiosource";
rev = "v${finalAttrs.version}";
hash = "sha256-SlX8gjs7X5jfoeU6pyk4n8f6oMJgneGVt0pmFs48+mQ=";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -Dm755 audiosource $out/bin/audiosource
runHook postInstall
'';
postInstall = ''
wrapProgram $out/bin/audiosource \
--prefix PATH : "${runtimePath}"
'';
meta = with lib; {
description = "Use an Android device as a USB microphone";
mainProgram = "audiosource";
homepage = "https://github.com/gdzx/audiosource";
license = licenses.mit;
platforms = [
"x86_64-linux"
"aarch64-linux"
];
maintainers = [ "ReStranger" ];
};
})