Skip to content

Instantly share code, notes, and snippets.

@arianvp
Last active October 1, 2024 17:16
Show Gist options
  • Save arianvp/8f80c23a3410d27746fb97a6563d9677 to your computer and use it in GitHub Desktop.
Save arianvp/8f80c23a3410d27746fb97a6563d9677 to your computer and use it in GitHub Desktop.
Use nix flakes with private github deps
#!/bin/sh
#If already set (e.g. in github actions); use that instead
if [ -z "$GITHUB_TOKEN" ]; then
nix run nixpkgs#gh auth status || nix run nixpkgs#gh auth login
GITHUB_TOKEN="$(nix run nixpkgs#gh auth token)"
export GITHUB_TOKEN
fi
NIX_CONFIG="access-tokens = github.com=$GITHUB_TOKEN"
export NIX_CONFIG
use flake

Use nix flakes with private github deps

image

{
description = "A very private flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
runners.url = "github:arianvp/runners"; # private dep
};
outputs = { self, nixpkgs, runners }: {
packages.aarch64-darwin.default = nixpkgs.legacyPackages.aarch64-darwin.hello;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment