Merge branch 'iron-and-configuration-organisation-rework' into mistress

This commit is contained in:
Primrose 2025-02-19 12:38:41 +01:00
commit 10865a1545
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
5 changed files with 90 additions and 136 deletions

View file

@ -23,11 +23,40 @@
{nixpkgs.hostPlatform = system;}
nixpkgsConfig
# nixos modules
self.nixosModules.commonModules
self.nixosModules.${"named-" + hostname}
or (abort ''
Expects a named NixOS module corresponding to the NixOS Configuration.
What you are doing doesn't make sense.
'')
# disko
inputs.disko.nixosModules.default
self.diskoConfigurations.${hostname} or {}
# user configuration
self.nixosModules.leana
inputs.home-manager.nixosModules.home-manager
({
config,
lib,
...
}: {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs.hostname = hostname;
sharedModules = [{home.stateVersion = lib.mkDefault config.system.stateVersion;}];
users.leana.imports = [
self.homeModules.${"named-" + hostname}
or (
builtins.trace "No named home-manager configuration supplied for named system config `${hostname}', defaulting to common modules."
self.homeModules.commonModules
)
];
};
})
];
in
many (
@ -37,6 +66,29 @@
config // {deploy = inputs.deploy-rs.lib.${system}.activate.nixos config;}
);
mkSimpleNixOSes = let
sharedModules = {
hostname,
system,
}: [
{nixpkgs.hostPlatform = system;}
nixpkgsConfig
# nixos modules
self.nixosModules.commonModules
self.nixosModules.${"named-" + hostname}
or (abort ''
Expects a named NixOS module corresponding to the NixOS Configuration.
What you are doing doesn't make sense.
'')
# disko
inputs.disko.nixosModules.default
self.diskoConfigurations.${hostname} or {}
];
in
many (mkNixOS sharedModules);
mkNixOSInstallers = let
sharedModules = {system, ...}: [
{nixpkgs.hostPlatform = system;}
@ -77,11 +129,29 @@
}: [
{nixpkgs.hostPlatform = system;}
nixpkgsConfig
self.darwinModules.commonModules
self.darwinModules.${"named-" + hostname}
or (abort ''
Expects a named nix-darwin module corresponding to the nix-darwin Configuration.
What you are doing doesn't make sense.
'')
inputs.home-manager.darwinModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs.hostname = hostname;
users.leana.imports = [
self.homeModules.${"named-" + hostname}
or (
builtins.trace "No named home-manager configuration supplied for named nix-darwin config `${hostname}', defaulting to common modules."
self.homeModules.commonModules
)
];
};
}
];
in
many (mkDarwin sharedModules);
@ -168,22 +238,6 @@ in {
}
];
};
iron = {
system = "x86_64-linux";
modules = [
self.nixosModules.layouts
inputs.nixos-hardware.nixosModules.apple-macbook-pro-8-1
self.nixosModules.macbook-swap-fn-ctrl
self.nixosModules.macbook-pro-radeon
{home-manager.users.leana.imports = [self.homeModules.preset-fancy];}
inputs.hoot.nixosModules.default
self.nixosModules.typst-bot
self.nixosModules.parrot
];
};
# Raspberry Pi 4
hydrogen = {
system = "aarch64-linux";
@ -192,6 +246,17 @@ in {
];
};
};
simpleSystemConfigs = {
iron = {
system = "x86_64-linux";
modules = [
# self.nixosModules.layouts
inputs.nixos-hardware.nixosModules.apple-macbook-pro-8-1
self.nixosModules.macbook-swap-fn-ctrl
self.nixosModules.macbook-pro-radeon
];
};
};
installerConfigs = {
installer.system = "x86_64-linux";
@ -206,5 +271,6 @@ in {
};
in
mkNixOSes systemConfigs
// mkSimpleNixOSes simpleSystemConfigs
// mkNixOSInstallers installerConfigs;
}