Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

feat: nix flake for Linux

Jareer0481cd163b90
diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml
new file mode 100644
index 00000000..126ebaa2
--- /dev/null
+++ b/.github/workflows/nix.yml
@@ -0,0 +1,25 @@
+# Validates the Nix flake (#7). Scoped to flake changes plus manual runs so
+# it does not tax every push; run it by hand after dependency lock changes.
+name: Nix
+
+on:
+ workflow_dispatch:
+ push:
+ paths:
+ - "flake.nix"
+ - "flake.lock"
+ - ".github/workflows/nix.yml"
+ pull_request:
+ paths:
+ - "flake.nix"
+ - "flake.lock"
+ - ".github/workflows/nix.yml"
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: DeterminateSystems/nix-installer-action@v16
+ - name: Build the flake package
+ run: nix build .#wolfcut --print-build-logs
diff --git a/README.md b/README.md
index 69db1d54..56c98dd1 100644
--- a/README.md
+++ b/README.md
@@ -38,6 +38,12 @@ Currently in Alpha (pre-release), Download from [Releases](https://github.com/ju
- MacOs (tested)
- Linux
+### Nix (Linux)
+
+The repository is a flake. `nix run github:jub0t/WolfCut` starts the editor
+with ffmpeg and whisper wired in; `nix develop` opens a shell with everything
+`npm run app` needs.
+
## Contribution
> [!IMPORTANT]
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 00000000..fb09da3e
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,130 @@
+{
+ # Nix support (#7). Linux only on purpose: Tauri under Nix on macOS means
+ # Apple SDK juggling, and the people asking for a flake run Linux.
+ #
+ # nix build .#wolfcut the app, with ffmpeg and whisper-cli wired in
+ # nix develop a shell with everything `npm run app` needs
+ description = "WolfCut - free and open source video editor";
+
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+
+ outputs =
+ { self, nixpkgs }:
+ let
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ ];
+ eachSystem = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
+ in
+ {
+ packages = eachSystem (pkgs: rec {
+ default = wolfcut;
+ wolfcut = pkgs.rustPlatform.buildRustPackage rec {
+ pname = "wolfcut";
+ version = "0.2.0";
+ src = self;
+
+ # No vendor hashes to keep in sync: cargo dependencies come straight
+ # from the Cargo.lock, npm dependencies straight from the integrity
+ # fields of package-lock.json.
+ cargoRoot = "desktop/src-tauri";
+ buildAndTestSubdir = cargoRoot;
+ cargoLock.lockFile = ./desktop/src-tauri/Cargo.lock;
+
+ npmRoot = "desktop";
+ npmDeps = pkgs.importNpmLock { npmRoot = ./desktop; };
+
+ nativeBuildInputs = with pkgs; [
+ cargo-tauri.hook
+ nodejs
+ importNpmLock.npmConfigHook
+ pkg-config
+ wrapGAppsHook3
+ copyDesktopItems
+ ];
+
+ buildInputs = with pkgs; [
+ openssl
+ webkitgtk_4_1
+ gtk3
+ libsoup_3
+ # TLS for the webview and for whisper model downloads.
+ glib-networking
+ # cpal's ALSA backend, for engine audio playback.
+ alsa-lib
+ ];
+
+ # The app looks for ffmpeg/ffprobe and whisper-cli beside itself
+ # first and falls back to PATH (engine `binaries.rs`, desktop
+ # `transcribe.rs`), so the Nix build bundles nothing and puts
+ # nixpkgs' copies on the wrapper's PATH instead. The library path
+ # is for the wgpu compositor, which loads Vulkan (or GL) at run
+ # time rather than linking it.
+ preFixup = ''
+ gappsWrapperArgs+=(
+ --prefix PATH : ${
+ pkgs.lib.makeBinPath [
+ pkgs.ffmpeg
+ pkgs.whisper-cpp
+ ]
+ }
+ --prefix LD_LIBRARY_PATH : ${
+ pkgs.lib.makeLibraryPath [
+ pkgs.vulkan-loader
+ pkgs.libGL
+ ]
+ }
+ )
+ '';
+
+ desktopItems = [
+ (pkgs.makeDesktopItem {
+ name = "wolfcut";
+ exec = "wolfcut-desktop";
+ icon = "wolfcut";
+ desktopName = "WolfCut";
+ comment = "Free and open source video editor";
+ categories = [
+ "AudioVideo"
+ "AudioVideoEditing"
+ ];
+ })
+ ];
+
+ postInstall = ''
+ install -Dm644 desktop/src-tauri/icons/128x128.png \
+ $out/share/icons/hicolor/128x128/apps/wolfcut.png
+ '';
+
+ meta = {
+ description = "Free and open source video editor";
+ homepage = "https://github.com/jub0t/WolfCut";
+ license = pkgs.lib.licenses.mpl20;
+ platforms = systems;
+ mainProgram = "wolfcut-desktop";
+ };
+ };
+ });
+
+ devShells = eachSystem (pkgs: {
+ default = pkgs.mkShell {
+ inputsFrom = [ self.packages.${pkgs.system}.wolfcut ];
+ packages = with pkgs; [
+ cargo
+ rustc
+ rustfmt
+ clippy
+ cargo-tauri
+ ffmpeg
+ whisper-cpp
+ ];
+ # Same runtime loads as the wrapped app, for `npm run app`.
+ LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
+ pkgs.vulkan-loader
+ pkgs.libGL
+ ];
+ };
+ });
+ };
+}