2023-07-31 00:21:32 -04:00
|
|
|
# iiogama's Personal NixOS/Home-Manager Configuration
|
|
|
|
|
|
|
|
## How to build existing system with flake
|
|
|
|
|
|
|
|
```
|
|
|
|
cd <build repo>
|
|
|
|
sudo nixos-rebuild switch --flake ".#<hostname>"
|
|
|
|
```
|
|
|
|
|
2023-09-28 21:28:33 -04:00
|
|
|
## How to update existing system's packages
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo nixos-rebuild switch --flake ".#<hostname>" --update-input nixpkgs --commit-lock-file
|
|
|
|
```
|
|
|
|
|
2024-03-02 19:57:38 -05:00
|
|
|
## How to install with single command
|
|
|
|
```
|
|
|
|
nix-shell -p git --command "nix run https://git.sdf.org/iiogama/confix --extra-experimental-features nix-command --extra-experimental-features flakes --flake .#fireweed"
|
|
|
|
|
2023-07-31 00:21:32 -04:00
|
|
|
## How to install new system with flake
|
|
|
|
|
2023-12-03 21:25:44 -05:00
|
|
|
### Method 1
|
|
|
|
|
2023-07-31 00:21:32 -04:00
|
|
|
1. Boot into live NixOS disk and run the following commands:
|
|
|
|
```
|
|
|
|
sudo su
|
|
|
|
nix-env -iA nixos.git
|
|
|
|
git clone <repo url> /mnt/etc/nixos
|
|
|
|
nixos-install --flake ".#<host>"
|
|
|
|
```
|
|
|
|
2. Reboot machine, log in, and run the following commands:
|
|
|
|
```
|
|
|
|
sudo rm -r /etc/nixos/configuration.nix
|
|
|
|
```
|
|
|
|
3. Move build to desired location.
|
|
|
|
|
2023-12-03 21:25:44 -05:00
|
|
|
|
|
|
|
### Method 2
|
|
|
|
1. Boot into live NixOS disk
|
|
|
|
2. Install NixOS
|
|
|
|
3. Add the following changes:
|
|
|
|
```/etc/nixos/configuration.nix
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
git
|
|
|
|
];
|
|
|
|
services.openssh.enable = true;
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
|
|
|
```
|
|
|
|
4. Run the following command:
|
|
|
|
```
|
|
|
|
sudo nixos-rebuild switch
|
|
|
|
```
|
|
|
|
5. Grab the IP address with the following command:
|
|
|
|
```
|
|
|
|
ip addr
|
|
|
|
```
|
|
|
|
6. Copy a flake repo from the host machine:
|
|
|
|
```
|
|
|
|
rsync -avz <repo directory> <user>@<ip addr>:
|
|
|
|
```
|
|
|
|
|
2023-07-31 00:21:32 -04:00
|
|
|
## Nix commands to remember
|
|
|
|
|
|
|
|
```
|
|
|
|
nix flake update
|
|
|
|
nix run nixpkgs#<package>
|
|
|
|
```
|
2023-08-02 10:10:29 -04:00
|
|
|
|
2023-11-23 01:24:22 -05:00
|
|
|
[Resources](https://pinboard.in/u:iiogama/t:nix/)
|