forked from Fediversity/Fediversity
pass sources
via specialArgs
(#464)
this gets rid of ugly in-place imports and upward paths Reviewed-on: Fediversity/Fediversity#464 Reviewed-by: kiara Grouwstra <kiara@procolix.eu> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io> Co-committed-by: Valentin Gagarin <valentin.gagarin@tweag.io>
This commit is contained in:
parent
f2017aaeb4
commit
b791bd515d
4 changed files with 36 additions and 28 deletions
|
@ -1,15 +1,4 @@
|
|||
let
|
||||
# pulling this in manually over from module args resolves an infinite recursion.
|
||||
# FIXME: instead untangle `//infra/flake-part.nix` and make it stop passing wild functions.
|
||||
# move moving towards a portable-services-like pattern where some things are submodules.
|
||||
# Right now those wild functions are for parameterising a bunch of things,
|
||||
# and the modular way to do that would be options --
|
||||
# obviously you can't use those for `imports`,
|
||||
# so one way to decouple fixpoints is to isolate them into submodules.
|
||||
# Therefore one approach would be to try to go down the call graph,
|
||||
# and see where what's currently a function could be a `submodule` field of something else.
|
||||
sources = import ../../npins;
|
||||
in
|
||||
{ sources, ... }:
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ let
|
|||
_module.args = {
|
||||
inherit
|
||||
inputs
|
||||
sources
|
||||
keys
|
||||
secrets
|
||||
;
|
||||
|
@ -37,6 +36,10 @@ let
|
|||
./common/proxmox-qemu-vm.nix
|
||||
];
|
||||
|
||||
nixos.specialArgs = {
|
||||
inherit sources;
|
||||
};
|
||||
|
||||
imports =
|
||||
[
|
||||
./common/resource.nix
|
||||
|
@ -66,6 +69,21 @@ let
|
|||
vmNames:
|
||||
{ providers, ... }:
|
||||
{
|
||||
# XXX: this type merge is for adding `specialArgs` to resource modules
|
||||
options.resources = mkOption {
|
||||
type =
|
||||
with lib.types;
|
||||
lazyAttrsOf (submoduleWith {
|
||||
class = "nixops4Resource";
|
||||
modules = [ ];
|
||||
# TODO(@fricklerhandwerk): we may want to pass through all of `specialArgs`
|
||||
# once we're sure it's sane. leaving it here for better control during refactoring.
|
||||
specialArgs = {
|
||||
inherit sources;
|
||||
};
|
||||
});
|
||||
};
|
||||
config = {
|
||||
providers.local = inputs.nixops4.modules.nixops4Provider.local;
|
||||
resources = genAttrs vmNames (vmName: {
|
||||
type = providers.local.exec;
|
||||
|
@ -78,6 +96,7 @@ let
|
|||
];
|
||||
});
|
||||
};
|
||||
};
|
||||
makeDeployment' = vmName: makeDeployment [ vmName ];
|
||||
|
||||
## Given an attrset of test configurations (key = test machine name, value =
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
{
|
||||
config,
|
||||
sources,
|
||||
...
|
||||
}:
|
||||
let
|
||||
name = "panel";
|
||||
sources = import ../../../npins;
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [
|
||||
(import ../../../panel { }).module
|
||||
(import "${sources.home-manager}/nixos")
|
||||
(../../../panel { }).module
|
||||
"${sources.home-manager}/nixos"
|
||||
];
|
||||
|
||||
security.acme = {
|
||||
|
|
|
@ -45,7 +45,7 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
module = import ./nix/configuration.nix;
|
||||
module = ./nix/configuration.nix;
|
||||
tests = pkgs.callPackage ./nix/tests.nix { };
|
||||
|
||||
# re-export inputs so they can be overridden granularly
|
||||
|
|
Loading…
Add table
Reference in a new issue