Skip to content

Instantly share code, notes, and snippets.

@srid
Last active September 21, 2024 02:29
Show Gist options
  • Save srid/24f6a25b942699291751d034ba089574 to your computer and use it in GitHub Desktop.
Save srid/24f6a25b942699291751d034ba089574 to your computer and use it in GitHub Desktop.
One-click Nix dev setup: Install Nix → Run `om health` to success → Initialize nix-dev-home
#!/bin/sh
# curl -sSF -L https://gist.githubusercontent.com/srid/24f6a25b942699291751d034ba089574/raw/b41b8eebc7bc9a519f13cfe81358e248b196067a/nixone.sh | sh -s --
GREEN='\033[0;32m'
# Function to echo in color
echo_color() {
color=$1
message=$2
echo -e "${color}${message}${NC}"
}
# Install Nix
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \
sh -s -- install --no-confirm --extra-conf "trusted-users = $(whoami)"
# Source nix configuration
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
# Run `om health`
echo_color $GREEN "\nCheck nix health"
nix --accept-flake-config run github:juspay/omnix health
# Setup nix-dev-home
echo_color $GREEN "\nSetting up home-manager & direnv"
mkdir -p ~/nixconfig && cd ~/nixconfig
nix --accept-flake-config run github:juspay/omnix -- \
init github:juspay/nix-dev-home -o . \
--non-interactive \
--params '{"username":"'$(whoami)'", "git-name":"'$(id -F)'", "git-email":"'$(whoami)'@juspay.in", "neovim": true, "github-ci": false}'
nix run
# TODO: ^ must move dotfiles out of the way
# Keep the shell open
exec $SHELL
@srid
Copy link
Author

srid commented Sep 20, 2024

Fails during om init with

zsh: suspended (tty output)

(Works on re-run though)


EDIT 1: After making om init non-interactive, this error appears during those aformentioned 4 prompts (nix-config).

EDIT 2: will obviate 4 prompts in juspay/nixos-unified-template#82

@srid
Copy link
Author

srid commented Sep 21, 2024

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