forked from alexellis/actions-batch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from meta-automata-nix/sweep/add_a_script_in_e…
…xamples_to_install_nix Sweep: Add script to install Nix and Hive
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Exit on any error, and set pipefail to catch any errors in pipelines | ||
set -eo pipefail | ||
|
||
# Install Nix using the Determinate Nix Installer | ||
echo "Installing Nix..." | ||
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- --daemon | ||
|
||
# Ensure the Nix profile script is sourced | ||
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then | ||
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' | ||
else | ||
echo "Nix profile script not found. Installation may have failed." | ||
exit 1 | ||
fi | ||
|
||
# Clone the divnix/hive repository | ||
echo "Cloning divnix/hive repository..." | ||
git clone https://github.com/divnix/hive.git | ||
cd hive | ||
|
||
# Assuming divnix/hive uses flake.nix for configuration | ||
if [ -f flake.nix ]; then | ||
# Build the environment using Nix flakes | ||
echo "Building the environment..." | ||
nix build .# --no-link | ||
|
||
# Run the environment (replace 'defaultPackage' with the actual attribute path) | ||
echo "Running the environment..." | ||
nix run .#defaultPackage | ||
else | ||
echo "flake.nix not found in the repository. Please ensure the repository contains a flake.nix file." | ||
exit 1 | ||
fi |