forked from colonelpanic/dotfiles
[NixOS] Automatically add configurations for machine files
This commit is contained in:
parent
5b9febb4d8
commit
4fbef3f0a3
@ -51,32 +51,38 @@
|
|||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.users.imalison = import ./home-manager.nix;
|
home-manager.users.imalison = import ./home-manager.nix;
|
||||||
});
|
});
|
||||||
mkNixosConfig = args@{ system ? "x86_64-linux", baseModules ? [ forAll ], modules ? [], specialArgs ? {}, ... }:
|
mkConfig = args@{ system ? "x86_64-linux", baseModules ? [ forAll ], modules ? [], specialArgs ? {}, ... }:
|
||||||
nixpkgs.lib.nixosSystem (args // {
|
nixpkgs.lib.nixosSystem (args // {
|
||||||
inherit system;
|
inherit system;
|
||||||
modules = baseModules ++ modules;
|
modules = baseModules ++ modules;
|
||||||
specialArgs = { inherit inputs; } // specialArgs;
|
specialArgs = { inherit inputs; } // specialArgs;
|
||||||
});
|
});
|
||||||
|
machineFilenames = builtins.attrNames (builtins.readDir ./machines);
|
||||||
|
machineNameFromFilename = filename: builtins.head (builtins.split "\\." filename);
|
||||||
|
mkConfigurationParams = filename: {
|
||||||
|
name = machineNameFromFilename filename;
|
||||||
|
value = {
|
||||||
|
modules = [ (./machines + ("/" + filename)) ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
defaultConfigurationParams =
|
||||||
|
builtins.listToAttrs (map mkConfigurationParams machineFilenames);
|
||||||
|
customParams = {
|
||||||
|
biskcomp = {
|
||||||
|
system = "aarch64-linux";
|
||||||
|
};
|
||||||
|
air-gapped-pi = {
|
||||||
|
system = "aarch64-linux";
|
||||||
|
};
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosConfigurations = {
|
nixosConfigurations = builtins.mapAttrs (machineName: params:
|
||||||
ivanm-dfinity-razer = mkNixosConfig {
|
let machineParams =
|
||||||
modules = [ ./machines/ivanm-dfinity-razer.nix ];
|
if builtins.hasAttr machineName customParams
|
||||||
};
|
then (builtins.getAttr machineName customParams)
|
||||||
ryzen-shine = mkNixosConfig {
|
else {};
|
||||||
modules = [ ./machines/ryzen-shine.nix ];
|
in mkConfig (params // machineParams)
|
||||||
};
|
) defaultConfigurationParams;
|
||||||
adele = mkNixosConfig {
|
|
||||||
modules = [ ./machines/adele.nix ];
|
|
||||||
};
|
|
||||||
biskcomp = mkNixosConfig {
|
|
||||||
system = "aarch64-linux";
|
|
||||||
modules = [ ./machines/biskcomp.nix ];
|
|
||||||
};
|
|
||||||
air-gapped-pi = mkNixosConfig {
|
|
||||||
system = "aarch64-linux";
|
|
||||||
modules = [ ./machines/air-gapped-pi.nix ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
networking.hostName = "air-gapped-pi";
|
networking.hostName = "air-gapped-pi";
|
||||||
hardware.video.hidpi.enable = true;
|
hardware.video.hidpi.enable = true;
|
||||||
networking.enable = false;
|
|
||||||
|
|
||||||
system.stateVersion = "21.05";
|
system.stateVersion = "21.05";
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
<nixpkgs/nixos/modules/installer/scan/not-detected.nix>
|
../users.nix
|
||||||
../full.nix
|
../full.nix
|
||||||
# ../cachix.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
hardware.enableRedistributableFirmware = true;
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ ];
|
||||||
@ -45,43 +46,15 @@
|
|||||||
nix.maxJobs = lib.mkDefault 4;
|
nix.maxJobs = lib.mkDefault 4;
|
||||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||||
|
|
||||||
boot.initrd.luks.devices = [
|
# boot.initrd.luks.devices."cryptroot" = {
|
||||||
{
|
# name = "root";
|
||||||
name = "root";
|
# device = "/dev/sda3";
|
||||||
device = "/dev/sda3";
|
# preLVM = true;
|
||||||
preLVM = true;
|
# };
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
networking.hostName = "imalison-home";
|
networking.hostName = "imalison-home";
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
services.samba = {
|
|
||||||
enable = true;
|
|
||||||
syncPasswordsByPam = true;
|
|
||||||
extraConfig = ''
|
|
||||||
workgroup = WORKGROUP
|
|
||||||
server string = smbnix
|
|
||||||
netbios name = smbnix
|
|
||||||
#use sendfile = yes
|
|
||||||
#max protocol = smb2
|
|
||||||
hosts allow = 192.168.0 localhost
|
|
||||||
hosts deny = 0.0.0.0/0
|
|
||||||
'';
|
|
||||||
shares = {
|
|
||||||
private = {
|
|
||||||
path = "/backups";
|
|
||||||
browseable = "yes";
|
|
||||||
"read only" = "no";
|
|
||||||
"guest ok" = "no";
|
|
||||||
"create mask" = "0644";
|
|
||||||
"directory mask" = "0755";
|
|
||||||
"force user" = "username";
|
|
||||||
"force group" = "groupname";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
screenSection = ''
|
screenSection = ''
|
||||||
DefaultDepth 24
|
DefaultDepth 24
|
||||||
|
@ -2,12 +2,13 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
<nixpkgs/nixos/modules/installer/scan/not-detected.nix>
|
|
||||||
../full.nix
|
../full.nix
|
||||||
../games.nix
|
../games.nix
|
||||||
../extra.nix
|
../extra.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
hardware.enableRedistributableFirmware = true;
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
boot.extraModulePackages = [ pkgs.linuxPackages.rtl8814au ];
|
boot.extraModulePackages = [ pkgs.linuxPackages.rtl8814au ];
|
||||||
|
Loading…
Reference in New Issue
Block a user