@@ -68,6 +68,75 @@ flake.nixosConfigurations."ihp-app" = nixpkgs.lib.nixosSystem {
6868
6969In the first line the ` "ihp-app" ` needs to be the same as your SSH name from the previous section.
7070
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+ ```
139+
71140
72141### Deploying the App
73142
0 commit comments