Skip to content

Commit

Permalink
Add droidcam support
Browse files Browse the repository at this point in the history
Temporary v4l2 overrideAttrs to work around breaking change in
NixOS/nixpkgs#134311
  • Loading branch information
frogamic committed Aug 19, 2021
1 parent 677e0e7 commit 8fc8578
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions services/android.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
{ pkgs, ... }: {
{ config, pkgs, ... }: {
programs.adb.enable = true;

boot = {
extraModulePackages = [ (config.boot.kernelPackages.v4l2loopback.overrideAttrs (old: {
outputs = ["out"];
postInstall = ''
make install-utils PREFIX=$out

This comment has been minimized.

Copy link
@L-as

L-as Aug 19, 2021

Why do you want the utils?

This comment has been minimized.

Copy link
@frogamic

frogamic Aug 19, 2021

Author Owner

I actually don't know that I do want the utils, I was just hacking to try understand how mkDerivation works.

'';
})) ];
kernelModules = [ "v4l2loopback" ];
extraModprobeConfig = ''
options v4l2loopback exclusive_caps=1
'';
};

environment.systemPackages = with pkgs; [
droidcam
adbfs-rootless
android-file-transfer
android-udev-rules
Expand All @@ -18,19 +32,13 @@
crop = "1080:2204:0:136";
title = "Touhou LostWord";
})

(mylib.mkAdbApp {
bin="adbscreen";
})
(pkgs.writeShellScriptBin "adbshot" ''
FILENAME="$(date --iso-8601=seconds).png"
adb shell screencap -p > "$FILENAME" && \
${pkgs.file}/bin/file "$FILENAME"
'')
(pkgs.writeShellScriptBin "adbscreen" ''
args=(
"--render-driver" "opengl" \
"--bit-rate" "12M" \
"$''\@" \
)
exec ${pkgs.scrcpy}/bin/scrcpy "''${args[''\@]}"
'')
];
}

0 comments on commit 8fc8578

Please sign in to comment.