mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-02 13:00:23 +00:00
To reproduce:
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: nix-x86_64-darwin
language: nix
rule:
any:
- pattern: "\"x86_64-darwin\""
kind: list_expression > string_expression
- pattern:
context: "{ \"x86_64-darwin\" = $EXPR; }"
selector: binding
- pattern:
context: "{ x86_64-darwin = $EXPR; }"
selector: binding
fix:
template: ""
' pkgs
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: json-first-x86_64-darwin
language: json
rule:
kind: object > pair:nth-child(1)
has:
pattern: "\"x86_64-darwin\""
field: key
fix:
template: ""
expandEnd: { regex: "," }
' pkgs
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: json-x86_64-darwin
language: json
rule:
kind: object > pair
has:
pattern: "\"x86_64-darwin\""
field: key
fix:
template: ""
expandStart: { regex: "," }
' pkgs
$ git restore pkgs/by-name/om/omnix/package.nix
$ git diff --name-only -z \
| nix shell nixpkgs/3b32825de172d0bc85664f495edb096b10862524#gnused \
-c xargs -0 sed -i '/^$/N; /^\n\? \+$/d'
$ treefmt
189 lines
4.6 KiB
Nix
189 lines
4.6 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
writeText,
|
|
|
|
fetchFromGitHub,
|
|
|
|
dotnetCorePackages,
|
|
buildDotnetModule,
|
|
|
|
ffmpeg-headless,
|
|
|
|
vulkan-loader,
|
|
openssl,
|
|
libGL,
|
|
libx11,
|
|
libice,
|
|
libsm,
|
|
libxi,
|
|
libxcursor,
|
|
libxext,
|
|
libxrandr,
|
|
|
|
makeDesktopItem,
|
|
copyDesktopItems,
|
|
desktopToDarwinBundle,
|
|
|
|
nix-update-script,
|
|
}:
|
|
let
|
|
inherit (dotnetCorePackages) fetchNupkg;
|
|
|
|
buildInfo = {
|
|
id = "NixOS";
|
|
name = "for NixOS";
|
|
};
|
|
|
|
appSettings = writeText "appsettings.json" (
|
|
lib.strings.toJSON {
|
|
PixiEditorApiUrl = "https://auth.pixieditor.net";
|
|
PixiEditorApiKey = "waIvElX0fPqaxnyD7Rh1SSEvdq8qfKUs";
|
|
AnalyticsUrl = "https://api.pixieditor.net/analytics/";
|
|
}
|
|
);
|
|
|
|
in
|
|
buildDotnetModule (finalAttrs: {
|
|
pname = "pixieditor";
|
|
version = "2.1.1.5";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "PixiEditor";
|
|
repo = "PixiEditor";
|
|
tag = finalAttrs.version;
|
|
hash = "sha256-XtDcAnMgNc4Su2hj5OV2SP+LFIAMSfH8h2LLw+VbHok=";
|
|
fetchSubmodules = true;
|
|
};
|
|
|
|
postPatch = ''
|
|
substituteInPlace ./src/PixiEditor/Helpers/VersionHelpers.cs \
|
|
--replace-fail 'builder.Append(" Release Build");' 'builder.Append(" ${buildInfo.name}");' \
|
|
--replace-fail 'return "Release";' 'return "${buildInfo.id}";';
|
|
|
|
substituteInPlace ./src/PixiEditor/Models/ExceptionHandling/CrashReport.cs \
|
|
--replace-fail 'ShellExecute(fileName,' 'ShellExecute("${placeholder "out"}/bin/pixieditor",';
|
|
|
|
rm -rf ./src/PixiEditor.AnimationRenderer.FFmpeg/ThirdParty/{Linux,Macos,Windows}/*
|
|
substituteInPlace ./src/PixiEditor.AnimationRenderer.FFmpeg/FFMpegRenderer.cs \
|
|
--replace-fail 'new FFOptions() { BinaryFolder = binaryPath }' 'new FFOptions() { BinaryFolder = "${ffmpeg-headless}/bin" }' \
|
|
--replace-fail 'MakeExecutableIfNeeded(binaryPath);' ' ';
|
|
|
|
cp src/nuget.config .
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
copyDesktopItems
|
|
]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
desktopToDarwinBundle
|
|
];
|
|
|
|
nugetDeps = ./deps.json;
|
|
linkNugetPackages = true;
|
|
|
|
dotnet-sdk = dotnetCorePackages.sdk_8_0;
|
|
dotnet-runtime = dotnetCorePackages.runtime_8_0;
|
|
dotnetFlags = [
|
|
"-p:RuntimeIdentifier=${dotnetCorePackages.systemToDotnetRid stdenv.hostPlatform.system}"
|
|
];
|
|
|
|
buildType = "ReleaseNoUpdate";
|
|
projectFile = [
|
|
"src/PixiEditor.Desktop/PixiEditor.Desktop.csproj"
|
|
"src/PixiEditor/PixiEditor.csproj"
|
|
(
|
|
if stdenv.hostPlatform.isLinux then
|
|
"src/PixiEditor.Linux/PixiEditor.Linux.csproj"
|
|
else
|
|
"src/PixiEditor.MacOs/PixiEditor.MacOs.csproj"
|
|
)
|
|
"src/PixiEditor.Platform.Standalone/PixiEditor.Platform.Standalone.csproj"
|
|
];
|
|
executables = [ "PixiEditor.Desktop" ];
|
|
|
|
runtimeDeps = [
|
|
vulkan-loader
|
|
openssl
|
|
libGL
|
|
libx11
|
|
libice
|
|
libsm
|
|
libxi
|
|
libxcursor
|
|
libxext
|
|
libxrandr
|
|
];
|
|
|
|
desktopItems = [
|
|
(makeDesktopItem {
|
|
name = "pixieditor";
|
|
type = "Application";
|
|
desktopName = "PixiEditor";
|
|
genericName = "2D Editor";
|
|
comment = finalAttrs.meta.description;
|
|
icon = "pixieditor";
|
|
exec = "pixieditor %f";
|
|
tryExec = "pixieditor";
|
|
startupWMClass = "pixieditor";
|
|
terminal = false;
|
|
categories = [
|
|
"Graphics"
|
|
"2DGraphics"
|
|
"RasterGraphics"
|
|
"VectorGraphics"
|
|
];
|
|
keywords = [
|
|
"editor"
|
|
"image"
|
|
"2d"
|
|
"graphics"
|
|
"design"
|
|
"vector"
|
|
"raster"
|
|
];
|
|
mimeTypes = [
|
|
"application/x-pixieditor"
|
|
];
|
|
extraConfig.SingleMainWindow = "true";
|
|
})
|
|
];
|
|
|
|
postInstall = ''
|
|
install -Dm644 ${appSettings} $out/lib/pixieditor/appsettings.json;
|
|
|
|
install -Dm644 ${./mimeinfo.xml} $out/share/mime/packages/pixieditor.xml;
|
|
|
|
install -Dm644 src/PixiEditor/Images/PixiEditorLogo.svg \
|
|
$out/share/icons/hicolor/scalable/apps/pixieditor.svg;
|
|
'';
|
|
|
|
postFixup = ''
|
|
mv $out/bin/PixiEditor.Desktop $out/bin/pixieditor
|
|
'';
|
|
|
|
passthru = {
|
|
updateScript = nix-update-script { };
|
|
};
|
|
|
|
meta = {
|
|
description = "Universal editor for all your 2D needs";
|
|
longDescription = ''
|
|
PixiEditor is a universal 2D platform that aims to provide you with tools and features for all your 2D needs.
|
|
Create beautiful sprites for your games, animations, edit images, create logos. All packed in an eye-friendly dark theme
|
|
'';
|
|
homepage = "https://pixieditor.net/";
|
|
changelog = "https://github.com/PixiEditor/PixiEditor/releases/tag/${finalAttrs.version}";
|
|
mainProgram = "pixieditor";
|
|
license = lib.licenses.lgpl3Only;
|
|
maintainers = with lib.maintainers; [
|
|
griffi-gh
|
|
];
|
|
platforms = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"aarch64-darwin"
|
|
];
|
|
};
|
|
})
|