Skip to content

Latest commit

 

History

History
106 lines (72 loc) · 2.42 KB

README.md

File metadata and controls

106 lines (72 loc) · 2.42 KB

nixos-dev

My NixOS development flake with configuration files for different hosts.

Apply to Current NixOS System

x86_64

sudo nixos-rebuild switch --flake .#wsl-x86_64 --show-trace
sudo nixos-rebuild switch --flake github:andreifloroiu/nixos-dev#wsl-x86_64

Bump version up and rebuild:

nix flake update \
    && sudo nixos-rebuild switch --flake .#wsl-x86_64 --show-trace

ARM64

sudo nixos-rebuild switch --flake .#wsl-aarch64 --show-trace
sudo nixos-rebuild switch --flake github:andreifloroiu/nixos-dev#wsl-aarch64

Bump version up and rebuild:

nix flake update \
    && sudo nixos-rebuild switch --flake .#wsl-aarch64 --show-trace

Apply to Other Distro

x86_64

Under root.

nix profile install "flake:home-manager#home-manager" --extra-experimental-features nix-command --extra-experimental-features flakes
sudo nix build --refresh github:andreifloroiu/nixos-dev#nixConfigurations.admin-x86_64 --extra-experimental-features nix-command --extra-experimental-features flakes

ARM64

Under root.

sudo nix build --refresh github:andreifloroiu/nixos-dev#nixConfigurations.admin-aarch64 --extra-experimental-features nix-command --extra-experimental-features flakes

Build WSL

Use Ubuntu WSL

Install nix package manager (single-user):

sh <(curl -L https://nixos.org/nix/install) --no-daemon

Follow the next instruction from install script then proceed.

Build into a result, which is a symlink:

nix build .#nixosConfigurations.wsl-aarch64.config.system.build.tarballBuilder \
        --extra-experimental-features nix-command --extra-experimental-features flakes \
        --out-link result \
    && echo "Running result..." \
    && sudo ./result/bin/nixos-wsl-tarball-builder \
    && sudo mv nixos.wsl nixos-wsl.tar.gz \
    && sudo chown andrei:users nixos-wsl.tar.gz

Move resulting file to host OS user folder:

mkdir  /mnt/c/Users/{{username}}/NixOS
mv nixos-wsl.tar.gz /mnt/c/Users/{{username}}/NixOS

Change to powershell on host OS and run:

cd $env:USERPROFILE\NixOS\
wsl --import NixOS $env:USERPROFILE\NixOS\ nixos-wsl.tar.gz --version 2

Update Versions

To update package versions to latest:

nix flake update

Cleanup

Perform a cleanup from time to time:

sudo nix-collect-garbage -d