Skip to content

Instantly share code, notes, and snippets.

@grahamc
Created June 28, 2019 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahamc/01c2366a332975a493df87c1014682fe to your computer and use it in GitHub Desktop.
Save grahamc/01c2366a332975a493df87c1014682fe to your computer and use it in GitHub Desktop.
{ config, pkgs, lib, ... }:
let
post-device-cmds = pkgs.writeScript "post-device-commands"
''
#!/bin/sh
set -eux
set -o pipefail
${pkgs.utillinux}/bin/lsblk -d -e 1,7,11 -o NAME -n \
| ${pkgs.busybox}/bin/sed -e "s#^#/dev/#" \
| ${pkgs.busybox}/bin/xargs ${pkgs.zfs}/bin/zpool \
create -f -O mountpoint=none rpool
${pkgs.zfs}/bin/zfs create -o mountpoint=legacy rpool/nix
'';
in {
boot.supportedFilesystems = [ "zfs" ];
boot.initrd.postDeviceCommands = "${post-device-cmds}";
nixpkgs.config.allowUnfree = true;
hardware.enableAllFirmware = true;
services.openssh.enable = true;
networking.hostId = "00000000";
fileSystems."/nix/.rw-store" = {
fsType = lib.mkForce "zfs";
device = lib.mkForce "rpool/nix";
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment