packages: convert to self-contained flake-parts modules
Each package file now exports its own perSystem.packages.<name> definition instead of being called from a centralized packages.nix file. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
1b7ea7e59b
commit
829fde6a3a
6 changed files with 459 additions and 445 deletions
|
|
@ -1,13 +1,14 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
lib,
|
perSystem =
|
||||||
stdenv,
|
{ pkgs, ... }:
|
||||||
fetchFromGitHub,
|
{
|
||||||
}:
|
packages.base16-schemes = pkgs.stdenv.mkDerivation (finalAttrs: {
|
||||||
stdenv.mkDerivation (finalAttrs: {
|
|
||||||
pname = "base16-schemes";
|
pname = "base16-schemes";
|
||||||
version = "0-unstable-2025-06-04";
|
version = "0-unstable-2025-06-04";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
owner = "tinted-theming";
|
owner = "tinted-theming";
|
||||||
repo = "schemes";
|
repo = "schemes";
|
||||||
rev = "317a5e10c35825a6c905d912e480dfe8e71c7559";
|
rev = "317a5e10c35825a6c905d912e480dfe8e71c7559";
|
||||||
|
|
@ -26,7 +27,9 @@ stdenv.mkDerivation (finalAttrs: {
|
||||||
meta = {
|
meta = {
|
||||||
description = "All the color schemes for use in base16 packages";
|
description = "All the color schemes for use in base16 packages";
|
||||||
homepage = "https://github.com/tinted-theming/schemes";
|
homepage = "https://github.com/tinted-theming/schemes";
|
||||||
maintainers = [ lib.maintainers.DamienCassou ];
|
maintainers = [ pkgs.lib.maintainers.DamienCassou ];
|
||||||
license = lib.licenses.mit;
|
license = pkgs.lib.licenses.mit;
|
||||||
};
|
};
|
||||||
})
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,25 @@
|
||||||
|
{ inputs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
lib,
|
perSystem =
|
||||||
stdenv,
|
{ system, ... }:
|
||||||
fetchurl,
|
|
||||||
makeWrapper,
|
|
||||||
makeDesktopItem,
|
|
||||||
copyDesktopItems,
|
|
||||||
p7zip,
|
|
||||||
unzip,
|
|
||||||
electron,
|
|
||||||
nodejs,
|
|
||||||
asar,
|
|
||||||
graphicsmagick,
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
let
|
||||||
pname = "claude-desktop";
|
pkgs = import inputs.nixpkgs {
|
||||||
version = "1.0.1768"; # Updated based on extracted nupkg
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
|
||||||
srcs.x86_64-linux = fetchurl {
|
pname = "claude-desktop";
|
||||||
|
version = "1.0.1768";
|
||||||
|
|
||||||
|
srcs.x86_64-linux = pkgs.fetchurl {
|
||||||
url = "https://downloads.claude.ai/releases/win32/x64/1.0.1768/Claude-67d01376d0e9d08b328455f6db9e63b0d603506a.exe";
|
url = "https://downloads.claude.ai/releases/win32/x64/1.0.1768/Claude-67d01376d0e9d08b328455f6db9e63b0d603506a.exe";
|
||||||
hash = "sha256-x76Qav38ya3ObpWIq3dDowo79LgvVquMfaZeH8M1LUk=;";
|
hash = "sha256-x76Qav38ya3ObpWIq3dDowo79LgvVquMfaZeH8M1LUk=;";
|
||||||
};
|
};
|
||||||
|
|
||||||
src =
|
src =
|
||||||
srcs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
srcs.${pkgs.stdenv.hostPlatform.system} or (throw "Unsupported system: ${pkgs.stdenv.hostPlatform.system}");
|
||||||
|
|
||||||
# Stub implementation for claude-native module
|
|
||||||
claudeNativeStub = ''
|
claudeNativeStub = ''
|
||||||
// Stub implementation of claude-native using KeyboardKey enum values
|
// Stub implementation of claude-native using KeyboardKey enum values
|
||||||
const KeyboardKey = {
|
const KeyboardKey = {
|
||||||
|
|
@ -50,12 +44,12 @@ let
|
||||||
KeyboardKey
|
KeyboardKey
|
||||||
};
|
};
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
{
|
||||||
|
packages.claude-desktop = pkgs.stdenv.mkDerivation rec {
|
||||||
inherit pname version src;
|
inherit pname version src;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = with pkgs; [
|
||||||
makeWrapper
|
makeWrapper
|
||||||
copyDesktopItems
|
copyDesktopItems
|
||||||
p7zip
|
p7zip
|
||||||
|
|
@ -64,12 +58,10 @@ stdenv.mkDerivation rec {
|
||||||
graphicsmagick
|
graphicsmagick
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [ pkgs.electron ];
|
||||||
electron
|
|
||||||
];
|
|
||||||
|
|
||||||
desktopItems = [
|
desktopItems = [
|
||||||
(makeDesktopItem {
|
(pkgs.makeDesktopItem {
|
||||||
name = "claude-desktop";
|
name = "claude-desktop";
|
||||||
desktopName = "Claude";
|
desktopName = "Claude";
|
||||||
comment = "AI assistant from Anthropic";
|
comment = "AI assistant from Anthropic";
|
||||||
|
|
@ -101,7 +93,7 @@ stdenv.mkDerivation rec {
|
||||||
# Extract app.asar to modify it
|
# Extract app.asar to modify it
|
||||||
if [ -f ./nupkg/lib/net45/resources/app.asar ]; then
|
if [ -f ./nupkg/lib/net45/resources/app.asar ]; then
|
||||||
echo "Extracting app.asar..."
|
echo "Extracting app.asar..."
|
||||||
${asar}/bin/asar extract ./nupkg/lib/net45/resources/app.asar ./app
|
${pkgs.asar}/bin/asar extract ./nupkg/lib/net45/resources/app.asar ./app
|
||||||
|
|
||||||
# Also copy the unpacked resources
|
# Also copy the unpacked resources
|
||||||
if [ -d ./nupkg/lib/net45/resources/app.asar.unpacked ]; then
|
if [ -d ./nupkg/lib/net45/resources/app.asar.unpacked ]; then
|
||||||
|
|
@ -158,7 +150,7 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
# Repack the modified app as app.asar
|
# Repack the modified app as app.asar
|
||||||
cd ./app
|
cd ./app
|
||||||
${asar}/bin/asar pack . ../app.asar
|
${pkgs.asar}/bin/asar pack . ../app.asar
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# Copy resources
|
# Copy resources
|
||||||
|
|
@ -179,7 +171,7 @@ stdenv.mkDerivation rec {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create wrapper script
|
# Create wrapper script
|
||||||
makeWrapper ${electron}/bin/electron $out/bin/claude-desktop \
|
makeWrapper ${pkgs.electron}/bin/electron $out/bin/claude-desktop \
|
||||||
--add-flags "$out/lib/claude-desktop/resources/app.asar" \
|
--add-flags "$out/lib/claude-desktop/resources/app.asar" \
|
||||||
--set DISABLE_AUTOUPDATER 1 \
|
--set DISABLE_AUTOUPDATER 1 \
|
||||||
--set NODE_ENV production
|
--set NODE_ENV production
|
||||||
|
|
@ -209,13 +201,15 @@ stdenv.mkDerivation rec {
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with pkgs.lib; {
|
||||||
description = "Claude Desktop - AI assistant from Anthropic";
|
description = "Claude Desktop - AI assistant from Anthropic";
|
||||||
homepage = "https://claude.ai";
|
homepage = "https://claude.ai";
|
||||||
license = licenses.unfree;
|
license = licenses.unfree;
|
||||||
sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||||
maintainers = with maintainers; [ ];
|
maintainers = [ ];
|
||||||
platforms = [ "x86_64-linux" ];
|
platforms = [ "x86_64-linux" ];
|
||||||
mainProgram = "claude-desktop";
|
mainProgram = "claude-desktop";
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{ ... }:
|
||||||
lib,
|
|
||||||
pkgs ? import <nixpkgs> { },
|
|
||||||
}:
|
|
||||||
|
|
||||||
|
{
|
||||||
|
perSystem =
|
||||||
|
{ pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
fastfetch-logo = pkgs.fetchurl {
|
fastfetch-logo = pkgs.fetchurl {
|
||||||
url = "https://discourse.nixos.org/uploads/default/original/3X/3/6/36954e6d6aa32c8b00f50ca43f142d898c1ff535.png";
|
url = "https://discourse.nixos.org/uploads/default/original/3X/3/6/36954e6d6aa32c8b00f50ca43f142d898c1ff535.png";
|
||||||
|
|
@ -78,4 +78,7 @@ let
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
pkgs.writeShellScriptBin "fastfetch" ''exec ${lib.getExe pkgs.fastfetch} --config ${fastfetch-config} --logo-type kitty --logo ${fastfetch-logo} --logo-padding-right 1 --logo-width 36 "$@" ''
|
{
|
||||||
|
packages.fastfetch = pkgs.writeShellScriptBin "fastfetch" ''exec ${lib.getExe pkgs.fastfetch} --config ${fastfetch-config} --logo-type kitty --logo ${fastfetch-logo} --logo-padding-right 1 --logo-width 36 "$@" '';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
{
|
{ ... }:
|
||||||
pkgs ? import <nixpkgs> { },
|
|
||||||
}:
|
|
||||||
|
|
||||||
pkgs.writeShellScriptBin "hm" ''
|
{
|
||||||
|
perSystem =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
packages.hm-cli = pkgs.writeShellScriptBin "hm" ''
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
HM="${pkgs.lib.getExe pkgs.home-manager}"
|
HM="${pkgs.lib.getExe pkgs.home-manager}"
|
||||||
|
|
@ -102,4 +104,6 @@ pkgs.writeShellScriptBin "hm" ''
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
''
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
{ pkgs }:
|
{ ... }:
|
||||||
|
|
||||||
pkgs.symlinkJoin {
|
{
|
||||||
|
perSystem =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
packages.kwrite = pkgs.symlinkJoin {
|
||||||
name = "kwrite";
|
name = "kwrite";
|
||||||
paths = [ pkgs.kdePackages.kate ];
|
paths = [ pkgs.kdePackages.kate ];
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
|
|
@ -12,4 +16,6 @@ pkgs.symlinkJoin {
|
||||||
$out/share/icons/hicolor/scalable/apps/kate.svg \
|
$out/share/icons/hicolor/scalable/apps/kate.svg \
|
||||||
$out/share/appdata/org.kde.kate.appdata.xml
|
$out/share/appdata/org.kde.kate.appdata.xml
|
||||||
'';
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
{
|
{ ... }:
|
||||||
pkgs ? import <nixpkgs> { },
|
|
||||||
}:
|
|
||||||
|
|
||||||
pkgs.writeShellScriptBin "toggleaudiosink" ''
|
{
|
||||||
|
perSystem =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
packages.toggleaudiosink = pkgs.writeShellScriptBin "toggleaudiosink" ''
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
sound_server="pipewire"
|
sound_server="pipewire"
|
||||||
|
|
@ -45,4 +47,6 @@ pkgs.writeShellScriptBin "toggleaudiosink" ''
|
||||||
for app in $(${pkgs.pulseaudio}/bin/pactl list sink-inputs | sed -n -e 's/.*Sink Input #\([[:digit:]]\)/\1/p'); do
|
for app in $(${pkgs.pulseaudio}/bin/pactl list sink-inputs | sed -n -e 's/.*Sink Input #\([[:digit:]]\)/\1/p'); do
|
||||||
${pkgs.pulseaudio}/bin/pactl "move-sink-input $app $next_sink"
|
${pkgs.pulseaudio}/bin/pactl "move-sink-input $app $next_sink"
|
||||||
done
|
done
|
||||||
''
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue