mirror of
https://github.com/tuxdotrs/nix-config.git
synced 2026-06-21 03:36:32 +05:30
refactor(hosts): simplify configuration imports across hosts
This commit is contained in:
@@ -4,21 +4,14 @@
|
|||||||
{
|
{
|
||||||
hostName,
|
hostName,
|
||||||
userName,
|
userName,
|
||||||
modulesPath,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
imports =
|
imports = with config.flake.modules.nixos; [
|
||||||
with config.flake.modules.nixos;
|
|
||||||
[
|
|
||||||
boot
|
boot
|
||||||
hardware
|
|
||||||
networking
|
networking
|
||||||
virtualisation
|
virtualisation
|
||||||
services
|
services
|
||||||
]
|
|
||||||
++ [
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
tnix = {
|
tnix = {
|
||||||
|
|||||||
@@ -14,7 +14,14 @@ in
|
|||||||
{
|
{
|
||||||
flake.nixosConfigurations."${hostName}" = nixpkgs.lib.nixosSystem {
|
flake.nixosConfigurations."${hostName}" = nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
specialArgs = { inherit hostName userName userEmail; };
|
specialArgs = {
|
||||||
|
inherit
|
||||||
|
hostName
|
||||||
|
userName
|
||||||
|
userEmail
|
||||||
|
system
|
||||||
|
;
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
config.flake.modules.nixos.core
|
config.flake.modules.nixos.core
|
||||||
config.flake.modules.nixos.${hostName}
|
config.flake.modules.nixos.${hostName}
|
||||||
|
|||||||
17
modules/hosts/alpha/hardware.nix
Normal file
17
modules/hosts/alpha/hardware.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
flake.modules.nixos.alpha =
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
modulesPath,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault system;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
{
|
{
|
||||||
flake.modules.nixos.arcturus =
|
flake.modules.nixos.arcturus =
|
||||||
{
|
{
|
||||||
pkgs,
|
|
||||||
hostName,
|
hostName,
|
||||||
userName,
|
userName,
|
||||||
...
|
...
|
||||||
@@ -10,7 +9,6 @@
|
|||||||
{
|
{
|
||||||
imports = with config.flake.modules.nixos; [
|
imports = with config.flake.modules.nixos; [
|
||||||
boot
|
boot
|
||||||
hardware
|
|
||||||
networking
|
networking
|
||||||
virtualisation
|
virtualisation
|
||||||
services
|
services
|
||||||
@@ -109,10 +107,6 @@
|
|||||||
firewall.enable = false;
|
firewall.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
nvtopPackages.full
|
|
||||||
];
|
|
||||||
|
|
||||||
system.stateVersion = "26.05";
|
system.stateVersion = "26.05";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,14 @@ in
|
|||||||
{
|
{
|
||||||
flake.nixosConfigurations."${hostName}" = nixpkgs.lib.nixosSystem {
|
flake.nixosConfigurations."${hostName}" = nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
specialArgs = { inherit hostName userName userEmail; };
|
specialArgs = {
|
||||||
|
inherit
|
||||||
|
hostName
|
||||||
|
userName
|
||||||
|
userEmail
|
||||||
|
system
|
||||||
|
;
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
config.flake.modules.nixos.core
|
config.flake.modules.nixos.core
|
||||||
config.flake.modules.nixos.${hostName}
|
config.flake.modules.nixos.${hostName}
|
||||||
|
|||||||
@@ -1,11 +1,17 @@
|
|||||||
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
flake.modules.nixos.arcturus =
|
flake.modules.nixos.arcturus =
|
||||||
{
|
{
|
||||||
config,
|
|
||||||
lib,
|
lib,
|
||||||
|
pkgs,
|
||||||
|
system,
|
||||||
...
|
...
|
||||||
}:
|
}@innerArgs:
|
||||||
{
|
{
|
||||||
|
imports = with config.flake.modules.nixos; [
|
||||||
|
hardware
|
||||||
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [
|
boot.initrd.availableKernelModules = [
|
||||||
"nvme"
|
"nvme"
|
||||||
"xhci_pci"
|
"xhci_pci"
|
||||||
@@ -18,15 +24,13 @@
|
|||||||
boot.kernelModules = [ "kvm-amd" ];
|
boot.kernelModules = [ "kvm-amd" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
hardware.cpu.amd.updateMicrocode = lib.mkDefault innerArgs.config.hardware.enableRedistributableFirmware;
|
||||||
# (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.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.wlp10s0f3u2i2.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
networking.useDHCP = lib.mkDefault true;
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
nixpkgs.hostPlatform = lib.mkDefault system;
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
nvtopPackages.amd
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
{
|
{
|
||||||
imports = with config.flake.modules.nixos; [
|
imports = with config.flake.modules.nixos; [
|
||||||
boot
|
boot
|
||||||
hardware
|
|
||||||
networking
|
networking
|
||||||
desktop
|
desktop
|
||||||
gaming
|
gaming
|
||||||
@@ -120,20 +119,7 @@
|
|||||||
firewall.enable = false;
|
firewall.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
# --- Hardware / GPU ---
|
|
||||||
# hardware = {
|
|
||||||
# nvidia = {
|
|
||||||
# modesetting.enable = true;
|
|
||||||
# open = false;
|
|
||||||
# nvidiaSettings = true;
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
# boot.kernelParams = [ "nvidia-drm.modeset=1" ];
|
|
||||||
# nixpkgs.config.cudaSupport = true;
|
|
||||||
# services.xserver.videoDrivers = [ "nvidia" ];
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
nvtopPackages.full
|
|
||||||
davinci-resolve
|
davinci-resolve
|
||||||
telegram-desktop
|
telegram-desktop
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -14,7 +14,14 @@ in
|
|||||||
{
|
{
|
||||||
flake.nixosConfigurations."${hostName}" = nixpkgs.lib.nixosSystem {
|
flake.nixosConfigurations."${hostName}" = nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
specialArgs = { inherit hostName userName userEmail; };
|
specialArgs = {
|
||||||
|
inherit
|
||||||
|
hostName
|
||||||
|
userName
|
||||||
|
userEmail
|
||||||
|
system
|
||||||
|
;
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
config.flake.modules.nixos.core
|
config.flake.modules.nixos.core
|
||||||
config.flake.modules.nixos.${hostName}
|
config.flake.modules.nixos.${hostName}
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
flake.modules.nixos.canopus =
|
flake.modules.nixos.canopus =
|
||||||
{
|
{
|
||||||
config,
|
|
||||||
lib,
|
lib,
|
||||||
|
system,
|
||||||
...
|
...
|
||||||
}:
|
}@innerArgs:
|
||||||
{
|
{
|
||||||
|
imports = with config.flake.modules.nixos; [
|
||||||
|
hardware
|
||||||
|
];
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [
|
boot.initrd.availableKernelModules = [
|
||||||
"nvme"
|
"nvme"
|
||||||
"xhci_pci"
|
"xhci_pci"
|
||||||
@@ -18,15 +23,9 @@
|
|||||||
boot.kernelModules = [ "kvm-amd" ];
|
boot.kernelModules = [ "kvm-amd" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
hardware.cpu.amd.updateMicrocode = lib.mkDefault innerArgs.config.hardware.enableRedistributableFirmware;
|
||||||
# (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.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.wlp10s0f3u2i2.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
networking.useDHCP = lib.mkDefault true;
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
nixpkgs.hostPlatform = lib.mkDefault system;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
{
|
{
|
||||||
imports = with config.flake.modules.nixos; [
|
imports = with config.flake.modules.nixos; [
|
||||||
boot
|
boot
|
||||||
hardware
|
|
||||||
networking
|
networking
|
||||||
desktop
|
desktop
|
||||||
gaming
|
gaming
|
||||||
@@ -121,20 +120,7 @@
|
|||||||
firewall.enable = false;
|
firewall.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
# --- Hardware / GPU ---
|
|
||||||
hardware = {
|
|
||||||
nvidia = {
|
|
||||||
modesetting.enable = true;
|
|
||||||
open = false;
|
|
||||||
nvidiaSettings = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
boot.kernelParams = [ "nvidia-drm.modeset=1" ];
|
|
||||||
nixpkgs.config.cudaSupport = true;
|
|
||||||
services.xserver.videoDrivers = [ "nvidia" ];
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
nvtopPackages.full
|
|
||||||
davinci-resolve
|
davinci-resolve
|
||||||
telegram-desktop
|
telegram-desktop
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -14,7 +14,14 @@ in
|
|||||||
{
|
{
|
||||||
flake.nixosConfigurations."${hostName}" = nixpkgs.lib.nixosSystem {
|
flake.nixosConfigurations."${hostName}" = nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
specialArgs = { inherit hostName userName userEmail; };
|
specialArgs = {
|
||||||
|
inherit
|
||||||
|
hostName
|
||||||
|
userName
|
||||||
|
userEmail
|
||||||
|
system
|
||||||
|
;
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
config.flake.modules.nixos.core
|
config.flake.modules.nixos.core
|
||||||
config.flake.modules.nixos.${hostName}
|
config.flake.modules.nixos.${hostName}
|
||||||
|
|||||||
@@ -1,11 +1,18 @@
|
|||||||
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
flake.modules.nixos.sirius =
|
flake.modules.nixos.sirius =
|
||||||
{
|
{
|
||||||
config,
|
|
||||||
lib,
|
lib,
|
||||||
|
pkgs,
|
||||||
|
system,
|
||||||
...
|
...
|
||||||
}:
|
}@innerArgs:
|
||||||
{
|
{
|
||||||
|
imports = with config.flake.modules.nixos; [
|
||||||
|
hardware
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.kernelParams = [ "nvidia-drm.modeset=1" ];
|
||||||
boot.initrd.availableKernelModules = [
|
boot.initrd.availableKernelModules = [
|
||||||
"nvme"
|
"nvme"
|
||||||
"xhci_pci"
|
"xhci_pci"
|
||||||
@@ -18,15 +25,23 @@
|
|||||||
boot.kernelModules = [ "kvm-amd" ];
|
boot.kernelModules = [ "kvm-amd" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
hardware = {
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
nvidia = {
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
modesetting.enable = true;
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
open = false;
|
||||||
networking.useDHCP = lib.mkDefault true;
|
nvidiaSettings = true;
|
||||||
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
|
};
|
||||||
# networking.interfaces.wlp10s0f3u2i2.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
cpu.amd.updateMicrocode = lib.mkDefault innerArgs.config.hardware.enableRedistributableFirmware;
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
};
|
||||||
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
|
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
nixpkgs.config.cudaSupport = true;
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault system;
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
nvtopPackages.full
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,21 +3,14 @@
|
|||||||
flake.modules.nixos.vps =
|
flake.modules.nixos.vps =
|
||||||
{
|
{
|
||||||
hostName,
|
hostName,
|
||||||
modulesPath,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
imports =
|
imports = with config.flake.modules.nixos; [
|
||||||
with config.flake.modules.nixos;
|
|
||||||
[
|
|
||||||
boot
|
boot
|
||||||
hardware
|
|
||||||
networking
|
networking
|
||||||
virtualisation
|
virtualisation
|
||||||
services
|
services
|
||||||
]
|
|
||||||
++ [
|
|
||||||
(modulesPath + "/profiles/qemu-guest.nix")
|
|
||||||
];
|
];
|
||||||
|
|
||||||
tnix = {
|
tnix = {
|
||||||
|
|||||||
@@ -14,7 +14,14 @@ in
|
|||||||
{
|
{
|
||||||
flake.nixosConfigurations."${hostName}" = nixpkgs.lib.nixosSystem {
|
flake.nixosConfigurations."${hostName}" = nixpkgs.lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
specialArgs = { inherit hostName userName userEmail; };
|
specialArgs = {
|
||||||
|
inherit
|
||||||
|
hostName
|
||||||
|
userName
|
||||||
|
userEmail
|
||||||
|
system
|
||||||
|
;
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
config.flake.modules.nixos.core
|
config.flake.modules.nixos.core
|
||||||
config.flake.modules.nixos.${hostName}
|
config.flake.modules.nixos.${hostName}
|
||||||
|
|||||||
17
modules/hosts/vps/hardware.nix
Normal file
17
modules/hosts/vps/hardware.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
flake.modules.nixos.vps =
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
modulesPath,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault system;
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user