docs: update Flakes example
and add a small example how to deploy with nixos-rebuild.
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
description = "NixOS configuration";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11-small";
|
||||||
|
|
||||||
|
simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-25.11";
|
||||||
|
simple-nixos-mailserver.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{
|
||||||
|
nixpkgs,
|
||||||
|
simple-nixos-mailserver,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
nixosConfigurations = {
|
||||||
|
hostname = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux"; # or aarch64-linux
|
||||||
|
modules = [
|
||||||
|
simple-nixos-mailserver.nixosModule
|
||||||
|
{
|
||||||
|
mailserver = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# Check the setup guide if you have no idea how to continue
|
||||||
|
# from here!
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
+13
-25
@@ -1,30 +1,18 @@
|
|||||||
Nix Flakes
|
Flakes
|
||||||
==========
|
======
|
||||||
|
|
||||||
If you're using `flakes <https://wiki.nixos.org/wiki/Flakes>`__, you can use
|
To use NixOS mailserver `Nix flakes`_, the following minimal ``flake.nix`` can
|
||||||
the following minimal ``flake.nix`` as an example:
|
serve as an example to get started:
|
||||||
|
|
||||||
.. code:: nix
|
.. _Nix flakes: https://wiki.nixos.org/wiki/Flakes
|
||||||
|
|
||||||
{
|
.. literalinclude:: ./flakes.nix
|
||||||
description = "NixOS configuration";
|
:language: nix
|
||||||
|
|
||||||
inputs.simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-20.09";
|
|
||||||
|
|
||||||
outputs = { self, nixpkgs, simple-nixos-mailserver }: {
|
Lock the inputs and deploy the system closure:
|
||||||
nixosConfigurations = {
|
|
||||||
hostname = nixpkgs.lib.nixosSystem {
|
.. code-block:: console
|
||||||
system = "x86_64-linux";
|
|
||||||
modules = [
|
nix flake lock
|
||||||
simple-nixos-mailserver.nixosModule
|
nixos-rebuild --target-host root@mail.example.com --flake .#hostname switch
|
||||||
{
|
|
||||||
mailserver = {
|
|
||||||
enable = true;
|
|
||||||
# ...
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user