From 2000500f7627977cf8bfdc46f1c8f47ed88b704c Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Mon, 6 Jan 2025 18:57:51 +0100 Subject: [PATCH] kde ark: add unrar to decompress .rar archives --- modules/ark.nix | 43 ++++++++++++++++++++++++++++++++++++++++ modules/kde.nix | 1 + modules/programs-kde.nix | 4 ++-- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 modules/ark.nix diff --git a/modules/ark.nix b/modules/ark.nix new file mode 100644 index 0000000..7d5717a --- /dev/null +++ b/modules/ark.nix @@ -0,0 +1,43 @@ +# Archive manager: Compress and decompress + +# https://github.com/NixOS/nixpkgs/issues/311240 +# The package definition for `kdePackages.ark` does not specify the extra tools that can be used by Ark. The older definition `libsForQt5.ark` contains extra tools such as unar to handle extra types of archives. +# +# Solution: To extract `.rar` files, we manually override some of the attributes based on how it is done in the old file of `libsForQt5.ark`. + +{ config, pkgs, mkKdeDerivation, lib, ... }: +let + extraTools = with pkgs; [ + p7zip + lrzip + unar + unrar + ]; + + # https://ryantm.github.io/nixpkgs/using/overrides/#sec-pkg-overrideAttrs + ark-with-unrar = pkgs.kdePackages.ark.overrideAttrs { + buildInputs = with pkgs; [ + libarchive + libzip + ] ++ extraTools; + + qtWrapperArgs = [ + "--prefix" + "PATH" + ":" + (lib.makeBinPath extraTools) + ]; + }; +in +{ + allowUnfree = [ + # Required for ark + "unrar" + ]; + + users.users.yoda = { + packages = with pkgs; [ + ark-with-unrar # Archive manager: Compress and decompress + ]; + }; +} diff --git a/modules/kde.nix b/modules/kde.nix index 68af6d1..03f9344 100644 --- a/modules/kde.nix +++ b/modules/kde.nix @@ -40,6 +40,7 @@ # environment.plasma6.excludePackages = with pkgs.kdePackages; [ krdp # Remote Desktop Protocol (RDP) + ark # Archive manager: Compress and decompress ]; # GNOME desktop integration. diff --git a/modules/programs-kde.nix b/modules/programs-kde.nix index edcda3f..3ddd073 100644 --- a/modules/programs-kde.nix +++ b/modules/programs-kde.nix @@ -1,7 +1,7 @@ -{ config, pkgs, ... }: +{ config, pkgs, mkKdeDerivation, lib, ... }: { imports = [ - ./file-roller.nix + ./ark.nix # Archive manager: Compress and decompress ]; nixpkgs.config.permittedInsecurePackages = [