Skip to content

Instantly share code, notes, and snippets.

@vfarcic
Last active April 12, 2024 12:15
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save vfarcic/8ebbf4943c5c012c8c98e1967fa7f33b to your computer and use it in GitHub Desktop.
Save vfarcic/8ebbf4943c5c012c8c98e1967fa7f33b to your computer and use it in GitHub Desktop.
# Source: https://gist.github.com/vfarcic/8ebbf4943c5c012c8c98e1967fa7f33b
#####################################################################
# Say Goodbye to Containers - Ephemeral Environments with Nix Shell #
#####################################################################
# Additional Info:
# - Nix: https://nixos.org
# - Dagger: The Missing Ingredient for Your Disastrous CI/CD Pipeline: https://youtu.be/oosQ3z_9UEM
#########
# Setup #
#########
# Install `nix` by following the instructions at https://nix.dev/install-nix.
#########################################
# Ephemeral Shell Environments with Nix #
#########################################
gh repo clone vfarcic/crossplane-tutorial
nix-shell --packages gh kubectl awscli2
PS1="$ "
gh repo clone vfarcic/crossplane-tutorial
which gh
which kubectl
cd crossplane-tutorial
chmod +x setup/01-managed-resources.sh
./setup/01-managed-resources.sh
cat setup/01-managed-resources-nix.sh
chmod +x setup/01-managed-resources-nix.sh
./setup/01-managed-resources-nix.sh
# Press `ctrl+c` to stop
./setup/01-managed-resources-nix.sh
# Press `ctrl+c` to stop
exit
cd crossplane-tutorial
cat shell.nix
nix-shell
PS1="$ "
gum
./setup/01-managed-resources.sh
# Press `ctrl+c` to stop
exit
nix-shell --run $SHELL
exit
nix-store --gc
###########
# Destroy #
###########
cd ..
rm -rf crossplane-tutorial
@dmorawetz
Copy link

dmorawetz commented Feb 18, 2024

For all that want to copy-paste the shell.nix at 10:54 here is a slightly modified version:

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
  packages = with pkgs; [ 
    gum
    git
    gh
    kind
    kubectl
    yq-go
    google-cloud-sdk
    awscli2
    eksctl
    azure-cli
  ];
}

@vfarcic
Copy link
Author

vfarcic commented Feb 18, 2024

Thanks a ton @dmorawetz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment