Adds scripts and README

This commit is contained in:
Abhinav Sarkar 2022-09-27 21:31:14 +05:30
parent e2e88cb20c
commit 336545a3f8
4 changed files with 43 additions and 0 deletions

26
README.md Normal file
View File

@ -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

3
bin/cleanup Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
nix-collect-garbage -d --delete-old

10
bin/install Executable file
View File

@ -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 '<home-manager>' -A install

4
bin/update Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
nix-channel --update
home-manager switch