Skip to content

Instantly share code, notes, and snippets.

@hyphon81
Last active April 14, 2017 06:40
Show Gist options
  • Save hyphon81/0346a5e170722825795fc5ba5d6d0e64 to your computer and use it in GitHub Desktop.
Save hyphon81/0346a5e170722825795fc5ba5d6d0e64 to your computer and use it in GitHub Desktop.
Failed to install NixOS 17.03 in ZFS. It stopped stage 1 because NixOS can not find zpool.
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the GRUB 2 boot loader.
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/vda";
boot.supportedFilesystems = [ "zfs" ];
boot.loader.grub.zfsSupport = true;
boot.zfs.forceImportRoot = false;
boot.zfs.forceImportAll = false;
boot.kernelParams = [
"zfs_force=1"
];
networking.hostId = "8425e349";
networking.hostName = "nixos.tokyo"; # Define your hostname.
# Select internationalisation properties.
i18n = {
consoleFont = "Lat2-Terminus16";
consoleKeyMap = "jp106";
defaultLocale = "en_US.UTF-8";
};
# Set your time zone.
time.timeZone = "Asia/Tokyo";
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages = with pkgs; [
wget
git
vim
];
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
users.extraUsers.hyphon81 = {
isNormalUser = true;
extraGroups = [ "wheel" ];
createHome = true;
uid = 1000;
};
# The NixOS release to be compatible with for stateful data such as databases.
system.stateVersion = "17.03";
}
{ config, lib, pkgs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/profiles/qemu-guest.nix>
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "rpool/root/nixos";
fsType = "zfs";
};
fileSystems."/home" =
{ device = "rpool/home";
fsType = "zfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/7153a80d-f996-4aa7-a87d-0935e0cab3c3";
fsType = "ext4";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/dec80265-67ee-4884-8cdc-08f33c53d51e"; }
];
nix.maxJobs = lib.mkDefault 3;
}
[root@nixos:~]# zpool history
History for 'rpool':
2017-04-13.16:23:19 zpool create -o ashift=12 -o altroot=/mnt rpool /dev/vda3
2017-04-13.16:23:35 zfs create -o mountpoint=none rpool/root
2017-04-13.16:23:35 zfs create -o mountpoint=legacy rpool/root/nixos
2017-04-13.16:23:36 zfs create -o mountpoint=legacy rpool/home
2017-04-13.16:23:41 zfs set compression=lz4 rpool/home
2017-04-14.05:39:56 zpool import -R /mnt rpool
2017-04-14.05:53:23 zpool import -R /mnt rpool
2017-04-14.06:03:20 zpool import -R /mnt rpool
2017-04-14.06:34:26 zpool import -R /mnt rpool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment