mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git
synced 2024-11-09 18:13:12 +00:00
4419a1323a
Now it should work for all nested imports too. `imports` are traversed recursively to redefine each imported module function with altered one, constraining its config attribute (respecting config-paths-needed.json).
31 lines
1.2 KiB
Nix
31 lines
1.2 KiB
Nix
{
|
|
description = "PoC SP module for the simple-nixos-mailserver";
|
|
|
|
inputs.mailserver.url =
|
|
gitlab:simple-nixos-mailserver/nixos-mailserver;
|
|
|
|
outputs = { self, mailserver }: {
|
|
# tricks to rename (alias) the original module
|
|
nixosModules.default = args@{ pkgs, config, ... }:
|
|
let
|
|
module = mailserver.nixosModules.default args;
|
|
in
|
|
module // {
|
|
imports = module.imports ++ [
|
|
./config.nix
|
|
{ mailserver = config.selfprivacy.userdata.simple-nixos-mailserver; }
|
|
];
|
|
options = module.options // {
|
|
selfprivacy.userdata.simple-nixos-mailserver =
|
|
module.options.mailserver;
|
|
};
|
|
};
|
|
configPathsNeeded =
|
|
builtins.fromJSON (builtins.readFile ./config-paths-needed.json);
|
|
|
|
# TODO generate json docs from module? something like:
|
|
# nix eval --impure --expr 'let flake = builtins.getFlake (builtins.toPath ./.); pkgs = flake.inputs.mailserver.inputs.nixpkgs.legacyPackages.x86_64-linux; in (pkgs.nixosOptionsDoc { inherit (pkgs.lib.evalModules { modules = [ flake.nixosModules.default ]; }) options; }).optionsJSON'
|
|
# (doesn't work because of `assertions`)
|
|
};
|
|
}
|