-
-
Save ivanbrennan/4c188d45e75439762b89aef71a1b52c2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# prepare nix files on "nix" branch | |
git checkout -b nix | |
# tuck everything except shell.nix under a nix/ directory | |
mkdir -p nix | |
# generate nix expressions for dependencies | |
nix-shell --packages bundler --run 'bundle lock' | |
nix-shell --packages bundix --run 'bundix --gemset=nix/gemset.nix' | |
# pin nixpkgs | |
cat > nix/nixpkgs.nix <<EOF | |
import (builtins.fetchTarball { | |
url = "https://github.com/NixOS/nixpkgs/archive/be1461fc0ab29c45c69e7b2c2097c887750e4fe0.tar.gz"; | |
sha256 = "1fdlnfipa3qpyzqqqy3cf5zicgj6chwmd40yz8n60nil8qi6452w"; | |
}) | |
EOF | |
# write shell.nix | |
vim shell.nix | |
# write an init script that can bootstrap nix support in a fresh repo | |
vim nix/init.sh | |
# commit with bootstrap instructions | |
git add shell.nix nix/ | |
git commit -m 'initial nix support | |
To initialize nix support in a local repo, run: | |
tmpDir=$(mktemp --tmpdir -d fakeproject-nix.XXXXXX) | |
git clone --depth 1 --branch nix \ | |
git@github.com:ivanbrennan/fakeproject.git $tmpDir | |
$tmpDir/nix/init.sh | |
rm -rf $tmpDir && unset tmpDir | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment