basics Absolutely β€” using **Nix** on Debian can give you a powerful, AUR-like experience with access to thousands of packages, isolated environments, and even rollbacks. It’s a different mindset than `apt`, but super powerful once you get the hang of it. --- ## 🧰 What Is Nix? Nix is a **purely functional package manager**: * Installs packages **without interfering** with your system. * Supports **per-user installs** β€” no sudo needed for most things. * Enables **isolated dev environments**, rollbacks, and reproducibility. --- ## 🧱 Step-by-Step: Installing and Using Nix on Debian ### πŸ”Ή 1. **Install Nix** Run this script (official installer): ```bash curl -L https://nixos.org/nix/install | sh ``` > βœ… After installation, either restart your shell or run: ```bash . ~/.nix-profile/etc/profile.d/nix.sh ``` --- ### πŸ”Ή 2. **Install a Package (like `hello`)** ```bash nix-env -iA nixpkgs.hello ``` > This installs the `hello` program into your **user profile** β€” no sudo needed. You can run it immediately: ```bash hello ``` --- ### πŸ”Ή 3. **Search for Packages** ```bash nix search nixpkgs firefox ``` Or use the web search: [https://search.nixos.org/packages](https://search.nixos.org/packages) --- ### πŸ”Ή 4. **Upgrade Installed Packages** ```bash nix-env --upgrade ``` --- ### πŸ”Ή 5. **Remove a Package** ```bash nix-env -e hello ``` --- ## πŸ§ͺ Bonus: Reproducible Dev Environments (`shell.nix`) Make a file named `shell.nix`: ```nix { pkgs ? import {} }: pkgs.mkShell { buildInputs = [ pkgs.git pkgs.nodejs pkgs.python3 ]; } ``` Then run: ```bash nix-shell ``` This drops you into an environment with only those tools installed β€” perfect for development! --- ## πŸ” Is It Safe? Yes β€” it’s **sandboxed**, doesn't touch your global system files, and is trusted by many in the DevOps/Dev world. --- ## ⚠️ Things to Know * It uses a **huge store** (`/nix/store`) β€” so expect some disk usage. * It can be a **learning curve**, but well worth it if you want reproducibility or project-based environments. * You can uninstall Nix any time with `nix-env --uninstall` or delete `/nix`. --- Want to try installing a specific package with Nix now, or explore using `home-manager` for managing your full dotfiles setup?   **Installing packages** To install **Brave** using **Nix**, you have a couple of options depending on how you want to use it (system-wide, user profile, or temporary). Here's how to do it: --- ## 🦁 Option 1: Install Brave to Your User Profile (Permanent) First, search for it: ```bash nix search nixpkgs brave ``` You should see a result like: ```text brave # A privacy-focused web browser ``` Then install it: ```bash nix-env -iA nixpkgs.brave ``` βœ… This makes `brave` available permanently in your user environment. --- ## ⚑ Option 2: Use `nix shell` (Temporary) If you just want to **run Brave without installing**: ```bash nix shell nixpkgs#brave ``` This will drop you into a shell where `brave` is available. You can launch it: ```bash brave ``` When you exit the shell, it's gone β€” no clutter! --- ## πŸ”₯ Option 3: Use `nix run` (One-off Execution) To run Brave **directly**: ```bash nix run nixpkgs#brave ``` --- ## πŸ“¦ Bonus: Use `home-manager` (for managing user packages declaratively) If you're managing your dotfiles/config with Nix, you can declare Brave in your `home.nix` like this: ```nix { home.packages = with pkgs; [ brave ]; } ``` Then just run `home-manager switch`. --- Would you like help setting up `home-manager` too? It's great if you're building a Nix-based setup.   for enabling expermimental feature which is required for search and install packages ```sh sudo mkdir -p /etc/nix sudo nano /etc/nix/nix.conf ``` then add following ```txt experimental-features = nix-command flakes ```   to remove packages if installed with nix-env ```sh nix-env -e brave ``` and then for removing unused packages ```sh nix-collect-garbage ``` for older generations: ```sh nix-collect-garbage -d ```