in this blogpost i hope to explain my experience of contributing to nixpkgs until this moment
Note: i am not a native english speaker please let me know my mistakes and help me improve my english
Creating my first package (derivition)
i was working on my experimental accessibility program when working on accessibility abstraction of it
i wanted to reflect over enums on c++ for looping over enums, doing map lookups, and for printing in program names
of atspi enums for doing theses i wanted to use magic enum library for doing these but this wasn’t packaged
in nixpkgs unlike my other dependencies so i went ahead and created a simple derivation(package) in my flake.nix
i added cmake build system as build time dependency
enabled tests to be sure library works properly
it was pretty easy to be fair magic enum is pretty trivial to package library it had
cmake install scripts so nix automatically installed it to $out and it didn’t had any dependency except c++ compiler
lastly it didn’t had any fetch_content() calls in cmake so no network sandbox complexity too
...meta =with lib;{
description ="Static reflection for enums (to string, from string, iteration) for modern C++";
homepage ="https://github.com/Neargye/magic_enum";
license = licenses.mit;
maintainers =with maintainers; [ Alper-Celik ];
};
...
lastly navigated (it at least had some organization) pkgs/top-level/all-packages.nix for finding correctish spot for package and i found it about at 22.000 th line
# about 22.000 lines... magic-enum = callPackage ../development/libraries/magic-enum { };
...# who knows how many lines at the bottom of file
and i was ready to create pr for it
i created and waited about a week and @NickCao
pointed out i forget to format package commit message and [recommended formatting package dependencies with nixpkgs-fmt.
i was actually using nixpkgs-fmt with nul-ls.nvim, it was actually formatted but when i put one dependency to
other line it expanded and this fixed formatting.
to be fair i was put the formatted the pr message like that and forget to actually format commit message i fixed that.
after fixing problems with pr i thanked @NickCao for reviewing my pr with my perfect english.
after about a day later @NickCao merged my pr and i was officially a nixpkgs package maintainer
after a while i backported to 22.11 release because i was using stable release on my flake.nix and it got quickly merged by @superherointj too
after some more time i switched to using unstable release system wide instead of having stable and unstable nixos side by side this broked running Qt
info gui when developing because Qt program wasn’t wrapped while developing so i updated my flake.nix to nixos-unstable too
but then it started to build magic-enum instead of fetching from binary cache and failed i guess binary cache failed too and because of that nix tried to build it.
after looking to logs it was about some wide characters (emojis) while building unit tests, after looking into issues tacker of magic-enum i saw it was a problem with building on
gcc 12 and unstable releases updating to gcc 12 broked the package, i submitted a pr disabling building of the tests
# last shape of the pr:# disable tests until upstream fixes build issues with gcc 12# see https://github.com/Neargye/magic_enum/issues/235doCheck =false;
cmakeFlags = [
"-DMAGIC_ENUM_OPT_BUILD_TESTS=OFF"];
after @wegank helped me with grammar, layout of the sentences and misspellings (he fixed them) he merged the pr.
i will probably enable tests on next version of the library if building tests on the latest compilers gets fixed by then
lastly there was no need to backport this pr since stable(22.11) was still using gcc 11