forked from Fediversity/Fediversity
Clean up resource definition
This commit is contained in:
parent
232680c9bf
commit
1f2ea73e69
1 changed files with 17 additions and 13 deletions
|
@ -13,33 +13,37 @@ let
|
||||||
vmid:
|
vmid:
|
||||||
{ providers, ... }:
|
{ providers, ... }:
|
||||||
let
|
let
|
||||||
vmmodule = import (./. + "/${vmid}");
|
vmConfig = import (./. + "/${vmid}");
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
type = providers.local.exec;
|
type = providers.local.exec;
|
||||||
imports = [ inputs.nixops4-nixos.modules.nixops4Resource.nixos ];
|
imports = [ inputs.nixops4-nixos.modules.nixops4Resource.nixos ];
|
||||||
|
|
||||||
ssh = {
|
ssh = {
|
||||||
# FIXME: The following assumes that `vmmodule` does not use arguments
|
host = vmConfig.procolix.vm.ip4;
|
||||||
# and does not get `proxolix.vm.ip4` from an import, etc. I have tried
|
|
||||||
# an approach with `lib.evalModules` but I cannot get it to work.
|
|
||||||
host = vmmodule.procolix.vm.ip4;
|
|
||||||
opts = "";
|
opts = "";
|
||||||
hostPublicKey = self.keys.systems.${vmid};
|
hostPublicKey = self.keys.systems.${vmid};
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs = inputs.nixpkgs;
|
nixpkgs = inputs.nixpkgs;
|
||||||
|
|
||||||
nixos.module = {
|
nixos.module = {
|
||||||
imports = [
|
imports = [
|
||||||
vmmodule
|
## NOTE: We import an attrset as a NixOS module, for convenience, so
|
||||||
|
## as to be able to use it in NixOps4 and to grab information from it
|
||||||
|
## (eg. the IP) without evaluating the whole configuration first.
|
||||||
|
vmConfig
|
||||||
|
|
||||||
./common
|
./common
|
||||||
self.nixosModules.ageSecrets
|
self.nixosModules.ageSecrets
|
||||||
{
|
|
||||||
fediversity.hostPublicKey = self.keys.systems.${vmid};
|
|
||||||
|
|
||||||
## FIXME: Remove direct root authentication once the NixOps4 NixOS
|
|
||||||
## provider supports users with password-less sudo.
|
|
||||||
users.users.root.openssh.authorizedKeys.keys = attrValues self.keys.contributors;
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
## Necessary to filter Age secrets.
|
||||||
|
fediversity.hostPublicKey = self.keys.systems.${vmid};
|
||||||
|
|
||||||
|
## FIXME: Remove direct root authentication once the NixOps4 NixOS
|
||||||
|
## provider supports users with password-less sudo.
|
||||||
|
users.users.root.openssh.authorizedKeys.keys = attrValues self.keys.contributors;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue