From 7ac61b26b6561fa10d42671fb909de590dff84a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20St=C3=BChrk?= Date: Sun, 21 Feb 2021 00:56:31 +0100 Subject: [PATCH] Update README Closes #13 --- README.rst | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/README.rst b/README.rst index 2691cbec..453ab630 100644 --- a/README.rst +++ b/README.rst @@ -10,33 +10,23 @@ DistroLauncher_ as ``install.tar.gz`` or as input to ``wsl --import --version Quick start =========== -First, you need to build the rootfs tarball. That can be done in some existing -Nix installation. If you don't have one, `you can install Nix in an existing -Linux installation such as Ubuntu on WSL -`_. Alernatively, you can -also use the `nixos/nix Docker container `_. +First, `download the latest release's system tarball +`_. -Run the following commands in your Nix-enabled system: +Then open up a Terminal, PowerShell or Command Prompt and run:: -- ``git clone https://github.com/Trundle/NixOS-WSL`` -- ``cd NixOS-WSL`` -- ``$EDITOR configuration.nix`` and change the ``defaultUser`` variable to whatever you want -- ``nix-build -A system -A config.system.build.tarball ./nixos.nix`` + wsl --import NixOS .\NixOS\ nixos-system-x86_64-linux.tar.gz --version 2 -After that, the rootfs tarball can be found under -``result-2/tarball/nixos-system-x86_64-linux.tar.gz``. Copy the file to your -Windows installation. If you used another WSL distribution to build the tarball, -that can be done with the following commands: +This sets up a new WSL distribution ``NixOS`` that is installed under +``.\NixOS``. ``nixos-system-x86_64-linux.tar.gz`` is the path to the file you +downloaded earlier. You might need to change this path or change to the download +directory first. -- ``mkdir "/mnt/c/Users/[Windows username]/NixOS"`` -- ``cp result-2/tarball/nixos-system-x86_64-linux.tar.gz "/mnt/c/Users/[Windows username]/NixOS/"`` +You can now run NixOS:: -Open up a Command Prompt or PowerShell and run: + wsl -d NixOS -- ``wsl --import NixOS .\NixOS\ .\NixOS\nixos-system-x86_64-linux.tar.gz --version 2`` -- ``wsl -d NixOS`` - -You will be dropped into a very primitive ``sh`` shell, from here you need to +You will be dropped into a very primitive ``sh`` shell. From here you need to run this once:: /nix/var/nix/profiles/system/activate @@ -64,12 +54,25 @@ combination is resolved in two ways: wrapper (see above) enters the systemd namespace before dropping to the shell. -How to build -============ +Build your own system tarball +============================= + +This requires access to a system that already has Nix installed. Please refer to +the `Nix installation guide `_ if +that's not the case. + +If you have a flakes-enabled Nix, you can use the following command to buld your +own tarball instead of relying on a prebuilt one:: + + nix build github:Trundle/NixOS-WSL#nixosConfigurations.mysystem.config.system.build.tarball + +Or, if you want to build with local changes, run inside your checkout:: + + nix build .#nixosConfigurations.mysystem.config.system.build.tarball -:: +Without a flakes-enabled Nix, you can build a tarball using:: - $ nix-build -A system -A config.system.build.tarball ./nixos.nix + nix-build -A system -A config.system.build.tarball ./nixos.nix The resulting mini rootfs can then be found under ``./result-2/tarball/nixos-system-x86_64-linux.tar.gz``.