mirror of
https://github.com/wimpysworld/stream-sprout
synced 2026-03-14 06:35:50 +01:00
feat: add nix flake
This commit is contained in:
parent
2244197989
commit
53575da58e
6 changed files with 142 additions and 0 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
.direnv/
|
||||
stream-sprout.yaml
|
||||
15
devshell.nix
Normal file
15
devshell.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{ lib,
|
||||
mkShell,
|
||||
pkgs,
|
||||
stdenv,
|
||||
}:
|
||||
mkShell {
|
||||
packages = with pkgs; ([
|
||||
ffmpeg-headless
|
||||
procps
|
||||
yq-go
|
||||
]);
|
||||
|
||||
shellHook = ''
|
||||
'';
|
||||
}
|
||||
40
flake.lock
generated
Normal file
40
flake.lock
generated
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-schemas": {
|
||||
"locked": {
|
||||
"lastModified": 1721078157,
|
||||
"narHash": "sha256-c2AZH9cOnSpPXV8Lwy19/I8EgW7G+E+Zh6YQBZZwzxI=",
|
||||
"rev": "29e53dd33b1a38f235ef073e768c62821cb6146e",
|
||||
"revCount": 66,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.3/0190b841-54d3-7b7a-8550-24942bc38caf/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A.tar.gz"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1721548954,
|
||||
"narHash": "sha256-7cCC8+Tdq1+3OPyc3+gVo9dzUNkNIQfwSDJ2HSi2u3o=",
|
||||
"rev": "63d37ccd2d178d54e7fb691d7ec76000740ea24a",
|
||||
"revCount": 633334,
|
||||
"type": "tarball",
|
||||
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2405.633334%2Brev-63d37ccd2d178d54e7fb691d7ec76000740ea24a/0190d847-0241-7628-8ab0-d49f442300f4/source.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://flakehub.com/f/NixOS/nixpkgs/%2A.tar.gz"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-schemas": "flake-schemas",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
42
flake.nix
Normal file
42
flake.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
description = "Stream Sprout flake";
|
||||
inputs = {
|
||||
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*.tar.gz";
|
||||
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*.tar.gz";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
flake-schemas,
|
||||
nixpkgs,
|
||||
}: let
|
||||
# Define supported systems and a helper function for generating system-specific outputs
|
||||
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" "aarch64-linux" ];
|
||||
|
||||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
|
||||
system = system;
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
});
|
||||
in {
|
||||
# Define schemas for the flake's outputs
|
||||
schemas = flake-schemas.schemas;
|
||||
|
||||
# Define overlays for each supported system
|
||||
overlays = forEachSupportedSystem ({pkgs, system, ...}: {
|
||||
default = final: prev: {
|
||||
stream-sprout = final.callPackage ./package.nix { };
|
||||
};
|
||||
});
|
||||
|
||||
# Define packages for each supported system
|
||||
packages = forEachSupportedSystem ({pkgs, system, ...}: rec {
|
||||
stream-sprout = pkgs.callPackage ./package.nix { };
|
||||
default = stream-sprout;
|
||||
});
|
||||
|
||||
# Define devShells for each supported system
|
||||
devShells = forEachSupportedSystem ({pkgs, system, ...}: {
|
||||
default = pkgs.callPackage ./devshell.nix { };
|
||||
});
|
||||
};
|
||||
}
|
||||
42
package.nix
Normal file
42
package.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
{ lib
|
||||
, installShellFiles
|
||||
, makeWrapper
|
||||
, stdenv
|
||||
, ffmpeg-headless
|
||||
, procps
|
||||
, yq-go
|
||||
}:
|
||||
let
|
||||
runtimePaths = [
|
||||
ffmpeg-headless
|
||||
procps
|
||||
yq
|
||||
];
|
||||
versionMatches =
|
||||
builtins.match ''
|
||||
.*
|
||||
readonly[[:blank:]]VERSION="([[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+)"
|
||||
.*
|
||||
'' (builtins.readFile ./stream-sprout);
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "stream-sprout";
|
||||
version = builtins.concatStringsSep "" versionMatches;
|
||||
src = lib.cleanSource ./.;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dm755 -t "$out/bin" stream-sprout
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Re-stream a video source to multiple destinations such as Twitch, YouTube, and Owncast.";
|
||||
homepage = "https://github.com/wimpys-world/stream-sprout";
|
||||
mainProgram = "stream-sprout";
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = with lib.maintainers; [ flexiondotorg ];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue