2 ms·
To supplement and illustrate your claim about NixOS being easy to package for, I'd like to share an example: I've been using NixOS more or less exclusively for
by pxc 9y ago
To supplement and illustrate your claim about NixOS being easy to package for, I'd like to share an example:
I've been using NixOS more or less exclusively for ~2.5 years now. Whenever I want to run software on NixOS which is not already in Nixpkgs, I package it (if I want it bad enough). This week, for example, I packaged KSmoothDock so that I could try it out.
This is the whole thing:
{ mkDerivation, lib, fetchFromGitHub
, cmake, extra-cmake-modules
, plasma-framework, kwindowsystem }:
let
version = "5.9";
in
mkDerivation {
name = "ksmoothdock-${version}";
src = (fetchFromGitHub {
owner = "dangvd";
repo = "ksmoothdock";
rev = "v${version}";
sha256 = "1fbghyd079xk4q5na8msna5zkfg85c4ksyfqy524v2pm96dyl2dr";
} + "/src");
nativeBuildInputs = [
cmake
extra-cmake-modules
];
buildInputs = [
plasma-framework
kwindowsystem
];
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace /usr/share/ share/
'';
}
It didn't feel like much work and I think it only took a few minutes. In this case, I was able to base the package definition on another 3rd-party dock for Plasma, so it was even easier than usual to get started. I just copied the other package and changed the package name and location of the source code, and everything worked. I then cleaned up by consulting the README for the project and removing as many extraneous dependencies as possible, and smoothed over a quirk, which was pretty painless.
Once you get a feel for the docs (and the Nixpkgs source, just because it's a treasure trove of examples), packaging for/with Nixpkgs is usually pretty easy, and the results pretty readable.
I should also add that the range of packages already included also seems to me to have improved a great deal over the years that I've been using NixOS. And I think once NixOS gains support for Snap packages and Flatpaks (the latter is in the works and has been making good progress recently), it will become a much more viable desktop OS for those unwilling or unable to deal with packaging the odd missing application.