fix: ildkule grub duplicated devices, format nix files

This commit is contained in:
Adrian G L
2026-05-19 16:26:36 +02:00
parent 1024b428ac
commit 30ec70fa5f
3 changed files with 288 additions and 245 deletions

100
flake.nix
View File

@@ -49,8 +49,14 @@
qotd.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, nixpkgs-unstable, sops-nix, disko, ... }@inputs:
let
outputs = {
self,
nixpkgs,
nixpkgs-unstable,
sops-nix,
disko,
...
} @ inputs: let
inherit (nixpkgs) lib;
systems = [
"x86_64-linux"
@@ -71,9 +77,11 @@
in {
inputs = lib.mapAttrs (_: src: src.outPath) inputs;
pkgs = forAllSystems (system: import nixpkgs {
pkgs = forAllSystems (system:
import nixpkgs {
inherit system;
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg)
config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg)
[
"nvidia-x11"
"nvidia-settings"
@@ -81,11 +89,7 @@
});
nixosConfigurations = let
nixosConfig =
nixpkgs:
name:
configurationPath:
extraArgs@{
nixosConfig = nixpkgs: name: configurationPath: extraArgs @ {
localSystem ? "x86_64-linux", # buildPlatform
crossSystem ? "x86_64-linux", # hostPlatform
specialArgs ? {},
@@ -93,48 +97,62 @@
overlays ? [],
enableDefaults ? true,
...
}:
let
commonPkgsConfig = {
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg)
}: let
commonPkgsConfig =
{
config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg)
[
"nvidia-x11"
"nvidia-settings"
];
overlays = (lib.optionals enableDefaults [
overlays =
(lib.optionals enableDefaults [
# Global overlays go here
inputs.roowho2.overlays.default
]) ++ overlays;
} // (if localSystem != crossSystem then {
])
++ overlays;
}
// (
if localSystem != crossSystem
then {
inherit localSystem crossSystem;
} else {
}
else {
system = crossSystem;
});
}
);
pkgs = import nixpkgs commonPkgsConfig;
unstablePkgs = import nixpkgs-unstable commonPkgsConfig;
in
lib.nixosSystem (lib.recursiveUpdate
lib.nixosSystem (
lib.recursiveUpdate
{
system = crossSystem;
inherit pkgs;
specialArgs = {
specialArgs =
{
inherit inputs unstablePkgs;
values = import ./values.nix;
fp = path: ./${path};
} // specialArgs;
}
// specialArgs;
modules = [
modules =
[
{
networking.hostName = lib.mkDefault name;
}
configurationPath
] ++ (lib.optionals enableDefaults [
]
++ (lib.optionals enableDefaults [
sops-nix.nixosModules.sops
inputs.roowho2.nixosModules.default
self.nixosModules.rsync-pull-targets
]) ++ modules;
])
++ modules;
}
(builtins.removeAttrs extraArgs [
"localSystem"
@@ -148,7 +166,8 @@
stableNixosConfig = name: extraArgs:
nixosConfig nixpkgs name ./hosts/${name}/configuration.nix extraArgs;
in {
in
{
bicep = stableNixosConfig "bicep" {
modules = [
inputs.matrix-next.nixosModules.default
@@ -238,12 +257,13 @@
];
};
}
//
(let
// (let
machineNames = map (i: "lupine-${toString i}") (lib.range 1 5);
stableLupineNixosConfig = name: extraArgs:
nixosConfig nixpkgs name ./hosts/lupine/configuration.nix extraArgs;
in lib.genAttrs machineNames (name: stableLupineNixosConfig name {
in
lib.genAttrs machineNames (name:
stableLupineNixosConfig name {
modules = [{networking.hostName = name;}];
specialArgs.lupineName = name;
}));
@@ -268,7 +288,8 @@
})
];
};
in pkgs.callPackage ./shell.nix { };
in
pkgs.callPackage ./shell.nix {};
cuda = let
cuda-pkgs = import nixpkgs-unstable {
inherit system;
@@ -277,18 +298,22 @@
cudaSupport = true;
};
};
in cuda-pkgs.callPackage ./shells/cuda.nix { };
in
cuda-pkgs.callPackage ./shells/cuda.nix {};
});
packages = {
"x86_64-linux" = let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in rec {
in
rec {
default = important-machines;
important-machines = pkgs.linkFarm "important-machines"
important-machines =
pkgs.linkFarm "important-machines"
(lib.getAttrs importantMachines self.packages.${system});
all-machines = pkgs.linkFarm "all-machines"
all-machines =
pkgs.linkFarm "all-machines"
(lib.getAttrs allMachines self.packages.${system});
simplesamlphp = pkgs.callPackage ./packages/simplesamlphp {};
@@ -329,7 +354,8 @@
modules = [
./topology
{
nixosConfigurations = lib.mapAttrs (_name: nixosCfg: nixosCfg.extendModules {
nixosConfigurations = lib.mapAttrs (_name: nixosCfg:
nixosCfg.extendModules {
modules = [
inputs.nix-topology.nixosModules.default
./topology/service-extractors/greg-ng.nix
@@ -337,13 +363,15 @@
./topology/service-extractors/mysql.nix
./topology/service-extractors/gitea-runners.nix
];
}) self.nixosConfigurations;
})
self.nixosConfigurations;
}
];
};
in {
topology = topology'.config.output;
topology-png = pkgs.runCommand "pvv-config-topology-png" {
topology-png =
pkgs.runCommand "pvv-config-topology-png" {
nativeBuildInputs = [pkgs.writableTmpDirAsHomeHook];
} ''
mkdir -p "$out"

View File

@@ -1,5 +1,11 @@
{ config, fp, pkgs, lib, values, ... }:
{
config,
fp,
pkgs,
lib,
values,
...
}: {
imports = [
./hardware-configuration.nix
./disks.nix
@@ -10,8 +16,8 @@
./services/journald-remote.nix
];
boot.loader.systemd-boot.enable = false;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.enable = true;
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.tmp.cleanOnBoot = true;
zramSwap.enable = true;
@@ -29,11 +35,20 @@
interfaces."ens3" = {
ipv4.addresses = [
{ address = hostConf.ipv4; prefixLength = 32; }
{ address = hostConf.ipv4_internal; prefixLength = 24; }
{
address = hostConf.ipv4;
prefixLength = 32;
}
{
address = hostConf.ipv4_internal;
prefixLength = 24;
}
];
ipv6.addresses = [
{ address = hostConf.ipv6; prefixLength = 64; }
{
address = hostConf.ipv6;
prefixLength = 64;
}
];
};
};