Skip to content

Commit 174075d

Browse files
authored
Added more specific example
1 parent 87def41 commit 174075d

File tree

1 file changed

+69
-1
lines changed

1 file changed

+69
-1
lines changed

Guide/deployment.markdown

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,75 @@ flake.nixosConfigurations."ihp-app" = nixpkgs.lib.nixosSystem {
6767
```
6868

6969
In the first line the `"ihp-app"` needs to be the same as your SSH name from the previous section.
70-
Make sure you put this into the `flake-parts.lib.mkFlake` block.
70+
71+
Make sure you put this into the `flake-parts.lib.mkFlake` block. The final `flake.nix` should look like this:
72+
73+
```diff
74+
{
75+
inputs = {
76+
ihp.url = "github:digitallyinduced/ihp/v1.2";
77+
nixpkgs.follows = "ihp/nixpkgs";
78+
flake-parts.follows = "ihp/flake-parts";
79+
devenv.follows = "ihp/devenv";
80+
systems.follows = "ihp/systems";
81+
};
82+
83+
outputs = inputs@{ ihp, flake-parts, systems, ... }:
84+
flake-parts.lib.mkFlake { inherit inputs; } {
85+
86+
systems = import systems;
87+
imports = [ ihp.flakeModules.default ];
88+
89+
perSystem = { pkgs, ... }: {
90+
ihp = {
91+
enable = true;
92+
projectPath = ./.;
93+
packages = with pkgs; [
94+
# Native dependencies, e.g. imagemagick
95+
];
96+
haskellPackages = p: with p; [
97+
# Haskell dependencies go here
98+
p.ihp
99+
cabal-install
100+
base
101+
wai
102+
text
103+
];
104+
};
105+
};
106+
107+
+ flake.nixosConfigurations."ihp-app" = nixpkgs.lib.nixosSystem {
108+
+ system = "x86_64-linux";
109+
+ specialArgs = inputs;
110+
+ modules = [
111+
+ "${nixpkgs}/nixos/modules/virtualisation/amazon-image.nix"
112+
+ ihp.nixosModules.appWithPostgres
113+
+ ({ ... }: {
114+
+ security.acme.defaults.email = "[email protected]";
115+
+
116+
+ services.ihp = {
117+
+ domain = "myihpapp.com";
118+
+ migrations = ./Application/Migration;
119+
+ schema = ./Application/Schema.sql;
120+
+ fixtures = ./Application/Fixtures.sql;
121+
+ sessionSecret = "xxx";
122+
+ };
123+
+
124+
+ # Add swap to avoid running out of memory during builds
125+
+ # Useful if your server have less than 4GB memory
126+
+ swapDevices = [ { device = "/swapfile"; size = 8192; } ];
127+
+
128+
+ # This should reflect the nixos version from the NixOS AMI initally installed
129+
+ # After the initial install, it should not be changed. Otherwise e.g. the postgres
130+
+ # server might need a manual data migration if NixOS changes the default postgres version
131+
+ system.stateVersion = "23.05";
132+
+ })
133+
+ ];
134+
+ };
135+
136+
};
137+
}
138+
```
71139

72140

73141
### Deploying the App

0 commit comments

Comments
 (0)