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
|
||||
{ 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 =
|
||||
let
|
||||
globalsSystem = lib.evalModules {
|
||||
prefix = [ "globals" ];
|
||||
specialArgs = {
|
||||
inherit (inputs.self.pkgs.x86_64-linux) lib; # fuck
|
||||
# inherit (self.outputs) lib;
|
||||
inherit (pkgs) lib;
|
||||
inherit (self.outputs) nodes;
|
||||
inherit inputs;
|
||||
inherit (config) nodes;
|
||||
};
|
||||
modules = [
|
||||
../modules/nixos/common/globals.nix
|
||||
(
|
||||
{ lib, ... }:
|
||||
let
|
||||
# Try to access the extra builtin we loaded via nix-plugins.
|
||||
# Throw an error if that doesn't exist.
|
||||
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` ?";
|
||||
|
|
@ -38,7 +48,7 @@
|
|||
{
|
||||
globals = lib.mkMerge (
|
||||
lib.concatLists (
|
||||
lib.flip lib.mapAttrsToList config.nodes (
|
||||
lib.flip lib.mapAttrsToList self.outputs.nodes (
|
||||
name: cfg:
|
||||
builtins.addErrorContext "while aggregating globals from nixosConfigurations.${name} into flake-level globals:" cfg.config._globalsDefs
|
||||
)
|
||||
|
|
@ -50,8 +60,6 @@
|
|||
};
|
||||
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)
|
||||
domains
|
||||
services
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@
|
|||
specialArgs = {
|
||||
inherit inputs outputs self minimal homeLib configName arch;
|
||||
inherit (config.pkgs.${arch}) lib;
|
||||
inherit (config) globals nodes;
|
||||
inherit (config) nodes;
|
||||
globals = config.globals.${arch};
|
||||
type = "nixos";
|
||||
};
|
||||
modules = [
|
||||
|
|
@ -68,7 +69,8 @@
|
|||
inputs.nix-darwin.lib.darwinSystem {
|
||||
specialArgs = {
|
||||
inherit inputs lib outputs self minimal configName;
|
||||
inherit (config) globals nodes;
|
||||
inherit (config) nodes;
|
||||
globals = config.globals.${arch};
|
||||
};
|
||||
modules = [
|
||||
# inputs.disko.nixosModules.disko
|
||||
|
|
@ -103,7 +105,8 @@
|
|||
inherit pkgs;
|
||||
extraSpecialArgs = {
|
||||
inherit inputs lib outputs self configName arch type;
|
||||
inherit (config) globals nodes;
|
||||
inherit (config) nodes;
|
||||
globals = config.globals.${arch};
|
||||
minimal = false;
|
||||
};
|
||||
modules = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue