Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting started instructions do not work from NixOS 20.09 live USB #287

Closed
bluesquall opened this issue May 17, 2021 · 11 comments
Closed

getting started instructions do not work from NixOS 20.09 live USB #287

bluesquall opened this issue May 17, 2021 · 11 comments

Comments

@bluesquall
Copy link

If you skip the cache,

[nixos@nixos:~]$ nix-shell https://github.com/divnix/devos/archive/core.tar.gz -A shell --run "flk get core"
unpacking 'https://github.com/divnix/devos/archive/core.tar.gz'...
unpacking 'https://github.com/edolstra/flake-compat/archive/e7e5d481a0e15dcd459396e55327749989e04ce0.tar.gz'...
error: getting status of '/nix/store/flake.nix': No such file or directory
(use '--show-trace' to show detailed location information)
[nixos@nixos:~/devos]$ nix-shell https://github.com/divnix/devos/archive/core.tar.gz -A shell --run "flk get core" --show-trace
error: while evaluating the attribute 'defaultNix' at /nix/store/0n6nqnb6b6cs3hjqprq9k10a1nc2rgiy-source/default.nix:182:5:
while evaluating 'callLocklessFlake' at /nix/store/0n6nqnb6b6cs3hjqprq9k10a1nc2rgiy-source/default.nix:75:23, called from /nix/store/0n6nqnb6b6cs3hjqprq9k10a1nc2rgiy-source/default.nix:173:10:
getting status of '/nix/store/flake.nix': No such file or directory

This may be related to part of #284.

To use the cache, you have to sudo the command to add it:

sudo nix-shell -p cachix --run "cachix use nrdxp"

Unfortunately, nixos is not a trusted user on the live USB, so even with the cache, nix-shell ignores experimental-features and fails at the end:

[nixos@nixos:~]$ nix-shell https://github.com/divnix/devos/archive/core.tar.gz -A shell --run "flk get core"
.
.
.
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/lw8c19dkrr8a766qbl89nsfwbgwhp43q-deploy-rs-0.1.0
shrinking /nix/store/lw8c19dkrr8a766qbl89nsfwbgwhp43q-deploy-rs-0.1.0/bin/deploy
shrinking /nix/store/lw8c19dkrr8a766qbl89nsfwbgwhp43q-deploy-rs-0.1.0/bin/activate
strip is /nix/store/c1gipyfc161lm0fqfg65k4ak7yl2i17i-binutils-2.34/bin/strip
stripping (with command strip and flags -S) in /nix/store/lw8c19dkrr8a766qbl89nsfwbgwhp43q-deploy-rs-0.1.0/bin
patching script interpreter paths in /nix/store/lw8c19dkrr8a766qbl89nsfwbgwhp43q-deploy-rs-0.1.0
checking for references to /build/ in /nix/store/lw8c19dkrr8a766qbl89nsfwbgwhp43q-deploy-rs-0.1.0...
building '/nix/store/vvdpn4m35k3dqvdhhgp5h4kf0j3mvw71-devshell-dir.drv'...
created 202 symlinks in user environment
building '/nix/store/h7kxn2wcdzdh4kbgq4hka1z055qds75a-devshell-entrypoint.drv'...
fatal: not a git repository (or any of the parent directories): .git
warning: ignoring the user-specified setting 'experimental-features', because it is a restricted setting and you are not a trusted user
error: cannot find flake attribute 'github:divnix/devos/core#defaultTemplate'

and trying to run the nix-shell command as root gets past the trusted user issue, but ends with the same:

.
.
.
fatal: not a git repository (or any of the parent directories): .git

I'll happily file a PR on the docs once I figure out how to get this to work. I couldn't manage to get much further on an Ubuntu machine with nix installed for home-manager, either. I appreciate any suggestions from you folks more familiar with devOS & nix.

@bluesquall
Copy link
Author

Following a suggestion in #284, but as root on the live USB to get around the trusted user issue:

[nixos@nixos:~]$ sudo su
[root@nixos:/home/nixos]$ cd
[root@nixos:~]$ git clone https://github.com/divnix/devos
[root@nixos:~]$ cd devos
[root@nixos:~]$ nix-shell

Partial success! we are now in a devshell!

Unfortunately, flk get core still fails:

[devshell]# flk get core flk
error: cannot find flake attribute 'github:divnix/devos/core#defaultTemplate'

but community works:

[devshell]# flk get community ~/comm
[devshell]# pushd ~/comm
~/comm ~/devos
[devshell] ../comm # ls
book.toml  cachix.nix  default.nix  flake.lock  lib      overlays   profiles   shell      SUMMARY.md  users
bors.toml  compat      doc          flake.nix   modules  overrides  README.md  shell.nix  tests
cachix     COPYING     extern       hosts       nix      pkgs       secrets    suites     theme

...which seems to indicate that there's a difference in defaults between core and community?

@bluesquall
Copy link
Author

Unfortunately, flk iso NixOS fails with a NAR hash mismatch.

@bluesquall
Copy link
Author

