Rebase to flake parts #8
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
{ ... }: {
|
||||
flake.homeManagerModules.wisdomBrowsersChrome =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.browsers.chrome;
|
||||
in
|
||||
{
|
||||
options.chiasson.home.browsers.chrome.enable = lib.mkEnableOption ''
|
||||
Chrome (unfree, needs `allowUnfree`); skipped if nixpkgs has no build for this platform.
|
||||
'';
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = lib.optional (
|
||||
lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.google-chrome
|
||||
) pkgs.google-chrome;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{ ... }: {
|
||||
flake.homeManagerModules.wisdomBrowsersEdge =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.browsers.edge;
|
||||
in
|
||||
{
|
||||
options.chiasson.home.browsers.edge.enable = lib.mkEnableOption "Edge (unfree); skipped if unavailable on this platform.";
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = lib.optional (
|
||||
lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.microsoft-edge
|
||||
) pkgs.microsoft-edge;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
{ ... }: {
|
||||
flake.homeManagerModules.wisdomBrowsersFlow =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.browsers.flow;
|
||||
|
||||
flow-browser =
|
||||
let
|
||||
pname = "flow-browser";
|
||||
version = "0.11.0";
|
||||
|
||||
suffix = if pkgs.stdenv.hostPlatform.isAarch64 then "arm64" else "x86_64";
|
||||
|
||||
hash =
|
||||
if pkgs.stdenv.hostPlatform.isAarch64 then
|
||||
"sha256-rTRKbNyVRJAw7ZyDR6kx+XJ4rWmErZqA0b6LP9t5eOA="
|
||||
else
|
||||
"sha256-/Tca4uUBfgbZQEeXdYkCz6CWxqvCl40CQpACFry1k9s=";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://github.com/MultiboxLabs/flow-browser/releases/download/v${version}/flow-browser-${version}-${suffix}.AppImage";
|
||||
inherit hash;
|
||||
};
|
||||
|
||||
appimageContents = pkgs.appimageTools.extractType2 { inherit pname version src; };
|
||||
in
|
||||
pkgs.appimageTools.wrapType2 {
|
||||
inherit pname version src;
|
||||
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
|
||||
extraInstallCommands = ''
|
||||
wrapProgram $out/bin/${pname} \
|
||||
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}"
|
||||
|
||||
install -m 444 -D ${appimageContents}/flow-browser.desktop -t $out/share/applications
|
||||
substituteInPlace $out/share/applications/flow-browser.desktop \
|
||||
--replace-fail 'Exec=AppRun --ozone-platform-hint=auto' 'Exec=${pname} --ozone-platform-hint=auto'
|
||||
|
||||
install -m 444 -D ${appimageContents}/usr/share/icons/hicolor/512x512/apps/flow-browser.png \
|
||||
$out/share/icons/hicolor/512x512/apps/flow-browser.png
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Chromium-based browser (upstream AppImage)";
|
||||
homepage = "https://github.com/MultiboxLabs/flow-browser";
|
||||
license = lib.licenses.gpl3Plus;
|
||||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
||||
mainProgram = pname;
|
||||
maintainers = [ ];
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.chiasson.home.browsers.flow.enable = lib.mkEnableOption ''
|
||||
[Flow](https://github.com/MultiboxLabs/flow-browser) — upstream AppImage wrapped for NixOS.
|
||||
'';
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = lib.optional (
|
||||
lib.meta.availableOn pkgs.stdenv.hostPlatform flow-browser
|
||||
) flow-browser;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
{ ... }: {
|
||||
flake.homeManagerModules.wisdomBrowsersOrion =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.browsers.orion;
|
||||
|
||||
pname = "oriongtk";
|
||||
version = "0.3.0";
|
||||
flatpakBundle = pkgs.fetchurl {
|
||||
url = "https://cdn.kagi.com/downloads/oriongtk.${version}.flatpak";
|
||||
hash = "sha256-0NOWPS2Yv5NpnTxqsiMvshHFyTyDotPi964/2og/bCw=";
|
||||
};
|
||||
|
||||
appId = "com.kagi.OrionGtk";
|
||||
|
||||
oriongtk = pkgs.runCommand "oriongtk-${version}"
|
||||
{
|
||||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||
passthru = {
|
||||
inherit pname version;
|
||||
};
|
||||
}
|
||||
''
|
||||
mkdir -p "$out/bin"
|
||||
makeWrapper ${pkgs.flatpak}/bin/flatpak "$out/bin/${pname}" \
|
||||
--add-flags "run" \
|
||||
--add-flags ${lib.escapeShellArg appId}
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.chiasson.home.browsers.orion.enable = lib.mkEnableOption ''
|
||||
[Orion](https://orionbrowser.com/) (Kagi) — installs the upstream Flatpak bundle and provides `oriongtk`.
|
||||
'';
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = [ oriongtk ];
|
||||
|
||||
home.activation.oriongtkFlatpak = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
set -eu
|
||||
|
||||
if [ ! -x "${pkgs.flatpak}/bin/flatpak" ]; then
|
||||
echo "oriongtk: flatpak missing; enable Flatpak (e.g. services.flatpak on NixOS)." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "oriongtk: ensuring ${appId} from ${flatpakBundle} (user)"
|
||||
# `--or-update` still exits non-zero when the same ref is already installed from this bundle;
|
||||
# `--reinstall` is idempotent for HM switches (uninstall first only if present).
|
||||
${pkgs.flatpak}/bin/flatpak --user install \
|
||||
--assumeyes \
|
||||
--noninteractive \
|
||||
--reinstall \
|
||||
--bundle \
|
||||
${lib.escapeShellArg (builtins.toString flatpakBundle)}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
{ inputs, ... }: {
|
||||
flake.homeManagerModules.wisdomBrowsersZen =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.browsers.zen;
|
||||
in
|
||||
{
|
||||
imports = [ inputs.zen-browser.homeModules.beta ];
|
||||
|
||||
options.chiasson.home.browsers.zen.enable = lib.mkEnableOption "Zen Browser + locked-down policies / extensions.";
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
programs.zen-browser = {
|
||||
enable = true;
|
||||
policies = {
|
||||
PasswordManagerEnabled = false;
|
||||
AutofillCreditCardEnabled = false;
|
||||
AutofillAddressEnabled = false;
|
||||
DisableAppUpdate = true;
|
||||
DisableFeedbackCommands = true;
|
||||
DisableFirefoxStudies = true;
|
||||
DisablePocket = true;
|
||||
DisableTelemetry = true;
|
||||
OfferToSaveLogins = false;
|
||||
EnableTrackingProtection = {
|
||||
Value = true;
|
||||
Locked = true;
|
||||
Cryptomining = true;
|
||||
Fingerprinting = true;
|
||||
};
|
||||
ExtensionSettings = {
|
||||
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = {
|
||||
install_url = "https://addons.mozilla.org/firefox/downloads/latest/bitwarden-password-manager/latest.xpi";
|
||||
installation_mode = "normal_installed";
|
||||
};
|
||||
"uBlock0@raymondhill.net" = {
|
||||
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
|
||||
installation_mode = "normal_installed";
|
||||
};
|
||||
"{762f9885-5a13-4abd-9c77-433dcd38b8fd}" = {
|
||||
install_url = "https://addons.mozilla.org/firefox/downloads/latest/return-youtube-dislikes/latest.xpi";
|
||||
installation_mode = "normal_installed";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = [
|
||||
(pkgs.writeShellApplication {
|
||||
name = "extract-firefox-extension";
|
||||
runtimeInputs = with pkgs; [
|
||||
wget
|
||||
unzip
|
||||
jq
|
||||
];
|
||||
text = ''
|
||||
if [ -z "$1" ]; then
|
||||
echo "usage: $0 <firefox-addon-url>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PLUGIN_URL="$1"
|
||||
TEMP_DIR="extension-id-$(date +%s)"
|
||||
mkdir "$TEMP_DIR" || exit 1
|
||||
cd "$TEMP_DIR" || exit 1
|
||||
|
||||
DOWNLOAD_URL=$(echo "$PLUGIN_URL" \
|
||||
| sed -E 's|https://addons.mozilla.org/firefox/downloads/file/[0-9]+/([^/]+)-[^/]+\.xpi|\1|' \
|
||||
| tr '_' '-' \
|
||||
| awk '{print "https://addons.mozilla.org/firefox/downloads/latest/" $1 "/latest.xpi"}')
|
||||
|
||||
wget -q "$DOWNLOAD_URL" -O latest.xpi || { cd ..; rm -rf "$TEMP_DIR"; exit 1; }
|
||||
unzip -q latest.xpi -d unpacked || { cd ..; rm -rf "$TEMP_DIR"; exit 1; }
|
||||
|
||||
jq -r '.browser_specific_settings.gecko.id' unpacked/manifest.json || { cd ..; rm -rf "$TEMP_DIR"; exit 1; }
|
||||
|
||||
cd ..
|
||||
rm -rf "$TEMP_DIR"
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
{ ... }: {
|
||||
flake.homeManagerModules.wisdomDesktopGtkQtTheming =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.desktop.theming;
|
||||
in
|
||||
{
|
||||
options.chiasson.home.desktop.theming = {
|
||||
enable = lib.mkEnableOption ''
|
||||
WhiteSur GTK + icon themes, Phinger cursor, and Qt via the KDE platform theme — same idea as
|
||||
the old `home-shared.nix` stack for Hyprland/Niri (no full Plasma session required). Optional
|
||||
`dank-colors.css` import for DMS/matugen GTK accents.
|
||||
'';
|
||||
|
||||
matugenGtkColors = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Add `@import url("dank-colors.css");` to gtk3/gtk4 extraCss. DMS/matugen writes
|
||||
`~/.config/gtk-3.0` / `gtk-4.0` `dank-colors.css` when dynamic theming is on — disable if
|
||||
you use this module without DMS.
|
||||
'';
|
||||
};
|
||||
|
||||
gtkTheme = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "WhiteSur-Dark";
|
||||
};
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.whitesur-gtk-theme;
|
||||
};
|
||||
};
|
||||
|
||||
iconTheme = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "WhiteSur-dark";
|
||||
};
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.whitesur-icon-theme;
|
||||
};
|
||||
};
|
||||
|
||||
cursor = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "phinger-cursors-dark";
|
||||
};
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.phinger-cursors;
|
||||
};
|
||||
size = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 32;
|
||||
};
|
||||
};
|
||||
|
||||
qt = {
|
||||
platformTheme = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "kde";
|
||||
description = ''
|
||||
`QT_QPA_PLATFORMTHEME` (e.g. `kde` for Qt/KDE integration, matches previous flake).
|
||||
'';
|
||||
};
|
||||
extraPackages = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.package;
|
||||
default = [ pkgs.whitesur-kde pkgs.qt6Packages.qt6ct ];
|
||||
description = "Extra packages (KDE look-and-feel + qt6ct GUI).";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) (lib.mkMerge [
|
||||
{
|
||||
home.packages = cfg.qt.extraPackages;
|
||||
|
||||
home.sessionVariables = {
|
||||
QT_QPA_PLATFORMTHEME = cfg.qt.platformTheme;
|
||||
};
|
||||
|
||||
home.pointerCursor = {
|
||||
name = cfg.cursor.name;
|
||||
package = cfg.cursor.package;
|
||||
size = cfg.cursor.size;
|
||||
gtk.enable = true;
|
||||
x11.enable = true;
|
||||
};
|
||||
|
||||
gtk = {
|
||||
enable = true;
|
||||
theme = {
|
||||
name = cfg.gtkTheme.name;
|
||||
package = cfg.gtkTheme.package;
|
||||
};
|
||||
iconTheme = {
|
||||
name = cfg.iconTheme.name;
|
||||
package = cfg.iconTheme.package;
|
||||
};
|
||||
cursorTheme = {
|
||||
name = cfg.cursor.name;
|
||||
package = cfg.cursor.package;
|
||||
size = cfg.cursor.size;
|
||||
};
|
||||
gtk3.extraConfig = {
|
||||
gtk-application-prefer-dark-theme = 1;
|
||||
};
|
||||
gtk4.extraConfig = {
|
||||
gtk-application-prefer-dark-theme = 1;
|
||||
};
|
||||
};
|
||||
}
|
||||
(lib.mkIf cfg.matugenGtkColors {
|
||||
gtk.gtk3.extraCss = ''
|
||||
@import url("dank-colors.css");
|
||||
'';
|
||||
gtk.gtk4.extraCss = ''
|
||||
@import url("dank-colors.css");
|
||||
'';
|
||||
})
|
||||
]);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
{ ... }: {
|
||||
flake.homeManagerModules.wisdomDesktopScreenshot =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.desktop.screenshot;
|
||||
hyprlandHm = lib.attrByPath [ "wayland" "windowManager" "hyprland" ] { } config;
|
||||
hyprlandHmEnabled = hyprlandHm.enable or false;
|
||||
keyOk = cfg.swiftshareApiKeyFile != null && cfg.swiftshareApiKeyFile != "";
|
||||
in
|
||||
{
|
||||
options.chiasson.home.desktop.screenshot.enable = lib.mkEnableOption ''
|
||||
grim/slurp/swappy + SwiftShare helpers; Hyprland binds if HM Hyprland is on.
|
||||
'';
|
||||
|
||||
options.chiasson.home.desktop.screenshot.swiftshareApiKeyFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = ''
|
||||
File with SwiftShare API key (sops path is fine). Required when screenshot module is on.
|
||||
'';
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf (root.enable && cfg.enable) {
|
||||
assertions = [
|
||||
{
|
||||
assertion = keyOk;
|
||||
message = "chiasson.home.desktop.screenshot: set chiasson.home.desktop.screenshot.swiftshareApiKeyFile to your SwiftShare API key file path.";
|
||||
}
|
||||
];
|
||||
})
|
||||
(lib.mkIf (root.enable && cfg.enable && keyOk) (
|
||||
let
|
||||
apiKeyFile = cfg.swiftshareApiKeyFile;
|
||||
in
|
||||
lib.mkMerge [
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
grim
|
||||
slurp
|
||||
swappy
|
||||
wl-clipboard
|
||||
libnotify
|
||||
(writeShellScriptBin "swiftshare-upload" ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
COPY_URL=0
|
||||
if [ "$#" -ge 1 ] && [ "$1" = "--copy-url" ]; then
|
||||
COPY_URL=1
|
||||
shift
|
||||
fi
|
||||
|
||||
APP_NAME=""
|
||||
if [ "$#" -ge 2 ] && [ "$1" = "--app-name" ]; then
|
||||
APP_NAME="$2"
|
||||
shift 2
|
||||
fi
|
||||
|
||||
API_KEY_FILE=${lib.escapeShellArg apiKeyFile}
|
||||
if [ -r "$API_KEY_FILE" ]; then
|
||||
SWIFTSHARE_API_KEY="$(tr -d '\n' < "$API_KEY_FILE")"
|
||||
fi
|
||||
|
||||
if [ -z "''${SWIFTSHARE_API_KEY:-}" ]; then
|
||||
${pkgs.libnotify}/bin/notify-send "SwiftShare upload" "SwiftShare API key missing (expected readable: $API_KEY_FILE)"
|
||||
echo "Error: SwiftShare API key missing (expected readable: $API_KEY_FILE)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IMAGE_FILE=""
|
||||
RESPONSE_FILE=""
|
||||
cleanup() {
|
||||
if [ -n "$RESPONSE_FILE" ] && [ -f "$RESPONSE_FILE" ]; then
|
||||
rm -f "$RESPONSE_FILE"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ "$#" -ge 1 ] && [ "$1" != "-" ]; then
|
||||
IMAGE_FILE="$1"
|
||||
if [ "''${IMAGE_FILE#'/'}" = "''${IMAGE_FILE}" ]; then
|
||||
IMAGE_FILE="$(${pkgs.coreutils}/bin/readlink -f "''${IMAGE_FILE}")"
|
||||
fi
|
||||
if [ ! -f "$IMAGE_FILE" ]; then
|
||||
echo "Error: file not found: $IMAGE_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
APP_NAME="''${APP_NAME:-screenshot}"
|
||||
APP_NAME="''${APP_NAME%% *}"
|
||||
APP_NAME="''${APP_NAME//[^A-Za-z0-9]/}"
|
||||
APP_NAME="''${APP_NAME,,}"
|
||||
if [ -z "$APP_NAME" ]; then
|
||||
APP_NAME="screenshot"
|
||||
fi
|
||||
|
||||
IMAGE_FILE="$(${pkgs.coreutils}/bin/mktemp --suffix=.png "''${TMPDIR:-/tmp}/''${APP_NAME}_XXXXXX")"
|
||||
cat > "$IMAGE_FILE"
|
||||
fi
|
||||
|
||||
if [ ! -s "$IMAGE_FILE" ]; then
|
||||
${pkgs.libnotify}/bin/notify-send "SwiftShare" "Empty capture (maybe canceled) – not uploading"
|
||||
echo "Empty image file, not uploading." >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
RESPONSE_FILE="$(mktemp)"
|
||||
set +e
|
||||
HTTP_STATUS="$(${pkgs.curl}/bin/curl -sS -o "''${RESPONSE_FILE}" -w '%{http_code}' \
|
||||
-X POST "https://swiftshare.cloud/api/upload/sharex" \
|
||||
-F "upload=@''${IMAGE_FILE}" \
|
||||
-F "apiKey=''${SWIFTSHARE_API_KEY}")"
|
||||
CURL_EXIT=$?
|
||||
set -e
|
||||
|
||||
RESPONSE="$(cat "''${RESPONSE_FILE}")"
|
||||
|
||||
if [ "''${CURL_EXIT}" -ne 0 ]; then
|
||||
${pkgs.libnotify}/bin/notify-send "SwiftShare upload failed" "Network or HTTP error (curl exit ''${CURL_EXIT})"
|
||||
echo "SwiftShare upload failed (curl exit ''${CURL_EXIT})." >&2
|
||||
echo "Response body:" >&2
|
||||
echo "''${RESPONSE}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! echo "''${HTTP_STATUS}" | grep -qE '^2[0-9][0-9]$'; then
|
||||
ERROR_MSG="$(${pkgs.jq}/bin/jq -r '.error // empty' <<< "''${RESPONSE}")"
|
||||
if [ -z "''${ERROR_MSG}" ] || [ "''${ERROR_MSG}" = "null" ]; then
|
||||
ERROR_MSG="Failed to upload file"
|
||||
fi
|
||||
${pkgs.libnotify}/bin/notify-send "SwiftShare upload failed (''${HTTP_STATUS})" "''${ERROR_MSG}"
|
||||
echo "SwiftShare upload failed (HTTP ''${HTTP_STATUS}): ''${ERROR_MSG}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
URL="$(${pkgs.jq}/bin/jq -r '.url // empty' <<< "''${RESPONSE}")"
|
||||
THUMBNAIL="$(${pkgs.jq}/bin/jq -r '.thumbnail // empty' <<< "''${RESPONSE}")"
|
||||
|
||||
if [ -z "$URL" ] || [ "$URL" = "null" ]; then
|
||||
${pkgs.libnotify}/bin/notify-send "SwiftShare upload failed" "Could not parse URL from response"
|
||||
echo "Upload failed. Raw response:" >&2
|
||||
echo "''${RESPONSE}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$URL"
|
||||
if [ -n "$THUMBNAIL" ] && [ "$THUMBNAIL" != "null" ]; then
|
||||
echo "$THUMBNAIL"
|
||||
fi
|
||||
|
||||
if [ "$COPY_URL" = "1" ]; then
|
||||
${pkgs.wl-clipboard}/bin/wl-copy <<< "$URL"
|
||||
fi
|
||||
|
||||
if [ -n "$IMAGE_FILE" ] && [ -f "$IMAGE_FILE" ]; then
|
||||
${pkgs.libnotify}/bin/notify-send \
|
||||
-a "SwiftShare" \
|
||||
-i "$IMAGE_FILE" \
|
||||
-h string:image-path:"$IMAGE_FILE" \
|
||||
"SwiftShare upload" "Uploaded image: $URL"
|
||||
else
|
||||
${pkgs.libnotify}/bin/notify-send "SwiftShare upload" "Uploaded image: $URL"
|
||||
fi
|
||||
'')
|
||||
|
||||
(writeShellScriptBin "swiftshare-screenshot" ''
|
||||
#!${pkgs.bash}/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
LOG_DIR="$HOME/.local/state/swiftshare"
|
||||
mkdir -p "$LOG_DIR"
|
||||
LOG_FILE="$LOG_DIR/screenshot.log"
|
||||
|
||||
APP_CLASS="$(${pkgs.hyprland}/bin/hyprctl activewindow -j 2>/dev/null | ${pkgs.jq}/bin/jq -r '.class // .initialClass // empty' 2>/dev/null || true)"
|
||||
APP_CLASS="''${APP_CLASS%% *}"
|
||||
APP_CLASS="''${APP_CLASS//[^A-Za-z0-9]/}"
|
||||
APP_CLASS="''${APP_CLASS,,}"
|
||||
if [ -z "$APP_CLASS" ]; then
|
||||
APP_CLASS="screenshot"
|
||||
fi
|
||||
|
||||
GEOM="$(${pkgs.slurp}/bin/slurp)"
|
||||
SLURP_EXIT=$?
|
||||
|
||||
if [ "$SLURP_EXIT" -ne 0 ] || [ -z "$GEOM" ]; then
|
||||
${pkgs.libnotify}/bin/notify-send "SwiftShare" "Capture canceled"
|
||||
{
|
||||
echo "==== $(date) ==== capture canceled (slurp exit $SLURP_EXIT, geom='$GEOM')"
|
||||
} >>"$LOG_FILE" 2>&1
|
||||
exit 0
|
||||
fi
|
||||
|
||||
{
|
||||
echo "==== $(date) ===="
|
||||
echo "Geometry: $GEOM"
|
||||
${pkgs.grim}/bin/grim -g "$GEOM" - | ${pkgs.swappy}/bin/swappy -f - -o - | swiftshare-upload --copy-url --app-name "$APP_CLASS"
|
||||
} >>"$LOG_FILE" 2>&1
|
||||
'')
|
||||
];
|
||||
}
|
||||
(lib.mkIf hyprlandHmEnabled {
|
||||
wayland.windowManager.hyprland.settings = {
|
||||
bind = [
|
||||
", Print, exec, grim -g \"$(slurp)\" - | wl-copy"
|
||||
"Control, Print, exec, grim -g \"$(slurp)\" - | swappy -f -"
|
||||
"SUPER, Print, exec, swiftshare-screenshot"
|
||||
];
|
||||
windowrule = [
|
||||
"float on, opacity 1.0 override, match:class ^(swappy)$"
|
||||
];
|
||||
};
|
||||
})
|
||||
]
|
||||
))
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
{ inputs, ... }: {
|
||||
flake.homeManagerModules.wisdomEditorsCursor =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.editors.cursor;
|
||||
cursorPkgs = inputs.cursor.packages.${pkgs.stdenv.hostPlatform.system} or { };
|
||||
cursorPkg =
|
||||
if cursorPkgs ? cursor then
|
||||
cursorPkgs.cursor
|
||||
else if cursorPkgs ? default then
|
||||
cursorPkgs.default
|
||||
else
|
||||
null;
|
||||
# NixOS-New `home-shared.nix`: `cursor-cli` alongside the AppImage. nixpkgs now names this
|
||||
# `cursor-agent`; keep both for compatibility across pins.
|
||||
defaultAgentPkg =
|
||||
if pkgs ? cursor-agent then
|
||||
pkgs.cursor-agent
|
||||
else if pkgs ? cursor-cli then
|
||||
pkgs.cursor-cli
|
||||
else
|
||||
null;
|
||||
in
|
||||
{
|
||||
options.chiasson.home.editors.cursor = {
|
||||
enable = lib.mkEnableOption "Cursor editor from the `cursor` flake input.";
|
||||
setAsDefaultEditor = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "`EDITOR` / `VISUAL` → `cursor --wait`.";
|
||||
};
|
||||
agent = {
|
||||
enable = lib.mkEnableOption ''
|
||||
Cursor Agent CLI (`cursor-agent` in current nixpkgs; older pins used `cursor-cli`).
|
||||
'' // {
|
||||
default = true;
|
||||
};
|
||||
package = lib.mkOption {
|
||||
type = with lib.types; nullOr package;
|
||||
default = defaultAgentPkg;
|
||||
defaultText = "pkgs.cursor-agent or pkgs.cursor-cli or null";
|
||||
description = ''
|
||||
Package providing the `cursor-agent` CLI. Set to `null` to omit the CLI while keeping the GUI app.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable && cursorPkg != null) {
|
||||
home.packages =
|
||||
[ cursorPkg ]
|
||||
++ lib.optionals (cfg.agent.enable && cfg.agent.package != null) [ cfg.agent.package ];
|
||||
home.sessionVariables = lib.mkIf cfg.setAsDefaultEditor {
|
||||
EDITOR = "cursor --wait";
|
||||
VISUAL = "cursor --wait";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
{ ... }: {
|
||||
flake.homeManagerModules.wisdomFilebrowsersDolphin =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = root.filebrowsers.dolphin;
|
||||
in
|
||||
{
|
||||
options.chiasson.home.filebrowsers.dolphin.enable = lib.mkEnableOption "Dolphin + declarative dolphinrc.";
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = [ pkgs.kdePackages.dolphin ];
|
||||
|
||||
xdg.configFile."dolphinrc".text = ''
|
||||
[ContentDisplay]
|
||||
UsePermissionsFormat=CombinedFormat
|
||||
|
||||
[General]
|
||||
StartupPath=~
|
||||
DoubleClickViewAction=show_hidden_files
|
||||
ShowFullPath=true
|
||||
ShowFullPathInTitlebar=true
|
||||
ShowStatusBar=FullWidth
|
||||
UseTabForSwitchingSplitView=true
|
||||
Version=202
|
||||
ViewPropsTimestamp=2025,11,17,23,21,57.762
|
||||
|
||||
[KFileDialog Settings]
|
||||
Places Icons Auto-resize=false
|
||||
Places Icons Static Size=22
|
||||
|
||||
[MainWindow]
|
||||
MenuBar=Disabled
|
||||
ToolBarsMovable=Disabled
|
||||
|
||||
[PreviewSettings]
|
||||
Plugins=appimagethumbnail,audiothumbnail,blenderthumbnail,comicbookthumbnail,cursorthumbnail,djvuthumbnail,ebookthumbnail,exrthumbnail,directorythumbnail,fontthumbnail,imagethumbnail,jpegthumbnail,kraorathumbnail,windowsexethumbnail,windowsimagethumbnail,mobithumbnail,opendocumentthumbnail,gsthumbnail,rawthumbnail,svgthumbnail,ffmpegthumbs
|
||||
|
||||
[IconsMode]
|
||||
IconSize=48
|
||||
PreviewSize=48
|
||||
TextLines=2
|
||||
UseThumbnails=true
|
||||
|
||||
[DetailsMode]
|
||||
FontWeight=50
|
||||
HighlightEntireRow=true
|
||||
|
||||
[ViewProperties]
|
||||
Mode=1
|
||||
ColumnWidths=50,50,50,50,50,50,50,50,50,50
|
||||
SortColumn=0
|
||||
SortOrder=0
|
||||
SortFoldersFirst=true
|
||||
SortHiddenLast=false
|
||||
SortCaseSensitively=false
|
||||
ShowPreviews=true
|
||||
ShowInGroups=false
|
||||
ShowFoldersFirst=true
|
||||
ShowHiddenFilesLast=false
|
||||
NaturalSorting=true
|
||||
|
||||
[ContextMenu]
|
||||
ShowCopyToMenu=true
|
||||
ShowMoveToMenu=true
|
||||
|
||||
[Search]
|
||||
Location=Everywhere
|
||||
|
||||
[SettingsWindow]
|
||||
SidebarWidth=180
|
||||
SplitterState=AAAA/wAAAAD9AAAAAAAAAAAAAAABAAAAAQAAAAEAAAAAQAAAAEAAAAA=
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{ ... }: {
|
||||
flake.homeManagerModules.wisdomHardwareUconsoleGamepad =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.hardware.uconsoleGamepad;
|
||||
in
|
||||
{
|
||||
options.chiasson.home.hardware.uconsoleGamepad.enable = lib.mkEnableOption ''
|
||||
uConsole gamepad antimicrox profile + Hyprland exec-once when HM Hyprland is on.
|
||||
'';
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) (lib.mkMerge [
|
||||
{
|
||||
home.packages = [ pkgs.antimicrox ];
|
||||
home.file.".config/antimicrox/uconsole.gamecontroller.amgp".text = ''
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gamecontroller configversion="19" appversion="3.5.1">
|
||||
<sdlname>Clockwork Pi DevTerm</sdlname>
|
||||
<uniqueID>030000fdaf1e00002400000010010000785536</uniqueID>
|
||||
<stickAxisAssociation index="2" xAxis="3" yAxis="4"/>
|
||||
<stickAxisAssociation index="1" xAxis="1" yAxis="2"/>
|
||||
<vdpadButtonAssociations index="1">
|
||||
<vdpadButtonAssociation axis="0" button="12" direction="1"/>
|
||||
<vdpadButtonAssociation axis="0" button="13" direction="4"/>
|
||||
<vdpadButtonAssociation axis="0" button="14" direction="8"/>
|
||||
<vdpadButtonAssociation axis="0" button="15" direction="2"/>
|
||||
</vdpadButtonAssociations>
|
||||
<names>
|
||||
<controlstickname index="2">Stick 2</controlstickname>
|
||||
<controlstickname index="1">Stick 1</controlstickname>
|
||||
</names>
|
||||
<sets>
|
||||
<set index="1">
|
||||
<trigger index="6">
|
||||
<throttle>positivehalf</throttle>
|
||||
</trigger>
|
||||
<trigger index="5">
|
||||
<throttle>positivehalf</throttle>
|
||||
</trigger>
|
||||
<button index="2">
|
||||
<slots>
|
||||
<slot>
|
||||
<code>0x1000022</code>
|
||||
<mode>keyboard</mode>
|
||||
</slot>
|
||||
</slots>
|
||||
</button>
|
||||
</set>
|
||||
</sets>
|
||||
</gamecontroller>
|
||||
'';
|
||||
}
|
||||
(lib.mkIf (config.wayland.windowManager.hyprland.enable or false) {
|
||||
wayland.windowManager.hyprland.settings.exec-once = lib.mkAfter [
|
||||
"antimicrox --hidden --no-tray --profile ${config.home.homeDirectory}/.config/antimicrox/uconsole.gamecontroller.amgp &"
|
||||
];
|
||||
})
|
||||
]);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user