mirror of
https://github.com/cupcakearmy/nix-cli.git
synced 2025-12-11 16:25:03 +00:00
v2
This commit is contained in:
49
README.md
49
README.md
@@ -1,24 +1,37 @@
|
||||
# Nix
|
||||
# My Nix Server Configuration
|
||||
|
||||
Nix setup for server
|
||||
This Nix flake configures a server with common tools and shell aliases.
|
||||
|
||||
## Install
|
||||
## Prerequisites
|
||||
|
||||
- [Nix](https://nixos.org/download.html) must be installed on the server.
|
||||
|
||||
## Installation
|
||||
|
||||
1. **Fork this repository on GitHub.**
|
||||
|
||||
2. **Customize your fork:**
|
||||
|
||||
In `flake.nix`, change the `username` variable to your actual username on the server. You can do this directly on GitHub or by cloning your fork locally, making the change, and pushing it.
|
||||
|
||||
3. **Apply the configuration on your server:**
|
||||
|
||||
```bash
|
||||
nix run home-manager/master -- switch --flake github:<your-github-username>/nix-server#<your-username>
|
||||
```
|
||||
|
||||
For example, if your GitHub username is `johndoe` and your server username is `john`:
|
||||
|
||||
```bash
|
||||
nix run home-manager/master -- switch --flake github:johndoe/nix-server#john
|
||||
```
|
||||
|
||||
## Updating
|
||||
|
||||
To update the packages and your configuration on the server, simply run the same command again. Nix will automatically fetch the latest version of your flake from your GitHub repository.
|
||||
|
||||
```bash
|
||||
# First time install
|
||||
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
|
||||
|
||||
# Install / Update
|
||||
nix run home-manager -- switch --flake github:cupcakearmy/nix-cli#root -b bkp
|
||||
nix run home-manager/master -- switch --flake github:<your-github-username>/nix-server#<your-username>
|
||||
```
|
||||
|
||||
## Update
|
||||
|
||||
This can be run on any machine. Just update and then just rerun on the targets
|
||||
|
||||
```bash
|
||||
nix flake update
|
||||
|
||||
# To test
|
||||
nix run home-manager -- build --flake .#root
|
||||
```
|
||||
To update the flake's dependencies (like `nixpkgs`), you'll need to update the `flake.lock` file in your repository. You can do this by running `nix flake update` in a local clone of your repository and pushing the changes.
|
||||
|
||||
Reference in New Issue
Block a user