Stream: nixos

Topic: NixOS oneclick install tutorial


view this post on Zulip LV Nilesh (Jun 11 2024 at 18:01):

https://github.com/lvnilesh/nix-one-click

is this enough? will it autogenerate the lock file?

view this post on Zulip Srid (Jun 11 2024 at 18:04):

You should generate the lock file by running nix flake lock, and commit that to the repo.

view this post on Zulip Srid (Jun 11 2024 at 18:04):

nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";

Also, 24.05 was recently released.

view this post on Zulip Srid (Jun 11 2024 at 18:05):

Don't forget to add your ssh key to rootAuthorizedKeys

view this post on Zulip Srid (Jun 11 2024 at 18:05):

Assuming this is for https://nixos.asia/en/nixos-install-oneclick

view this post on Zulip LV Nilesh (Jun 11 2024 at 18:10):

I added my pubkey.
I did not generate lock. I could not generate lock because the git repo is remote.
Install finished when I used my README in my git repo https://github.com/lvnilesh/nix-one-click
Then the new nix machine wont boot after a power cycle.

I am now debugging.

Thanks for your help.

view this post on Zulip Srid (Jun 11 2024 at 18:20):

@LV Nilesh It is not advisable to ignore generating the lock file. You won't get the reproducibility benefits of NixOS.

view this post on Zulip Srid (Jun 11 2024 at 18:20):

Just clone the git repo and add it

view this post on Zulip Srid (Jun 11 2024 at 18:48):

LV Nilesh said:

Then the new nix machine wont boot after a power cycle.

I am now debugging.

Let me know how that goes. Probably something to do with boot loader configuration. I've tested that flake only on Parallels VM on mac.

view this post on Zulip LV Nilesh (Jun 11 2024 at 19:07):

can’t clone without git

view this post on Zulip LV Nilesh (Jun 11 2024 at 19:08):

Newbie does not know how to get git in a USB booted live nix environment

view this post on Zulip Srid (Jun 11 2024 at 19:08):

nix run nixpkgs#git clone <url>

view this post on Zulip Srid (Jun 11 2024 at 19:09):

(For more on that nifty nix run command, see https://nixos.asia/en/nix-first)

view this post on Zulip LV Nilesh (Jun 11 2024 at 19:10):

:+1:

view this post on Zulip LV Nilesh (Jun 11 2024 at 19:19):

nix --extra-experimental-features "nix-command flakes" run nixpkgs#git clone git@github:lvnilesh/nix-one-click

Thanks.

view this post on Zulip LV Nilesh (Jun 11 2024 at 19:26):

nix --extra-experimental-features "nix-command flakes" run nix flake lock
nix --extra-experimental-features "nix-command flakes" run flake lock
nix --extra-experimental-features "nix-command flakes" flake lock

all fail LOL

view this post on Zulip LV Nilesh (Jun 11 2024 at 19:27):

I cloned git - then CD into it and then don't yet know how to nix flake lock

view this post on Zulip Srid (Jun 11 2024 at 19:37):

all fail LOL

Post the error message. Your 3rd command is correct.

view this post on Zulip LV Nilesh (Jun 11 2024 at 19:49):

git cloned https://github.com/lvnilesh/nix-one-click /tmp/nix-one-click
cd /tmp/nix-one-click
nix --extra-experimental-features "nix-command flakes" flake lock

error: while fetching the input git+file://tmp/nix-one-click
error: getting the HEAD of the git tree /tmp/nix-one-click failed with exit code 1
error executing git: no such file or directory

view this post on Zulip LV Nilesh (Jun 11 2024 at 20:09):

image.png

view this post on Zulip LV Nilesh (Jun 11 2024 at 20:11):

this screenshot when I try UEFI

view this post on Zulip LV Nilesh (Jun 11 2024 at 20:11):

and
image.png
this screenshot when I try SeaBIOS

view this post on Zulip Srid (Jun 11 2024 at 20:24):

Ah, try this.

First, run nix shell nixpkgs#git to enter a shell with git on PATH.

Then, you can run nix flake lock, etc. normally.

view this post on Zulip LV Nilesh (Jun 11 2024 at 20:38):

nix --extra-experimental-features "nix-command flakes" run nixpkgs#git clone [email protected]:lvnilesh/nix-one-click

cd nix-one-click

nix --extra-experimental-features "nix-command flakes"  shell nixpkgs#git
nix --extra-experimental-features "nix-command flakes" flake lock

git status
git add flake.lock
git commit -am "add flake lock"
git push

bash README.md

power off and reboot from disk and be greeted by
image.png

view this post on Zulip LV Nilesh (Jun 11 2024 at 20:57):

README.md contains

# Assuming
# - your system is x86_64-linux
# - your harddrive device is /dev/sda
FLAKE="github:lvnilesh/nix-one-click#nixoneclick"
DISK_DEVICE=/dev/sda
sudo nix \
    --extra-experimental-features 'flakes nix-command' \
    run github:nix-community/disko#disko-install -- \
    --flake "$FLAKE" \
    --write-efi-boot-entries \
    --disk main "$DISK_DEVICE"

view this post on Zulip Srid (Jun 11 2024 at 21:49):

Can you say more about the machine you are installing to?

view this post on Zulip LV Nilesh (Jun 11 2024 at 23:30):

image.png

view this post on Zulip Srid (Jun 11 2024 at 23:50):

Was /dev/sda the right disk ?

view this post on Zulip LV Nilesh (Jun 12 2024 at 01:11):

yes

view this post on Zulip Srid (Jun 12 2024 at 02:51):

Try the graphical installer, and see what configuration.nix it generates. Then adopt that config into your flake:

https://nixos.asia/en/nixos-install-flake

view this post on Zulip LV Nilesh (Jun 12 2024 at 03:37):

Did that. It created https://github.com/lvnilesh/nixos-config/blob/master/configuration.nix

How would I add that to this https://github.com/lvnilesh/nix-one-click/blob/master/flake.nix

view this post on Zulip Srid (Jun 12 2024 at 03:52):

Add it to the modules list

view this post on Zulip Srid (Jun 12 2024 at 03:52):

Just like how you are importing ./disk-config.nix

view this post on Zulip Srid (Jun 12 2024 at 03:52):

Make sure to git add the new file (Nix won't see it otherwise)

view this post on Zulip Srid (Jun 12 2024 at 03:53):

Though at this point you can get rid of ./disk-config.nix, and the existing boot config from flake.

view this post on Zulip Shivaraj B H (Jun 17 2024 at 15:43):

LV Nilesh said:

image.png

I recall facing this while setting up a server at Juspay. It is most likely due to Intel VMD being enabled in your BIOS, which would require the proprietary intel drivers to get it working in NixOS. I recommend just disabling it if that’s the case and you can use mdadm for raid configuration instead.


Last updated: Nov 15 2024 at 12:33 UTC