Rebase to flake parts #11
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
{ ... }: {
|
||||
flake.homeManagerModules.wisdomAppsSpacedrive =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.apps.spacedrive;
|
||||
spacedrivePkg = pkgs.callPackage ./package { };
|
||||
in
|
||||
{
|
||||
options.chiasson.home.apps.spacedrive = {
|
||||
enable = lib.mkEnableOption ''
|
||||
[Spacedrive](https://spacedrive.com/) v2 alpha — upstream `.deb` repackaged for NixOS.
|
||||
'';
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = spacedrivePkg;
|
||||
description = "Spacedrive package (defaults to upstream v2.0.0-alpha.2).";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = [ cfg.package ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchurl,
|
||||
dpkg,
|
||||
makeWrapper,
|
||||
autoPatchelfHook,
|
||||
wrapGAppsHook3,
|
||||
adwaita-icon-theme,
|
||||
ffmpeg,
|
||||
gdk-pixbuf,
|
||||
glib,
|
||||
glib-networking,
|
||||
gst_all_1,
|
||||
gtk3,
|
||||
hicolor-icon-theme,
|
||||
libsoup_3,
|
||||
webkitgtk_4_1,
|
||||
xdotool,
|
||||
}:
|
||||
|
||||
let
|
||||
version = "2.0.0-alpha.2";
|
||||
|
||||
srcInfo =
|
||||
if stdenv.hostPlatform.system == "x86_64-linux" then
|
||||
{
|
||||
url = "https://github.com/spacedriveapp/spacedrive/releases/download/v${version}/Spacedrive-linux-x86_64.deb";
|
||||
hash = "sha256-KzRPBtyX5x4ZLlZd6SgAS/cy/7irXt7v+b3Yuq9GETo=";
|
||||
}
|
||||
else if stdenv.hostPlatform.system == "aarch64-linux" then
|
||||
{
|
||||
url = "https://github.com/spacedriveapp/spacedrive/releases/download/v${version}/Spacedrive-linux-aarch64.deb";
|
||||
hash = "sha256-Arq4seJxd69XdraIaYJSv1p9g+Bz/7rez/l9EP6dc9k=";
|
||||
}
|
||||
else
|
||||
throw "spacedrive ${version}: unsupported platform: ${stdenv.hostPlatform.system}";
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "spacedrive";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl srcInfo;
|
||||
|
||||
nativeBuildInputs = [
|
||||
dpkg
|
||||
makeWrapper
|
||||
autoPatchelfHook
|
||||
wrapGAppsHook3
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
adwaita-icon-theme
|
||||
ffmpeg
|
||||
gdk-pixbuf
|
||||
glib
|
||||
glib-networking
|
||||
gtk3
|
||||
hicolor-icon-theme
|
||||
libsoup_3
|
||||
webkitgtk_4_1
|
||||
xdotool
|
||||
gst_all_1.gst-plugins-ugly
|
||||
gst_all_1.gst-plugins-bad
|
||||
gst_all_1.gst-plugins-base
|
||||
gst_all_1.gstreamer
|
||||
];
|
||||
|
||||
# WebKitGTK + TLS + icons; ffmpeg/ffprobe on PATH (alpha Linux builds omit bundled ffmpeg).
|
||||
preFixup = ''
|
||||
gappsWrapperArgs+=(
|
||||
"--prefix" "PATH" ":" "${lib.makeBinPath [ ffmpeg ]}"
|
||||
"--set-default" "WEBKIT_DISABLE_DMABUF_RENDERER" "1"
|
||||
)
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
# Core daemon is not GTK-linked; wrapGAppsHook3 skips it — still needs ffmpeg for media paths.
|
||||
wrapProgram $out/bin/sd-daemon --prefix PATH : "${lib.makeBinPath [ ffmpeg ]}"
|
||||
'';
|
||||
|
||||
unpackPhase = "dpkg-deb -x $src source";
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/{bin,lib,share}
|
||||
cp -r source/usr/bin/* $out/bin/
|
||||
cp -r source/usr/lib/* $out/lib/
|
||||
cp -r source/usr/share/* $out/share/
|
||||
|
||||
ln -sf Spacedrive $out/bin/spacedrive
|
||||
|
||||
substituteInPlace $out/share/applications/Spacedrive.desktop \
|
||||
--replace-fail 'Exec=Spacedrive' 'Exec=spacedrive'
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Local-first file manager and virtual distributed filesystem (v2 alpha)";
|
||||
homepage = "https://spacedrive.com";
|
||||
changelog = "https://github.com/spacedriveapp/spacedrive/releases/tag/v${version}";
|
||||
license = licenses.agpl3Plus;
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
mainProgram = "spacedrive";
|
||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
{ ... }: {
|
||||
flake.nixosModules.systemChromiumHevcVaapi =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.chiasson.system.chromiumHevc;
|
||||
in
|
||||
{
|
||||
options.chiasson.system.chromiumHevc.enable = lib.mkEnableOption ''
|
||||
VA-API packages for Chromium HEVC (Intel iHD + optional NVIDIA nvidia-vaapi-driver).
|
||||
Pair with `wisdomBrowsersChromiumHevc` on the user side.
|
||||
'';
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware.graphics.enable = lib.mkDefault true;
|
||||
hardware.graphics.extraPackages = lib.mkAfter (
|
||||
with pkgs;
|
||||
[ nvidia-vaapi-driver ]
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
flake.homeManagerModules.wisdomBrowsersChromiumHevc =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.browsers.chromiumHevc;
|
||||
|
||||
browserCatalog = {
|
||||
"google-chrome" = {
|
||||
package = pkgs.google-chrome;
|
||||
binary = "google-chrome-stable";
|
||||
launcher = "google-chrome-hevc";
|
||||
desktopName = "Google Chrome (HEVC)";
|
||||
icon = "google-chrome";
|
||||
};
|
||||
chromium = {
|
||||
package = pkgs.chromium;
|
||||
binary = "chromium";
|
||||
launcher = "chromium-hevc";
|
||||
desktopName = "Chromium (HEVC)";
|
||||
icon = "chromium";
|
||||
};
|
||||
"microsoft-edge" = {
|
||||
package = pkgs.microsoft-edge;
|
||||
binary = "microsoft-edge-stable";
|
||||
launcher = "microsoft-edge-hevc";
|
||||
desktopName = "Microsoft Edge (HEVC)";
|
||||
icon = "microsoft-edge";
|
||||
};
|
||||
};
|
||||
|
||||
gpuProfiles = {
|
||||
intel = {
|
||||
driver = "iHD";
|
||||
drmDevice = "/dev/dri/renderD128";
|
||||
nvdBackend = "direct";
|
||||
enableFeatures = [
|
||||
"VaapiVideoDecodeLinuxGL"
|
||||
"VaapiVideoDecoder"
|
||||
"VaapiIgnoreDriverChecks"
|
||||
"PlatformHEVCDecoderSupport"
|
||||
"UseMultiPlaneFormatForHardwareVideo"
|
||||
"AcceleratedVideoDecodeLinuxGL"
|
||||
];
|
||||
disableFeatures = [
|
||||
"AcceleratedVideoDecodeLinuxZeroCopyGL"
|
||||
];
|
||||
};
|
||||
nvidia = {
|
||||
driver = "nvidia";
|
||||
drmDevice = "/dev/dri/renderD129";
|
||||
nvdBackend = "direct";
|
||||
enableFeatures = [
|
||||
"VaapiVideoDecoder"
|
||||
"VaapiIgnoreDriverChecks"
|
||||
"PlatformHEVCDecoderSupport"
|
||||
"VaapiOnNvidiaGPUs"
|
||||
"AcceleratedVideoDecodeLinuxGL"
|
||||
];
|
||||
disableFeatures = [
|
||||
"AcceleratedVideoDecodeLinuxZeroCopyGL"
|
||||
"UseMultiPlaneFormatForHardwareVideo"
|
||||
"VaapiVideoDecodeLinuxGL"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
activeGpu = gpuProfiles.${cfg.vaapi.gpu};
|
||||
|
||||
mkChromiumHevc =
|
||||
packageName:
|
||||
let
|
||||
spec = browserCatalog.${packageName};
|
||||
browser = spec.package;
|
||||
launcherName = spec.launcher;
|
||||
enableFeatures = lib.concatStringsSep "," activeGpu.enableFeatures;
|
||||
disableFeatures = lib.concatStringsSep "," activeGpu.disableFeatures;
|
||||
desktopItem = pkgs.makeDesktopItem {
|
||||
name = launcherName;
|
||||
desktopName = spec.desktopName;
|
||||
genericName = "Web Browser";
|
||||
exec = "${launcherName} %U";
|
||||
icon = spec.icon;
|
||||
categories = [
|
||||
"Network"
|
||||
"WebBrowser"
|
||||
];
|
||||
mimeTypes = [
|
||||
"text/html"
|
||||
"text/xml"
|
||||
"application/xhtml+xml"
|
||||
"x-scheme-handler/http"
|
||||
"x-scheme-handler/https"
|
||||
];
|
||||
};
|
||||
in
|
||||
pkgs.runCommand launcherName
|
||||
{
|
||||
inherit (browser) version;
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
passthru = { inherit browser; };
|
||||
}
|
||||
''
|
||||
mkdir -p $out/bin $out/share/applications
|
||||
|
||||
makeWrapper ${browser}/bin/${spec.binary} $out/bin/${launcherName} \
|
||||
--set LIBVA_DRIVER_NAME ${lib.escapeShellArg activeGpu.driver} \
|
||||
--set LIBVA_DRM_DEVICE ${lib.escapeShellArg activeGpu.drmDevice} \
|
||||
--set NVD_BACKEND ${lib.escapeShellArg activeGpu.nvdBackend} \
|
||||
--add-flags "--enable-features=${enableFeatures}" \
|
||||
--add-flags "--disable-features=${disableFeatures}" \
|
||||
${lib.concatMapStringsSep " " (a: "--add-flags ${lib.escapeShellArg a}") cfg.extraCommandLineArgs}
|
||||
|
||||
cp ${desktopItem}/share/applications/${launcherName}.desktop \
|
||||
$out/share/applications/${launcherName}.desktop
|
||||
'';
|
||||
|
||||
selectedPackages = lib.filter (
|
||||
name:
|
||||
let
|
||||
spec = browserCatalog.${name};
|
||||
in
|
||||
lib.meta.availableOn pkgs.stdenv.hostPlatform spec.package
|
||||
) cfg.packages;
|
||||
|
||||
wrappers = map mkChromiumHevc selectedPackages;
|
||||
in
|
||||
{
|
||||
options.chiasson.home.browsers.chromiumHevc = {
|
||||
enable = lib.mkEnableOption ''
|
||||
`google-chrome-hevc`: Chromium with VA-API HEVC for Jellyfin / MSE playback.
|
||||
|
||||
Default GPU is **Intel** (`vaapi.gpu = "intel"`): Chromium + NVIDIA VA-API is
|
||||
unsupported upstream (`nvidia-vaapi-driver` README) and fails with
|
||||
`failed Initialize()ing the frame pool` in Jellyfin.
|
||||
|
||||
Requires `chiasson.system.chromiumHevc.enable` on NixOS.
|
||||
'';
|
||||
|
||||
packages = lib.mkOption {
|
||||
type = lib.types.listOf (
|
||||
lib.types.enum (lib.attrNames browserCatalog)
|
||||
);
|
||||
default = [ "google-chrome" ];
|
||||
description = "Chromium-based browsers to wrap.";
|
||||
};
|
||||
|
||||
vaapi.gpu = lib.mkOption {
|
||||
type = lib.types.enum [
|
||||
"intel"
|
||||
"nvidia"
|
||||
];
|
||||
default = "intel";
|
||||
description = ''
|
||||
VA-API stack for `google-chrome-hevc`. Use **intel** for Jellyfin (Chromium +
|
||||
nvidia-vaapi-driver is unsupported and hits frame-pool init errors). **nvidia**
|
||||
keeps renderD129 + VaapiOnNvidiaGPUs for experiments only.
|
||||
'';
|
||||
};
|
||||
|
||||
extraCommandLineArgs = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
description = "Extra Chromium flags appended after the HEVC profile flags.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = wrappers;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
imports = [
|
||||
./apps/discord.nix
|
||||
./apps/localsend.nix
|
||||
./apps/spacedrive
|
||||
./apps/pokeclicker
|
||||
./apps/spotify.nix
|
||||
./browsers/orion.nix
|
||||
|
||||
@@ -21,6 +21,23 @@
|
||||
pkgs.cursor-cli
|
||||
else
|
||||
null;
|
||||
nixIdeTools = [ pkgs.nixd pkgs.nixfmt ];
|
||||
cursorWithNixIde =
|
||||
if cursorPkg == null then
|
||||
null
|
||||
else
|
||||
pkgs.symlinkJoin {
|
||||
name = "cursor-with-nix-ide";
|
||||
paths = [ cursorPkg ];
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
for prog in $out/bin/*; do
|
||||
if [ -x "$prog" ]; then
|
||||
wrapProgram "$prog" --prefix PATH : "${lib.makeBinPath nixIdeTools}"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
options.chiasson.home.editors.cursor = {
|
||||
@@ -45,12 +62,28 @@
|
||||
'';
|
||||
};
|
||||
};
|
||||
nixIde = {
|
||||
enable = lib.mkEnableOption ''
|
||||
Nix IDE extension tooling (`nixd` LSP, `nixfmt` formatter).
|
||||
|
||||
Installs `nixd` / `nixfmt` and wraps Cursor so they are on the editor `PATH`
|
||||
(the GUI does not inherit your shell profile).
|
||||
'' // {
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable && cursorPkg != null) {
|
||||
home.packages =
|
||||
[ cursorPkg ]
|
||||
++ lib.optionals (cfg.agent.enable && cfg.agent.package != null) [ cfg.agent.package ];
|
||||
[
|
||||
(if cfg.nixIde.enable && cursorWithNixIde != null then
|
||||
cursorWithNixIde
|
||||
else
|
||||
cursorPkg)
|
||||
]
|
||||
++ lib.optionals (cfg.agent.enable && cfg.agent.package != null) [ cfg.agent.package ]
|
||||
++ lib.optionals cfg.nixIde.enable nixIdeTools;
|
||||
home.sessionVariables = lib.mkIf cfg.setAsDefaultEditor {
|
||||
EDITOR = "cursor --wait";
|
||||
VISUAL = "cursor --wait";
|
||||
|
||||
Reference in New Issue
Block a user