forked from DGNum/infrastructure
feat(modules/dgn-harware): Refactor hardware config
This commit is contained in:
parent
73239b2f5c
commit
18b6b0f605
6 changed files with 76 additions and 102 deletions
|
@ -28,6 +28,8 @@ lib.extra.mkConfig {
|
||||||
"sshd-bruteforce"
|
"sshd-bruteforce"
|
||||||
"sshd-timeout"
|
"sshd-timeout"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
dgn-hardware.useZfs = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
root = ./.;
|
root = ./.;
|
||||||
|
|
|
@ -1,42 +1,21 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
{ modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
[
|
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "ahci" "ehci_pci" "megaraid_sas" "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
|
fileSystems."/" = {
|
||||||
boot.initrd.kernelModules = [ ];
|
device = "/dev/disk/by-uuid/c83f6978-fd26-44a8-a86a-b0e971bb0c8c";
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
fsType = "ext4";
|
||||||
boot.supportedFilesystems = [ "zfs" ];
|
};
|
||||||
boot.zfs.forceImportRoot = false;
|
|
||||||
boot.zfs.extraPools = [ "fast01" "work01" ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" =
|
fileSystems."/boot" = {
|
||||||
{
|
device = "/dev/disk/by-uuid/55DB-056F";
|
||||||
device = "/dev/disk/by-uuid/c83f6978-fd26-44a8-a86a-b0e971bb0c8c";
|
fsType = "vfat";
|
||||||
fsType = "ext4";
|
};
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" =
|
|
||||||
{
|
|
||||||
device = "/dev/disk/by-uuid/55DB-056F";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices =
|
swapDevices =
|
||||||
[{ device = "/dev/disk/by-uuid/30547280-00e9-4ee1-8a07-d116590d9fbf"; }];
|
[{ device = "/dev/disk/by-uuid/30547280-00e9-4ee1-8a07-d116590d9fbf"; }];
|
||||||
|
|
||||||
# networking.interfaces.eno2.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.eno3.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.eno4.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.idrac.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,5 +14,9 @@ lib.extra.mkConfig {
|
||||||
"peertube"
|
"peertube"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
extraConfig = {
|
||||||
|
dgn-hardware.useZfs = true;
|
||||||
|
};
|
||||||
|
|
||||||
root = ./.;
|
root = ./.;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,58 +1,21 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
{ config, lib, modulesPath, ... }:
|
{ modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
[
|
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "ahci" "ehci_pci" "megaraid_sas" "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
|
fileSystems."/" = {
|
||||||
boot.initrd.kernelModules = [ ];
|
device = "/dev/disk/by-uuid/278cb2a2-47b9-4ec5-8b68-a5a6d037d59e";
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
fsType = "ext4";
|
||||||
boot.supportedFilesystems = [ "zfs" ];
|
};
|
||||||
boot.zfs.forceImportRoot = false;
|
|
||||||
boot.zfs.extraPools = [ "fast01" "work01" ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" =
|
fileSystems."/boot" = {
|
||||||
{
|
device = "/dev/disk/by-uuid/8BD2-C908";
|
||||||
device = "/dev/disk/by-uuid/278cb2a2-47b9-4ec5-8b68-a5a6d037d59e";
|
fsType = "vfat";
|
||||||
fsType = "ext4";
|
};
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" =
|
|
||||||
{
|
|
||||||
device = "/dev/disk/by-uuid/8BD2-C908";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices =
|
swapDevices =
|
||||||
[{ device = "/dev/disk/by-uuid/65a6f6e4-e996-4718-a4d0-cd0c78dcb15b"; }];
|
[{ device = "/dev/disk/by-uuid/65a6f6e4-e996-4718-a4d0-cd0c78dcb15b"; }];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
# networking.interfaces.eno1 = {
|
|
||||||
# useDHCP = true;
|
|
||||||
# ipv4 = {
|
|
||||||
# addresses = [
|
|
||||||
# { address = "129.199.146.148"; prefixLength = 24; }
|
|
||||||
# { address = "192.168.1.148"; prefixLength = 24; }
|
|
||||||
# ];
|
|
||||||
#
|
|
||||||
# routes = [
|
|
||||||
# { address = "192.168.1.0"; prefixLength = 24; }
|
|
||||||
# ];
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
# networking.interfaces.eno2.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.eno3.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.eno4.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,12 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||||
# and may be overwritten by future invocations. Please make changes
|
# and may be overwritten by future invocations. Please make changes
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
{ modulesPath, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||||||
(let sources = import ../../npins; in sources.disko + "/module.nix")
|
(let sources = import ../../npins; in sources.disko + "/module.nix")
|
||||||
./disko.nix
|
./disko.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "ehci_pci" "virtio_pci" "ahci" "virtio_blk" ];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,36 @@
|
||||||
{ config, lib, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib) mkEnableOption mkIf mkMerge;
|
||||||
mkEnableOption
|
|
||||||
mkIf
|
|
||||||
mkMerge;
|
|
||||||
|
|
||||||
cfg = config.dgn-hardware;
|
cfg = config.dgn-hardware;
|
||||||
in
|
|
||||||
|
|
||||||
{
|
in {
|
||||||
options.dgn-hardware = {
|
options.dgn-hardware = {
|
||||||
enable = mkEnableOption "default hardware configuration." // { default = true; };
|
enable = mkEnableOption "default hardware configuration." // {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
useSystemd = mkEnableOption "sytemd boot and configuration." // { default = true; };
|
useSystemd = mkEnableOption "sytemd boot and configuration." // {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
useZfs = mkEnableOption "zfs configuration.";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (mkMerge [
|
config = mkIf cfg.enable (mkMerge [
|
||||||
{ hardware.enableRedistributableFirmware = true; }
|
{
|
||||||
|
hardware.enableRedistributableFirmware = true;
|
||||||
|
hardware.cpu.intel.updateMicrocode = true;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
|
||||||
|
boot = {
|
||||||
|
initrd.availableKernelModules =
|
||||||
|
[ "ata_piix" "uhci_hcd" "ehci_pci" "virtio_pci" "ahci" "virtio_blk" ];
|
||||||
|
kernelModules = [ "kvm-intel" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
(mkIf cfg.useSystemd {
|
(mkIf cfg.useSystemd {
|
||||||
boot.loader = {
|
boot.loader = {
|
||||||
|
@ -25,5 +38,27 @@ in
|
||||||
efi.canTouchEfiVariables = true;
|
efi.canTouchEfiVariables = true;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.useZfs {
|
||||||
|
boot = {
|
||||||
|
initrd.availableKernelModules = [
|
||||||
|
"ahci"
|
||||||
|
"ehci_pci"
|
||||||
|
"megaraid_sas"
|
||||||
|
"usb_storage"
|
||||||
|
"usbhid"
|
||||||
|
"sd_mod"
|
||||||
|
"sr_mod"
|
||||||
|
];
|
||||||
|
kernelModules = [ "kvm-intel" ];
|
||||||
|
supportedFilesystems = [ "zfs" ];
|
||||||
|
|
||||||
|
zfs = {
|
||||||
|
forceImportRoot = false;
|
||||||
|
extraPools = [ "fast01" "work01" ];
|
||||||
|
package = pkgs.zfs_2_1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue