# iiogama's Personal NixOS/Home-Manager Configuration ## How to build existing system with flake ``` cd sudo nixos-rebuild switch --flake ".#" ``` ## How to update existing system's packages ``` sudo nixos-rebuild switch --flake ".#" --update-input nixpkgs --commit-lock-file ``` ## How to install new system with flake ### Method 1 1. Boot into live NixOS disk and run the following commands: ``` sudo su nix-env -iA nixos.git git clone /mnt/etc/nixos nixos-install --flake ".#" ``` 2. Reboot machine, log in, and run the following commands: ``` sudo rm -r /etc/nixos/configuration.nix ``` 3. Move build to desired location. ### 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 @: ``` ## Nix commands to remember ``` nix flake update nix run nixpkgs# ``` [Resources](https://pinboard.in/u:iiogama/t:nix/)