mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2026-04-14 13:19:09 +02:00
fix: globals evaluation pinned to static arch
This commit is contained in:
parent
272413627d
commit
517017f0d6
2 changed files with 24 additions and 13 deletions
|
|
@ -1,25 +1,35 @@
|
||||||
# adapted from https://github.com/oddlama/nix-config/blob/main/nix/globals.nix
|
# adapted from https://github.com/oddlama/nix-config/blob/main/nix/globals.nix
|
||||||
{ inputs, ... }:
|
{ self, inputs, ... }:
|
||||||
{
|
{
|
||||||
flake = { config, lib, ... }:
|
|
||||||
|
imports = [
|
||||||
|
(
|
||||||
|
{ lib, flake-parts-lib, ... }:
|
||||||
|
flake-parts-lib.mkTransposedPerSystemModule {
|
||||||
|
name = "globals";
|
||||||
|
file = ./globals.nix;
|
||||||
|
option = lib.mkOption {
|
||||||
|
type = lib.types.unspecified;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
)
|
||||||
|
];
|
||||||
|
perSystem = { lib, pkgs, ... }:
|
||||||
{
|
{
|
||||||
globals =
|
globals =
|
||||||
let
|
let
|
||||||
globalsSystem = lib.evalModules {
|
globalsSystem = lib.evalModules {
|
||||||
prefix = [ "globals" ];
|
prefix = [ "globals" ];
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit (inputs.self.pkgs.x86_64-linux) lib; # fuck
|
inherit (pkgs) lib;
|
||||||
# inherit (self.outputs) lib;
|
inherit (self.outputs) nodes;
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
inherit (config) nodes;
|
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
../modules/nixos/common/globals.nix
|
../modules/nixos/common/globals.nix
|
||||||
(
|
(
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let
|
||||||
# Try to access the extra builtin we loaded via nix-plugins.
|
|
||||||
# Throw an error if that doesn't exist.
|
|
||||||
sopsImportEncrypted =
|
sopsImportEncrypted =
|
||||||
assert lib.assertMsg (builtins ? extraBuiltins.sopsImportEncrypted)
|
assert lib.assertMsg (builtins ? extraBuiltins.sopsImportEncrypted)
|
||||||
"The extra builtin 'sopsImportEncrypted' is not available, so repo.secrets cannot be decrypted. Did you forget to add nix-plugins and point it to `./nix/extra-builtins.nix` ?";
|
"The extra builtin 'sopsImportEncrypted' is not available, so repo.secrets cannot be decrypted. Did you forget to add nix-plugins and point it to `./nix/extra-builtins.nix` ?";
|
||||||
|
|
@ -38,7 +48,7 @@
|
||||||
{
|
{
|
||||||
globals = lib.mkMerge (
|
globals = lib.mkMerge (
|
||||||
lib.concatLists (
|
lib.concatLists (
|
||||||
lib.flip lib.mapAttrsToList config.nodes (
|
lib.flip lib.mapAttrsToList self.outputs.nodes (
|
||||||
name: cfg:
|
name: cfg:
|
||||||
builtins.addErrorContext "while aggregating globals from nixosConfigurations.${name} into flake-level globals:" cfg.config._globalsDefs
|
builtins.addErrorContext "while aggregating globals from nixosConfigurations.${name} into flake-level globals:" cfg.config._globalsDefs
|
||||||
)
|
)
|
||||||
|
|
@ -50,8 +60,6 @@
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Make sure the keys of this attrset are trivially evaluatable to avoid infinite recursion,
|
|
||||||
# therefore we inherit relevant attributes from the config.
|
|
||||||
inherit (globalsSystem.config.globals)
|
inherit (globalsSystem.config.globals)
|
||||||
domains
|
domains
|
||||||
services
|
services
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit inputs outputs self minimal homeLib configName arch;
|
inherit inputs outputs self minimal homeLib configName arch;
|
||||||
inherit (config.pkgs.${arch}) lib;
|
inherit (config.pkgs.${arch}) lib;
|
||||||
inherit (config) globals nodes;
|
inherit (config) nodes;
|
||||||
|
globals = config.globals.${arch};
|
||||||
type = "nixos";
|
type = "nixos";
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
|
|
@ -68,7 +69,8 @@
|
||||||
inputs.nix-darwin.lib.darwinSystem {
|
inputs.nix-darwin.lib.darwinSystem {
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit inputs lib outputs self minimal configName;
|
inherit inputs lib outputs self minimal configName;
|
||||||
inherit (config) globals nodes;
|
inherit (config) nodes;
|
||||||
|
globals = config.globals.${arch};
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
# inputs.disko.nixosModules.disko
|
# inputs.disko.nixosModules.disko
|
||||||
|
|
@ -103,7 +105,8 @@
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
inherit inputs lib outputs self configName arch type;
|
inherit inputs lib outputs self configName arch type;
|
||||||
inherit (config) globals nodes;
|
inherit (config) nodes;
|
||||||
|
globals = config.globals.${arch};
|
||||||
minimal = false;
|
minimal = false;
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue