Skip to content

Commit

Permalink
feat: mpv and mpv-discord
Browse files Browse the repository at this point in the history
  • Loading branch information
bddvlpr committed Jul 16, 2024
1 parent 50b1f84 commit 657b2dd
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
25 changes: 25 additions & 0 deletions modules/home/mpv/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
lib,
config,
pkgs,
...
}: let
inherit (lib) mkIf mkOption types;

cfg = config.sysc.mpv;
in {
options.sysc.mpv = {
enable = mkOption {
type = types.bool;
default = true;
};
};

config = mkIf cfg.enable {
home.packages = [
(pkgs.mpv.override {
scripts = [pkgs.mpv-discord];
})
];
};
}
2 changes: 1 addition & 1 deletion modules/shared/users/bddvlpr.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ in {
}
(mkIf (!isDarwin) {
isNormalUser = true;
extraGroups = ["wheel" "audio" "video" "networkmanager" "docker"];
extraGroups = ["wheel" "audio" "video" "dialout" "networkmanager" "docker"];
hashedPassword = "$y$j9T$loVbb4dcOYqZmhAC3NScI1$NmvBmCrmuybhIhaM25x6.X2AgFKkvk9Upfr8GyqCA.3";
})
(mkIf isDarwin {
Expand Down
35 changes: 35 additions & 0 deletions pkgs/mpv-discord/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
buildGoModule,
fetchFromGitHub,
stdenv,
}: let
name = "mpv-discord";
version = "1.6.1";

src = fetchFromGitHub {
owner = "tnychn";
repo = name;
rev = "v${version}";
hash = "sha256-Uvm4McZR88s9tsstqLz7O2F3KkqsGlGrDoL8RjgQnVI=";
};

core = buildGoModule {
name = "${name}-core";
inherit version;
src = "${src}/mpv-discord";

vendorHash = "sha256-xe1jyWFQUD+Z4qBAVQ0SBY0gdxmi5XG9t29n3f/WKDs=";
};
in
stdenv.mkDerivation rec {
inherit name version src;

scriptName = "discord.lua";

installPhase = ''
mkdir -p $out/share/mpv/scripts/
cp -rv $src/scripts/discord.lua $out/share/mpv/scripts/${scriptName}
substituteInPlace $out/share/mpv/scripts/${scriptName} --replace 'binary_path = ""' 'binary_path = "${core}/bin/mpv-discord"'
'';
}

0 comments on commit 657b2dd

Please sign in to comment.