Stepping back again and redoing flk get community without the optional argument puts the template in ~/devos/flk and flk iso NixOS is running... I'll check back once it completes.

@Pacman99
Copy link
Member

Thank you for the detailed reports! This should help us a lot.

error: cannot find flake attribute 'github:divnix/devos/core#defaultTemplate'

Yes that was just reported, I should be able to fix that soon. I forgot to un-comment a line.

Unfortunately, flk iso NixOS fails with a NAR hash mismatch.

This could be fixed by nix flake lock --update-input pkgs.

And your first error should be fixed by #286

@nova-nowiz
Copy link
Contributor

I'm pinging my thread for reference:
#285 (comment)
And that good that it is just a commenting error! I thought it was coming from the flk utility not being in sync with the API change 😆

@nova-nowiz
Copy link
Contributor

And knowing that you can add the cache with sudo is a good thing that should be documented in the installation docs as it is useful even on a normal installation of NixOS 😉

@nova-nowiz
Copy link
Contributor

Awesome! I can get the clean fkl folder, thanks @Pacman99!

@bluesquall
Copy link
Author

My first attempt ended out of space because I was on an old small flash drive.

Started over on a new one today and whatever you've fixed in the meantime let me flk get core and build a bootable ISO just fine.

There was a fatal message that didn't break anything, I believe related to the template not being a git repo yet -- I'll paste the logs here for reference once I get them off the test machine, and see if I can add anything to flk to avoid it.

@bluesquall
Copy link
Author

[root@nixos:~]# nix-shell -p cachix --run "cachix use nrdxp"
[root@nixos:~]# nix-shell https://github.com/divnix/devos/archive/core.tar.gz -A shell --run "flk get core"
.
.
.
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/lw8c19dkrr8a766qbl89nsfwbgwhp43q-deploy-rs-0.1.0
shrinking /nix/store/lw8c19dkrr8a766qbl89nsfwbgwhp43q-deploy-rs-0.1.0/bin/deploy
shrinking /nix/store/lw8c19dkrr8a766qbl89nsfwbgwhp43q-deploy-rs-0.1.0/bin/activate
strip is /nix/store/c1gipyfc161lm0fqfg65k4ak7yl2i17i-binutils-2.34/bin/strip
stripping (with command strip and flags -S) in /nix/store/lw8c19dkrr8a766qbl89nsfwbgwhp43q-deploy-rs-0.1.0/bin 
patching script interpreter paths in /nix/store/lw8c19dkrr8a766qbl89nsfwbgwhp43q-deploy-rs-0.1.0
checking for references to /build/ in /nix/store/lw8c19dkrr8a766qbl89nsfwbgwhp43q-deploy-rs-0.1.0...
building '/nix/store/vvdpn4m35k3dqvdhhgp5h4kf0j3mvw71-devshell-dir.drv'...
created 202 symlinks in user environment
building '/nix/store/h7kxn2wcdzdh4kbgq4hka1z055qds75a-devshell-entrypoint.drv'...
fatal: not a git repository (or any of the parent directories): .git

[root@nixos:~]# ls
flk

[root@nixos:~]# cd flk/

[root@nixos:~/flk]# nix-shell
fatal: not a git repository (or any of the parent directories): .git
🔨 Welcome to devshell
.
.
.
[devshell]# git config --global user.name "Nix OS"
[devshell]# git config --global user.email "NixOS@example.com"
[devshell]# git init
[devshell]# git add .
[devshell]# git commit -am"init DevOS"

[devshell]# flk iso NixOS
.
.
.
[devshell]# du -shD result
854M    result
[devshell]# dd bs=4M status=progress oflag=sync if=result/
iso/         nix-support/ 
[devshell]# dd bs=4M status=progress oflag=sync if=result/iso/nixos-NixOS-21.05.20210315.266dc8c-x86_64-linux.iso of=/dev/sd
sda   sda1  sda2  sdb   sdb1  sdb2  
[devshell]# dd bs=4M status=progress oflag=sync if=result/iso/nixos-NixOS-21.05.20210315.266dc8c-x86_64-linux.iso of=/dev/sdb
894435328 bytes (894 MB, 853 MiB) copied, 798 s, 1.1 MB/s
213+1 records in
213+1 records out
894435328 bytes (894 MB, 853 MiB) copied, 797.864 s, 1.1 MB/s

@bluesquall
Copy link
Author

The fatal I'm referring to is at the end of flk get core and also after cd flk; nix-shell -- It looks like nix-shell and dropping into devshell expects the folder to already be a git repo, but flk get core doesn't produce a git repo.

I'll poke around a bit tonight to see if I can contribute an acceptable way to avoid this red herring.

In the meantime, I believe my original issue is resolved, so I'm marking this as closed.

@nova-nowiz
Copy link
Contributor

And knowing that you can add the cache with sudo is a good thing that should be documented in the installation docs as it is useful even on a normal installation of NixOS 😉

Should I make a separate tracking issue for this?
I had completly forgot about this 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants