Skip to content

Instantly share code, notes, and snippets.

@2gn
Last active May 22, 2022 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 2gn/d0948b332222cb9b77626ad1c3021540 to your computer and use it in GitHub Desktop.
Save 2gn/d0948b332222cb9b77626ad1c3021540 to your computer and use it in GitHub Desktop.
# use it as a normal shell script. I recommend you to place this file to somewhere on PATH.
# for example ( assuming you're using home-manager to configure your HOME ) :
# in your ~/.config/nixpkgs/home.nix
# {
# home = {
# sessionPath = [
# "$HOME/bin"
# ];
# };
# }
# and place this file into your ~/bin
#
# things should be replaced >>>
# YOUR_AUTH_TOKEN with your github api token. see GITHUB REST API documentation -> https://docs.github.com/en/rest
# YOUR_GH_USERNAME with your GitHub username. you know, your username.
# YOUR_GH_REPO_BRANCH_FOR_NIX_DARWIN with your github repo branch you've created. If you made changes directly to "main" branch, you should use "main" for replacement.
# /path/to/nix-darwin with your local development environment for nix-darwin. ~/Documents/nix-darwin for example.
# <<<
# if you don't want to pull latest changes from "original" nix-darwin to your repository, you can safely ignore lines starts from `curl` command by commenting them out.
# PS. I've mistakenly uploaded my GitHub auth token twice just for creating this gist.
curl \
-X POST \
-H "Accept: applicatoin/vnd.github.v3+json" \
-H "Authorization: token YOUR_AUTH_TOKEN" \
https://api.github.com/repos/YOUR_GH_USERNAME/nix-darwin/merge-upstream \
-d '{"branch":"YOUR_GH_REPO_BRANCH_FOR_NIX_DARWIN"}'
cd /path/to/nix-darwin && git pull origin YOUR_GH_REPO_BRANCH_FOR_NIX_DARWIN
darwin-rebuild switch -I darwin=/path/to/nix-darwin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment