This repository contains a bash script to automate the setup of a static version of Nix on your system. The script downloads the latest static version of Nix, configures it, and provides commands to build and run programs.
- A Unix-like operating system (Linux, macOS, etc.)
curl
installed on your system- Basic knowledge of using the terminal
-
Clone the repository:
git clone https://github.com/yourusername/nix-static-setup.git cd nix-static-setup
-
Make the script executable:
chmod +x setup_nix.sh
-
Run the script:
./setup_nix.sh
This will download the latest static version of Nix, configure it, and set up the necessary environment.
The script will create a configuration file at ~/.config/nix/nix.conf
with the following content:
store = ~/mynixroot
extra-experimental-features = flakes nix-command
ssl-cert-file = /etc/pki/tls/cert.pem
- store: Specifies the root directory for Nix.
- extra-experimental-features: Enables experimental features like flakes and the Nix command.
- ssl-cert-file: Path to the SSL certificate file. Adjust this path if necessary.
After running the script, you can use the following commands to run Nix programs:
-
To run a program (e.g.,
hello
):~/nixstatic run nixpkgs#hello
-
To enter a Nix shell:
~/nixstatic shell nixpkgs#nix nixpkgs#bashInteractive --command bash
You can then use commands like
nix profile install
. Note that you cannot recursively enter another Nix shell.
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please feel free to submit a pull request or open an issue for any suggestions or improvements.
- Thanks to the Nix community for their contributions and support.
code --no-sandbox google-chrome-stable --no-sandbox
~/nixstatic shell nixpkgs#nix nixpkgs#bashInteractive nixpkgs#git --command bash
fix error ssl git config --global http.sslVerify false
~/nixstatic store gc