From fe6f3136f77b60f5a6d20a2ac43d94f492000a6e Mon Sep 17 00:00:00 2001 From: Yves Dubromelle Date: Fri, 21 Apr 2017 23:38:04 +0200 Subject: [PATCH] essai de backport d'un annuaire de gestion de parc --- base.nix | 1 + config-generator.nix | 1 - options.nix | 78 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 options.nix diff --git a/base.nix b/base.nix index 1717af4..dbfb1fb 100644 --- a/base.nix +++ b/base.nix @@ -11,6 +11,7 @@ in imports = [ # moulinette de configuration ./config-generator.nix + ./options.nix # subfolders ./applications/graphical/default.nix diff --git a/config-generator.nix b/config-generator.nix index 329d839..dab91fb 100644 --- a/config-generator.nix +++ b/config-generator.nix @@ -16,7 +16,6 @@ in ###### interface options = { - #* Utilisé pour afecter des capacités aux machines r6d.profiles = { # Domaine diff --git a/options.nix b/options.nix new file mode 100644 index 0000000..bfcb7e7 --- /dev/null +++ b/options.nix @@ -0,0 +1,78 @@ +{ config, lib, pkgs, r6d, ... }: +let + inherit (lib) mkEnableOption mkTextOption mkIf mkMerge mkOption singleton types; + + # TODO: Anglish :) + machineOptions = types.submodule { + options = { + + configuration-flags = types.submodule r6d.config-generator; + profiles = types.submodule r6d.profiles; + + ipAddress = mkOption { + description = "Adresse IP"; + type = lib.types.string; + }; + nix-serve-server = mkEnableOption "nix-serve server"; + nix-serve-client = mkEnableOption "nix-serve client"; + + tinc = { + enable = mkEnableOption "Enable tinc service"; + connectToAddress = mkOption { + default = ""; + example = "192.168.1.1"; + description = "External address to connect from another node."; + type = lib.types.string; + }; + vpnAddress = mkOption { + example = "192.168.69.69/24"; + description = "VPN local node IP address."; + type = lib.types.string; + }; + vpnCidrLength = mkOption { + default = 24; + example = 24; + description = "VPN netmask length."; + type = lib.types.int; + }; + extraConfig = mkOption { + default = ""; + example = '' + Mode = router + ConnecTo = bar + ''; + description = "Configuration supplémentaire pour tinc"; + type = lib.types.string; + }; + }; + + windowsBoot = { + enable = mkEnableOption "Activation du démarrage de Windows par Grub"; + drive = mkOption { + description = "Lecteur sur lequel est présent le système Windows (au format GRUB)"; + type = lib.types.string; + default = "hd0,1"; + }; + }; + windowsMount ={ + enable = mkEnableOption "Montage de la partition data Windows"; + device = mkOption { + description = "Lecteur sur lequel est présent le disque de data Windows"; + type = lib.types.string; + default = "/dev/sda2"; + }; + }; + }; + }; +in + +{ + options = { + r6d.machines = mkOption { + type = types.attrsOf machineOptions; + description = '' + Machines directory. + ''; + }; + }; +}