Rebase to flake parts #7
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
{ inputs, ... }: {
|
||||
flake.homeManagerModules.wisdomAppsDiscord =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.apps.discord;
|
||||
# nixcord still pulls `discord` on some paths; that package is not built for aarch64-linux.
|
||||
nixcordSupported = lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.discord;
|
||||
in
|
||||
{
|
||||
imports = [ inputs.nixcord.homeModules.default ];
|
||||
|
||||
options.chiasson.home.apps.discord.enable = lib.mkEnableOption ''
|
||||
Vesktop (nixcord). Needs nixpkgs `discord` — breaks on e.g. aarch64-linux.
|
||||
'';
|
||||
|
||||
config = lib.mkIf root.enable (lib.mkMerge [
|
||||
{
|
||||
assertions = lib.mkIf cfg.enable [
|
||||
{
|
||||
assertion = nixcordSupported;
|
||||
message = "chiasson.home.apps.discord uses nixcord, which currently requires nixpkgs `discord` (not available on ${pkgs.stdenv.hostPlatform.system}). Disable `chiasson.home.apps.discord` on this host.";
|
||||
}
|
||||
];
|
||||
}
|
||||
(lib.mkIf (cfg.enable && nixcordSupported) {
|
||||
programs.nixcord = {
|
||||
enable = true;
|
||||
vesktop.enable = true;
|
||||
dorion.enable = false;
|
||||
config = {
|
||||
useQuickCss = true;
|
||||
transparent = true;
|
||||
enabledThemes = lib.optionals (
|
||||
lib.attrByPath [ "programs" "dank-material-shell" "enable" ] false config
|
||||
) [ "dank-discord.css" ];
|
||||
plugins = {
|
||||
showHiddenChannels = {
|
||||
enable = true;
|
||||
showMode = 0;
|
||||
};
|
||||
platformIndicators.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
{ ... }: {
|
||||
flake.nixosModules.systemLocalsend =
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.chiasson.system.localsend;
|
||||
in
|
||||
{
|
||||
options.chiasson.system.localsend.openFirewall = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Open TCP/UDP **53317** for LocalSend. Use with `wisdomAppsLocalsend` on the user side.
|
||||
'';
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.openFirewall {
|
||||
networking.firewall.allowedTCPPorts = [ 53317 ];
|
||||
networking.firewall.allowedUDPPorts = [ 53317 ];
|
||||
};
|
||||
};
|
||||
|
||||
flake.homeManagerModules.wisdomAppsLocalsend =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.apps.localsend;
|
||||
in
|
||||
{
|
||||
options.chiasson.home.apps.localsend = {
|
||||
enable = lib.mkEnableOption ''
|
||||
LocalSend client; open the firewall on NixOS with `system.localsend` if you want inbound.
|
||||
'';
|
||||
|
||||
package = lib.mkPackageOption pkgs "localsend" { };
|
||||
};
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = [ cfg.package ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{ ... }: {
|
||||
flake.homeManagerModules.wisdomAppsPokeclicker =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.apps.pokeclicker;
|
||||
pokeclickerPkg = pkgs.callPackage ./package { };
|
||||
in
|
||||
{
|
||||
options.chiasson.home.apps.pokeclicker.enable = lib.mkEnableOption "PokéClicker desktop (Farigh fork .deb → nix).";
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
home.packages = [ pokeclickerPkg ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
fetchurl,
|
||||
dpkg,
|
||||
makeWrapper,
|
||||
autoPatchelfHook,
|
||||
alsa-lib,
|
||||
gtk3,
|
||||
libnotify,
|
||||
nss,
|
||||
xdg-utils,
|
||||
at-spi2-core,
|
||||
libsecret,
|
||||
libuuid,
|
||||
mesa,
|
||||
xorg,
|
||||
}:
|
||||
|
||||
let
|
||||
version = "1.2.13";
|
||||
|
||||
srcInfo =
|
||||
if stdenvNoCC.hostPlatform.system == "x86_64-linux" then
|
||||
{
|
||||
url = "https://github.com/Farigh/pokeclicker-automation-desktop/releases/download/v${version}/pokeclicker-desktop-with-scripts_${version}_amd64.deb";
|
||||
hash = "sha256-V4z0RDyaJHICUBcFanfZqGVHNVJcKakABx9RSen6hZw=";
|
||||
}
|
||||
else if stdenvNoCC.hostPlatform.system == "aarch64-linux" then
|
||||
{
|
||||
url = "https://github.com/Farigh/pokeclicker-automation-desktop/releases/download/v${version}/pokeclicker-desktop-with-scripts_${version}_arm64.deb";
|
||||
hash = "sha256-tcVD0eV3hT9Iq75cJ7o/EK7uLHHBWhxdUHsWdJvcNlk=";
|
||||
}
|
||||
else
|
||||
throw "pokeclicker-automation-desktop: unsupported platform: ${stdenvNoCC.hostPlatform.system}";
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "pokeclicker-automation-desktop";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl srcInfo;
|
||||
|
||||
nativeBuildInputs = [
|
||||
dpkg
|
||||
makeWrapper
|
||||
autoPatchelfHook
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
alsa-lib
|
||||
gtk3
|
||||
libnotify
|
||||
mesa
|
||||
nss
|
||||
xdg-utils
|
||||
at-spi2-core
|
||||
libsecret
|
||||
libuuid
|
||||
xorg.libXScrnSaver
|
||||
xorg.libXtst
|
||||
];
|
||||
|
||||
unpackPhase = "true";
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
dpkg-deb -x "$src" "$out"
|
||||
|
||||
if [ -d "$out/usr/share" ]; then
|
||||
mkdir -p "$out/share"
|
||||
mv "$out/usr/share/"* "$out/share/"
|
||||
rmdir -p --ignore-fail-on-non-empty "$out/usr" || true
|
||||
fi
|
||||
|
||||
mkdir -p "$out/bin"
|
||||
|
||||
appDir="$out/opt/PokéClicker with Scripts"
|
||||
makeWrapper "$appDir/pokeclicker-desktop-with-scripts" "$out/bin/pokeclicker-desktop-with-scripts" \
|
||||
--add-flags "--no-sandbox"
|
||||
|
||||
ln -s "$out/bin/pokeclicker-desktop-with-scripts" "$out/bin/pokeclicker-automation-desktop"
|
||||
|
||||
desktopFile="$out/share/applications/pokeclicker-desktop-with-scripts.desktop"
|
||||
if [ -f "$desktopFile" ]; then
|
||||
substituteInPlace "$desktopFile" \
|
||||
--replace 'Exec="/opt/PokéClicker with Scripts/pokeclicker-desktop-with-scripts" %U' \
|
||||
'Exec=pokeclicker-desktop-with-scripts %U'
|
||||
fi
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
autoPatchelfIgnoreMissingDeps = true;
|
||||
|
||||
meta = with lib; {
|
||||
description = "PokéClicker desktop wrapper with scripts support (Farigh fork)";
|
||||
homepage = "https://github.com/Farigh/pokeclicker-automation-desktop";
|
||||
license = licenses.isc;
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
mainProgram = "pokeclicker-desktop-with-scripts";
|
||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
{ inputs, ... }: {
|
||||
flake.homeManagerModules.wisdomAppsSpotify =
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
root = config.chiasson.home;
|
||||
cfg = config.chiasson.home.apps.spotify;
|
||||
spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.stdenv.hostPlatform.system};
|
||||
in
|
||||
{
|
||||
imports = [ inputs.spicetify-nix.homeManagerModules.default ];
|
||||
|
||||
options.chiasson.home.apps.spotify.enable = lib.mkEnableOption ''
|
||||
x86_64: spicetify + Spotify; others: `spotify-player`; aarch64 also gets `ncspot`.
|
||||
'';
|
||||
|
||||
options.chiasson.home.apps.spotify.openDiscoveryFirewall = lib.mkEnableOption ''
|
||||
Punch TCP 57621 / UDP 5353 on the host firewall for LAN discovery (needs Spotify enabled here).
|
||||
'';
|
||||
|
||||
config = lib.mkIf (root.enable && cfg.enable) {
|
||||
programs.spicetify = lib.mkIf pkgs.stdenv.isx86_64 {
|
||||
enable = true;
|
||||
enabledCustomApps = [
|
||||
spicePkgs.apps.ncsVisualizer
|
||||
spicePkgs.apps.lyricsPlus
|
||||
];
|
||||
enabledExtensions = [ spicePkgs.extensions.fullScreen ];
|
||||
};
|
||||
|
||||
home.packages =
|
||||
with pkgs;
|
||||
[ spotify-player ]
|
||||
++ lib.optionals pkgs.stdenv.hostPlatform.isAarch64 [ ncspot ];
|
||||
};
|
||||
};
|
||||
|
||||
# Opens Spotify LAN ports when any wired HM user sets `chiasson.home.apps.spotify.*` (requires HM+NixOS).
|
||||
flake.nixosModules.systemSpotify =
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
users = config.home-manager.users or { };
|
||||
userOpensDiscovery =
|
||||
name:
|
||||
let
|
||||
u = users.${name};
|
||||
in
|
||||
(lib.attrByPath [ "chiasson" "home" "enable" ] false u)
|
||||
&& (lib.attrByPath [ "chiasson" "home" "apps" "spotify" "enable" ] false u)
|
||||
&& (lib.attrByPath [ "chiasson" "home" "apps" "spotify" "openDiscoveryFirewall" ] false u);
|
||||
anyDiscovery = lib.any userOpensDiscovery (lib.attrNames users);
|
||||
in
|
||||
{
|
||||
config = lib.mkIf anyDiscovery {
|
||||
networking.firewall.allowedTCPPorts = [ 57621 ];
|
||||
networking.firewall.allowedUDPPorts = [ 5353 ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user