Skip to content

Latest commit

 

History

History
87 lines (71 loc) · 2.61 KB

contrib.org

File metadata and controls

87 lines (71 loc) · 2.61 KB

Contributing to nixpkgs

Table of Content

Initial setup

Forking

Branching

  • $ git branch -c <pkgname>
  • $ git checkout <pkgname>

Packaging

Maintainers

  • Not yet a maintainer?
  • Add yourself to nixpkgs/maintainers/maintainer-list.nix
  • This will be a seperate commit from the packages
    • $ git commit -m "maintainers: add <user>"

Creating

Package

  • Find an appropriate location in nixpkgs/pkgs/
  • $ mkdir <pkgsname>
  • $ touch <pkgsname>/default.nix
  • Add the package to nixpkgs/pkgs/top-level/
    • Generic: all-packages.nix
    • Kernel: linux-kernels.nix
    • etc..

module

  • In these modules you will create the options to set up the package in a system
  • $ touch nixpkgs/nixos/<subdir>/<pkgname>.nix
  • Add module to nixpkgs/nixos/modules/module-list.nix

Testing on system

Package

Inside nixpkgs

  • $ nix-build -A <pkgsname>
  • $ ./result/bin/<pkgsname>

Module

Recommended to do in virtual machine

  • Add new package and/or module to general config /etc/nixos/configuration.nix
  • $ sudo nixos-rebuild -I nixpkgs=$PWD switch

Editing an existing packages

  • Just find the package in the repo and edit
  • Personally I use $ grep -Frwl <pkgname> to quickly find the package in nixpkgs/pkgs/

Pull request

Commit

Push

  • $ git push origin <branch (pkgsname)>

Pull

  • Move to your github repo
  • Create pull-request

Review process

  • If changes are required, add new commits.
  • When done, squash commits.
  • $ git rebase -i HEAD~<# prev commits>
    • change pick to squash on all commits that need to be squash to initial commit.
    • change title at the top of next menu if needed. You can uncomment all other commit titles.
    • $ git push -f origin <branch (pkgsname)
  • After a merge to master, you can delete the branch.
  • Propagation to nixos-unstable from master can take a while (multiple days). Sit back and relax!