added module options
This commit is contained in:
@@ -2,10 +2,12 @@ let
|
|||||||
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-25.11";
|
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-25.11";
|
||||||
pkgs = import nixpkgs { config = {}; overlays = []; };
|
pkgs = import nixpkgs { config = {}; overlays = []; };
|
||||||
in
|
in
|
||||||
|
{ serverUrl ? "" }:
|
||||||
{
|
{
|
||||||
pinepods = pkgs.callPackage ./pinepods.nix {
|
pinepods = pkgs.callPackage ./pinepods.nix {
|
||||||
# Pin wasm-bindgen-cli to exactly the version PinePods requires
|
# Pin wasm-bindgen-cli to exactly the version PinePods requires
|
||||||
wasm-bindgen-cli = pkgs.wasm-bindgen-cli_0_2_105;
|
wasm-bindgen-cli = pkgs.wasm-bindgen-cli_0_2_105;
|
||||||
inherit (pkgs) binaryen tailwindcss_3 libayatana-appindicator gst_all_1;
|
inherit (pkgs) binaryen tailwindcss_3 libayatana-appindicator gst_all_1 python3;
|
||||||
|
inherit serverUrl;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
28
patch-lib.py
Normal file
28
patch-lib.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
target = '.run(tauri::generate_context!())'
|
||||||
|
replacement = '''.setup(|app| {
|
||||||
|
if let Ok(server_url) = std::env::var("PINEPODS_SERVER") {
|
||||||
|
if !server_url.is_empty() {
|
||||||
|
use tauri::Manager;
|
||||||
|
let window = app.get_webview_window("main").unwrap();
|
||||||
|
window.navigate(server_url.parse().unwrap()).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
|
.run(tauri::generate_context!())'''
|
||||||
|
|
||||||
|
with open(sys.argv[1], 'r') as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
if target not in content:
|
||||||
|
print(f"ERROR: Could not find target string in {sys.argv[1]}")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
content = content.replace(target, replacement)
|
||||||
|
|
||||||
|
with open(sys.argv[1], 'w') as f:
|
||||||
|
f.write(content)
|
||||||
|
|
||||||
|
print("Successfully patched lib.rs")
|
||||||
24
pinepods-module.nix
Normal file
24
pinepods-module.nix
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.pinepods;
|
||||||
|
pinepods-pkg = (import "${toString ./.}/default.nix" {
|
||||||
|
serverUrl = cfg.server;
|
||||||
|
}).pinepods;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.pinepods = {
|
||||||
|
enable = lib.mkEnableOption "PinePods podcast manager";
|
||||||
|
|
||||||
|
server = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "";
|
||||||
|
example = "https://pinepods.example.com";
|
||||||
|
description = "The URL of your PinePods server.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
environment.systemPackages = [ pinepods-pkg ];
|
||||||
|
};
|
||||||
|
}
|
||||||
13
pinepods.nix
13
pinepods.nix
@@ -26,6 +26,8 @@
|
|||||||
, makeWrapper
|
, makeWrapper
|
||||||
, libayatana-appindicator
|
, libayatana-appindicator
|
||||||
, gst_all_1
|
, gst_all_1
|
||||||
|
, python3
|
||||||
|
, serverUrl ? ""
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@@ -96,6 +98,7 @@ rustPlatform.buildRustPackage {
|
|||||||
pkg-config
|
pkg-config
|
||||||
wrapGAppsHook3
|
wrapGAppsHook3
|
||||||
makeWrapper
|
makeWrapper
|
||||||
|
python3
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
@@ -128,12 +131,11 @@ rustPlatform.buildRustPackage {
|
|||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
chmod -R u+w $NIX_BUILD_TOP/source
|
chmod -R u+w $NIX_BUILD_TOP/source
|
||||||
|
|
||||||
# Link the pre-built frontend where tauri.conf.json expects it
|
|
||||||
ln -s ${frontend} $NIX_BUILD_TOP/source/web/dist
|
ln -s ${frontend} $NIX_BUILD_TOP/source/web/dist
|
||||||
|
|
||||||
# Remove devUrl so Tauri serves embedded assets instead of connecting to a dev server
|
|
||||||
sed -i '/"devUrl"/d' $NIX_BUILD_TOP/source/web/src-tauri/tauri.conf.json
|
sed -i '/"devUrl"/d' $NIX_BUILD_TOP/source/web/src-tauri/tauri.conf.json
|
||||||
|
|
||||||
|
# Patch lib.rs to read PINEPODS_SERVER env var and navigate to it on startup
|
||||||
|
python3 ${./patch-lib.py} $NIX_BUILD_TOP/source/web/src-tauri/src/lib.rs
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
@@ -187,7 +189,8 @@ rustPlatform.buildRustPackage {
|
|||||||
postFixup = ''
|
postFixup = ''
|
||||||
wrapProgram $out/bin/pinepods \
|
wrapProgram $out/bin/pinepods \
|
||||||
--set WEBKIT_DISABLE_COMPOSITING_MODE 1 \
|
--set WEBKIT_DISABLE_COMPOSITING_MODE 1 \
|
||||||
--set WEBKIT_FORCE_SANDBOX 0 \
|
--set WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS 1 \
|
||||||
|
${lib.optionalString (serverUrl != "") "--set PINEPODS_SERVER \"${serverUrl}\""} \
|
||||||
--prefix LD_LIBRARY_PATH : "${libayatana-appindicator}/lib" \
|
--prefix LD_LIBRARY_PATH : "${libayatana-appindicator}/lib" \
|
||||||
--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "${gst_all_1.gstreamer}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-base}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-good}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-bad}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-ugly}/lib/gstreamer-1.0:${gst_all_1.gst-libav}/lib/gstreamer-1.0" \
|
--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "${gst_all_1.gstreamer}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-base}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-good}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-bad}/lib/gstreamer-1.0:${gst_all_1.gst-plugins-ugly}/lib/gstreamer-1.0:${gst_all_1.gst-libav}/lib/gstreamer-1.0" \
|
||||||
--prefix XDG_DATA_DIRS : "$out/share" \
|
--prefix XDG_DATA_DIRS : "$out/share" \
|
||||||
|
|||||||
Reference in New Issue
Block a user