Class: OsCtld::DistConfig::Distributions::NixOS::Configurator

Inherits:
Configurator
  • Object
show all
Defined in:
lib/osctld/dist_config/distributions/nixos.rb

Instance Attribute Summary

Attributes inherited from Configurator

#ctid, #distribution, #network_backend, #rootfs, #version

Instance Method Summary collapse

Methods inherited from Configurator

#add_netif, #dns_resolvers, #initialize, #instantiate_network_class, #log_type, #remove_netif, #rename_netif, #unset_etc_hosts, #update_etc_hosts

Methods included from Helpers::Common

#systemd_service_enabled?, #systemd_service_masked?, #writable?

Constructor Details

This class inherits a constructor from OsCtld::DistConfig::Configurator

Instance Method Details

#network(netifs) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/osctld/dist_config/distributions/nixos.rb', line 12

def network(netifs)
  tpl_base = 'dist_config/network/nixos'

  %w[add del].each do |operation|
    cmds = netifs.map do |netif|
      OsCtld::ErbTemplate.render(
        File.join(tpl_base, netif.type.to_s),
        { netif:, op: operation }
      )
    end

    writable?(File.join(rootfs, "ifcfg.#{operation}")) do |path|
      File.write(path, cmds.join("\n"))
    end
  end
end

#network_classObject (protected)



31
32
33
# File 'lib/osctld/dist_config/distributions/nixos.rb', line 31

def network_class
  nil
end

#set_hostname(_new_hostname, old_hostname: nil) ⇒ Object



8
9
10
# File 'lib/osctld/dist_config/distributions/nixos.rb', line 8

def set_hostname(_new_hostname, old_hostname: nil)
  log(:warn, 'Unable to apply hostname to NixOS container')
end