jakehamilton / config

One Nix flake to rule them all.
Other
360 stars 21 forks source link

How to use the various systems #14

Closed stratosgear closed 8 months ago

stratosgear commented 8 months ago

Sorry for bothering you here, but I am trying to work my way through your repo, as it seems it contains a ton of nixos gems. Alas it is completely undocumented... :(

As I understand it you can: sudo nixos-build switch --flake .#XXX, where XXX any of the systems under system/x86_64-linux in order to apply the configurations on that system

But how do you use any of the other system/[xxx_xxx_xxxx] subfolders?

For example I thought it would be easy to play with a virtual box, so I do not nuke any physical machines, but I do not understand how to use the system/x86_64-virtualbox/virt system.

Same with x86_64-install-iso or x86_64-iso... :( How do I make these images? A very short README in the root folder of these systems, with the proper incantation to use them would be VERY useful.

It's a shame that there is SOOOO much info in your repo, but inaccessible to people trying to learn. I completely understand the difficulty (and maybe even the boring task of doing so) but even a simple push in the right direction would be a great help! As a matter of fact it might even be unfair to apply this criticism to you only, but I came across this issue in ALL nixos resources I found online. People do a ton of cool stuff, but take it for granted that everyone else is a nix guru too able to follow along! Sorry for the rant, I do not really mean to be mean, just expressing my frustration to follow along. You owe me nothing like I request here. I just think that it might be easier to provide a bit more documentation on this repo, with an extra comment here and there, than creating full time online detailed tutorials (which it would be totally unreasonable to expect).

Tutorials, which btw, I really enjoyed by seeing your live streams. What a bad luck on your last stream, when your machine failed to boot after the nixos install. I was really hoping you would be able to go over the system configurations once your brought it online.

Thanks for all your work, anyways... :)

jakehamilton commented 8 months ago

Hey there!

My config is built using Snowfall Lib. You can find the system QuickStart here: https://snowfall.org/guides/lib/systems/

And there is a section explaining all of the supported system types in the reference documentation (see the Darwin and NixOS Generators section): https://snowfall.org/reference/lib/#mkflake

One other helpful thing may be using nix flake show to display all the outputs of a flake.


I'm glad the streams helped a bit, I've wanted to go back to finish a nixos installation and move on to showing how to work with nixos modules, etc. Haven't gotten around to it just yet!

stratosgear commented 8 months ago

I checked the links you sent but there are no examples of how to build any of the systems. I also checked the https://github.com/nix-community/nixos-generators site and none of their proposed ways to trigger any of the available formats seemed to work on a checked out copy of your repo. The intention was to run one of your configured systems in a VM, if possible, or maybe run what you have marked as x86_64-virtualbox/virt and start tweaking from there.

I guess there is an even bigger gap between your assumption (or my assumption?) of what a nixos newbie knows (or ought to know) and what is the minimum requirement before they make sense of such a repo like yours here. It seems I am oscillating between examples that are too trivial and real life working implementations that are too hard (or abstract).

Oh well, thanks for taking the time to respond, anyways... :)

jakehamilton commented 8 months ago

Ah, you are looking for nix build. For example, you can do nix build .#isoConfigurations.minimal or nix build .#virtualboxConfigurations.virt.

JeanMertz commented 6 months ago

I've got a question related to this @jakehamilton. (How) is it possible to cross-compile an install-iso target using this setup?

I have a systems/x86_64-install-iso/minimal/default.nix with some basic configuration in there, including:

boot.binfmt.emulatedSystems = [ "x86_64-linux" ];

I also added nixos-generators to my inputs.

Now I want to be able to run something like this from my m2  Mac:

nix build path:.#install-isoConfigurations.minimal --system x86_64-linux

But it fails due to unexecutable binaries, which I'm sure is because of the cross-compilation. Should I just assume this isn't possible, and do something similar to https://github.com/Robertof/nixos-docker-sd-image-builder and build the ISO through Docker or a VM instead?

edit: Well, I'm dumb (but learning). Here's a perfect explainer why this isn't going to work: https://discourse.nixos.org/t/flake-to-create-aarch64-iso-for-a-rpi-from-a-mac/24699/2 (i.e. boot.binfmt.emulatedSystems should be set on the source system, but that option is only available on NixOS systems, not on macOS).