diff options
| -rw-r--r-- | flake.lock | 61 | ||||
| -rw-r--r-- | flake.nix | 79 |
2 files changed, 140 insertions, 0 deletions
diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9aa7f11 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1760038930, + "narHash": "sha256-Oncbh0UmHjSlxO7ErQDM3KM0A5/Znfofj2BSzlHLeVw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0b4defa2584313f3b781240b29d61f6f9f7e0df3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ba3000c --- /dev/null +++ b/flake.nix @@ -0,0 +1,79 @@ +{ + description = "EZLive: Self-hosted Serverless Livestream"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + packages.default = pkgs.stdenv.mkDerivation { + pname = "ezlive"; + version = "0.1.0"; + + src = ./.; + + nativeBuildInputs = with pkgs; [ + pkg-config + ]; + + buildInputs = with pkgs; [ + ffmpeg + aws-sdk-cpp + ]; + + makeFlags = [ + "CC=${pkgs.stdenv.cc}/bin/cc" + "CXX=${pkgs.stdenv.cc}/bin/c++" + ]; + + installPhase = '' + runHook preInstall + mkdir -p $out/bin + cp ezlive $out/bin/ + runHook postInstall + ''; + + meta = with pkgs.lib; { + description = "Self-hosted Serverless Livestream built on top of S3-compatible object storage"; + homepage = "https://github.com/mistivia/ezlive"; + license = licenses.agpl3Only; + maintainers = [ ]; + platforms = platforms.linux; + }; + }; + + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + gcc + gnumake + pkg-config + ffmpeg + aws-sdk-cpp + ]; + + shellHook = '' + echo "EZLive development environment" + echo "Run 'make' to build the project" + ''; + }; + + packages.docker = pkgs.dockerTools.buildLayeredImage { + name = "ezlive"; + tag = "latest"; + + contents = [ self.packages.${system}.default ]; + + config = { + Cmd = [ "${self.packages.${system}.default}/bin/ezlive" ]; + WorkingDir = "/app"; + }; + }; + } + ); +} |
