After a few days using nixos I am very impressed, and seriously looking at making it my daily driver.
I want to install novelwriter in nixos, but it is not in the repo. I have had a look at ways to install packages not in the nixos repo, and all of them are way above my paygrade. I can follow instructions, and I’m fairly comfortable with the command line, but there’s a lot of stuff I don’t understand about nixos yet, and installing a non-nixosed package is on top of the list.
Novelwriter is written in python, but that’s about all I know.
All advice gratefully received.
{ lib
, python3
, fetchFromGitHub
}:
python3.pkgs.buildPythonApplication rec {
pname = "novelwriter";
version = "2.2";
pyproject = true;
src = fetchFromGitHub {
owner = "vkbo";
repo = "novelwriter";
rev = "v${version}";
hash = "sha256-ASNDMj4+P04LRUX2sNo1VQ+PuBgLXws2AEPrZNUFdKs=";
};
nativeBuildInputs = [
python3.pkgs.setuptools
python3.pkgs.wheel
];
propagatedBuildInputs = with python3.pkgs; [
pyenchant
pyqt5
];
pythonImportsCheck = [ "novelwriter" ];
meta = with lib; {
description = "";
homepage = "https://github.com/vkbo/novelwriter";
changelog = "https://github.com/vkbo/novelwriter/blob/${src.rev}/CHANGELOG.md";
license = licenses.gpl3Only;
maintainers = with maintainers; [ ];
mainProgram = "novelwriter";
};
}
nix-build -I nixpkgs=/wherever/your/nixpkgs/is -E '(import <nixpkgs> {}).libsForQt5.callPackage ./default.nix {}'
(libsForQt5
might be incorrect here)
got me this error when I ran the program found in result
:
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
zsh: abort (core dumped) ./novelwriter
seems like a bit of rabbit hole but there is something in the manual that might help: Nix expression for a Qt package
Also see this thread How can I build a Python package that uses Qt?
@tobiasBora could you help me out here? No worries if not
@rjpc thanks for this comprehensive reply, much appreciated!
I will follow up and let you know how I go.
Well, fell at the first hurdle. FIrst off tried to understand where to put that piece of code you kindly provided, but soon got hopelessly lost. Tried reading about flakes and home manager, but couldn’t really understand any of it. Also it seems like Qt is a minefield of workarounds and kludges for Python, and I pretty soon found myself way out of my depth trying to understand all that. Bottom line is I am going to have to wait for someone a lot smarter than me, and with a much deeper understanding of NixOS than me, to do the hard yards to get novelwriter into the NixOS repo.
Thanks again,
:-\ Ian
No worries! It takes time. I still have to reference a crib sheet for this stuff and ask for help There’s a way for sure to get this package to build correctly (it’s just software!) but it’ll just take some more digging and the right combination of configuration. This one is just a bit trickier than most, perhaps. Don’t be discouraged and may the Nix be with you!
I stumbled across this post while looking for something else. I noticed that there is now a novelwriter package in the unstable repository.
Thanks for that. Unfortunately I had to give up on Nixos. I’m just not techie enough to keep up.