From 66c3fa48b19bdc49eb4bd164a88b6dadd1b743bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rton=20Boros?= Date: Sat, 7 Dec 2024 21:48:35 +0000 Subject: [PATCH] fix deploy documentation and template --- configurations/preview.nix | 8 +++++++- docs/getting-started/deploy.md | 16 +++++++--------- .../default/{preview.nix => configuration.nix} | 0 templates/default/flake.nix | 10 +++++++++- 4 files changed, 23 insertions(+), 11 deletions(-) mode change 120000 => 100644 configurations/preview.nix rename templates/default/{preview.nix => configuration.nix} (100%) diff --git a/configurations/preview.nix b/configurations/preview.nix deleted file mode 120000 index 9e9a02a..0000000 --- a/configurations/preview.nix +++ /dev/null @@ -1 +0,0 @@ -../templates/default/preview.nix \ No newline at end of file diff --git a/configurations/preview.nix b/configurations/preview.nix new file mode 100644 index 0000000..82af316 --- /dev/null +++ b/configurations/preview.nix @@ -0,0 +1,7 @@ +{ + cardano = { + network = "preview"; + node.enable = true; + ogmios.enable = true; + }; +} diff --git a/docs/getting-started/deploy.md b/docs/getting-started/deploy.md index 1253d1a..f871c43 100644 --- a/docs/getting-started/deploy.md +++ b/docs/getting-started/deploy.md @@ -10,8 +10,6 @@ An easy way to get started is to use the [flake template](https://zero-to-nix.co mkdir myproject cd myproject nix flake init --template github:mlabs-haskell/cardano.nix -git init -git add . ``` ### Run a virtual machine @@ -30,22 +28,22 @@ This machine is set up just like the one in [Run a VM](vm.md), but can be custom #### `flake.nix` -This [Nix Flake](https://zero-to-nix.com/concepts/flakes) is the entry point to the project. It locks inputs and provides the following inputs: +This [Nix Flake](https://zero-to-nix.com/concepts/flakes) is the entry point to the project. It locks inputs and provides the following outputs: -- a NixOS configuration for the virtual machine, under `nixosConfigurations.server-vm` -- an app to run the virtual machine as above, under `apps.x86_64-linux.server-vm` +- a NixOS configuration for the virtual machine, under `nixosConfigurations.vm` +- an app to run the virtual machine as above, under `apps.x86_64-linux.vm` -#### `preview.nix` +#### `configuration.nix` -This is the [NixOS configuration](https://zero-to-nix.com/concepts/nixos#configuration) to run cardano services for the machine. +This is the [NixOS configuration](https://zero-to-nix.com/concepts/nixos#configuration) to run cardano services on the machine. #### `vm.nix` -This NixOS configuration sets virtual machine options such as cores, memory and port forwarding. It is included in the configuration for the `nixosConfigurations.server-vm` virtual machine in `flake.nix`. +Local VM configuration for convenient development. Don't use this in the cloud, it is insecure with an empty root password. Sets virtual machine options such as cores, memory and port forwarding. It is included in the configuration for the `nixosConfigurations.vm` virtual machine in `flake.nix`. ### Customize -To learn more, browse available [NixOS options in nixpkgs](https://search.nixos.org/options) and [NixOS options provided by cardano.nix](../reference/module-options/cardano.md) (see other modules in the menu on the left). You can ad these options to `preview.nix` to configure the system. +To learn more, browse available [NixOS options in nixpkgs](https://search.nixos.org/options) and [NixOS options provided by cardano.nix](../reference/module-options/cardano.md) (see other modules in the menu on the left). You can ad these options to `configuration.nix` to configure the system. ### Deployment options diff --git a/templates/default/preview.nix b/templates/default/configuration.nix similarity index 100% rename from templates/default/preview.nix rename to templates/default/configuration.nix diff --git a/templates/default/flake.nix b/templates/default/flake.nix index 3e5b4a0..5968bcf 100644 --- a/templates/default/flake.nix +++ b/templates/default/flake.nix @@ -12,10 +12,18 @@ system = "x86_64-linux"; modules = [ inputs.cardano-nix.nixosModules.default - ./preview.nix + ./configuration.nix ./vm.nix ]; }; + server = inputs.nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + inputs.cardano-nix.nixosModules.default + ./configuration.nix + # add server configuraition here + ]; + }; }; apps.x86_64-linux = { vm = {