From 65ea368ebbed4fa52a1a59fcb06848c49b310c9c Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Sun, 17 Nov 2024 02:51:42 +1100 Subject: [PATCH] installer: move channel creation to README --- .github/workflows/test.yml | 6 ++++-- README.md | 16 +++++++++------- pkgs/darwin-installer/default.nix | 14 -------------- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90bd6fdd..73a3fb71 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,8 +41,9 @@ jobs: with: install_url: https://releases.nixos.org/nix/nix-2.18.8/install nix_path: nixpkgs=channel:${{ env.CURRENT_STABLE_CHANNEL }} - - name: Install ${{ env.CURRENT_STABLE_CHANNEL }} channel + - name: Install channels run: | + nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin nix-channel --add https://nixos.org/channels/${{ env.CURRENT_STABLE_CHANNEL }} nixpkgs nix-channel --update - name: Install nix-darwin and test @@ -87,8 +88,9 @@ jobs: with: install_url: https://releases.nixos.org/nix/nix-2.24.9/install nix_path: nixpkgs=channel:nixpkgs-unstable - - name: Install nixpkgs-unstable channel + - name: Install channels run: | + nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs nix-channel --update - name: Install nix-darwin and test diff --git a/README.md b/README.md index bfc825e9..f029c9a5 100644 --- a/README.md +++ b/README.md @@ -119,24 +119,26 @@ nix-darwin.lib.darwinSystem { Copy the [simple](./modules/examples/simple.nix) example to `~/.config/nix-darwin/configuration.nix`. -### Step 2. Installing `nix-darwin` +### Step 2. Adding `nix-darwin` channel + +```bash +nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin +nix-channel --update +``` + +### Step 3. Installing `nix-darwin` ```bash nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer ./result/bin/darwin-installer ``` -### Step 3. Updating `nix-darwin` - -The installer will configure a channel for this repository. +### Step 4. Updating `nix-darwin` ```bash nix-channel --update darwin darwin-rebuild changelog ``` - -> NOTE: If you are using Nix as a daemon service the channel for that will be owned by root. -> Use `sudo -i nix-channel --update darwin` instead. ## Documentation diff --git a/pkgs/darwin-installer/default.nix b/pkgs/darwin-installer/default.nix index 0eed5187..630c5bfe 100644 --- a/pkgs/darwin-installer/default.nix +++ b/pkgs/darwin-installer/default.nix @@ -47,20 +47,6 @@ stdenv.mkDerivation { echo >&2 "Installing nix-darwin..." echo >&2 - i=y - darwinPath=$(NIX_PATH=$HOME/.nix-defexpr/channels nix-instantiate --eval -E '' 2> /dev/null) || true - if ! test -e "$darwinPath"; then - if test -t 0; then - read -p "Would you like to manage with nix-channel? [y/N] " i - fi - case "$i" in - y|Y) - nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin - nix-channel --update - ;; - esac - fi - export NIX_PATH=${nixPath} system=$(nix-build '' -A system --no-out-link --show-trace)