diff --git a/README.md b/README.md new file mode 100644 index 0000000..4676a95 --- /dev/null +++ b/README.md @@ -0,0 +1,26 @@ +# Nix + Home Manager based MacBook configuration + +This is the [Nix] and [Home Manager] configuration for managing my MacBook. + +## Usage + +First install [Nix]. To install `home-manager` and set up the MacBook as per the config, run: + +```bash +bin/install +``` + +To update installed packages, run: + +```bash +bin/update +``` + +To cleanup garbage, run: + +```bash +bin/cleanup +``` + +[Nix]: https://nixos.org +[Home Manager]: https://github.com/nix-community/home-manager diff --git a/bin/cleanup b/bin/cleanup new file mode 100755 index 0000000..61eead5 --- /dev/null +++ b/bin/cleanup @@ -0,0 +1,3 @@ +#!/bin/bash + +nix-collect-garbage -d --delete-old diff --git a/bin/install b/bin/install new file mode 100755 index 0000000..b4dcda1 --- /dev/null +++ b/bin/install @@ -0,0 +1,10 @@ +#!/bin/bash + +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +ROOT_DIR=$( dirname "$SCRIPT_DIR" ) +mkdir -p "$HOME/.config/nixpkgs" +ln -f -s "$ROOT_DIR/home.nix" "$HOME/.config/nixpkgs/home.nix" +nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager +nix-channel --update +export NIX_PATH=$HOME/.nix-defexpr/channels:/nix/var/nix/profiles/per-user/root/channels${NIX_PATH:+:$NIX_PATH} +nix-shell '' -A install diff --git a/bin/update b/bin/update new file mode 100755 index 0000000..651143c --- /dev/null +++ b/bin/update @@ -0,0 +1,4 @@ +#!/bin/bash + +nix-channel --update +home-manager switch