Want to contribute? Fork me on Codeberg.org!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
3.0 KiB

/*
Some utility commands:
- `nix flake update --commit-lock-file`
- `nix flake lock update-input <input>`
- `nix build .#webcam-streamer` or `nix build .`
- `nix run .#webcam-streamer` or `nix run .`
*/
{
description = "";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, rust-overlay }:
let
overlays = [ (import rust-overlay) ];
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system overlays;
};
rustSettings = with pkgs; {
src = ./.;
buildInputs = with pkgs; [ ffmpeg ];
cargoHash = nixpkgs.lib.fakeHash;
};
meta = with nixpkgs.lib; {
homepage = "https://git.elnu.com/ElnuDev/webcam-streamer";
license = [ licenses.gpl3 ];
platforms = [ system ];
maintainers = with maintainers; [ elnudev ];
};
in {
devShells.${system}.default = with pkgs; mkShell {
packages = [
(pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
})
cargo-edit
bacon
];
inputsFrom = with self.packages.${system}; [ webcam-streamer ];
};
packages.${system} = {
default = self.packages.${system}.webcam-streamer;
webcam-streamer = pkgs.rustPlatform.buildRustPackage (rustSettings // {
pname = "webcam-streamer";
version = "0.1.0";
buildAndTestSubdir = "webcam-streamer";
cargoHash = "sha256-+TaGIiKf+Pz2bTABeG8aCZz0/ZTCKl5398+qbas4Nvo=";
meta = meta // {
description = "";
};
});
};
/*
nixosModules.default = { config, ... }: let
lib = nixpkgs.lib;
in {
options.services.webcam-streamer = {
enable = lib.mkEnableOption (lib.mdDoc "webcam-streamer service");
package = lib.mkOption {
type = lib.types.package;
default = self.packages.${system}.webcam-streamer;
defaultText = "pkgs.webcam-streamer";
description = lib.mdDoc ''
The webcam-streamer package that should be used.
'';
};
port = lib.mkOption {
type = lib.types.port;
default = 8000;
description = lib.mdDoc ''
The port at which to run.
'';
};
};
config.systemd.services.webcam-streamer = let
cfg = config.services.webcam-streamer;
pkg = self.packages.${system}.webcam-streamer;
in lib.mkIf cfg.enable {
description = pkg.meta.description;
after = [ "network.target" ];
wantedBy = [ "network.target" ];
serviceConfig = {
ExecStart = ''
${cfg.package}/bin/webcam-streamer --port ${builtins.toString cfg.port}
'';
Restart = "always";
DynamicUser = true;
};
};
};
*/
};
}