Generalise machine definitions, fix pi4 config
This commit is contained in:
parent
68b5d1d151
commit
31c676eabd
6 changed files with 67 additions and 74 deletions
71
flake.nix
71
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" ])
|
||||
(
|
||||
|
|
27
machines/default.nix
Normal file
27
machines/default.nix
Normal file
|
@ -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);
|
||||
};
|
||||
}
|
|
@ -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" = {
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ in
|
|||
cross-systems = mkOption {
|
||||
description = "list of systems to cross compile for";
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue