Affinity v3 & v2 packaged with Nix!
Based on https://github.com/lf-/affinity-crimes and https://affinity.liz.pet/, and uses ElementalWarrior's wine.
We also install https://github.com/noahc3/AffinityPluginLoader for a far more pleasant experience.
There is a sister project which allows you to run these packages on any Linux distro through AppImages, affinity-everywhere.
With the release of v3, there has been some changes:
- Packages
{wine,wineboot,wineserver,winetricks}have been removed. There are instructions below to access these binaries. - Packages
{update,direct}*have been removed. There are instructions below to update the apps. - Since v3 was unified into a single application,
{photo,designer,publisher}remain the way to access v2 affinity, withv3becoming the package to access the v3 application. - Additionally, the
defaultpackage now points to v3.
Tip
Add garnix as a substituter to avoid compiling yourself.
Note
This repo does not attempt to redistribute affinity archives. Any instance of caching Canva IP should be reported as a bug.
User preferences are located in $XDG_DATA_HOME/affinity/ or $XDG_DATA_HOME/affinity-v3/ falling back to $HOME/.local/share/affinity/ or $HOME/.local/share/affinity-v3/.
A wine prefix containing all the necessary dependencies and the affinity installation is built in nix and mounted at runtime. Overlayfs is used to keep your user preferences intact. fuse-overlayfs will be fallen back on if your kernel rejects unprivileged user namespaces, common on hardened systems. This can reduce performance.
graph LR;
A([Winetricks])-.->B[Nix Store];
C([Affinity])-.->B;
D([Wine])-.->B;
B e1@-->E[Overlayfs];
F[User Data] e2@<-->E;
E<-- Mounted @ Runtime -->G[Affinity Application];
$ nix run github:mrshmllow/affinity-nix#affinity-v3
-- v2 versions:
$ nix run github:mrshmllow/affinity-nix#affinity-photo
$ nix run github:mrshmllow/affinity-nix#affinity-designer
$ nix run github:mrshmllow/affinity-nix#affinity-publisher$ nix profile install github:mrshmllow/affinity-nix#affinity-v3
-- v2 versions:
$ nix profile install github:mrshmllow/affinity-nix#affinity-photo
$ nix profile install github:mrshmllow/affinity-nix#affinity-designer
$ nix profile install github:mrshmllow/affinity-nix#affinity-publisherInstalling via an overlay is recommended, as the package will become unfree in the future.
Install with NixOS:
{
inputs = {
affinity-nix.url = "github:mrshmllow/affinity-nix";
# ...
};
outputs = inputs @ {
affinity-nix,
...
}: {
nixosConfigurations.my-system = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {inherit inputs;};
modules = [
# ...
({ pkgs, ... }: {
nixpkgs.overlays = [ affinity-nix.overlays.default ];
environment.systemPackages = [ pkgs.affinity-v3 ];
})
];
};
}
}Install with Home Manager:
{
inputs = {
affinity-nix.url = "github:mrshmllow/affinity-nix";
# ...
};
outputs = inputs @ {
affinity-nix,
...
}: {
homeConfigurations.my-user = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages."x86_64-linux";
extraSpecialArgs = {inherit inputs;};
modules = [
# ...
({ pkgs, ... }: {
nixpkgs.overlays = [ affinity-nix.overlays.default ];
home.packages = [ pkgs.affinity-v3 ];
})
];
};
}
}Each package (v3|photo|designer|publisher) has the following usage:
$ affinity-v3 --help
Usage: affinity-v3 [OPTIONS] [AFFINITY_ARGUMENTS]... [COMMAND]
Commands:
wine Run wine within sandbox
winetricks Run winetricks within sandbox
wineboot Run wineboot within sandbox
wineserver Run wineserver within sandbox
help Print this message or the help of the given subcommand(s)
Arguments:
[AFFINITY_ARGUMENTS]... Arguments for affinity application
Options:
--verbose Make Wine far more verbose
-h, --help Print help
-V, --version Print version
Tip
Armed with these you should be able to follow https://affinity.liz.pet/v2/misc-troubleshooting/ for troubleshooting steps.
For example, accessing wine:
$ affinity-v3 wine
Usage: wine PROGRAM [ARGUMENTS...] Run the specified program
wine --help Display this help and exit
wine --version Output version information and exit
Or winecfg:
$ affinity-v3 wine winecfgI (the maintainer of this repo) currently only have an AMD GPU to test OpenCL support for Affinity. On AMD, I can attest that
hardware.amdgpu.opencl.enable = true;appears to be all that is required to get OpenCL to work with affinity-nix.
