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.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 // {
|
||||
inherit system;
|
||||
modules = baseModules ++ modules;
|
||||
specialArgs = { inherit inputs; } // specialArgs;
|
||||
});
|
||||
in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
ivanm-dfinity-razer = mkNixosConfig {
|
||||
modules = [ ./machines/ivanm-dfinity-razer.nix ];
|
||||
};
|
||||
ryzen-shine = mkNixosConfig {
|
||||
modules = [ ./machines/ryzen-shine.nix ];
|
||||
};
|
||||
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 ];
|
||||
};
|
||||
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
|
||||
{
|
||||
nixosConfigurations = builtins.mapAttrs (machineName: params:
|
||||
let machineParams =
|
||||
if builtins.hasAttr machineName customParams
|
||||
then (builtins.getAttr machineName customParams)
|
||||
else {};
|
||||
in mkConfig (params // machineParams)
|
||||
) defaultConfigurationParams;
|
||||
};
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
networking.hostName = "air-gapped-pi";
|
||||
hardware.video.hidpi.enable = true;
|
||||
networking.enable = false;
|
||||
|
||||
system.stateVersion = "21.05";
|
||||
}
|
||||
|
@ -2,11 +2,12 @@
|
||||
|
||||
{
|
||||
imports = [
|
||||
<nixpkgs/nixos/modules/installer/scan/not-detected.nix>
|
||||
../users.nix
|
||||
../full.nix
|
||||
# ../cachix.nix
|
||||
];
|
||||
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
@ -45,43 +46,15 @@
|
||||
nix.maxJobs = lib.mkDefault 4;
|
||||
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
||||
|
||||
boot.initrd.luks.devices = [
|
||||
{
|
||||
name = "root";
|
||||
device = "/dev/sda3";
|
||||
preLVM = true;
|
||||
}
|
||||
];
|
||||
# boot.initrd.luks.devices."cryptroot" = {
|
||||
# name = "root";
|
||||
# device = "/dev/sda3";
|
||||
# preLVM = true;
|
||||
# };
|
||||
|
||||
networking.hostName = "imalison-home";
|
||||
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 = {
|
||||
screenSection = ''
|
||||
DefaultDepth 24
|
||||
|
@ -2,12 +2,13 @@
|
||||
|
||||
{
|
||||
imports = [
|
||||
<nixpkgs/nixos/modules/installer/scan/not-detected.nix>
|
||||
../full.nix
|
||||
../games.nix
|
||||
../extra.nix
|
||||
];
|
||||
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ pkgs.linuxPackages.rtl8814au ];
|
||||
|
Loading…
Reference in New Issue
Block a user