From e3274843ccd5c88d91b073de843f342617fdb16b Mon Sep 17 00:00:00 2001 From: L-Nafaryus Date: Tue, 25 Jun 2024 16:09:03 +0500 Subject: [PATCH] Add Nix flakes support --- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5473ff3 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1719223410, + "narHash": "sha256-jtIo8xR0Zp4SalIwmD+OdCwHF4l7OU6PD63UUK4ckt4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "efb39c6052f3ce51587cf19733f5f4e5d515aa13", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..1aaf0b2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,52 @@ +{ + description = "OBS Studio plugin with image that reacts to sound source"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + + outputs = { self, nixpkgs, ... }: + let + forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "i686-linux" ]; + nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); + inherit (nixpkgs) lib; + in { + packages = forAllSystems (system: + let pkgs = nixpkgsFor.${system}; + in { + obs-image-reaction = pkgs.stdenv.mkDerivation { + pname = "obs-image-reaction"; + version = "1.2"; + + src = ./.; + + nativeBuildInputs = with pkgs; [ cmake ]; + buildInputs = with pkgs; [ obs-studio ]; + + postInstall = '' + mkdir $out/lib $out/share + mv $out/obs-plugins/64bit $out/lib/obs-plugins + rm -rf $out/obs-plugins + mv $out/data $out/share/obs + ''; + + meta = with lib; { + description = "OBS Studio plugin with image that reacts to sound source"; + homepage = "https://github.com/L-Nafaryus/obs-image-reaction"; + maintainers = []; + license = licenses.gpl2Plus; + platforms = [ "x86_64-linux" "i686-linux" ]; + }; + }; + + default = self.packages.${system}.obs-image-reaction; + }); + + devShells = forAllSystems (system: let pkgs = nixpkgsFor.${system}; in { + default = pkgs.mkShell { + buildInputs = with pkgs; [ gcc cmake gnumake obs-studio ]; + }; + }); + }; +} +