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

View File

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