Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/nix - Add NixOS support #119

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake . '--impure' '--show-trace'
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
.DS_Store
dist
dist
#snow-blower working dir
.sb*
22 changes: 22 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,28 @@ Install the dependencies using npm:
npm i
```

### Nix Setup (With Flakes)

Pull down this project locally.

when you enter the directory if you have direnv installed run:

```sh
direnv allow
```

If you do not run

```sh
nix develop
```

this will pull down all dependencies, install hooks and formatters etc. You are now free to run.

```sh
npm i
```

## Building the project

Run the `build` script:
Expand Down
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,38 @@

This will create a `.ai-shell` file in your home directory.

### Nix Setup (With Flakes)

This package can be integrated into Nix environments as a custom package. Follow the steps below to set it up:

1. **Add this package to your flakes inputs:**
```nix
inputs.ai-shell.url = "github:BuilderIO/ai-shell";
```

2. **Add the package to your system or Home Manager configuration:**
- For Home Manager:
```nix
home.packages = with pkgs; [
inputs.ai-shell.defaultPackage.x86_64-linux
];
```
- **or** for NixOS system packages:
```nix
users.users.<your-username>.packages = with pkgs; [
inputs.ai-shell.defaultPackage.x86_64-linux
];
```

3. **Activate the configuration:**
If you are on NixOS, execute:
```bash
sudo nixos-rebuild switch --flake .#your-computer
```

And you are good to go!


## Usage

```bash
Expand Down
34 changes: 34 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{dream2nix, ...}: {
imports = [
dream2nix.modules.dream2nix.nodejs-package-json-v3
dream2nix.modules.dream2nix.nodejs-package-lock-v3
dream2nix.modules.dream2nix.nodejs-granular-v3
];

name = "ai-shell";
version = "1.0.10";

mkDerivation = {
src = ./.;
};

deps = {nixpkgs, ...}: {
inherit
(nixpkgs)
gnugrep
stdenv
;

npm = nixpkgs.nodejs_18.pkgs.npm;
};

nodejs-package-lock-v3 = {
packageLockFile = ./package-lock.json;
};

# nodejs-granular-v3 = {
# buildScript = ''
# npm run pkgroll
# '';
# };
}
Loading
Loading