From c886a5849a8f3413b9ffc915f0e3dff7533181c4 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 10 Oct 2021 18:31:00 +1000 Subject: [PATCH] can i boot this? --- flake.nix | 13 ++++++- hosts/curve.nix | 9 +++++ .../hardware/curve-hardware-configuration.nix | 38 +++++++++++++++++++ profiles/hardware/curve.nix | 28 ++++++++++++++ profiles/hardware/yubikey.nix | 0 5 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 profiles/hardware/curve-hardware-configuration.nix create mode 100644 profiles/hardware/curve.nix create mode 100644 profiles/hardware/yubikey.nix diff --git a/flake.nix b/flake.nix index bba4f434..9864cafd 100644 --- a/flake.nix +++ b/flake.nix @@ -114,13 +114,22 @@ hosts = { /* set host specific properties here */ NixOS = { }; + curve = { + channelName = "latest"; + modules = [ ]; # nixos-hardware.nixosModules.lenovo-thinkpad + # Yubikey + }; + box = { }; + hypercube = { }; }; importables = rec { profiles = digga.lib.rakeLeaves ./profiles // { users = digga.lib.rakeLeaves ./users; }; suites = with profiles; rec { - base = [ core users.nixos users.root ]; + base = [ core users.nixos users.root nvim ]; + sealight = [ base ]; # matrix rsshub backup wireguard + mossnet = [ base ]; # shaarli wallabag nextcloud taskwarrior headphones }; }; }; @@ -132,10 +141,12 @@ profiles = digga.lib.rakeLeaves ./users/profiles; suites = with profiles; rec { base = [ direnv git ]; + gui = [ base firefox desktop ] }; }; users = { nixos = { suites, ... }: { imports = suites.base; }; + anish = { suites, ... }: { imports = suites.gui; }; }; # digga.lib.importers.rakeLeaves ./users/hm; }; diff --git a/hosts/curve.nix b/hosts/curve.nix index e69de29b..7ac4026e 100644 --- a/hosts/curve.nix +++ b/hosts/curve.nix @@ -0,0 +1,9 @@ +{profiles, suites, ... }: +{ + imports = [ + profiles.core + profiles.users.anish + profiles.hardware.curve # how else to deal with hardware? + suites.gui + ]; +} diff --git a/profiles/hardware/curve-hardware-configuration.nix b/profiles/hardware/curve-hardware-configuration.nix new file mode 100644 index 00000000..9b8a0228 --- /dev/null +++ b/profiles/hardware/curve-hardware-configuration.nix @@ -0,0 +1,38 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ "dm-snapshot" ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/6ee9d430-1b1b-4e39-bced-606145570a78"; + fsType = "btrfs"; + options = [ "subvol=root" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/6ee9d430-1b1b-4e39-bced-606145570a78"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/AD0C-92EF"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/5486bd9f-6826-4ac7-b09b-8768a35c331f"; } + ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +} diff --git a/profiles/hardware/curve.nix b/profiles/hardware/curve.nix new file mode 100644 index 00000000..83cc5dbc --- /dev/null +++ b/profiles/hardware/curve.nix @@ -0,0 +1,28 @@ +{ + imports = [ ./curve-hardware-configuration ]; + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + # Define on which hard drive you want to install Grub. + boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only + + # Minimal list of modules to use the EFI system partition and the YubiKey + boot.initrd.kernelModules = [ "vfat" "nls_cp437" "nls_iso8859-1" "usbhid" ]; + + # Enable support for the YubiKey PBA + boot.initrd.luks.yubikeySupport = true; + + # Configuration to use your Luks device + boot.initrd.luks.devices = { + "crypthome" = { + device = "/dev/sda2"; + preLVM = true; # You may want to set this to false if you need to start a network service first + yubikey = { + slot = 2; + twoFactor = true; # Set to false if you did not set up a user password. + storage = { + device = "/dev/sda1"; + }; + }; + }; + }; +} diff --git a/profiles/hardware/yubikey.nix b/profiles/hardware/yubikey.nix new file mode 100644 index 00000000..e69de29b