refactor: hide x86_64-specific host config in a module

This commit is contained in:
Colin 2024-06-04 14:23:43 +00:00
parent b52057e317
commit b334db28c6
5 changed files with 17 additions and 21 deletions

View File

@ -4,7 +4,6 @@
./boot.nix
./feeds.nix
./fs.nix
./hardware
./home
./hosts.nix
./ids.nix

View File

@ -1,17 +0,0 @@
{ config, lib, pkgs, ... }:
{
imports = [
./x86_64.nix
];
# services.snapper.configs = {
# root = {
# subvolume = "/";
# extraConfig = {
# ALLOW_USERS = "colin";
# };
# };
# };
# services.snapper.snapshotInterval = "daily";
}

View File

@ -3,6 +3,7 @@
{
imports = [
./derived-secrets
./hal
./hosts.nix
./nixcache.nix
./roles

View File

@ -0,0 +1,6 @@
{ ... }:
{
imports = [
./x86_64.nix
];
}

View File

@ -1,7 +1,14 @@
{ lib, pkgs, ... }:
{ config, lib, pkgs, ... }:
let
cfg = config.sane.hal.x86_64;
in
{
config = lib.mkIf (pkgs.system == "x86_64-linux") {
options = {
sane.hal.x86_64.enable = (lib.mkEnableOption "x86_64-specific hardware support") // {
default = pkgs.system == "x86_64-linux";
};
};
config = lib.mkIf cfg.enable {
boot.initrd.availableKernelModules = [
"xhci_pci" "ahci" "sd_mod" "sdhci_pci" # nixos-generate-config defaults
"usb_storage" # rpi needed this to boot from usb storage, i think.