Jump to content

Calibre: Difference between revisions

From NixOS Wiki
m Fix formatting a bit
m switch RAR Wikipedia link to shorthand as well
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
[https://calibre-ebook.com/ Calibre] is program to view, edit, convert and print ebooks.  
[https://calibre-ebook.com/ Calibre] is program to view, edit, convert and print ebooks.


This page is intended to explain how to run <code>calibre</code> in nixos.
== Installation ==


== Connecting USB devices ==
Calibre is available in [[nixpkgs]] as {{nixos:package|calibre}}.


To connect devices via USB, you might have to add the following to your <code>configuration.nix</code> file:
=== Testing ===


<syntaxHighlight lang=nix>
You can test Calibre without installing it by using a nix shell.
 
==== Flakes ====
 
If you have [[flakes]] enabled, you can run this command to enter a temporary shell with Calibre available:
 
<syntaxhighlight lang="bash">
nix shell nixpkgs#calibre
</syntaxhighlight>
 
==== Non-flakes ====
 
Without flakes, use this command to open a temporary shell with Calibre available:
 
<syntaxhighlight lang="bash">
nix-shell -p calibre
</syntaxhighlight>
 
=== NixOS ===
 
Add the package to your NixOS configuration, in {{nixos:option|environment.systemPackages}}:
 
<syntaxhighlight lang="nix">
environment.systemPackages = with pkgs; [
  calibre
];
</syntaxhighlight>
 
=== Home Manager ===
 
Add the package to your <code>[https://home-manager-options.extranix.com/?release=master&query=home.packages home.packages]</code>:
 
<syntaxhighlight lang="nix">
home.packages = with pkgs; [     
  calibre
];
</syntaxhighlight>
 
 
== Extras ==
 
=== Connecting USB devices ===
 
To connect devices via USB, you might have to add the following to your NixOS configuration:
 
<syntaxhighlight lang="nix">
services.udisks2.enable = true;
services.udisks2.enable = true;
</syntaxHighlight>
</syntaxhighlight>


== .cbr and .cbz files ==
=== Opening <code>.cbr</code> files ===


If you want to open .cbr and .cbz files, you need to add the following lines to your <code>configuration.nix</code> file:
<code>.cbr</code> files are comic book archives in the [[Wikipedia:RAR_(file_format)|RAR]] archive format.
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
 
environment.systemPackages = with pkgs; [    
If you want to open <code>.cbr</code> files, replace <code>calibre</code> with the following in your NixOS or Home Manager configuration:
   (calibre.override {
 
    unrarSupport = true;
<syntaxhighlight lang="nix">
   })
(calibre.override {
  unrarSupport = true;
})
</syntaxhighlight>
 
{{note|<code>calibre</code> requires {{nixos:package|unrar}} to open .cbr files, which is an unfree package. This also causes <code>calibre</code> to be marked as unfree. If you are using [https://nixos.org/manual/nixpkgs/unstable/#sec-allow-unfree <code>allowUnfreePredicate</code>] you will need to ensure that your configurations permit all of them.
 
For example, you can add this snippet to your NixOS configuration to allow <code>calibre</code> and <code>unrar</code>.
<syntaxhighlight lang="nix">
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
   "calibre"
   "unrar"
];
];
</nowiki>}}
</syntaxhighlight>
}}
 
== See also ==
* [[Wikipedia:Calibre|Calibre on Wikipedia]]


{{note|<code>calibre</code> requires several unfree packages to open .cbr and .cbz files. If you are using <code>allowUnfreePredicate</code> you will need to ensure that your configurations permit all of them.
<syntaxHighlight lang=nix>
{
  nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
    "calibre"
    "unrar"
  ];
}
</syntaxHighlight>
}}
[[Category: Applications]]
[[Category: Applications]]

Latest revision as of 02:27, 8 September 2025

Calibre is program to view, edit, convert and print ebooks.

Installation

Calibre is available in nixpkgs as calibre.

Testing

You can test Calibre without installing it by using a nix shell.

Flakes

If you have flakes enabled, you can run this command to enter a temporary shell with Calibre available:

nix shell nixpkgs#calibre

Non-flakes

Without flakes, use this command to open a temporary shell with Calibre available:

nix-shell -p calibre

NixOS

Add the package to your NixOS configuration, in environment.systemPackages:

environment.systemPackages = with pkgs; [
  calibre
];

Home Manager

Add the package to your home.packages:

home.packages = with pkgs; [      
  calibre
];


Extras

Connecting USB devices

To connect devices via USB, you might have to add the following to your NixOS configuration:

services.udisks2.enable = true;

Opening .cbr files

.cbr files are comic book archives in the RAR archive format.

If you want to open .cbr files, replace calibre with the following in your NixOS or Home Manager configuration:

(calibre.override {
  unrarSupport = true;
})
Note: calibre requires unrar to open .cbr files, which is an unfree package. This also causes calibre to be marked as unfree. If you are using allowUnfreePredicate you will need to ensure that your configurations permit all of them.

For example, you can add this snippet to your NixOS configuration to allow calibre and unrar.

nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
  "calibre"
  "unrar"
];

See also