Skip to content

Instantly share code, notes, and snippets.

@StevenHugo
Created December 27, 2019 08:54
Show Gist options
  • Save StevenHugo/24f436be5af6256d2bf5547a3d16749c to your computer and use it in GitHub Desktop.
Save StevenHugo/24f436be5af6256d2bf5547a3d16749c to your computer and use it in GitHub Desktop.

Revisions

  1. StevenHugo created this gist Dec 27, 2019.
    23 changes: 23 additions & 0 deletions install-nix.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/usr/bin/env bash

    USER_NAME=`whoami`

    if ! command -v nix-env >/dev/null 2>&1; then
    /usr/bin/sudo mkdir -m 755 /nix; echo 'use-sqlite-wal = false' | /usr/bin/sudo tee -a /nix/nix.conf
    curl -o install-nix https://nixos.org/nix/install
    if command -v gpg >/dev/null 2>&1; then
    curl -o install-nix.sig https://nixos.org/nix/install.sig
    gpg --recv-keys B541D55301270E0BCF15CA5D8170B4726D7198DE
    gpg --verify ./install-nix.sig
    shred -uz -n9 ./install-nix.sig
    fi
    chmod u+x ./install-nix
    if -d /nix; then
    /usr/bin/sudo chown USER_NAME -R /nix
    fi
    . ./install-nix
    shred -uz -n9 ./install-nix
    . /home/$USER_NAME/.nix-profile/etc/profile.d/nix.sh
    nix-channel --add https://nixos.org/channels/nixpkgs-unstable
    nix-channel --update
    fi