nix-get
is a simple script to manage NixOS packages, similar to the apt-get
CLI tool. This script allows you to install packages either for the current user or system-wide.
- 📥 Install packages for the current user
- 🌐 Install packages system-wide
- 🛠 Automatically detects the current user
- 🔍 Checks for duplicate packages before adding
-
Download and make the script executable:
chmod +x nix-get.sh
-
Install a package for the current user:
sudo ./nix-get.sh install <package-name>
-
Install a package system-wide:
sudo ./nix-get.sh --system install <package-name>
Replace
<package-name>
with the name of the package you want to install.
To install htop
for the current user:
sudo ./nix-get.sh install htop
To install htop
system-wide:
sudo ./nix-get.sh --system install htop
- Root Check: Ensures the script is run with sudo.
- Argument Check: Validates that the required arguments are provided.
- Argument Parsing: Checks for the
--system
flag. - Action Validation: Ensures the action is
install
. - Configuration File Check: Verifies the existence of
/etc/nixos/configuration.nix
. - System-Wide Installation:
- Checks if the package is already in the system-wide list.
- Appends the package if not present.
- Rebuilds the NixOS configuration.
- User-Specific Installation:
- Detects the current user.
- Checks if the package is already in the user's list.
- Appends the package if not present.
- Rebuilds the NixOS configuration.
- Output Message: Provides feedback on the success or failure of the operation.
This project is licensed under the MIT License.
Contributions are welcome! Please fork the repository and submit a pull request.
For any questions or feedback, please open an issue on the GitHub repository.