# Using Groups with a Different Remote Origin URL

When your repository URL differs from the default `github:anotherhadi/nixy`, you need to update the input URL in your consuming flake. Here's how to use the groups with any remote URL.

## Update the Input in Your Flake

### Example 1: GitHub URL
```nix
inputs.nixy.url = "github:yourusername/nixy";
```

### Example 2: GitLab URL
```nix
inputs.nixy.url = "gitlab:yourusername/nixy";
```

### Example 3: Gitea URL (like the current origin)
```nix
inputs.nixy.url = "gitea:yourusername/nixy.git";
```

### Example 4: SSH URL
```nix
inputs.nixy.url = "git+ssh://git@github.com/yourusername/nixy.git";
```

### Example 5: Local file path (for development/testing)
```nix
inputs.nixy.url = "path:/path/to/nixy";
```

## Using Groups in Home Manager

Once the input URL is configured, you can import any group module:

```nix
{ inputs, ... }: {
  imports = [
    inputs.nixy.homeManagerModules.cybersecurity
    # inputs.nixy.homeManagerModules.dev
    # inputs.nixy.homeManagerModules.basic-apps
    # inputs.nixy.homeManagerModules.misc
  ];
}
```

This will:
- Install all packages from the cybersecurity group
- Set up `~/Cyber/wordlists/` directory with SecLists, fuzz4bounty, and hashcat rules
- Create `~/Cyber/tmp/` as a temporary workspace

## Using Groups in nix shell

For a quick shell with the group's packages without installing:

```sh
nix shell yourusername/nixy#cybersecurity
nix shell yourusername/nixy#dev
```

Replace `yourusername/nixy` with the actual path to the flake.

## Important Notes

### 1. Group Output Names Must Match

The group names available in your local flake (`flake.nix`) are defined in the `homeManagerModules` output. Currently these groups are defined:

- `dev` - Go, Bun, Air, and other development tools
- `cybersecurity` - Security tools (nmap, john, dirb, ffuf, etc.)
- `basic-apps` - Basic applications
- `misc` - Miscellaneous packages

### 2. Access to Groups vs Packages

There are two ways to access groups:

- **`inputs.nixy.homeManagerModules.<group>`** - For Home Manager integration (packages + files + systemd units)
- **`inputs.nixy.packages.<group>`** - For standalone environments (packages only)

Both require the same input URL configuration.

### 3. Flake Lock Consistency

After changing the input URL, run:

```sh
nix flake lock --update-input nixy
```

or

```sh
nix flake update
```

This ensures the `flake.lock` file references the correct commit.

### 4. Using with Multiple Remote URLs

If you need to reference the same flake from different remotes, you can specify multiple inputs:

```nix
inputs = {
  nixy-main.url = "github:anotherhadi/nixy";
  nixy-personal.url = "github:yourusername/nixy";

  # Then reference them as inputs.nixy-main.homeManagerModules.cybersecurity
  # or inputs.nixy-personal.packages.dev
};
```

### 5. Checking Available Groups

You can check which groups are available by inspecting the flake output:

```sh
nix flake show yourusername/nixy#groups
```

This will display all available outputs including the `homeManagerModules` and `packages` groups.

## Troubleshooting

### Error: "Unknown flake output"

**Cause:** The input URL points to a location that doesn't have the expected flake structure.

**Solution:** Verify the repository has the expected flake.nix and the correct outputs are defined.

### Error: "Not a flake"

**Cause:** The input URL might be pointing to a non-git repository or a branch/tag that doesn't have a flake.

**Solution:** Check the URL path and ensure it points to a valid git repository with a flake.nix file.

### Error: "Permission denied"

**Cause:** Using SSH URLs with read-only access or incorrect credentials.

**Solution:** Use HTTPS URLs for read-only access, or configure SSH keys properly for SSH URLs.
