Skip to content
Snippets Groups Projects
Select Git revision
  • 95f73519877934360a4549b8b0e4147c66470cc7
  • develop default protected
  • production protected
  • nixpkgs-upgrade-2025-06-16
  • nixpkgs-upgrade-2024-12-23
  • 190-our-regular-updates-fill-up-the-servers-boot-partitions
  • nixpkgs-upgrade-2024-10-14
  • hro-cloud protected
  • 162.flexible-grafana-module
  • nixpkgs-upgrade-2024-05-13
  • nixpkgs-upgrade-2024-04-22
  • nixpkgs-upgrade-2024-03-25
  • nixpkgs-upgrade-2024-03-18
  • nixpkgs-upgrade-2024-03-11
  • nixpkgs-upgrade-2024-03-04
  • 163.jp-to-ben-for-prod
  • nixpkgs-upgrade-2024-02-26
  • 164.grafana-alert-rules
  • 157.authorize-new-hro-key
  • nixpkgs-upgrade-2024-02-19
  • nixpkgs-upgrade-2024-02-12
21 results

issuer.nix

Blame
  • 100tb.nix 5.02 KiB
    # A NixOS module which configures a system that is hosted by 100TB.  Each of
    # our servers hosted with 100TB will probably import this module and pass it
    # the minimum system configuration to get the server to boot and accept
    # administrative ssh connections.
    #
    # A NixOS module is defined as a Nix expression language function.
    {
      # This contains generally useful library functionality provided by nixpkgs.
      # These are things like string manipulation and, notably for us, a library
      # for defining options for configuring moduless.
      lib,
    
      # This is all of the configuration for a particular system where this module
      # might be instantiated.  For any system where we want the 100TB module to
      # be active, this should have the 100TB configuration details (IP, gateway,
      # etc).
      config,
    
      # More parameters exist and are accepted but we don't need them so we ignore them.
      ...
    }:
    let
      # Pull out the configuration for this module for convenient use later.  The
      # module name is quoted because `1` makes `100tb` look an awful lot like it
      # should be a number.
      cfg = config."100tb".config;
    
      # Define the API to this module.  Everything in `options` is about
      # specifying what kind of values we expect to be given.  This is both
      # human-facing documentation as well as guidance to NixOS about acceptable
      # values (mainly by type) so it can automatically reject certain bogus
      # values.  This value is in the `let` to make the code below a little easier
      # to read.  See below where we use it.
      options = {
        interface = lib.mkOption
        { type = lib.types.str;
          example = lib.literalExample "eno0";
          description = "The name of the network interface on which to configure a static address.";
    
        };
        publicIPv4 = lib.mkOption
        { type = lib.types.str;
          example = lib.literalExample "192.0.2.0";
          description = "The IPv4 address to statically assign to `interface`.";
        };
        prefixLength = lib.mkOption
        { type = lib.types.int;
          example = lib.literalExample 24;
          description = "The statically configured network's prefix length.";
        };
        gateway = lib.mkOption
        { type = lib.types.str;
          example = lib.literalExample "192.0.2.1";
          description = "The statically configured address of the network gateway.";
        };
        gatewayInterface = lib.mkOption
        { type = lib.types.str;
          example = lib.literalExample "eno0";
          description = "The name of the network interface for the default route.";
          default = cfg.interface;
        };
        grubDeviceID = lib.mkOption
        { type = lib.types.str;
          example = lib.literalExample "wwn-0x5000c500936410b9";
          description = "The ID of the disk on which to install grub.";
        };
        rootPublicKey = lib.mkOption
        { type = lib.types.str;
          example = lib.literalExample "ssh-ed25519 AAAA... username@host";
          description = "The public key to install for the root user.";