Meta variables:
{{project}}
: name of the project{{domain}}
: name of the machine{{image}}
: name of the machine image{{hostname}}
: host-name of the machine{{mac}}
: MAC address of the machine{{ip}}
: IP address of the machine
- Run
infra/shell.sh
- Create a new folder
infra/{{project}}
- Create a MAC address by running
infra/mac.sh {{hostname}}
- Create
infra/images/{{project}}.sh
based on the following template and run it:
. ../lib.sh
volume-create-backing images {{image}}}.qcow2 8G minimal-base-v1.qcow2
- Add the following line to
infra/networks/private-network.xml
:
<host mac="{{mac}}" name="{{hostname}}" ip="{{ip}}"/>
- Create
infra/{{project}}/{{domain}}.xml
based on the following template:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../domain.xsl"?>
<!DOCTYPE domain SYSTEM '../domain.dtd'>
<domain>
<name>{{domain}}</name>
<memory unit="G">1</memory>
<vcpu>1</vcpu>
<disk pool='images' volume='{{image}}.qcow2'/>
<network-interface
network='private-network'
mac='{{mac}}'/>
</domain>
-
Create
infra/{{project}}/inventory.txt
, which should contain one domain per line. -
Create the domain by running:
domain-create {{domain}}.xml
-
Refresh the network by running:
infra/networks/refresh.sh
- Create a new folder
machines/<project>
- Write
machines/<project>/configuration.nix
- Add the following to
ssh_config
:
Host {{hostname}}
User root
HostName {{hostname}}
ProxyJump bastion
- Add the following to
machines/deploy.sh
and run it:
deploy {{hostname}} './<project>/configure.nix'
- After accepting the server key commit and push the
known_hosts
repository
-
Create a new folder
machines/<project>
-
Write
machines/<project>/configuration.nix
-
Build the image by running (in the directory):
nix-build '<nixpkgs/nixos>' -A config.system.build.image -I nixos-config=configure.nix
- Run
infra/shell.sh
- Create a new folder
infra/{{project}}
- Create a MAC address by running
infra/mac.sh {{hostname}}
- Create
infra/images/{{project}}.sh
based on the following template and run it:
. ../lib.sh
volume-create images {{image}}-base-v1.qcow2 8G
volume-upload images {{image}}-base-v1.qcow2 '../../machines/<project>/result/nixos.qcow2'
volume-create-backing images {{image}}}.qcow2 8G {{image}}-base-v1.qcow2
- Add the following line to
infra/networks/private-network.xml
:
<host mac="{{mac}}" name="{{hostname}}" ip="{{ip}}"/>
- Create
infra/{{project}}/{{domain}}.xml
based on the following template:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../domain.xsl"?>
<!DOCTYPE domain SYSTEM '../domain.dtd'>
<domain>
<name>{{domain}}</name>
<memory unit="G">1</memory>
<vcpu>1</vcpu>
<disk pool='images' volume='{{image}}.qcow2'/>
<network-interface
network='private-network'
mac='{{mac}}'/>
</domain>
-
Create
infra/{{project}}/inventory.txt
, which should contain one domain per line. -
Create the domain by running:
domain-create {{domain}}.xml
-
Refresh the network by running:
infra/networks/refresh.sh