forked from Fediversity/Fediversity
specify _class
module attributes to explicitly declare module types (#398)
closes #93. note that this includes classes: - `nixos` - `nixosTest` - `nixops4Resource` - `nixops4Deployment` .. and my (made-up, as per the [docs](https://ryantm.github.io/nixpkgs/module-system/module-system/#module-system-lib-evalModules-param-class)): - `nix-unit` - `package` .. while i did not manage to cover: - service tests, given `pkgs.nixosTest` seemed to not actually like `_class = "nixosTest"` (?!) ... nor #93's mentioned destructured arguments for that matter, as per Fediversity/Fediversity#93 (comment) - let me know if that is still desired as well. Reviewed-on: Fediversity/Fediversity#398 Reviewed-by: Valentin Gagarin <valentin.gagarin@tweag.io> Co-authored-by: Kiara Grouwstra <kiara@procolix.eu> Co-committed-by: Kiara Grouwstra <kiara@procolix.eu>
This commit is contained in:
parent
c1b33121b6
commit
9a25a04bfa
60 changed files with 118 additions and 0 deletions
|
@ -17,6 +17,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "flake";
|
||||
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{ inputs, ... }:
|
||||
|
||||
{
|
||||
_class = "nixosTest";
|
||||
|
||||
name = "deployment-basic";
|
||||
|
||||
nodes.deployer =
|
||||
|
|
|
@ -20,6 +20,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "flake";
|
||||
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
|
|
|
@ -7,6 +7,8 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
_class = "nixosTest";
|
||||
|
||||
name = "deployment-cli";
|
||||
|
||||
nodes.deployer =
|
||||
|
|
|
@ -18,6 +18,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [ ./sharedOptions.nix ];
|
||||
|
||||
options.system.extraDependenciesFromModule = mkOption {
|
||||
|
|
|
@ -42,6 +42,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixosTest";
|
||||
|
||||
imports = [
|
||||
./sharedOptions.nix
|
||||
];
|
||||
|
|
|
@ -11,6 +11,7 @@ let
|
|||
inherit (lib) mkOption types;
|
||||
|
||||
in
|
||||
# `config` not set and imported from multiple places: no fixed module class
|
||||
{
|
||||
options = {
|
||||
targetMachines = mkOption {
|
||||
|
|
|
@ -12,6 +12,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
(modulesPath + "/../lib/testing/nixos-test-base.nix")
|
||||
|
|
|
@ -12,6 +12,8 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
imports = [ ./sharedOptions.nix ];
|
||||
|
||||
options = {
|
||||
|
|
|
@ -23,6 +23,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "flake";
|
||||
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
|
|
|
@ -121,6 +121,8 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
_class = "nixosTest";
|
||||
|
||||
name = "deployment-panel";
|
||||
|
||||
## The panel's module sets `nixpkgs.overlays` which clashes with
|
||||
|
|
|
@ -11,6 +11,8 @@ let
|
|||
}).config;
|
||||
in
|
||||
{
|
||||
_class = "nix-unit";
|
||||
|
||||
test-eval = {
|
||||
expr =
|
||||
let
|
||||
|
|
|
@ -7,6 +7,8 @@ let
|
|||
in
|
||||
with types;
|
||||
{
|
||||
_class = "nixops4Deployment";
|
||||
|
||||
options = {
|
||||
runtime-environments = mkOption {
|
||||
description = "Collection of runtime environments into which applications can be deployed";
|
||||
|
|
|
@ -65,6 +65,8 @@ let
|
|||
cfg = config.deployment;
|
||||
in
|
||||
{
|
||||
_class = "nixops4Deployment";
|
||||
|
||||
options = {
|
||||
deployment = lib.mkOption {
|
||||
description = ''
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "flake";
|
||||
|
||||
imports = [
|
||||
./check/basic/flake-part.nix
|
||||
./check/cli/flake-part.nix
|
||||
|
|
|
@ -17,6 +17,8 @@ let
|
|||
inherit (lib) types mkOption;
|
||||
in
|
||||
{
|
||||
_class = "nixops4Deployment";
|
||||
|
||||
options = {
|
||||
enable = lib.mkEnableOption "Fediversity configuration";
|
||||
domain = mkOption {
|
||||
|
|
|
@ -5,6 +5,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [
|
||||
./hardware.nix
|
||||
./networking.nix
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{ modulesPath, ... }:
|
||||
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
|
||||
|
||||
boot = {
|
||||
|
|
|
@ -5,6 +5,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
config = {
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixos";
|
||||
|
||||
users.users = {
|
||||
procolix = {
|
||||
isNormalUser = true;
|
||||
|
|
|
@ -6,6 +6,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
options.fediversityVm = {
|
||||
|
||||
##########################################################################
|
||||
|
|
|
@ -18,6 +18,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
fediversityVm.hostPublicKey = mkDefault keys.systems.${config.fediversityVm.name};
|
||||
|
|
|
@ -155,6 +155,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "flake";
|
||||
|
||||
## - Each normal or test machine gets a NixOS configuration.
|
||||
## - Each normal or test machine gets a VM options entry.
|
||||
## - Each normal machine gets a deployment.
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 200;
|
||||
proxmox = "fediversity";
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 201;
|
||||
proxmox = "fediversity";
|
||||
|
|
|
@ -6,6 +6,8 @@ let
|
|||
name = "panel";
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [
|
||||
(import ../../../panel { }).module
|
||||
];
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 2116;
|
||||
proxmox = "procolix";
|
||||
|
|
|
@ -5,6 +5,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
services.forgejo = {
|
||||
enable = true;
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 2187;
|
||||
proxmox = "procolix";
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
services.phpfpm.pools.mediawiki.phpOptions = ''
|
||||
upload_max_filesize = 1024M;
|
||||
post_max_size = 1024M;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 7001;
|
||||
proxmox = "fediversity";
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 7002;
|
||||
proxmox = "fediversity";
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 7003;
|
||||
proxmox = "fediversity";
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 7004;
|
||||
proxmox = "fediversity";
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 7005;
|
||||
proxmox = "fediversity";
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 7006;
|
||||
proxmox = "fediversity";
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 7011;
|
||||
proxmox = "fediversity";
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 7012;
|
||||
proxmox = "fediversity";
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 7013;
|
||||
proxmox = "fediversity";
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
_class = "nixops4Resource";
|
||||
|
||||
fediversityVm = {
|
||||
vmId = 7014;
|
||||
proxmox = "fediversity";
|
||||
|
|
|
@ -76,6 +76,8 @@ in
|
|||
# https://git.dgnum.eu/mdebray/djangonix/
|
||||
# unlicensed at the time of writing, but surely worth taking some inspiration from...
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
options.services.${name} = {
|
||||
enable = mkEnableOption "Service configuration for `${name}`";
|
||||
production = mkOption {
|
||||
|
|
|
@ -60,6 +60,8 @@ let
|
|||
];
|
||||
in
|
||||
python3.pkgs.buildPythonPackage {
|
||||
_class = "package";
|
||||
|
||||
pname = name;
|
||||
inherit (pyproject.project) version;
|
||||
pyproject = true;
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
_class = "package";
|
||||
|
||||
pname = "django-pydantic-field";
|
||||
version = "v0.3.12";
|
||||
pyproject = true;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
_class = "package";
|
||||
|
||||
pname = "drf-pydantic";
|
||||
version = "v2.7.1";
|
||||
pyproject = true;
|
||||
|
|
|
@ -6,6 +6,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [
|
||||
./garage
|
||||
./mastodon
|
||||
|
|
|
@ -97,6 +97,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
config = mkIf config.fediversity.garage.enable {
|
||||
|
|
|
@ -5,6 +5,8 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
options.fediversity.garage = {
|
||||
enable = mkEnableOption "Enable a Garage server on the machine";
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
config = mkMerge [
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
options.fediversity.mastodon =
|
||||
(import ../sharedOptions.nix {
|
||||
inherit config lib;
|
||||
|
|
|
@ -5,6 +5,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
config = mkMerge [
|
||||
|
|
|
@ -6,6 +6,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
options.fediversity.peertube =
|
||||
(import ../sharedOptions.nix {
|
||||
inherit config lib;
|
||||
|
|
|
@ -15,6 +15,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
config = mkMerge [
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
options.fediversity.pixelfed =
|
||||
(import ../sharedOptions.nix {
|
||||
inherit config lib;
|
||||
|
|
|
@ -14,6 +14,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
enable = mkEnableOption "Enable a ${serviceDocName} server on the machine";
|
||||
|
||||
s3AccessKeyFile = mkOption {
|
||||
|
|
|
@ -127,6 +127,8 @@ let
|
|||
preOverride = pkgs.nixosTest (
|
||||
test
|
||||
// {
|
||||
_class = "nixosTest";
|
||||
|
||||
interactive = (test.interactive or { }) // {
|
||||
# no need to // with test.interactive.nodes here, since we are iterating
|
||||
# over all of them, and adding back in the config via `imports`
|
||||
|
|
|
@ -10,6 +10,8 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [ (modulesPath + "/virtualisation/qemu-vm.nix") ];
|
||||
|
||||
fediversity.garage.enable = true;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# customize nixos-rebuild build-vm to be a bit more convenient
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
# let us log in
|
||||
users.mutableUsers = false;
|
||||
users.users.root.hashedPassword = "";
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
...
|
||||
}:
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [ (modulesPath + "/virtualisation/qemu-vm.nix") ];
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
}:
|
||||
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [ (modulesPath + "/virtualisation/qemu-vm.nix") ];
|
||||
|
||||
fediversity = {
|
||||
|
|
|
@ -11,6 +11,8 @@ let
|
|||
in
|
||||
|
||||
{
|
||||
_class = "nixos";
|
||||
|
||||
imports = [ (modulesPath + "/virtualisation/qemu-vm.nix") ];
|
||||
|
||||
fediversity = {
|
||||
|
|
Loading…
Add table
Reference in a new issue