Skip to content

andreifloroiu/nixos-dev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

ARM64

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

Bump Versions

nix flake update

Garbage Collection

Perform a cleanup from time to time:

sudo nix-collect-garbage -d

Rollback

sudo nixos-rebuild switch --rollback

Development

Build without applying configuration:

nixos-rebuild build --flake .#wsl-aarch64
nixos-rebuild build --flake .#wsl-x86_64

Build ISO

nix build --flake .#nixosConfigurations.desktop-x86_64.config.system.build.isoImage
nix build --flake github:andreifloroiu/nixos-dev#nixosConfigurations.desktop-x86_64.config.system.build.isoImage

Build WSL Distro From Scratch

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 github:andreifloroiu/nixos-dev#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

Build for Server

  1. Clone this repo andreifloroiu/nixos-dev.

  2. cd into it

  3. Build an sd-image for target, e.g. nix build '.#nixosConfigurations.jump-x86_64.config.system.build.sd-image' or nix build '.#nixosConfigurations.jump-aarch64.config.system.build.sd-image'

More Read

About

My NixOS dev environment.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published