Workflow for contributing and using contributions in NixOS - moaxcp/etc-nixos GitHub Wiki
The workflow for nixpkgs is quite unique and powerful. If you already have a fork skip to syncing with nixpkgs.
First create a fork of the repo.
git clone https://github.com/moaxcp/nixpkgs.git
next add two remotes
john@n1 ~/p/nixpkgs (master)> git remote add channels git://github.com/NixOS/nixpkgs-channels.git
john@n1 ~/p/nixpkgs (master)> git remote add nixpkgs https://github.com/NixOS/nixpkgs.git
john@n1 ~/p/nixpkgs (master)> git remote -v
channels git://github.com/NixOS/nixpkgs-channels.git (fetch)
channels git://github.com/NixOS/nixpkgs-channels.git (push)
nixpkgs https://github.com/NixOS/nixpkgs.git (fetch)
nixpkgs https://github.com/NixOS/nixpkgs.git (push)
origin https://github.com/moaxcp/nixpkgs.git (fetch)
origin https://github.com/moaxcp/nixpkgs.git (push)
Sync with nixpkgs/master
git fetch nixpkgs
git checkout master
git reset --hard nixpkgs/master
git push origin master --force
Then fetch channels
git fetch channels
get current commit for NixOS
john@n1 ~/p/nixpkgs (master)> nixos-version
17.03.1819.7eb1a42de4 (Gorilla)
delete local branch
git branch -D local
checkout commit from nixos
git checkout -b local 7eb1a42de4
update files
branch off master and cherry-pick changes into new branch (usually name of package being updated) commit messages must match contributing standards.
nix-build -A name
From the top level of nixpkgs repo this will build your changes and place the results in the results dir.
nix-env -f . -iA name
This will install the package on your system.
Create new branch from master
git checkout master
git branch -b package-name
git cherry-pick hash