diff --git a/flake.nix b/flake.nix index 71afe9f..92c4b96 100644 --- a/flake.nix +++ b/flake.nix @@ -71,6 +71,7 @@ , ... } @ inputs: with inputs; let + machines = import ./machines inputs; defSystem = system: baseConfig: nixpkgs.lib.nixosSystem { system = "${system}"; @@ -87,7 +88,11 @@ self.overlays.default ha-now-playing.overlays.${system} pamedia.overlays.${system} - ]; + ] ++ nixpkgs.lib.optional (system == "aarch64-linux") + (final: super: { + makeModulesClosure = x: + super.makeModulesClosure (x // { allowMissing = true; }); + }); } baseConfig @@ -104,6 +109,7 @@ }; in { + overlays.default = import ./overlays; # overlay = final: prev: { # unstable = import nixpkgs { @@ -119,59 +125,18 @@ }) (builtins.attrNames (builtins.readDir ./modules))); - nixosConfigurations = { - vm1 = defSystem "x86_64-linux" { - imports = [ - (import ./machines/vm1/configuration.nix { inherit self; }) - ]; - }; - vm2 = defSystem "x86_64-linux" { - imports = [ - (import ./machines/vm2/configuration.nix { inherit self; }) - ]; - }; - - loki = defSystem "x86_64-linux" { - imports = [ - (import ./machines/loki/configuration.nix { inherit self nixpkgs; }) - nixos-hardware.nixosModules.common-cpu-amd - nixos-hardware.nixosModules.common-gpu-amd - nixos-hardware.nixosModules.common-pc-ssd - ]; - }; - - drone = defSystem "x86_64-linux" { - imports = [ - (import ./machines/drone/configuration.nix { inherit self; }) - ]; - }; - - proxy = defSystem "x86_64-linux" { - imports = [ - (import ./machines/proxy/configuration.nix { inherit self; }) - ]; - }; - - gitea = defSystem "x86_64-linux" { - imports = [ - (import ./machines/gitea/configuration.nix { inherit self; }) - ]; - }; - - heimdall = defSystem "x86_64-linux" { - imports = [ - (import ./machines/heimdall/configuration.nix { inherit self; }) - ]; - }; - - eitri = defSystem "aarch64-linux" { - imports = [ - (import ./machines/eitri/configuration.nix { inherit self nixpkgs; }) - nixos-hardware.nixosModules.raspberry-pi-4 - ]; - }; - }; - + inherit machines; + + nixosConfigurations = builtins.listToAttrs (map + (machine: { + name = machine; + value = (defSystem (machines.${machine}.system or "x86_64-linux") { + imports = [ + machines.${machine}.config + ]; + }); + }) + (builtins.attrNames machines)); } // (flake-utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ]) ( diff --git a/machines/default.nix b/machines/default.nix new file mode 100644 index 0000000..5e52306 --- /dev/null +++ b/machines/default.nix @@ -0,0 +1,27 @@ +{ ... }@inputs: { + drone = { + config = (import ./drone/configuration.nix inputs); + }; + eitri = { + system = "aarch64-linux"; + config = (import ./eitri/configuration.nix inputs); + }; + gitea = { + config = (import ./gitea/configuration.nix inputs); + }; + heimdall = { + config = (import ./heimdall/configuration.nix inputs); + }; + loki = { + config = (import ./loki/configuration.nix inputs); + }; + proxy = { + config = (import ./proxy/configuration.nix inputs); + }; + vm1 = { + config = (import ./vm1/configuration.nix inputs); + }; + vm2 = { + config = (import ./vm2/configuration.nix inputs); + }; +} diff --git a/machines/eitri/configuration.nix b/machines/eitri/configuration.nix index 1a0db83..74b485f 100644 --- a/machines/eitri/configuration.nix +++ b/machines/eitri/configuration.nix @@ -1,9 +1,12 @@ -{ self, nixpkgs, ... }: +{ self, nixpkgs, nixos-hardware, ... }: let - pkgs = import nixpkgs { system = "aarch64-linux"; }; + pkgs = import nixpkgs { + system = "aarch64-linux"; + }; in { imports = [ + nixos-hardware.nixosModules.raspberry-pi-4 ../../users/root ../../users/erwin ]; @@ -12,6 +15,7 @@ in users.erwin = { enable = true; }; + base.kernel = pkgs.linuxPackages_rpi4; desktop.enable = true; fonts.enable = true; gnome.enable = true; @@ -22,14 +26,6 @@ in systemd.enable = true; }; - boot = { - loader.raspberryPi = { - enable = true; - version = 4; - }; - loader.generic-extlinux-compatible.enable = nixpkgs.lib.mkForce false; - }; - hardware = { enableRedistributableFirmware = true; raspberry-pi."4" = { diff --git a/machines/loki/configuration.nix b/machines/loki/configuration.nix index 4c73eab..ed03128 100644 --- a/machines/loki/configuration.nix +++ b/machines/loki/configuration.nix @@ -1,9 +1,18 @@ -{ self, nixpkgs, ... }: +{ self, nixpkgs, nixos-hardware, ... }: let pkgs = import nixpkgs { system = "x86_64-linux"; }; in { - imports = [ ./hardware-configuration.nix ../../users/erwin ../../users/root ../../users/builder ]; + imports = [ + nixos-hardware.nixosModules.common-cpu-amd + nixos-hardware.nixosModules.common-gpu-amd + nixos-hardware.nixosModules.common-pc-ssd + + ./hardware-configuration.nix + ../../users/erwin + ../../users/root + ../../users/builder + ]; eboskma = { users = { diff --git a/machines/loki/hardware-configuration.nix b/machines/loki/hardware-configuration.nix index 9328aff..15f875f 100644 --- a/machines/loki/hardware-configuration.nix +++ b/machines/loki/hardware-configuration.nix @@ -1,16 +1,9 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. { config , lib , pkgs , modulesPath , ... }: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" "apple-mfi-fastcharge" "zenpower" "nf_nat_ftp" ]; @@ -37,4 +30,7 @@ # high-resolution display hardware.video.hidpi.enable = lib.mkDefault true; + + # Enable firmware + hardware.enableAllFirmware = true; } diff --git a/modules/nix-common/default.nix b/modules/nix-common/default.nix index 0fca52d..76a3f8a 100644 --- a/modules/nix-common/default.nix +++ b/modules/nix-common/default.nix @@ -13,7 +13,7 @@ in cross-systems = mkOption { description = "list of systems to cross compile for"; type = with types; listOf str; - default = []; + default = [ ]; }; };