Skip to content

Instantly share code, notes, and snippets.

@arianvp
Last active December 6, 2024 14:25
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