Patches are only applied if the have the right format. In other words a simple git diff
to generate them does not work.
Using git commit -a
(temporary commit i. e. named "changes"), then git format-patch
(for that to work you need to have username and email set in git config), followed by git reset --[hard|mixed] <SHA of last not temporary commit>
should work.
Test using git am < 0001-changes.patch
before uploading 0001-changes.patch
elsewhere.
Now the more probelmatic issue:
If you set to patch i. e. nixpkgs using the approach here NixOS/nixpkgs#111651 (comment) you first need to give it a (wrong) sha to provoke getting the right one, i. e. use nix-hash --flat --type sha256 0001-changes.patch
and put the output in fetchpatches sha256 field. The build will then output an error saying "got: sha256:". That one you can finally put in the sha256 field and then the build should output i. e. "applying patch /nix/store/8q1lhja5kbmnmynsqxzwf4pqfkpjsssm-nixpkgs-0001-changes.patch (...) patching file".
It's just the derivation was built and in nix-store already. So to have the patches (re-)applied you need to delete the according nix-store entries or change the derivation name.