From f3a44ea76a984648b00424d13727f6f15a1dfa1d Mon Sep 17 00:00:00 2001 From: Luna Simons Date: Tue, 16 Jan 2024 16:45:00 +0100 Subject: [PATCH] mpv-discord: init --- homes/common/applications/default.nix | 1 + .../applications/entertainment/r2modman.nix | 3 +- homes/common/applications/media/mpv.nix | 7 ++++ homes/common/desktop/wayland/default.nix | 1 - pkgs/default.nix | 1 + pkgs/media/mpv-discord.nix | 36 +++++++++++++++++++ 6 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 homes/common/applications/media/mpv.nix create mode 100644 pkgs/media/mpv-discord.nix diff --git a/homes/common/applications/default.nix b/homes/common/applications/default.nix index d1dbc65..6fbddba 100644 --- a/homes/common/applications/default.nix +++ b/homes/common/applications/default.nix @@ -16,6 +16,7 @@ ./graphics/blender.nix ./graphics/cura.nix ./graphics/unity.nix + ./media/mpv.nix ./media/obs.nix ./media/spotify.nix ./productivity/freecad.nix diff --git a/homes/common/applications/entertainment/r2modman.nix b/homes/common/applications/entertainment/r2modman.nix index 65f2bf9..05ffc46 100644 --- a/homes/common/applications/entertainment/r2modman.nix +++ b/homes/common/applications/entertainment/r2modman.nix @@ -1,7 +1,6 @@ {pkgs, ...}: { home = { - # TODO: https://github.com/NixOS/nixpkgs/pull/273455 - # packages = with pkgs; [r2modman]; + packages = with pkgs; [r2modman]; persistence."/nix/persist/home/bddvlpr".directories = [".config/r2modman" ".config/r2modmanPlus-local"]; }; diff --git a/homes/common/applications/media/mpv.nix b/homes/common/applications/media/mpv.nix new file mode 100644 index 0000000..e399730 --- /dev/null +++ b/homes/common/applications/media/mpv.nix @@ -0,0 +1,7 @@ +{pkgs, ...}: { + home.packages = [ + (pkgs.mpv.override { + scripts = [pkgs.mpv-discord]; + }) + ]; +} diff --git a/homes/common/desktop/wayland/default.nix b/homes/common/desktop/wayland/default.nix index 2a6f43b..8a825b8 100644 --- a/homes/common/desktop/wayland/default.nix +++ b/homes/common/desktop/wayland/default.nix @@ -10,7 +10,6 @@ packages = with pkgs; [ grim imv - mpv mimeo waypipe slurp diff --git a/pkgs/default.nix b/pkgs/default.nix index f093f0e..a2c60b6 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -3,4 +3,5 @@ geist-mono = pkgs.callPackage ./fonts/geist-mono.nix {}; geist-nf = pkgs.callPackage ./fonts/geist-nf.nix {}; proton-ge-custom = pkgs.callPackage ./entertainment/proton-ge-custom.nix {}; + mpv-discord = pkgs.callPackage ./media/mpv-discord.nix {}; } diff --git a/pkgs/media/mpv-discord.nix b/pkgs/media/mpv-discord.nix new file mode 100644 index 0000000..1250f3c --- /dev/null +++ b/pkgs/media/mpv-discord.nix @@ -0,0 +1,36 @@ +{ + buildGoModule, + fetchFromGitHub, + stdenv, + ... +}: let + name = "mpv-discord"; + version = "1.4.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"' + ''; + }