Skip to content

Commit

Permalink
Switch to just and provide a devShell
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Gerace <[email protected]>
  • Loading branch information
nickgerace committed Jan 2, 2025
1 parent 54ae961 commit 1fc47e8
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 26 deletions.
17 changes: 0 additions & 17 deletions Makefile

This file was deleted.

23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,34 @@ A collection of dotfiles, scripts and configurations from [@nickgerace](https://

## Quickstart

Before starting, ensure that `bash` and `zsh` are installed on your macOS or Linux system.
Before starting, ensure that `bash` and `just` are installed on your macOS or Linux system.
The "install" recipe will install `zsh` if you opt to install packages, so it is not required to start.

> [!TIP]
> You can use the `devShell` from the [flake](flake.nix) to get the base depedencies.
You will also need to ensure that this repository resides in the `$HOME/src/` directory.
You may need to create it by executing `mkdir $HOME/src`.

Once everything looks good, execute the following:

> [!WARNING]
> Running the `make` target may overwrite files if you are coming from an existing configuration.
> Please read the source code, starting from the [Makefile](Makefile), before executing the target.
> Running the following command may overwrite files if you are coming from an existing configuration.
> Please read the source code, starting from the [justfile](justfile), before executing the recipe.
```bash
make
just install
```

The invoked `make` target runs an idempotent-ish bootstrap script, so you should be able to execute it multiple times.
The invoked `just` recipe runs an idempotent-ish bootstrap script, so you should be able to execute it multiple times.
That being said: *caution is advised*.

## Updating

Once the initial `make` target is ran, you can update packages and more using the `update` target.
Once the initial `just` recipe is ran, you can update packages and more using the `update` recipe.

```bash
make update
just update
```

Alternatively, if you run `sz` or reload your shell, you can run the [update function](zsh/update.zsh).
Expand All @@ -40,7 +45,7 @@ update

> [!NOTE]
> The above commands only update packages with the current dotfiles in place.
> If you'd like to re-link dotfiles, run the default `make` target again.
> If you'd like to re-link dotfiles, run `just install` again.
## Q&A

Expand All @@ -55,7 +60,7 @@ These dotfiles rely on [`zsh`](https://www.zsh.org/) as the interactive shell.
These dotfiles require neither [`oh-my-zsh`](https://ohmyz.sh/) nor [`starship`](https://starship.rs/) to be installed.
Only `zsh` needs to be installed as all shell-based dotfiles are custom and configured manually.

### Does the `make` target do more than setup dotfiles?
### Does the `just` recipe do more than setup dotfiles?

The script only sets up dotfiles by default.
However, for certain Linux distributions and macOS, you can optionally install packages and setup the base system (e.g. install an opinionated set of base packages with a package manager).
Expand Down
15 changes: 15 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@
nixpkgs,
nix-darwin,
}: {
devShells = {
default = {system}: let
pkgs = import nixpkgs {inherit system;};
in
pkgs.mkShell {
packages = with pkgs; [
alejandra
bash
just
shfmt
];
formatter = pkgs.alejandra;
};
};

nixosConfigurations.nixos = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [./os/nixos/server/configuration.nix];
Expand Down
16 changes: 16 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
_default:
@just --list

# Links dotfiles and installs system packages
install:
@bin/install.sh

# Updates system packages
update:
@bin/update.sh

# Formats relevant files
format:
alejandra **/*.nix
-shfmt -i 2 -w **/*.sh
-shfmt -i 2 -w **/*.zsh
1 change: 1 addition & 0 deletions os/nixos/server/configuration.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
htop
hugo
jq
just
lolcat
mold
nodejs
Expand Down

0 comments on commit 1fc47e8

Please sign in to comment.