Skip to content

Instantly share code, notes, and snippets.

Setting up NixOs with LUKS encrypted root

Here are my working notes on getting a system up and running.

WARNING: You can run into a hidden problem that will prevent a correct partition setup and /etc/nixos/configuration.nix from working: if you are setting up a UEFI system, then you need to make sure you boot into the NixOS installation from the UEFI partition of the bootable media. You may have to enter your BIOS boot selection menu to verify this. For example, if you setup a NixOS installer image on a flash drive, your BIOS menu may display several boot options from that flash drive: choose the one explicitly labeled with “UEFI”.

References

I used these resources:

@1pakch
1pakch / pyenv.nix
Created November 27, 2017 22:36
Nix expression for creating Python environments from command line
# Use via nix-shell --argstr package-names ipython,quandl --command fish
{ package-names, python-version ? "36" }:
with builtins;
let
pkgs = import <nixpkgs-fork> {};
from = where: what: getAttr what where;
v = python-version;
python = from pkgs "python${v}";
@1pakch
1pakch / python-env
Created November 27, 2017 20:30
Nix expression for Python development enviroments
with import <nixpkgs-fork> {};
let
p = python36;
pp = python36Packages;
in stdenv.mkDerivation {
name = "blabla";
buildInputs = [ stdenv p pp.ipython pp.quandl ];
}
@1pakch
1pakch / dummyService.nix
Created October 26, 2017 13:45
A dummy NixOS systemd service that just sleeps
{ config, pkgs, lib, ...}:
with lib;
let
cfg = config.services.dummy;
in {
imports = [];
@1pakch
1pakch / echoService.nix
Created October 25, 2017 14:21
Trivial systemd service for NixOS for testing purposes
{ config, pkgs, lib, ...}:
with lib;
let
cfg = config.services.echo;
in {
imports = [];
@1pakch
1pakch / line_profiler_usage.py
Created April 14, 2015 11:08
Python: using line_profiler on functions outside top-level module/script
# A standard way to use Robert Kern's line profiler
# https://github.com/rkern/line_profiler
# is to wrap a function of interest using the @profile decorator
# and then to run the script via
# kernprof -l script_to_profile.py
# or
# python -m line_profiler script_to_profile.py.lprof
#
# This approach does not work, however if the function of interest
# is defined outside of the top-level script (or module) since @profile