diff --git a/nixos/flake.nix b/nixos/flake.nix index 6881db24..d4ad9824 100644 --- a/nixos/flake.nix +++ b/nixos/flake.nix @@ -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; + }; } diff --git a/nixos/machines/air-gapped-pi.nix b/nixos/machines/air-gapped-pi.nix index a0e0f4e0..a3a814d6 100644 --- a/nixos/machines/air-gapped-pi.nix +++ b/nixos/machines/air-gapped-pi.nix @@ -7,7 +7,6 @@ networking.hostName = "air-gapped-pi"; hardware.video.hidpi.enable = true; - networking.enable = false; system.stateVersion = "21.05"; } diff --git a/nixos/machines/imalison-home.nix b/nixos/machines/imalison-home.nix index 128e0d1a..3ac284cb 100644 --- a/nixos/machines/imalison-home.nix +++ b/nixos/machines/imalison-home.nix @@ -2,11 +2,12 @@ { imports = [ - + ../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 diff --git a/nixos/machines/uber-loaner.nix b/nixos/machines/uber-loaner.nix index 6e9dc796..a6c75de2 100644 --- a/nixos/machines/uber-loaner.nix +++ b/nixos/machines/uber-loaner.nix @@ -2,12 +2,13 @@ { imports = [ - ../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 ];