all repos — gemini-redirect @ 1cbe681dd6dce46d52cfdd93fea315e84be80b33

blog/installing-nixos/index.html (view raw)

1<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta name=description content="Official Lonami's website"><meta name=viewport content="width=device-width, initial-scale=1.0, user-scalable=yes"><title> Installing NixOS | Lonami's Blog </title><link rel=stylesheet href=/style.css><body><article><nav class=sections><ul class=left><li><a href=/>lonami's site</a><li><a href=/blog class=selected>blog</a><li><a href=/golb>golb</a></ul><div class=right><a href=https://github.com/LonamiWebs><img src=/img/github.svg alt=github></a><a href=/blog/atom.xml><img src=/img/rss.svg alt=rss></a></div></nav><main><h1 class=title>Installing NixOS</h1><div class=time><p>2017-05-13<p>last updated 2019-02-16</div><h2 id=update>Update</h2><p><em>Please see <a href=../installing_nixos_2/index.html>my followup post with NixOS</a> for a far better experience with it</em><hr><p>Today I decided to install <a href=http://nixos.org/>NixOS</a> as a recommendation, a purely functional Linux distribution, since <a href=https://xubuntu.org/>Xubuntu</a> kept crashing. Here's my journey, and how I managed to install it from a terminal for the first time in my life. Steps aren't hard, but they may not seem obvious at first.<ul><li><p>Grab the Live CD, burn it on a USB stick and boot. I recommend using <a href=https://etcher.io/>Etcher</a>.<li><p>Type <code>systemctl start display-manager</code> and wait.<sup class=footnote-reference><a href=#1>1</a></sup><li><p>Open both the manual and the <code>konsole</code>.<li><p>Connect to the network using the GUI.<li><p>Create the disk partitions by using <code>fdisk</code>.</p> <p>You can list them with <code>fdisk -l</code>, modify a certain drive with <code>fdisk /dev/sdX</code> (for instance, <code>/dev/sda</code>) and follow the instructions.</p> <p>To create the file system, use <code>mkfs.ext4 -L &LTlabel> /dev/sdXY</code> and swap with <code>mkswap -L &LTlabel> /dev/sdXY</code>.</p> <p>The EFI partition should be done with <code>mkfs.vfat</code>.<li><p>Mount the target to <code>/mnt</code> e.g. if the label was <code>nixos</code>, <code>mount /dev/disk/by-label/nixos /mnt</code><li><p><code>mkdir /mnt/boot</code> and then mount your EFI partition to it.<li><p>Generate a configuration template with <code>nixos-generate-config --root /mnt</code>, and modify it with <code>nano /etc/nixos/configuration.nix</code>.<li><p>While modifying the configuration, make sure to add <code>boot.loader.grub.device = "/dev/sda"</code><li><p>More useful configuration things are:</p> <ul><li>Uncomment the whole <code>i18n</code> block.<li>Add some essential packages like <code>environment.systemPackages = with pkgs; [wget git firefox pulseaudio networkmanagerapplet];</code>.<li>If you want to use XFCE, add <code>services.xserver.desktopManager.xfce.enable = true;</code>, otherwise, you don't need <code>networkmanagerapplet</code> either. Make sure to add <code>networking.networkmanager.enable = true;</code> too.<li>Define some user for yourself (modify <code>guest</code> name) and use a UID greater than 1000. Also, add yourself to <code>extraGroups = ["wheel" "networkmanager"];</code> (the first to be able to <code>sudo</code>, the second to use network related things).</ul><li><p>Run <code>nixos-install</code>. If you ever modify that file again, to add more packages for instance (this is how they're installed), run <code>nixos-rebuild switch</code> (or use <code>test</code> to test but don't boot to it, or <code>boot</code> not to switch but to use on next boot.<li><p><code>reboot</code>.<li><p>Login as <code>root</code>, and set a password for your user with <code>passwd &LTuser></code>. Done!</ul><p>I enjoyed the process of installing it, and it's really cool that it has versioning and is so clean to keep track of which packages you install. But not being able to run arbitrary binaries by default is something very limitting in my opinion, though they've done a good job.<p>I'm now back to Xubuntu, with a fresh install.<h2 id=update-1>Update</h2><p>It is not true that "they don't allow running arbitrary binaries by default", as pointed out in their <a href=https://nixos.org/nixpkgs/manual/#sec-fhs-environments>manual, buildFHSUserEnv</a>:<blockquote><p><code>buildFHSUserEnv</code> provides a way to build and run FHS-compatible lightweight sandboxes. It creates an isolated root with bound <code>/nix/store</code>, so its footprint in terms of disk space needed is quite small. This allows one to run software which is hard or unfeasible to patch for NixOS -- 3rd-party source trees with FHS assumptions, games distributed as tarballs, software with integrity checking and/or external self-updated binaries. It uses Linux namespaces feature to create temporary lightweight environments which are destroyed after all child processes exit, without root user rights requirement.</blockquote><p>Thanks to <a href=https://github.com/bb010g>@bb010g</a> for pointing this out.<h2 id=notes>Notes</h2><div class=footnote-definition id=1><sup class=footnote-definition-label>1</sup><p>The keyboard mapping is a bit strange. On my Spanish keyboard, the keys were as follows:</div><table><thead><tr><th>Keyboard<th>Maps to<th>Shift<tbody><tr><td>'<td>-<td>_<tr><td>´<td>'<td>"<tr><td>`<td>[<td><tr><td>+<td>]<td><tr><td>¡<td>=<td><tr><td>-<td>/<td><tr><td>ñ<td>;<td></table></main><footer><div><p>Share your thoughts, or simply come hang with me <a href=https://t.me/LonamiWebs><img src=/img/telegram.svg alt=Telegram></a> <a href=mailto:totufals@hotmail.com><img src=/img/mail.svg alt=Mail></a></div></footer></article><p class=abyss>Glaze into the abyss… Oh hi there!