Skip to content

Commit

Permalink
Readme: more focused flow
Browse files Browse the repository at this point in the history
- Highlighting the main scripts
- Promoting Nix usage as the main one
  • Loading branch information
ptitfred committed Oct 13, 2024
1 parent d4e240e commit 6ad0bcf
Showing 1 changed file with 55 additions and 26 deletions.
81 changes: 55 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,55 +11,53 @@ properly use it as is.

## What's in the toolbox

A collection of script to add to your PATH:
- [git-authors](src/scripts/git-authors), a git script to list committers other a commit range
Highlighted tools I use on a daily basis:
- [git-bubbles](src/scripts/git-bubbles), a git script to handle pull requests
- [git-checkout-log](src/scripts/git-checkout-log), a git script to browser reflog and follow checkouts
- [git-prd](src/scripts/git-prd), a git script to display the path of the root of a git repository relative to your HOME directory
- [git-pwd](src/scripts/git-pwd), a git script to display the path relative to the root of a git repository
- [git-rm-others](src/scripts/git-rm-others), a git script to clean the working copy from untracked files
- [git-search](src/scripts/git-search), a git script to search the diff other a commit range
- [git-short](src/scripts/git-short), a git script to display short SHA1 of a given commit
- [git-std-init](src/scripts/git-std-init), a git script to setup a repository with an initial empty commit and a base and master branches
- [git-tree](src/scripts/git-tree), a git script to tree files handled by git
- [prd](src/scripts/prd), a script to print the working directory relative to your HOME directory
- [repeat](src/scripts/repeat), a script to repeat a command some times
- [short-path](src/scripts/short-path), a script to abbreviate every directory unless the last part of a path
- [wait-tcp](src/scripts/wait-tcp), a script to wait for some server sockets to be opened on a TCP

2 source-able bash scripts to customize your terminal:
- [git-ps1](src/scripts/git-ps1), a PS1 expression, mostly focusing on handling git
- [ls-colors](src/ls-colors.nix), a LS_COLORS env var, built from [trapd00r's LS_COLORS](https://github.com/trapd00r/LS_COLORS)

Other scripts live alond but I don't use them directly, [see below](#other-scripts).

## How-to install

This project relies on [nix](https://nixos.org), and [flakes must be enabled](https://nixos.wiki/wiki/Flakes#Enable_flakes).

### Test from a shell

```bash
nix shell github:ptitfred/posix-toolbox
```

### Install via a profile
### Install via home-manager as a module

I would recommend you to use [home-manager](https://nix-community.github.io/home-manager/index.html#ch-nix-flakes) instead (see below), but if you prefer a more classic approach, you can install it in your user's path this way:
I'm using [home-manager](https://nix-community.github.io/home-manager/index.html#ch-nix-flakes) for my whole setup and this is therefore my recomended way to use it. It's the best supported way to use it as it sources scripts for you:

```bash
nix profile install github:ptitfred/posix-toolbox
```nix
{
inputs = {
home-manager.url = "github:nix-community/home-manager/release-24.05";
ptitfred-posix-toolbox.url = "github:ptitfred/posix-toolbox";
};
outputs = inputs: {
homeManagerConfigurations.fredeirc = inputs.home-manager.lib.homeManagerConfiguration {
config.inputs = inputs;
modules = [ ./your-home.nix ];
};
}
}
```

### Install via home-manager as a module
The `your-home.nix` file might contain:

```nix
{ inputs, ... }:
{
imports = [
inputs.posix-toolbox.homeManagerModules.default
inputs.ptitfred-posix-toolbox.homeManagerModules.default
];
posix-toolbox.enable = true;
ptitfred.posix-toolbox.enable = true;
# You might have to enable git though:
programs.git.enable = true;
Expand All @@ -69,10 +67,41 @@ nix profile install github:ptitfred/posix-toolbox
}
```

If you're curious about [home-manager](https://github.com/nix-community/home-manager)
you can learn about it via [their official documentation](https://nix-community.github.io/home-manager)
You can learn more about home-manager via [their official documentation](https://nix-community.github.io/home-manager)
or by examples via [my own configuration](https://github.com/ptitfred/personal-infrastructure).

### Install via a profile

A more imperative approach: you can install it in your user's path this way:

```bash
nix profile install github:ptitfred/posix-toolbox
```

It doesn't source the PS1 for you nor the bash colors though. Shame!

### Test from a shell

If you want to poke around and try the scripts, you can launch a shell as a temporary setup:

```bash
nix shell github:ptitfred/posix-toolbox
```

## Other scripts

Other scripts I used to use or are used here:
- [git-authors](src/scripts/git-authors), a git script to list committers other a commit range
- [git-prd](src/scripts/git-prd), a git script to display the path of the root of a git repository relative to your HOME directory
- [git-pwd](src/scripts/git-pwd), a git script to display the path relative to the root of a git repository
- [git-rm-others](src/scripts/git-rm-others), a git script to clean the working copy from untracked files
- [git-search](src/scripts/git-search), a git script to search the diff other a commit range
- [git-short](src/scripts/git-short), a git script to display short SHA1 of a given commit
- [git-std-init](src/scripts/git-std-init), a git script to setup a repository with an initial empty commit and a base and master branches
- [prd](src/scripts/prd), a script to print the working directory relative to your HOME directory
- [repeat](src/scripts/repeat), a script to repeat a command some times
- [short-path](src/scripts/short-path), a script to abbreviate every directory unless the last part of a path

* * *

Copyright © 2010-, Frédéric Menou and Céline Louvet. Licensed under [MIT License].
Expand Down

0 comments on commit 6ad0bcf

Please sign in to comment.