vidbina / nixos-configuration

12 stars 0 forks source link

Hello #8

Open marioidival opened 6 years ago

marioidival commented 6 years ago

Hi, I'm new user from nixos and I found your config's file.. How I can use it? It's just make and done?

vidbina commented 6 years ago

Yeah. It's basically

Nixos-rebuild helpers

The test rule basically runs nixos-rebuild test which only sets up the configuration without producing a generation (which means that the changes will be more or less gone after a reboot) whereas the switch rule sets up the configuration by producing a new generation which you can boot into later. I generally use the test rule to verify if the configuration is valid and to play around with packages that I just want to "test" until I'm confident that I want to persist the change at which point I invoke the switch rule.

Installing against a modified nixpkgs

There are multiple variations of the test and switch rules. I would recommend you use vanilla make test and make switch, but when you start modifying a checked out version of the nixpkgs repository you could use make local-test or make local-switch which will install nixpkgs as it appears in the $HOME/nixpkgs directory by default. I generally start modifying my nixpkgs repository by first checking out the current version by

  1. cd-ing into $HOME/nixpkgs (I'm assuming that NixOS/nixpkgs was cloned inside $HOME) and
  2. checking out the current revision of NixOS that I am running by git checkout $(nixos-version --revision).

Checking out nixpkgs to your current NixOS version ensures that a nixos-rebuild against it will be as similar to your current setup and therefore not warrant a rebuild of too many packages. Only your diffs on top of that revision would have to be built :wink:.

After your changes are done you can return to the directory of your nixos-configuration which could be a fork of this repository and subsequently call make setup and then make local-test or make local-switch.

Installing against a nixpkgs archive

Here be :dragon:s

You could use the remote-test and remote-switch rules to build against a nixpkgs version somewhere on the web. By default it builds against the current branch of my fork of nixpkgs. But you can see in the Makefile that you can basically change MY_NIXPKGS_REPO and MY_NIXPKGS_BRANCH to point it to any remote. Mind you that I haven't actually used these rules yet so I don't even know if it actually works.

marioidival commented 6 years ago

@vidbina Oh, awesome explanation. Thank you!

I've been tried using virtualbox and I got some errors, but with more details I think can fix it.

vidbina commented 6 years ago

@marioidival most welcome 🙇 . When installing Virtualbox a nix-prefetch-url cmd needs to be performed. It's a licensing thing. Basically you need to run the command to indicate that you have read and agree with the Personal Use and Evaluation License (PUAL).

Don't worry though, the output of the make operation should indicate what you really need to nix-prefetch-url but sometimes it helps to re-run the rebuild operation again because all the noise of downloading and building all those other packages sometimes make it harder to spot this message and re-running it will generally just fail right away with the nix-prefetch-url notification which makes it easy to spot. You could also just grep for "nix-prefetch-url" in your terminal output to spot the message. :wink:

You can find more about it in the source.

vidbina commented 6 years ago

@marioidival I've also added a README to the repository and a literate programmed the hell out of the Makefile, so feel free to have a look there and inform me of anything that may be unclear. :wink:

Also beware that the default WM for this configuration is XMonad. If you're not familiar with XMonad you may want to consider an alternative or keep a XMonad tutorial stand-by to learn it. It's pretty dope. I'm continually screwing around with my rather basic configs (see my XMonad config, xmobar config and other dotfiles which are a perpetual work-in-progress, I fear 😨) but I've seen some really dope setups on unixporn, so it's well worth the effort IMHO. Otherwise checkout i3 or perhaps something more mouse-focussed if that is your thing. :wink:

2018-02-08-005826_3199x1801_scrot

marioidival commented 6 years ago

@vidbina Wow, awesome! Will be of great help to all who want to start using NixOs

vidbina commented 6 years ago

@marioidival Thanks. To be honest, @tmrts has even cooler looking dotfiles and has more or less all configurations in a single repository. So in case this doesn't quite work for you, those dotfiles are closer to what you want or you are just plain ol' curious; you may want to give that a try. :wink:

Let me know if you managed to build the configuration from this repository though. In case anything fails, I actually want to know about it so I can fix it now and not leave those issues to my future self to deal with in probably an inconvenient time. 😝