From 810f62b7df17a6d2dd78bd8c234f864825173376 Mon Sep 17 00:00:00 2001 From: Paul d'Hubert Date: Fri, 21 Apr 2023 20:28:35 +0200 Subject: [PATCH 01/51] feat: add devenv support --- devenv.lock | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++ devenv.nix | 15 +++++ devenv.yaml | 7 +++ 3 files changed, 178 insertions(+) create mode 100644 devenv.lock create mode 100644 devenv.nix create mode 100644 devenv.yaml diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000..2c997d8 --- /dev/null +++ b/devenv.lock @@ -0,0 +1,156 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1682084853, + "narHash": "sha256-cV8elJHVXMTqNbDb05ijFzOo6lEeOJsjMxPap/6z39o=", + "owner": "cachix", + "repo": "devenv", + "rev": "4e838d443bea81f1c4fe743fce6cf4eb175cf9ca", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "ihp": { + "flake": false, + "locked": { + "lastModified": 1682101432, + "narHash": "sha256-BQIpCHdPkiOMabv79/dY0dWttTv6sALmor0vmw4z8bE=", + "owner": "pauldub", + "repo": "ihp", + "rev": "328ba9c8dc5cf3ea64ac6c81bca853beaded2ea0", + "type": "github" + }, + "original": { + "owner": "pauldub", + "ref": "feat-devenv-support", + "repo": "ihp", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1682109806, + "narHash": "sha256-d9g7RKNShMLboTWwukM+RObDWWpHKaqTYXB48clBWXI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2362848adf8def2866fabbffc50462e929d7fffb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1678872516, + "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1681831107, + "narHash": "sha256-pXl3DPhhul9NztSetUJw2fcN+RI3sGOYgKu29xpgnqw=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "b7ca8f6fff42f6af75c17f9438fed1686b7d855d", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "ihp": "ihp", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..c4633e4 --- /dev/null +++ b/devenv.nix @@ -0,0 +1,15 @@ +{ pkgs, inputs, config, ... }: + +{ + imports = [ + "${inputs.ihp}/NixSupport/devenv.nix" + ]; + + # https://devenv.sh/packages/ + packages = [ ]; + + ihp.enable = true; + ihp.projectPath = ./.; + + # See full reference at https://devenv.sh/reference/options/ +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000..0d7482b --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,7 @@ +--- +inputs: + nixpkgs: + url: github:NixOS/nixpkgs/nixpkgs-unstable + ihp: + url: github:pauldub/ihp?ref=feat-devenv-support + flake: false From c01a2c8160953ebcc745f706b0ace0c581ca6c4d Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sat, 29 Apr 2023 11:21:51 +0200 Subject: [PATCH 02/51] Disabled ihp.projectPath --- devenv.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devenv.nix b/devenv.nix index c4633e4..50b1857 100644 --- a/devenv.nix +++ b/devenv.nix @@ -9,7 +9,7 @@ packages = [ ]; ihp.enable = true; - ihp.projectPath = ./.; + # ihp.projectPath = ./.; # See full reference at https://devenv.sh/reference/options/ } From 78b14e51a86b9337d3e510f9a669040263026286 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sat, 29 Apr 2023 13:43:17 +0200 Subject: [PATCH 03/51] Updated devenv config --- devenv.lock | 20 ++++++++++---------- devenv.nix | 2 +- devenv.yaml | 11 +++++------ 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/devenv.lock b/devenv.lock index 2c997d8..2a3f4cc 100644 --- a/devenv.lock +++ b/devenv.lock @@ -72,33 +72,33 @@ "ihp": { "flake": false, "locked": { - "lastModified": 1682101432, - "narHash": "sha256-BQIpCHdPkiOMabv79/dY0dWttTv6sALmor0vmw4z8bE=", - "owner": "pauldub", + "lastModified": 1682767030, + "narHash": "sha256-YuOEcKBzDAzn+La8Hp6Uhxv6RWojE5wY66zw1oqH6RU=", + "owner": "digitallyinduced", "repo": "ihp", - "rev": "328ba9c8dc5cf3ea64ac6c81bca853beaded2ea0", + "rev": "abb513016b372f9f76b6c95caed66def536a885a", "type": "github" }, "original": { - "owner": "pauldub", - "ref": "feat-devenv-support", + "owner": "digitallyinduced", + "ref": "abb513016b372f9f76b6c95caed66def536a885a", "repo": "ihp", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1682109806, - "narHash": "sha256-d9g7RKNShMLboTWwukM+RObDWWpHKaqTYXB48clBWXI=", + "lastModified": 1681488673, + "narHash": "sha256-PmojOyePBNvbY3snYE7NAQHTLB53t7Ro+pgiJ4wPCuk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2362848adf8def2866fabbffc50462e929d7fffb", + "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", "repo": "nixpkgs", + "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", "type": "github" } }, diff --git a/devenv.nix b/devenv.nix index 50b1857..c4633e4 100644 --- a/devenv.nix +++ b/devenv.nix @@ -9,7 +9,7 @@ packages = [ ]; ihp.enable = true; - # ihp.projectPath = ./.; + ihp.projectPath = ./.; # See full reference at https://devenv.sh/reference/options/ } diff --git a/devenv.yaml b/devenv.yaml index 0d7482b..5fd3b82 100644 --- a/devenv.yaml +++ b/devenv.yaml @@ -1,7 +1,6 @@ ---- inputs: - nixpkgs: - url: github:NixOS/nixpkgs/nixpkgs-unstable - ihp: - url: github:pauldub/ihp?ref=feat-devenv-support - flake: false + nixpkgs: + url: github:NixOS/nixpkgs?rev=a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e + ihp: + url: github:digitallyinduced/ihp?ref=abb513016b372f9f76b6c95caed66def536a885a + flake: false \ No newline at end of file From e812c00a6703d06fb49f8c5cf54a121813999e15 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sat, 3 Jun 2023 12:12:39 +0200 Subject: [PATCH 04/51] Fixed indentation and added more default optiosn to devenv boilerplate --- devenv.nix | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/devenv.nix b/devenv.nix index c4633e4..c0dc145 100644 --- a/devenv.nix +++ b/devenv.nix @@ -1,15 +1,28 @@ { pkgs, inputs, config, ... }: { - imports = [ - "${inputs.ihp}/NixSupport/devenv.nix" - ]; + # See full reference at https://devenv.sh/reference/options/ + # For IHP specific options, see https://ihp.digitallyinduced.com/Guide/package-management.html - # https://devenv.sh/packages/ - packages = [ ]; + imports = [ + "${inputs.ihp}/NixSupport/devenv.nix" + ]; - ihp.enable = true; - ihp.projectPath = ./.; + # https://devenv.sh/packages/ + packages = with pkgs; [ + # Native dependencies, e.g. imagemagick + ]; - # See full reference at https://devenv.sh/reference/options/ + ihp.enable = true; + ihp.projectPath = ./.; + + ihp.haskellPackages = p: with p; [ + # Haskell dependencies go here + cabal-install + base + wai + text + hlint + ihp + ]; } From 43d3f586e563da1527baab549335509af065a42c Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sat, 3 Jun 2023 15:56:10 +0200 Subject: [PATCH 05/51] Added devenv.sh specific rules --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 06f03b5..fb11c46 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,8 @@ Config/client_session_key.aes # Ignore locally checked out IHP version IHP + +# devenv.sh +.devenv* +devenv.local.nix +.direnv From eb174e3781d80206c2583b84ebfa5755a496ef6a Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sun, 4 Jun 2023 14:41:36 +0200 Subject: [PATCH 06/51] Enabled nix flakes --- default.nix | 13 +---- devenv.lock | 156 ---------------------------------------------------- devenv.nix | 28 ---------- flake.nix | 57 +++++++++++++++++++ 4 files changed, 59 insertions(+), 195 deletions(-) delete mode 100644 devenv.lock delete mode 100644 devenv.nix create mode 100644 flake.nix diff --git a/default.nix b/default.nix index 9e1df23..e430fd8 100644 --- a/default.nix +++ b/default.nix @@ -5,17 +5,8 @@ let }; haskellEnv = import "${ihp}/NixSupport/default.nix" { ihp = ihp; - haskellDeps = p: with p; [ - cabal-install - base - wai - text - hlint - p.ihp - ]; - otherDeps = p: with p; [ - # Native dependencies, e.g. imagemagick - ]; + haskellDeps = (import ./devenv.nix { pkgs = {}; inputs = {}; config = {}; }).ihp.haskellPackages; + otherDeps = pkgs: (import ./devenv.nix { inherit pkgs; inputs = {}; config = {}; }).packages; projectPath = ./.; }; in diff --git a/devenv.lock b/devenv.lock deleted file mode 100644 index 2a3f4cc..0000000 --- a/devenv.lock +++ /dev/null @@ -1,156 +0,0 @@ -{ - "nodes": { - "devenv": { - "locked": { - "dir": "src/modules", - "lastModified": 1682084853, - "narHash": "sha256-cV8elJHVXMTqNbDb05ijFzOo6lEeOJsjMxPap/6z39o=", - "owner": "cachix", - "repo": "devenv", - "rev": "4e838d443bea81f1c4fe743fce6cf4eb175cf9ca", - "type": "github" - }, - "original": { - "dir": "src/modules", - "owner": "cachix", - "repo": "devenv", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-utils": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "pre-commit-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "ihp": { - "flake": false, - "locked": { - "lastModified": 1682767030, - "narHash": "sha256-YuOEcKBzDAzn+La8Hp6Uhxv6RWojE5wY66zw1oqH6RU=", - "owner": "digitallyinduced", - "repo": "ihp", - "rev": "abb513016b372f9f76b6c95caed66def536a885a", - "type": "github" - }, - "original": { - "owner": "digitallyinduced", - "ref": "abb513016b372f9f76b6c95caed66def536a885a", - "repo": "ihp", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1681488673, - "narHash": "sha256-PmojOyePBNvbY3snYE7NAQHTLB53t7Ro+pgiJ4wPCuk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", - "type": "github" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1678872516, - "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-22.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" - }, - "locked": { - "lastModified": 1681831107, - "narHash": "sha256-pXl3DPhhul9NztSetUJw2fcN+RI3sGOYgKu29xpgnqw=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "b7ca8f6fff42f6af75c17f9438fed1686b7d855d", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, - "root": { - "inputs": { - "devenv": "devenv", - "ihp": "ihp", - "nixpkgs": "nixpkgs", - "pre-commit-hooks": "pre-commit-hooks" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/devenv.nix b/devenv.nix deleted file mode 100644 index c0dc145..0000000 --- a/devenv.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ pkgs, inputs, config, ... }: - -{ - # See full reference at https://devenv.sh/reference/options/ - # For IHP specific options, see https://ihp.digitallyinduced.com/Guide/package-management.html - - imports = [ - "${inputs.ihp}/NixSupport/devenv.nix" - ]; - - # https://devenv.sh/packages/ - packages = with pkgs; [ - # Native dependencies, e.g. imagemagick - ]; - - ihp.enable = true; - ihp.projectPath = ./.; - - ihp.haskellPackages = p: with p; [ - # Haskell dependencies go here - cabal-install - base - wai - text - hlint - ihp - ]; -} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..69c9780 --- /dev/null +++ b/flake.nix @@ -0,0 +1,57 @@ +{ + inputs = { + ihp.url = "github:digitallyinduced/ihp?ref=abb513016b372f9f76b6c95caed66def536a885a"; + ihp.flake = false; + + nixpkgs.url = "github:NixOS/nixpkgs?rev=a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e"; + + systems.url = "github:nix-systems/default"; + devenv.url = "github:cachix/devenv"; + }; + + outputs = { self, nixpkgs, devenv, systems, ihp, ... } @ inputs: + let + devenvConfig = { pkgs, inputs, config, ... }: { + # See full reference at https://devenv.sh/reference/options/ + # For IHP specific options, see https://ihp.digitallyinduced.com/Guide/package-management.html + + imports = [ "${inputs.ihp}/NixSupport/devenv.nix" ]; + + ihp.enable = true; + ihp.projectPath = ./.; + + ihp.haskellPackages = p: with p; [ + # Haskell dependencies go here + p.ihp + cabal-install + base + wai + text + hlint + ]; + + packages = with pkgs; [ + # Native dependencies, e.g. imagemagick + ]; + }; + + releaseEnv = pkgs: import "${ihp}/NixSupport/default.nix" { + ihp = ihp; + haskellDeps = (devenvConfig inputs).ihp.haskellPackages; + otherDeps = p: (devenvConfig inputs).packages; + projectPath = ./.; + includeDevTools = false; + optimized = false; + }; + forEachSystem = nixpkgs.lib.genAttrs (import systems); + in + { + devShells = forEachSystem (system: { + default = let pkgs = nixpkgs.legacyPackages.${system}; in devenv.lib.mkShell { + inherit inputs pkgs; + modules = [devenvConfig]; + }; + }); + packages = forEachSystem (system: { default = releaseEnv nixpkgs.legacyPackages.${system}; }); + }; +} \ No newline at end of file From 93dce5f0ab289ca2b7be0db314f713b080399228 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sun, 4 Jun 2023 14:42:56 +0200 Subject: [PATCH 07/51] Added .envrc --- .envrc | 9 +++++++++ .gitignore | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .envrc diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..2042a80 --- /dev/null +++ b/.envrc @@ -0,0 +1,9 @@ +if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8=" +fi + +use flake . --impure + +# Add your env vars here +# +# E.g. export AWS_ACCESS_KEY_ID="XXXXX" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 06f03b5..c1b2493 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .DS_Store -.envrc .idea tmp result From 10de5a22535c2471b6a42d2fdffc3f40abc31282 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sun, 4 Jun 2023 15:07:57 +0200 Subject: [PATCH 08/51] Added binary cache --- flake.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flake.nix b/flake.nix index 69c9780..82f067f 100644 --- a/flake.nix +++ b/flake.nix @@ -54,4 +54,9 @@ }); packages = forEachSystem (system: { default = releaseEnv nixpkgs.legacyPackages.${system}; }); }; + + nixConfig = { + extra-substituters = "https://digitallyinduced.cachix.org"; + extra-trusted-public-keys = "digitallyinduced.cachix.org-1:y+wQvrnxQ+PdEsCt91rmvv39qRCYzEgGQaldK26hCKE="; + }; } \ No newline at end of file From 01f28f2afbf77eff1394c08b4c6301f32a89599e Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sun, 4 Jun 2023 15:14:14 +0200 Subject: [PATCH 09/51] fixed build --- flake.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 82f067f..b843226 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,7 @@ outputs = { self, nixpkgs, devenv, systems, ihp, ... } @ inputs: let - devenvConfig = { pkgs, inputs, config, ... }: { + devenvConfig = { pkgs, ... }: { # See full reference at https://devenv.sh/reference/options/ # For IHP specific options, see https://ihp.digitallyinduced.com/Guide/package-management.html @@ -37,8 +37,8 @@ releaseEnv = pkgs: import "${ihp}/NixSupport/default.nix" { ihp = ihp; - haskellDeps = (devenvConfig inputs).ihp.haskellPackages; - otherDeps = p: (devenvConfig inputs).packages; + haskellDeps = (devenvConfig pkgs).ihp.haskellPackages; + otherDeps = p: (devenvConfig pkgs).packages; projectPath = ./.; includeDevTools = false; optimized = false; From eeb86b498f148fcade6c641f4d82a7df783d4b91 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sun, 4 Jun 2023 15:23:52 +0200 Subject: [PATCH 10/51] Added comments --- flake.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index b843226..58d3f55 100644 --- a/flake.nix +++ b/flake.nix @@ -1,8 +1,11 @@ { inputs = { + # Here you can adjust the IHP version of your project + # You can find new releases at https://github.com/digitallyinduced/ihp/releases ihp.url = "github:digitallyinduced/ihp?ref=abb513016b372f9f76b6c95caed66def536a885a"; ihp.flake = false; + # See https://ihp.digitallyinduced.com/Guide/package-management.html#nixpkgs-pinning nixpkgs.url = "github:NixOS/nixpkgs?rev=a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e"; systems.url = "github:nix-systems/default"; @@ -15,8 +18,8 @@ # See full reference at https://devenv.sh/reference/options/ # For IHP specific options, see https://ihp.digitallyinduced.com/Guide/package-management.html + # Enable IHP support in devenv.sh imports = [ "${inputs.ihp}/NixSupport/devenv.nix" ]; - ihp.enable = true; ihp.projectPath = ./.; @@ -35,26 +38,35 @@ ]; }; + # Settings when running `nix build` releaseEnv = pkgs: import "${ihp}/NixSupport/default.nix" { ihp = ihp; haskellDeps = (devenvConfig pkgs).ihp.haskellPackages; otherDeps = p: (devenvConfig pkgs).packages; projectPath = ./.; + + # Dev tools are not needed in the release build includeDevTools = false; + + # Set optimized = true to get more optimized binaries, but slower build times optimized = false; }; forEachSystem = nixpkgs.lib.genAttrs (import systems); in { + # Dev shells are used for development, e.g. when running `nix develop --impure` devShells = forEachSystem (system: { default = let pkgs = nixpkgs.legacyPackages.${system}; in devenv.lib.mkShell { inherit inputs pkgs; modules = [devenvConfig]; }; }); + # Binaries for deploying IHP apps. These are used by `nix build --impure` packages = forEachSystem (system: { default = releaseEnv nixpkgs.legacyPackages.${system}; }); }; + # The following is needed to use the IHP binary cache. + # This binary cache provides binaries for all IHP packages and commonly used dependencies for all nixpkgs versions used by IHP. nixConfig = { extra-substituters = "https://digitallyinduced.cachix.org"; extra-trusted-public-keys = "digitallyinduced.cachix.org-1:y+wQvrnxQ+PdEsCt91rmvv39qRCYzEgGQaldK26hCKE="; From eebbda8f287eb36689c145d5bb95b3f527d88fcb Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sun, 4 Jun 2023 17:01:14 +0200 Subject: [PATCH 11/51] Improved b.c. support for nix-build --- default.nix | 22 +++++++++------------- flake.nix | 2 +- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/default.nix b/default.nix index e430fd8..e778a7a 100644 --- a/default.nix +++ b/default.nix @@ -1,13 +1,9 @@ -let - ihp = builtins.fetchGit { - url = "https://github.com/digitallyinduced/ihp.git"; - ref = "refs/tags/v1.0.1"; - }; - haskellEnv = import "${ihp}/NixSupport/default.nix" { - ihp = ihp; - haskellDeps = (import ./devenv.nix { pkgs = {}; inputs = {}; config = {}; }).ihp.haskellPackages; - otherDeps = pkgs: (import ./devenv.nix { inherit pkgs; inputs = {}; config = {}; }).packages; - projectPath = ./.; - }; -in - haskellEnv +# For backwards compatibility using flake.nix +(import + ( + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/12c64ca55c1014cdc1b16ed5a804aa8576601ff2.tar.gz"; + sha256 = "0jm6nzb83wa6ai17ly9fzpqc40wg1viib8klq8lby54agpl213w5"; + } + ) +{ src = ./.; }).defaultNix \ No newline at end of file diff --git a/flake.nix b/flake.nix index 58d3f55..6d77c35 100644 --- a/flake.nix +++ b/flake.nix @@ -62,7 +62,7 @@ }; }); # Binaries for deploying IHP apps. These are used by `nix build --impure` - packages = forEachSystem (system: { default = releaseEnv nixpkgs.legacyPackages.${system}; }); + defaultPackage = forEachSystem (system: releaseEnv nixpkgs.legacyPackages.${system}); }; # The following is needed to use the IHP binary cache. From 0e4f44393b2d8f09073809685dc819e3ca5696e0 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sun, 4 Jun 2023 21:38:37 +0200 Subject: [PATCH 12/51] Added support for .env files Co-authored-by: Lars Lillo Ulvestad --- .envrc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.envrc b/.envrc index 2042a80..6abd3dd 100644 --- a/.envrc +++ b/.envrc @@ -3,7 +3,12 @@ if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then fi use flake . --impure - +if [ -f .env ] +then + set -o allexport + source .env + set +o allexport +fi # Add your env vars here # # E.g. export AWS_ACCESS_KEY_ID="XXXXX" \ No newline at end of file From cfeb08fd361792cbcd4b4b3f3ec4b2ca163564bc Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sun, 4 Jun 2023 21:39:37 +0200 Subject: [PATCH 13/51] Added nixos comment Co-authored-by: Lars Lillo Ulvestad --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index 6d77c35..c9fb53e 100644 --- a/flake.nix +++ b/flake.nix @@ -63,6 +63,7 @@ }); # Binaries for deploying IHP apps. These are used by `nix build --impure` defaultPackage = forEachSystem (system: releaseEnv nixpkgs.legacyPackages.${system}); + # NixOS configurations goes here }; # The following is needed to use the IHP binary cache. From 31798ebd3e87a0018381107a04890e972fcc4520 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sun, 4 Jun 2023 21:39:51 +0200 Subject: [PATCH 14/51] Added .env to .gitignore Co-authored-by: Lars Lillo Ulvestad --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c1b2493..6349410 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .DS_Store .idea +.env tmp result node_modules From c50490847fa116911ef81029603ced08b601fda6 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Mon, 5 Jun 2023 14:18:25 +0200 Subject: [PATCH 15/51] Added comment on .env file --- .envrc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.envrc b/.envrc index 6abd3dd..099cf2b 100644 --- a/.envrc +++ b/.envrc @@ -3,12 +3,14 @@ if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then fi use flake . --impure + +# Include .env file if it exists locally. Use the .env file to load env vars that you don't want to commit to git if [ -f .env ] then - set -o allexport - source .env - set +o allexport + set -o allexport + source .env + set +o allexport fi # Add your env vars here # -# E.g. export AWS_ACCESS_KEY_ID="XXXXX" \ No newline at end of file +# E.g. export AWS_ACCESS_KEY_ID="XXXXX" From 9639252eeecb1b3444146eda0e8086b8d08bdcb8 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Mon, 5 Jun 2023 17:42:03 +0200 Subject: [PATCH 16/51] Delete devenv.yaml --- devenv.yaml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 devenv.yaml diff --git a/devenv.yaml b/devenv.yaml deleted file mode 100644 index 5fd3b82..0000000 --- a/devenv.yaml +++ /dev/null @@ -1,6 +0,0 @@ -inputs: - nixpkgs: - url: github:NixOS/nixpkgs?rev=a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e - ihp: - url: github:digitallyinduced/ihp?ref=abb513016b372f9f76b6c95caed66def536a885a - flake: false \ No newline at end of file From 177a78a8b89aff09d756292d277695c3d4daba30 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Mon, 5 Jun 2023 23:53:53 +0200 Subject: [PATCH 17/51] Added flake.lock --- flake.lock | 252 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..26a43ec --- /dev/null +++ b/flake.lock @@ -0,0 +1,252 @@ +{ + "nodes": { + "devenv": { + "inputs": { + "flake-compat": "flake-compat", + "nix": "nix", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1685996198, + "narHash": "sha256-MN05XjT2rJZs8FTdZMwNWps8l4hcbEqtKnRuaLLTVkU=", + "owner": "cachix", + "repo": "devenv", + "rev": "92ae3568a0f463e6c7334e54a21a3b7e4ffb014e", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "devenv", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "ihp": { + "flake": false, + "locked": { + "lastModified": 1682767030, + "narHash": "sha256-YuOEcKBzDAzn+La8Hp6Uhxv6RWojE5wY66zw1oqH6RU=", + "owner": "digitallyinduced", + "repo": "ihp", + "rev": "abb513016b372f9f76b6c95caed66def536a885a", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "ref": "abb513016b372f9f76b6c95caed66def536a885a", + "repo": "ihp", + "type": "github" + } + }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1676545802, + "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=", + "owner": "domenkozar", + "repo": "nix", + "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "relaxed-flakes", + "repo": "nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1678875422, + "narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1678872516, + "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1681488673, + "narHash": "sha256-PmojOyePBNvbY3snYE7NAQHTLB53t7Ro+pgiJ4wPCuk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": [ + "devenv", + "flake-compat" + ], + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": [ + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1682596858, + "narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "fb58866e20af98779017134319b5663b8215d912", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "ihp": "ihp", + "nixpkgs": "nixpkgs_2", + "systems": "systems" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} From d546ef6d7643d832c30b865a7d59b71726b23d9d Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Tue, 6 Jun 2023 00:04:37 +0200 Subject: [PATCH 18/51] Use latest IHP version --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index c9fb53e..1358b50 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ inputs = { # Here you can adjust the IHP version of your project # You can find new releases at https://github.com/digitallyinduced/ihp/releases - ihp.url = "github:digitallyinduced/ihp?ref=abb513016b372f9f76b6c95caed66def536a885a"; + ihp.url = "github:digitallyinduced/ihp?ref=80373b24fca3bdb03c0f5da6075cc84520938f8f"; ihp.flake = false; # See https://ihp.digitallyinduced.com/Guide/package-management.html#nixpkgs-pinning @@ -72,4 +72,4 @@ extra-substituters = "https://digitallyinduced.cachix.org"; extra-trusted-public-keys = "digitallyinduced.cachix.org-1:y+wQvrnxQ+PdEsCt91rmvv39qRCYzEgGQaldK26hCKE="; }; -} \ No newline at end of file +} From 70f446a5229a9cf9c58da1b9f1ef2f0798051eaa Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Tue, 6 Jun 2023 00:15:27 +0200 Subject: [PATCH 19/51] updated ihp --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 26a43ec..4f0f446 100644 --- a/flake.lock +++ b/flake.lock @@ -77,16 +77,16 @@ "ihp": { "flake": false, "locked": { - "lastModified": 1682767030, - "narHash": "sha256-YuOEcKBzDAzn+La8Hp6Uhxv6RWojE5wY66zw1oqH6RU=", + "lastModified": 1685976408, + "narHash": "sha256-fd50hIlpWIr9ybRUodGaDxDJNQX2+MGdbqiwBv5l9G0=", "owner": "digitallyinduced", "repo": "ihp", - "rev": "abb513016b372f9f76b6c95caed66def536a885a", + "rev": "80373b24fca3bdb03c0f5da6075cc84520938f8f", "type": "github" }, "original": { "owner": "digitallyinduced", - "ref": "abb513016b372f9f76b6c95caed66def536a885a", + "ref": "80373b24fca3bdb03c0f5da6075cc84520938f8f", "repo": "ihp", "type": "github" } From 7a3888c9f3a98977a25df4ef78147142845dc9c9 Mon Sep 17 00:00:00 2001 From: Nicolas Lenz Date: Wed, 7 Jun 2023 21:17:33 +0200 Subject: [PATCH 20/51] use newest flake-compat version in default.nix the old version wasn't compatible with packages.system.default outputs in flakes --- default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/default.nix b/default.nix index e778a7a..8bd1d4a 100644 --- a/default.nix +++ b/default.nix @@ -2,8 +2,8 @@ (import ( fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/12c64ca55c1014cdc1b16ed5a804aa8576601ff2.tar.gz"; - sha256 = "0jm6nzb83wa6ai17ly9fzpqc40wg1viib8klq8lby54agpl213w5"; + url = "https://github.com/edolstra/flake-compat/archive/35bb57c0c8d8b62bbfd284272c928ceb64ddbde9.tar.gz"; + sha256 = "sha256:1prd9b1xx8c0sfwnyzkspplh30m613j42l1k789s521f4kv4c2z2"; } ) -{ src = ./.; }).defaultNix \ No newline at end of file +{ src = ./.; }).defaultNix From ff63ce46b6fb68f1b8b3cdb0bdd6749f7ef1df93 Mon Sep 17 00:00:00 2001 From: Nicolas Lenz Date: Wed, 7 Jun 2023 21:18:27 +0200 Subject: [PATCH 21/51] update flake for new IHP flakeModule --- flake.lock | 80 ++++++++++++++++++++++++++++++++++++++++-------------- flake.nix | 78 ++++++++-------------------------------------------- 2 files changed, 71 insertions(+), 87 deletions(-) diff --git a/flake.lock b/flake.lock index 4f0f446..f41e6c9 100644 --- a/flake.lock +++ b/flake.lock @@ -8,11 +8,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1685996198, - "narHash": "sha256-MN05XjT2rJZs8FTdZMwNWps8l4hcbEqtKnRuaLLTVkU=", + "lastModified": 1686161729, + "narHash": "sha256-PrKWK7xf01qRvxfJhxyHF3cC3ulqDzBtr+Ja+mIsEXc=", "owner": "cachix", "repo": "devenv", - "rev": "92ae3568a0f463e6c7334e54a21a3b7e4ffb014e", + "rev": "5200404ac8d501bde360cfeae7d8bd020a44755c", "type": "github" }, "original": { @@ -37,6 +37,24 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1685662779, + "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1667395993, @@ -55,6 +73,7 @@ "gitignore": { "inputs": { "nixpkgs": [ + "ihp", "devenv", "pre-commit-hooks", "nixpkgs" @@ -75,20 +94,21 @@ } }, "ihp": { - "flake": false, + "inputs": { + "devenv": "devenv", + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs_2", + "systems": "systems" + }, "locked": { - "lastModified": 1685976408, - "narHash": "sha256-fd50hIlpWIr9ybRUodGaDxDJNQX2+MGdbqiwBv5l9G0=", - "owner": "digitallyinduced", - "repo": "ihp", - "rev": "80373b24fca3bdb03c0f5da6075cc84520938f8f", - "type": "github" + "lastModified": 1686139629, + "narHash": "sha256-beOM3RoPjYLYeU8ObOd8LWfTfo8Sns8lsLGgoqT5ZBg=", + "type": "git", + "url": "file:///home/eisfunke/repos/work/ihp" }, "original": { - "owner": "digitallyinduced", - "ref": "80373b24fca3bdb03c0f5da6075cc84520938f8f", - "repo": "ihp", - "type": "github" + "type": "git", + "url": "file:///home/eisfunke/repos/work/ihp" } }, "lowdown-src": { @@ -111,6 +131,7 @@ "inputs": { "lowdown-src": "lowdown-src", "nixpkgs": [ + "ihp", "devenv", "nixpkgs" ], @@ -147,6 +168,24 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1685564631, + "narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-regression": { "locked": { "lastModified": 1643052045, @@ -198,23 +237,25 @@ "pre-commit-hooks": { "inputs": { "flake-compat": [ + "ihp", "devenv", "flake-compat" ], "flake-utils": "flake-utils", "gitignore": "gitignore", "nixpkgs": [ + "ihp", "devenv", "nixpkgs" ], "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1682596858, - "narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=", + "lastModified": 1686050334, + "narHash": "sha256-R0mczWjDzBpIvM3XXhO908X5e2CQqjyh/gFbwZk/7/Q=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "fb58866e20af98779017134319b5663b8215d912", + "rev": "6881eb2ae5d8a3516e34714e7a90d9d95914c4dc", "type": "github" }, "original": { @@ -225,10 +266,7 @@ }, "root": { "inputs": { - "devenv": "devenv", - "ihp": "ihp", - "nixpkgs": "nixpkgs_2", - "systems": "systems" + "ihp": "ihp" } }, "systems": { diff --git a/flake.nix b/flake.nix index 1358b50..c301806 100644 --- a/flake.nix +++ b/flake.nix @@ -1,75 +1,21 @@ { - inputs = { - # Here you can adjust the IHP version of your project - # You can find new releases at https://github.com/digitallyinduced/ihp/releases - ihp.url = "github:digitallyinduced/ihp?ref=80373b24fca3bdb03c0f5da6075cc84520938f8f"; - ihp.flake = false; + inputs.ihp.url = "github:digitallyinduced/ihp/nicolas/flake"; # TODO branch/release - # See https://ihp.digitallyinduced.com/Guide/package-management.html#nixpkgs-pinning - nixpkgs.url = "github:NixOS/nixpkgs?rev=a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e"; + outputs = { self, ihp }: ihp.inputs.flake-parts.lib.mkFlake { inherit (ihp) inputs; } { - systems.url = "github:nix-systems/default"; - devenv.url = "github:cachix/devenv"; - }; - - outputs = { self, nixpkgs, devenv, systems, ihp, ... } @ inputs: - let - devenvConfig = { pkgs, ... }: { - # See full reference at https://devenv.sh/reference/options/ - # For IHP specific options, see https://ihp.digitallyinduced.com/Guide/package-management.html + systems = import ihp.inputs.systems; + imports = [ ihp.flakeModules.default ]; - # Enable IHP support in devenv.sh - imports = [ "${inputs.ihp}/NixSupport/devenv.nix" ]; - ihp.enable = true; - ihp.projectPath = ./.; + perSystem = { pkgs, ... }: { + devenv.shells.default.packages = with pkgs; [ + # Native dependencies, e.g. imagemagick + ]; - ihp.haskellPackages = p: with p; [ - # Haskell dependencies go here - p.ihp - cabal-install - base - wai - text - hlint - ]; - - packages = with pkgs; [ - # Native dependencies, e.g. imagemagick - ]; - }; - - # Settings when running `nix build` - releaseEnv = pkgs: import "${ihp}/NixSupport/default.nix" { - ihp = ihp; - haskellDeps = (devenvConfig pkgs).ihp.haskellPackages; - otherDeps = p: (devenvConfig pkgs).packages; + ihp = { + enable = true; projectPath = ./.; - - # Dev tools are not needed in the release build - includeDevTools = false; - - # Set optimized = true to get more optimized binaries, but slower build times - optimized = false; }; - forEachSystem = nixpkgs.lib.genAttrs (import systems); - in - { - # Dev shells are used for development, e.g. when running `nix develop --impure` - devShells = forEachSystem (system: { - default = let pkgs = nixpkgs.legacyPackages.${system}; in devenv.lib.mkShell { - inherit inputs pkgs; - modules = [devenvConfig]; - }; - }); - # Binaries for deploying IHP apps. These are used by `nix build --impure` - defaultPackage = forEachSystem (system: releaseEnv nixpkgs.legacyPackages.${system}); - # NixOS configurations goes here - }; - - # The following is needed to use the IHP binary cache. - # This binary cache provides binaries for all IHP packages and commonly used dependencies for all nixpkgs versions used by IHP. - nixConfig = { - extra-substituters = "https://digitallyinduced.cachix.org"; - extra-trusted-public-keys = "digitallyinduced.cachix.org-1:y+wQvrnxQ+PdEsCt91rmvv39qRCYzEgGQaldK26hCKE="; + }; + }; } From 56667c9cebbce4d8bd1da863e22fcfe15af7d8e3 Mon Sep 17 00:00:00 2001 From: Nicolas Lenz Date: Tue, 13 Jun 2023 17:16:17 +0200 Subject: [PATCH 22/51] restructure flake to use inputs follows --- flake.lock | 91 +++++++++++++++++++++++++++++++++--------------------- flake.nix | 32 ++++++++++--------- 2 files changed, 74 insertions(+), 49 deletions(-) diff --git a/flake.lock b/flake.lock index f41e6c9..2e07fb5 100644 --- a/flake.lock +++ b/flake.lock @@ -4,15 +4,18 @@ "inputs": { "flake-compat": "flake-compat", "nix": "nix", - "nixpkgs": "nixpkgs", + "nixpkgs": [ + "ihp", + "nixpkgs" + ], "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1686161729, - "narHash": "sha256-PrKWK7xf01qRvxfJhxyHF3cC3ulqDzBtr+Ja+mIsEXc=", + "lastModified": 1686054274, + "narHash": "sha256-93aebyN7EMmeFFXisFIvp28UEbrozu79vd3pKPjvNR0=", "owner": "cachix", "repo": "devenv", - "rev": "5200404ac8d501bde360cfeae7d8bd020a44755c", + "rev": "c51a56bac8853c019241fe8d821c0a0d82422835", "type": "github" }, "original": { @@ -97,18 +100,40 @@ "inputs": { "devenv": "devenv", "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs_2", + "ihp-boilerplate": "ihp-boilerplate", + "nixpkgs": "nixpkgs", "systems": "systems" }, "locked": { - "lastModified": 1686139629, - "narHash": "sha256-beOM3RoPjYLYeU8ObOd8LWfTfo8Sns8lsLGgoqT5ZBg=", - "type": "git", - "url": "file:///home/eisfunke/repos/work/ihp" + "lastModified": 1686165906, + "narHash": "sha256-O7Tv8DZ/3IyQQeeTrnWCXOIkxOs7BMXotUWxGZphEUE=", + "owner": "digitallyinduced", + "repo": "ihp", + "rev": "c0f3afbf366cac6e7e6f1d886f6d14da6dd1f90a", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "ref": "nicolas/flake", + "repo": "ihp", + "type": "github" + } + }, + "ihp-boilerplate": { + "flake": false, + "locked": { + "lastModified": 1686165507, + "narHash": "sha256-ZaP8GfqjZDnMayPcvWxEqnZmRs4ixf5O5d1Ba867m4c=", + "owner": "digitallyinduced", + "repo": "ihp-boilerplate", + "rev": "ff63ce46b6fb68f1b8b3cdb0bdd6749f7ef1df93", + "type": "github" }, "original": { - "type": "git", - "url": "file:///home/eisfunke/repos/work/ihp" + "owner": "digitallyinduced", + "ref": "nicolas/flake", + "repo": "ihp-boilerplate", + "type": "github" } }, "lowdown-src": { @@ -154,17 +179,17 @@ }, "nixpkgs": { "locked": { - "lastModified": 1678875422, - "narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=", + "lastModified": 1681488673, + "narHash": "sha256-PmojOyePBNvbY3snYE7NAQHTLB53t7Ro+pgiJ4wPCuk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459", + "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-unstable", "repo": "nixpkgs", + "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", "type": "github" } }, @@ -218,22 +243,6 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1681488673, - "narHash": "sha256-PmojOyePBNvbY3snYE7NAQHTLB53t7Ro+pgiJ4wPCuk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", - "type": "github" - } - }, "pre-commit-hooks": { "inputs": { "flake-compat": [ @@ -251,11 +260,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1686050334, - "narHash": "sha256-R0mczWjDzBpIvM3XXhO908X5e2CQqjyh/gFbwZk/7/Q=", + "lastModified": 1682596858, + "narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "6881eb2ae5d8a3516e34714e7a90d9d95914c4dc", + "rev": "fb58866e20af98779017134319b5663b8215d912", "type": "github" }, "original": { @@ -266,7 +275,19 @@ }, "root": { "inputs": { - "ihp": "ihp" + "flake-parts": [ + "ihp", + "flake-parts" + ], + "ihp": "ihp", + "nixpkgs": [ + "ihp", + "nixpkgs" + ], + "systems": [ + "ihp", + "systems" + ] } }, "systems": { diff --git a/flake.nix b/flake.nix index c301806..a02fc65 100644 --- a/flake.nix +++ b/flake.nix @@ -1,21 +1,25 @@ { - inputs.ihp.url = "github:digitallyinduced/ihp/nicolas/flake"; # TODO branch/release + # TODO use currently up-to-date release of IHP + inputs.ihp.url = "github:digitallyinduced/ihp/nicolas/flake"; + inputs.nixpkgs.follows = "ihp/nixpkgs"; + inputs.flake-parts.follows = "ihp/flake-parts"; + inputs.systems.follows = "ihp/systems"; - outputs = { self, ihp }: ihp.inputs.flake-parts.lib.mkFlake { inherit (ihp) inputs; } { + outputs = inputs@{ ihp, flake-parts, systems, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { - systems = import ihp.inputs.systems; - imports = [ ihp.flakeModules.default ]; + systems = import systems; + imports = [ ihp.flakeModules.default ]; - perSystem = { pkgs, ... }: { - devenv.shells.default.packages = with pkgs; [ - # Native dependencies, e.g. imagemagick - ]; - - ihp = { - enable = true; - projectPath = ./.; + perSystem = { pkgs, ... }: { + ihp = { + enable = true; + projectPath = ./.; + packages = with pkgs; [ + # Native dependencies, e.g. imagemagick + ]; + }; }; - }; - }; + }; } From 6c229417f7d37a3555c21d1701e98af325cd83d8 Mon Sep 17 00:00:00 2001 From: Nicolas Lenz Date: Tue, 20 Jun 2023 11:50:30 +0200 Subject: [PATCH 23/51] refactor inputs --- flake.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index a02fc65..76aba75 100644 --- a/flake.nix +++ b/flake.nix @@ -1,9 +1,11 @@ { - # TODO use currently up-to-date release of IHP - inputs.ihp.url = "github:digitallyinduced/ihp/nicolas/flake"; - inputs.nixpkgs.follows = "ihp/nixpkgs"; - inputs.flake-parts.follows = "ihp/flake-parts"; - inputs.systems.follows = "ihp/systems"; + inputs = { + # TODO use currently up-to-date release of IHP + ihp.url = "github:digitallyinduced/ihp/nicolas/flake"; + nixpkgs.follows = "ihp/nixpkgs"; + flake-parts.follows = "ihp/flake-parts"; + systems.follows = "ihp/systems"; + }; outputs = inputs@{ ihp, flake-parts, systems, ... }: flake-parts.lib.mkFlake { inherit inputs; } { From cda3d4f990306ee29cf82348ca2301f3e142345d Mon Sep 17 00:00:00 2001 From: Nicolas Lenz Date: Tue, 20 Jun 2023 12:04:58 +0200 Subject: [PATCH 24/51] add devenv input following IHP --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index 76aba75..b387c52 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,7 @@ ihp.url = "github:digitallyinduced/ihp/nicolas/flake"; nixpkgs.follows = "ihp/nixpkgs"; flake-parts.follows = "ihp/flake-parts"; + devenv.follows = "ihp/devenv"; systems.follows = "ihp/systems"; }; From d0b76031f62b43b7cae29a7a374c90bd2b6b3a95 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sat, 24 Jun 2023 13:06:27 +0200 Subject: [PATCH 25/51] Skip yes questions on first direnv run caused by nix flake config --- .envrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.envrc b/.envrc index 099cf2b..e9b9e71 100644 --- a/.envrc +++ b/.envrc @@ -2,7 +2,7 @@ if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8=" fi -use flake . --impure +use flake . --impure --accept-flake-config # Include .env file if it exists locally. Use the .env file to load env vars that you don't want to commit to git if [ -f .env ] From dcca577d6bf17e30e9c2086b6a3687145ef43794 Mon Sep 17 00:00:00 2001 From: Nicolas Lenz Date: Tue, 4 Jul 2023 15:51:50 +0200 Subject: [PATCH 26/51] add default haskellPackages to flake template --- flake.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/flake.nix b/flake.nix index b387c52..327155f 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,15 @@ packages = with pkgs; [ # Native dependencies, e.g. imagemagick ]; + haskellPackages = p: with p; [ + # Haskell dependencies go here + p.ihp + cabal-install + base + wai + text + hlint + ]; }; }; From 2b2ae12871ce8dd8a959d1ef6b64f5b4c4e649ca Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Thu, 13 Jul 2023 21:09:23 +0200 Subject: [PATCH 27/51] use latest ihp master --- flake.lock | 11 +++++++---- flake.nix | 3 +-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 2e07fb5..1e4ffcb 100644 --- a/flake.lock +++ b/flake.lock @@ -105,16 +105,15 @@ "systems": "systems" }, "locked": { - "lastModified": 1686165906, - "narHash": "sha256-O7Tv8DZ/3IyQQeeTrnWCXOIkxOs7BMXotUWxGZphEUE=", + "lastModified": 1689274971, + "narHash": "sha256-OnZDWHBwiCBbnf6ZpH8T+XqCbM3gV3gjCOHQ9qGhye4=", "owner": "digitallyinduced", "repo": "ihp", - "rev": "c0f3afbf366cac6e7e6f1d886f6d14da6dd1f90a", + "rev": "7fd9c8c29e4b57ea5a619d7f83bcaf1cd93ca16d", "type": "github" }, "original": { "owner": "digitallyinduced", - "ref": "nicolas/flake", "repo": "ihp", "type": "github" } @@ -275,6 +274,10 @@ }, "root": { "inputs": { + "devenv": [ + "ihp", + "devenv" + ], "flake-parts": [ "ihp", "flake-parts" diff --git a/flake.nix b/flake.nix index 327155f..25243a9 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,6 @@ { inputs = { - # TODO use currently up-to-date release of IHP - ihp.url = "github:digitallyinduced/ihp/nicolas/flake"; + ihp.url = "github:digitallyinduced/ihp"; nixpkgs.follows = "ihp/nixpkgs"; flake-parts.follows = "ihp/flake-parts"; devenv.follows = "ihp/devenv"; From 28439b042bcde95a1b99222a51f80d205d7bbf4e Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Fri, 14 Jul 2023 20:18:00 +0200 Subject: [PATCH 28/51] Updated flake.lock --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 1e4ffcb..8072b3e 100644 --- a/flake.lock +++ b/flake.lock @@ -105,11 +105,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1689274971, - "narHash": "sha256-OnZDWHBwiCBbnf6ZpH8T+XqCbM3gV3gjCOHQ9qGhye4=", + "lastModified": 1689358150, + "narHash": "sha256-R+aKxcBZhiSC/qjK0Cssa4rIulXqz2fL8wODvg6GITk=", "owner": "digitallyinduced", "repo": "ihp", - "rev": "7fd9c8c29e4b57ea5a619d7f83bcaf1cd93ca16d", + "rev": "ed567e800409dab50d7adf57a4075cfeb7a23db4", "type": "github" }, "original": { From 273ca9692c28e7af277a6a88937bbc4dde6b5e93 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sat, 15 Jul 2023 17:24:48 +0200 Subject: [PATCH 29/51] updated to latest ihp master --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 8072b3e..194fa2e 100644 --- a/flake.lock +++ b/flake.lock @@ -105,11 +105,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1689358150, - "narHash": "sha256-R+aKxcBZhiSC/qjK0Cssa4rIulXqz2fL8wODvg6GITk=", + "lastModified": 1689425378, + "narHash": "sha256-OvszAeAfnBReQeeW7tq8UOVtXBKqcaMNyvKmhjDhsrY=", "owner": "digitallyinduced", "repo": "ihp", - "rev": "ed567e800409dab50d7adf57a4075cfeb7a23db4", + "rev": "142c32c8351cc6164704f2acbb504575c55f1949", "type": "github" }, "original": { From 4bd716141cbb54b49c332d43fb54d7341bedb327 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Mon, 17 Jul 2023 22:45:31 +0200 Subject: [PATCH 30/51] Updated boilerplate to use the new IHP_LIB env var --- .ghci | 6 +++--- Makefile | 14 -------------- flake.lock | 6 +++--- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/.ghci b/.ghci index 01a4ea9..48ee12a 100644 --- a/.ghci +++ b/.ghci @@ -1,4 +1,4 @@ :set -XNoImplicitPrelude -:def source readFile -:source build/ihp-lib/applicationGhciConfig -import IHP.Prelude +:def loadFromIHP \file -> (System.Environment.getEnv "IHP_LIB") >>= (\ihpLib -> readFile (ihpLib <> "/" <> file)) +:loadFromIHP applicationGhciConfig +import IHP.Prelude \ No newline at end of file diff --git a/Makefile b/Makefile index 15b7a26..96fd66b 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,3 @@ -ifneq ($(wildcard IHP/.*),) -IHP = IHP/lib/IHP -else -ifneq ($(wildcard build/ihp-lib),) -IHP = build/ihp-lib -else -ifneq ($(shell which RunDevServer),) -IHP = $(shell dirname $$(which RunDevServer))/../lib/IHP -else -IHP = $(error IHP not found! Run the following command to fix this: nix-shell --run 'make .envrc' ) -endif -endif -endif - CSS_FILES += ${IHP}/static/vendor/bootstrap.min.css CSS_FILES += ${IHP}/static/vendor/flatpickr.min.css CSS_FILES += static/app.css diff --git a/flake.lock b/flake.lock index 194fa2e..fcc5cd1 100644 --- a/flake.lock +++ b/flake.lock @@ -105,11 +105,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1689425378, - "narHash": "sha256-OvszAeAfnBReQeeW7tq8UOVtXBKqcaMNyvKmhjDhsrY=", + "lastModified": 1689625799, + "narHash": "sha256-/HlmrJD0ieLn0a3ADsx0DRchlWHAWlTdPyvZ6etQ0N0=", "owner": "digitallyinduced", "repo": "ihp", - "rev": "142c32c8351cc6164704f2acbb504575c55f1949", + "rev": "b70de90278ff24971e79cc41bfdea7067890971b", "type": "github" }, "original": { From 4bee32b4e473dda3e82603d808cc28447a77be3b Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Mon, 17 Jul 2023 23:21:05 +0200 Subject: [PATCH 31/51] Fixed HLS not working due to missing build/ihp-lib --- hie.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hie.yaml b/hie.yaml index 0c8a861..7864281 100644 --- a/hie.yaml +++ b/hie.yaml @@ -1,4 +1,4 @@ # Used by haskell-language-server to find GHC settings cradle: bios: - program: build/ihp-lib/.hie-bios \ No newline at end of file + shell: "$IHP/.hie-bios" \ No newline at end of file From 4152a90f821740194b04a91434e2217bf76a6280 Mon Sep 17 00:00:00 2001 From: Nicolas Lenz Date: Tue, 18 Jul 2023 16:21:01 +0200 Subject: [PATCH 32/51] remove lock file nix should lock the inputs itself on first call --- flake.lock | 314 ----------------------------------------------------- 1 file changed, 314 deletions(-) delete mode 100644 flake.lock diff --git a/flake.lock b/flake.lock deleted file mode 100644 index fcc5cd1..0000000 --- a/flake.lock +++ /dev/null @@ -1,314 +0,0 @@ -{ - "nodes": { - "devenv": { - "inputs": { - "flake-compat": "flake-compat", - "nix": "nix", - "nixpkgs": [ - "ihp", - "nixpkgs" - ], - "pre-commit-hooks": "pre-commit-hooks" - }, - "locked": { - "lastModified": 1686054274, - "narHash": "sha256-93aebyN7EMmeFFXisFIvp28UEbrozu79vd3pKPjvNR0=", - "owner": "cachix", - "repo": "devenv", - "rev": "c51a56bac8853c019241fe8d821c0a0d82422835", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "devenv", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-parts": { - "inputs": { - "nixpkgs-lib": "nixpkgs-lib" - }, - "locked": { - "lastModified": 1685662779, - "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-utils": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "ihp", - "devenv", - "pre-commit-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1660459072, - "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "ihp": { - "inputs": { - "devenv": "devenv", - "flake-parts": "flake-parts", - "ihp-boilerplate": "ihp-boilerplate", - "nixpkgs": "nixpkgs", - "systems": "systems" - }, - "locked": { - "lastModified": 1689625799, - "narHash": "sha256-/HlmrJD0ieLn0a3ADsx0DRchlWHAWlTdPyvZ6etQ0N0=", - "owner": "digitallyinduced", - "repo": "ihp", - "rev": "b70de90278ff24971e79cc41bfdea7067890971b", - "type": "github" - }, - "original": { - "owner": "digitallyinduced", - "repo": "ihp", - "type": "github" - } - }, - "ihp-boilerplate": { - "flake": false, - "locked": { - "lastModified": 1686165507, - "narHash": "sha256-ZaP8GfqjZDnMayPcvWxEqnZmRs4ixf5O5d1Ba867m4c=", - "owner": "digitallyinduced", - "repo": "ihp-boilerplate", - "rev": "ff63ce46b6fb68f1b8b3cdb0bdd6749f7ef1df93", - "type": "github" - }, - "original": { - "owner": "digitallyinduced", - "ref": "nicolas/flake", - "repo": "ihp-boilerplate", - "type": "github" - } - }, - "lowdown-src": { - "flake": false, - "locked": { - "lastModified": 1633514407, - "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", - "owner": "kristapsdz", - "repo": "lowdown", - "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", - "type": "github" - }, - "original": { - "owner": "kristapsdz", - "repo": "lowdown", - "type": "github" - } - }, - "nix": { - "inputs": { - "lowdown-src": "lowdown-src", - "nixpkgs": [ - "ihp", - "devenv", - "nixpkgs" - ], - "nixpkgs-regression": "nixpkgs-regression" - }, - "locked": { - "lastModified": 1676545802, - "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=", - "owner": "domenkozar", - "repo": "nix", - "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f", - "type": "github" - }, - "original": { - "owner": "domenkozar", - "ref": "relaxed-flakes", - "repo": "nix", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1681488673, - "narHash": "sha256-PmojOyePBNvbY3snYE7NAQHTLB53t7Ro+pgiJ4wPCuk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", - "type": "github" - } - }, - "nixpkgs-lib": { - "locked": { - "dir": "lib", - "lastModified": 1685564631, - "narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a", - "type": "github" - }, - "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-regression": { - "locked": { - "lastModified": 1643052045, - "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", - "type": "github" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1678872516, - "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-22.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": [ - "ihp", - "devenv", - "flake-compat" - ], - "flake-utils": "flake-utils", - "gitignore": "gitignore", - "nixpkgs": [ - "ihp", - "devenv", - "nixpkgs" - ], - "nixpkgs-stable": "nixpkgs-stable" - }, - "locked": { - "lastModified": 1682596858, - "narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "fb58866e20af98779017134319b5663b8215d912", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, - "root": { - "inputs": { - "devenv": [ - "ihp", - "devenv" - ], - "flake-parts": [ - "ihp", - "flake-parts" - ], - "ihp": "ihp", - "nixpkgs": [ - "ihp", - "nixpkgs" - ], - "systems": [ - "ihp", - "systems" - ] - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} From 8f42f187b69b86ed54377c1aeed580ddf25f16ed Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Fri, 21 Jul 2023 09:28:16 +0200 Subject: [PATCH 33/51] Use IHP v1.1 branch --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 25243a9..69bdc2f 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - ihp.url = "github:digitallyinduced/ihp"; + ihp.url = "github:digitallyinduced/ihp/v1.1"; nixpkgs.follows = "ihp/nixpkgs"; flake-parts.follows = "ihp/flake-parts"; devenv.follows = "ihp/devenv"; From 83f69ba08e7ba72ec73230e61429a5448770e47f Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Fri, 21 Jul 2023 09:29:41 +0200 Subject: [PATCH 34/51] Updated start script for IHP v1.1 Fixes https://github.com/digitallyinduced/ihp-boilerplate/issues/26 --- start | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/start b/start index 679a691..81464a8 100755 --- a/start +++ b/start @@ -1,29 +1,2 @@ #!/usr/bin/env bash -# Script to start the local dev server - -set -e - -# On macOS the default max count of open files is 256. IHP needs atleast 1024 to run well. -# -# The wai-static-middleware sometimes doesn't close it's file handles directly (likely because of it's use of lazy bytestrings) -# and then we usually hit the file limit of 256 at some point. With 1024 the limit is usually never hit as the GC kicks in earlier -# and will close the remaining lazy bytestring handles. -if [[ $OSTYPE == 'darwin'* ]]; then - ulimit -n 4096 -fi - -# Unless the RunDevServer binary is available, we rebuild the .envrc cache with nix-shell -# and config cachix for using our binary cache -command -v RunDevServer >/dev/null 2>&1 \ - || { echo "PATH_add $(nix-shell -j auto --cores 0 --run 'printf %q $PATH')" > .envrc; } - -# Now we have to load the PATH variable from the .envrc cache -direnv allow -eval "$(direnv hook bash)" -eval "$(direnv export bash)" - -# You can define custom env vars here: -# export CUSTOM_ENV_VAR=".." - -# Finally start the dev server -RunDevServer +devenv up From fb88f6f4cdc0cf9dea808ea63e5397888f0e56cf Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Fri, 21 Jul 2023 15:45:00 +0200 Subject: [PATCH 35/51] Readded flake.lock Without the lockfile ihp-new crashes when creating a new project --- flake.lock | 315 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..199fd5d --- /dev/null +++ b/flake.lock @@ -0,0 +1,315 @@ +{ + "nodes": { + "devenv": { + "inputs": { + "flake-compat": "flake-compat", + "nix": "nix", + "nixpkgs": [ + "ihp", + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1686054274, + "narHash": "sha256-93aebyN7EMmeFFXisFIvp28UEbrozu79vd3pKPjvNR0=", + "owner": "cachix", + "repo": "devenv", + "rev": "c51a56bac8853c019241fe8d821c0a0d82422835", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1685662779, + "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "ihp", + "devenv", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "ihp": { + "inputs": { + "devenv": "devenv", + "flake-parts": "flake-parts", + "ihp-boilerplate": "ihp-boilerplate", + "nixpkgs": "nixpkgs", + "systems": "systems" + }, + "locked": { + "lastModified": 1689924346, + "narHash": "sha256-W2AF9A4F6BqANOqzAAzzGwvW38gWJ/UW/sGFv56LnV4=", + "owner": "digitallyinduced", + "repo": "ihp", + "rev": "ec6324cd7d4a2fb76d91c27603a08741a99a86d6", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "ref": "v1.1", + "repo": "ihp", + "type": "github" + } + }, + "ihp-boilerplate": { + "flake": false, + "locked": { + "lastModified": 1686165507, + "narHash": "sha256-ZaP8GfqjZDnMayPcvWxEqnZmRs4ixf5O5d1Ba867m4c=", + "owner": "digitallyinduced", + "repo": "ihp-boilerplate", + "rev": "ff63ce46b6fb68f1b8b3cdb0bdd6749f7ef1df93", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "ref": "nicolas/flake", + "repo": "ihp-boilerplate", + "type": "github" + } + }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": [ + "ihp", + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1676545802, + "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=", + "owner": "domenkozar", + "repo": "nix", + "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "relaxed-flakes", + "repo": "nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1681488673, + "narHash": "sha256-PmojOyePBNvbY3snYE7NAQHTLB53t7Ro+pgiJ4wPCuk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1685564631, + "narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1678872516, + "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": [ + "ihp", + "devenv", + "flake-compat" + ], + "flake-utils": "flake-utils", + "gitignore": "gitignore", + "nixpkgs": [ + "ihp", + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1682596858, + "narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "fb58866e20af98779017134319b5663b8215d912", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": [ + "ihp", + "devenv" + ], + "flake-parts": [ + "ihp", + "flake-parts" + ], + "ihp": "ihp", + "nixpkgs": [ + "ihp", + "nixpkgs" + ], + "systems": [ + "ihp", + "systems" + ] + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} From 832d1a5aed4dc3625486c82b06a1d07024267680 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Fri, 21 Jul 2023 17:53:09 +0200 Subject: [PATCH 36/51] Updated to the right commit --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 199fd5d..55f1735 100644 --- a/flake.lock +++ b/flake.lock @@ -105,11 +105,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1689924346, - "narHash": "sha256-W2AF9A4F6BqANOqzAAzzGwvW38gWJ/UW/sGFv56LnV4=", + "lastModified": 1689949405, + "narHash": "sha256-o0ZSDaDFgwbXqozHfcXKxW4FeF7JqaGprAh6r7NhvhE=", "owner": "digitallyinduced", "repo": "ihp", - "rev": "ec6324cd7d4a2fb76d91c27603a08741a99a86d6", + "rev": "e6c6eaf1d089423a03e586cd25d1eda39f5a6b11", "type": "github" }, "original": { From 07e71a18636ec6793b4ff79971c129558cd1bb2d Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Tue, 3 Oct 2023 12:44:50 +0200 Subject: [PATCH 37/51] Removed hlint as a default dependency --- flake.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/flake.nix b/flake.nix index 69bdc2f..d44d828 100644 --- a/flake.nix +++ b/flake.nix @@ -27,7 +27,6 @@ base wai text - hlint ]; }; }; From 7036eaafe26031808e3d9948ae85141544db8dc7 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Tue, 14 Nov 2023 18:22:16 -0800 Subject: [PATCH 38/51] Updated to IHP v1.2.0 --- flake.lock | 369 ++++++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 2 +- 2 files changed, 364 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index 55f1735..8bbeb25 100644 --- a/flake.lock +++ b/flake.lock @@ -10,6 +10,32 @@ ], "pre-commit-hooks": "pre-commit-hooks" }, + "locked": { + "lastModified": 1694422554, + "narHash": "sha256-s5NTPzT66yIMmau+ZGP7q9z4NjgceDETL4xZ6HJ/TBg=", + "owner": "cachix", + "repo": "devenv", + "rev": "63d20fe09aa09060ea9ec9bb6d582c025402ba15", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "devenv_2": { + "inputs": { + "flake-compat": "flake-compat_2", + "nix": "nix_2", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks_2" + }, "locked": { "lastModified": 1686054274, "narHash": "sha256-93aebyN7EMmeFFXisFIvp28UEbrozu79vd3pKPjvNR0=", @@ -40,10 +66,44 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, + "locked": { + "lastModified": 1693611461, + "narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, "locked": { "lastModified": 1685662779, "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", @@ -59,6 +119,24 @@ } }, "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { "locked": { "lastModified": 1667395993, "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", @@ -96,30 +174,98 @@ "type": "github" } }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "ihp": { "inputs": { "devenv": "devenv", "flake-parts": "flake-parts", "ihp-boilerplate": "ihp-boilerplate", - "nixpkgs": "nixpkgs", - "systems": "systems" + "nix-filter": "nix-filter", + "nixpkgs": "nixpkgs_2", + "systems": "systems_3" }, "locked": { - "lastModified": 1689949405, - "narHash": "sha256-o0ZSDaDFgwbXqozHfcXKxW4FeF7JqaGprAh6r7NhvhE=", + "lastModified": 1700013490, + "narHash": "sha256-oQz7ZBrHe6WwYMwnxxUgnYM55CuH5Oxjz6mrLnYbB7U=", "owner": "digitallyinduced", "repo": "ihp", - "rev": "e6c6eaf1d089423a03e586cd25d1eda39f5a6b11", + "rev": "d59a65d71943cb506eee3ad6255f017963237359", "type": "github" }, "original": { "owner": "digitallyinduced", - "ref": "v1.1", + "ref": "v1.2", "repo": "ihp", "type": "github" } }, "ihp-boilerplate": { + "inputs": { + "devenv": [ + "ihp", + "ihp-boilerplate", + "ihp", + "devenv" + ], + "flake-parts": [ + "ihp", + "ihp-boilerplate", + "ihp", + "flake-parts" + ], + "ihp": "ihp_2", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "nixpkgs" + ], + "systems": [ + "ihp", + "ihp-boilerplate", + "ihp", + "systems" + ] + }, + "locked": { + "lastModified": 1689954789, + "narHash": "sha256-RsgD1YGSlx+K/GkTspOdg/tz47PyZZDc66PzfFZvqBk=", + "owner": "digitallyinduced", + "repo": "ihp-boilerplate", + "rev": "832d1a5aed4dc3625486c82b06a1d07024267680", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "repo": "ihp-boilerplate", + "type": "github" + } + }, + "ihp-boilerplate_2": { "flake": false, "locked": { "lastModified": 1686165507, @@ -136,6 +282,29 @@ "type": "github" } }, + "ihp_2": { + "inputs": { + "devenv": "devenv_2", + "flake-parts": "flake-parts_2", + "ihp-boilerplate": "ihp-boilerplate_2", + "nixpkgs": "nixpkgs", + "systems": "systems_2" + }, + "locked": { + "lastModified": 1689949405, + "narHash": "sha256-o0ZSDaDFgwbXqozHfcXKxW4FeF7JqaGprAh6r7NhvhE=", + "owner": "digitallyinduced", + "repo": "ihp", + "rev": "e6c6eaf1d089423a03e586cd25d1eda39f5a6b11", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "ref": "v1.1", + "repo": "ihp", + "type": "github" + } + }, "lowdown-src": { "flake": false, "locked": { @@ -152,6 +321,22 @@ "type": "github" } }, + "lowdown-src_2": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, "nix": { "inputs": { "lowdown-src": "lowdown-src", @@ -177,6 +362,48 @@ "type": "github" } }, + "nix-filter": { + "locked": { + "lastModified": 1694434370, + "narHash": "sha256-7yfdTR4mCvWZ39Q6HUcsa18tr0mg+fJZSaHE/63rwoo=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "d6381c442f79f2f1fdfde00521c3d15d6c21218e", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, + "nix_2": { + "inputs": { + "lowdown-src": "lowdown-src_2", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression_2" + }, + "locked": { + "lastModified": 1676545802, + "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=", + "owner": "domenkozar", + "repo": "nix", + "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "relaxed-flakes", + "repo": "nix", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1681488673, @@ -194,6 +421,24 @@ } }, "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1693471703, + "narHash": "sha256-0l03ZBL8P1P6z8MaSDS/MvuU8E75rVxe5eE1N6gxeTo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3e52e76b70d5508f3cec70b882a29199f4d1ee85", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib_2": { "locked": { "dir": "lib", "lastModified": 1685564631, @@ -227,7 +472,39 @@ "type": "github" } }, + "nixpkgs-regression_2": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, "nixpkgs-stable": { + "locked": { + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_2": { "locked": { "lastModified": 1678872516, "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", @@ -243,6 +520,22 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1696291921, + "narHash": "sha256-isKgVAoUxuxYEuO3Q4xhbfKcZrF/+UkJtOTv0eb/W5E=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ea0284a3da391822909be5e98a60c1e62572a7dc", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ea0284a3da391822909be5e98a60c1e62572a7dc", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": [ @@ -259,6 +552,40 @@ ], "nixpkgs-stable": "nixpkgs-stable" }, + "locked": { + "lastModified": 1688056373, + "narHash": "sha256-2+SDlNRTKsgo3LBRiMUcoEUb6sDViRNQhzJquZ4koOI=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "5843cf069272d92b60c3ed9e55b7a8989c01d4c7", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pre-commit-hooks_2": { + "inputs": { + "flake-compat": [ + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "flake-compat" + ], + "flake-utils": "flake-utils_2", + "gitignore": "gitignore_2", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_2" + }, "locked": { "lastModified": 1682596858, "narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=", @@ -308,6 +635,36 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index d44d828..6f6ab11 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - ihp.url = "github:digitallyinduced/ihp/v1.1"; + ihp.url = "github:digitallyinduced/ihp/v1.2"; nixpkgs.follows = "ihp/nixpkgs"; flake-parts.follows = "ihp/flake-parts"; devenv.follows = "ihp/devenv"; From d8dc79c21147a6ff2c80e422d4938ad38d6a26b6 Mon Sep 17 00:00:00 2001 From: Amitai Burstein Date: Wed, 21 Feb 2024 20:19:40 +0200 Subject: [PATCH 39/51] Add more defaults an docs to flake.nix (#30) * Add more defaults an docs to flake.nix * SMTP config for local development. * Code review fixes * Change app name to `qa` * Remove mailhog from packages * Add SMTP_ENCRYPTION * envName * Update flake.nix * Update flake.nix * Apply suggestions from code review Co-authored-by: Marc Scholten * Apply suggestions from code review --------- Co-authored-by: Marc Scholten --- .envrc | 5 ++++ flake.nix | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/.envrc b/.envrc index e9b9e71..83a6fc0 100644 --- a/.envrc +++ b/.envrc @@ -14,3 +14,8 @@ fi # Add your env vars here # # E.g. export AWS_ACCESS_KEY_ID="XXXXX" + +# SMTP config for local development. +export SMTP_HOST="127.0.0.1" # On some computers may need `127.0.1.1` instead. +export SMTP_PORT="1025" +export SMTP_ENCRYPTION="Unencrypted" \ No newline at end of file diff --git a/flake.nix b/flake.nix index 6f6ab11..13e2004 100644 --- a/flake.nix +++ b/flake.nix @@ -27,8 +27,85 @@ base wai text + + # Uncomment on local development for testing + # hspec ]; }; + + # Custom configuration that will start with `devenv up` + devenv.shells.default = { + # Start Mailhog on local development to catch outgoing emails + # services.mailhog.enable = true; + + # Custom processes that don't appear in https://devenv.sh/reference/options/ + processes = { + # Uncomment if you use tailwindcss. + # tailwind.exec = "tailwindcss -c tailwind/tailwind.config.js -i ./tailwind/app.css -o static/app.css --watch=always"; + }; + }; + }; + + # Adding the new NixOS configuration for "qa" + # See https://ihp.digitallyinduced.com/Guide/deployment.html#deploying-with-deploytonixos for more info + # Used to deploy the IHP application to AWS. + # + # Change the `CHANGE-ME` to your correct config. + flake.nixosConfigurations."qa" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = inputs; + modules = [ + "${nixpkgs}/nixos/modules/virtualisation/amazon-image.nix" + ihp.nixosModules.appWithPostgres + ({ lib, pkgs, ... }: { + + networking.firewall = { + enable = true; + allowedTCPPorts = [ 22 80 443 ]; + }; + + # Enable the Let's encrypt certificate + security.acme.defaults.email = "CHANGE-ME@example.com"; + + # Accept the terms of service of the Let's encrypt provider. + security.acme.acceptTerms = true; + + services.nginx = { + virtualHosts."CHANGE-ME.com" = { + # Uncomment to have http auth with username `foo` and password `bar`. + # basicAuth = { foo = "bar"; }; + }; + }; + + services.ihp = { + domain = "CHANGE-ME.com"; + migrations = ./Application/Migration; + schema = ./Application/Schema.sql; + fixtures = ./Application/Fixtures.sql; + sessionSecret = "CHANGE-ME"; + additionalEnvVars = { + # Uncomment to use a custom database URL + # DATABASE_URL = "postgresql://postgres:...CHANGE-ME"; + + SMTP_HOST = "email-smtp.eu-west-1.amazonaws.com"; + SMTP_PORT = "587"; + SMTP_ENCRYPTION = "STARTTLS"; + + SMTP_USER = "CHANGE-ME"; + SMTP_PASSWORD = "CHANGE-ME"; + + AWS_ACCESS_KEY_ID = "CHANGE-ME"; + AWS_SECRET_ACCESS_KEY = "CHANGE-ME"; + }; + }; + # As we use a pre-built AMI on AWS, + # it is essential to enable automatic updates. + # @see https://nixos.wiki/wiki/Automatic_system_upgrades + system.autoUpgrade.enable = true; + # Keep as is. See https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "23.05"; + }) + ]; }; }; From 44cdcd3d60940c00b5b402f90e87b9cb8dc091c1 Mon Sep 17 00:00:00 2001 From: Amitai Burstein Date: Thu, 22 Feb 2024 11:39:53 +0200 Subject: [PATCH 40/51] Declare nixpkgs (#31) --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 13e2004..8351392 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ systems.follows = "ihp/systems"; }; - outputs = inputs@{ ihp, flake-parts, systems, ... }: + outputs = inputs@{ self, nixpkgs, ihp, flake-parts, systems, ... }: flake-parts.lib.mkFlake { inherit inputs; } { systems = import systems; From d8b89b2a9d8a617508a5d1026b799bf8b9536056 Mon Sep 17 00:00:00 2001 From: Amitai Burstein Date: Tue, 27 Feb 2024 15:12:14 +0200 Subject: [PATCH 41/51] Add config with placeholder for logging to AWS CloudWatch (#32) * Add config with placeholder for logging to AWS CloudWatch * Comment out services.vector --- flake.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/flake.nix b/flake.nix index 8351392..277dfa3 100644 --- a/flake.nix +++ b/flake.nix @@ -77,6 +77,34 @@ }; }; + # Logging to AWS CloudWatch + # services.vector = { + # enable = true; + # journaldAccess = true; + # settings = { + # sources.journald = { + # type = "journald"; + # # Log only the services we care about + # include_units = ["app.service" "nginx.service" "worker.service"]; + # }; + + # sinks.out = { + # group_name = "CHANGE-ME"; + # stream_name = "CHANGE-ME"; + # # Change the region to the correct one, e.g. `us-east-1` + # region = "CHANGE-ME"; + # auth = { + # access_key_id = "CHANGE-ME"; + # secret_access_key = "CHANGE-ME"; + # }; + # inputs = ["journald"]; + # type = "aws_cloudwatch_logs"; + # compression = "gzip"; + # encoding.codec = "json"; + # }; + # }; + # }; + services.ihp = { domain = "CHANGE-ME.com"; migrations = ./Application/Migration; From 73df8419c067029129fbda8677c1fdc97252199f Mon Sep 17 00:00:00 2001 From: Amitai Burstein Date: Tue, 27 Feb 2024 22:37:46 +0200 Subject: [PATCH 42/51] Add IHP_SESSION_SECRET placeholder (#33) * Add IHP_SESSION_SECRET placeholder * Add comment * Improve comment --- flake.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flake.nix b/flake.nix index 277dfa3..b05c9cf 100644 --- a/flake.nix +++ b/flake.nix @@ -115,6 +115,11 @@ # Uncomment to use a custom database URL # DATABASE_URL = "postgresql://postgres:...CHANGE-ME"; + # Uncomment to use a custom session secret, ensuring sessions aren't invalidated + # on each deploy. + # Learn how to create the secret key in https://ihp.digitallyinduced.com/Guide/deployment.html#ihpsessionsecret + # IHP_SESSION_SECRET = "CHANGE-ME"; + SMTP_HOST = "email-smtp.eu-west-1.amazonaws.com"; SMTP_PORT = "587"; SMTP_ENCRYPTION = "STARTTLS"; From 323591d6135f7a89b5b4e518d5d420cd5b046fe2 Mon Sep 17 00:00:00 2001 From: Aron Novak Date: Mon, 11 Mar 2024 17:40:52 +0100 Subject: [PATCH 43/51] custom db url -right way (#34) --- flake.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index b05c9cf..08d108f 100644 --- a/flake.nix +++ b/flake.nix @@ -111,10 +111,10 @@ schema = ./Application/Schema.sql; fixtures = ./Application/Fixtures.sql; sessionSecret = "CHANGE-ME"; - additionalEnvVars = { - # Uncomment to use a custom database URL - # DATABASE_URL = "postgresql://postgres:...CHANGE-ME"; + # Uncomment to use a custom database URL + # databaseUrl = lib.mkForce "postgresql://postgres:...CHANGE-ME"; + additionalEnvVars = { # Uncomment to use a custom session secret, ensuring sessions aren't invalidated # on each deploy. # Learn how to create the secret key in https://ihp.digitallyinduced.com/Guide/deployment.html#ihpsessionsecret From 68eb3debd8e353653391214a658deafa6f72d91c Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Sat, 4 May 2024 16:57:28 -0700 Subject: [PATCH 44/51] Updated to IHP v1.3 --- flake.lock | 646 ++++++++++++++++++++++++++++++++++++++++++++++++++--- flake.nix | 2 +- 2 files changed, 611 insertions(+), 37 deletions(-) diff --git a/flake.lock b/flake.lock index 8bbeb25..af25d21 100644 --- a/flake.lock +++ b/flake.lock @@ -1,15 +1,109 @@ { "nodes": { + "cachix": { + "inputs": { + "devenv": "devenv_2", + "flake-compat": [ + "ihp", + "devenv", + "flake-compat" + ], + "nixpkgs": [ + "ihp", + "devenv", + "nixpkgs" + ], + "pre-commit-hooks": [ + "ihp", + "devenv", + "pre-commit-hooks" + ] + }, + "locked": { + "lastModified": 1712055811, + "narHash": "sha256-7FcfMm5A/f02yyzuavJe06zLa9hcMHsagE28ADcmQvk=", + "owner": "cachix", + "repo": "cachix", + "rev": "02e38da89851ec7fec3356a5c04bc8349cae0e30", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "cachix", + "type": "github" + } + }, "devenv": { "inputs": { - "flake-compat": "flake-compat", - "nix": "nix", + "cachix": "cachix", + "flake-compat": "flake-compat_2", + "nix": "nix_2", "nixpkgs": [ "ihp", "nixpkgs" ], "pre-commit-hooks": "pre-commit-hooks" }, + "locked": { + "lastModified": 1714390914, + "narHash": "sha256-W5DFIifCjGYJXJzLU3RpqBeqes4zrf0Sr/6rwzTygPU=", + "owner": "cachix", + "repo": "devenv", + "rev": "34e6461fd76b5f51ad5f8214f5cf22c4cd7a196e", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "refs/tags/v1.0.5", + "repo": "devenv", + "type": "github" + } + }, + "devenv_2": { + "inputs": { + "flake-compat": [ + "ihp", + "devenv", + "cachix", + "flake-compat" + ], + "nix": "nix", + "nixpkgs": "nixpkgs", + "poetry2nix": "poetry2nix", + "pre-commit-hooks": [ + "ihp", + "devenv", + "cachix", + "pre-commit-hooks" + ] + }, + "locked": { + "lastModified": 1708704632, + "narHash": "sha256-w+dOIW60FKMaHI1q5714CSibk99JfYxm0CzTinYWr+Q=", + "owner": "cachix", + "repo": "devenv", + "rev": "2ee4450b0f4b95a1b90f2eb5ffea98b90e48c196", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "python-rewrite", + "repo": "devenv", + "type": "github" + } + }, + "devenv_3": { + "inputs": { + "flake-compat": "flake-compat_3", + "nix": "nix_3", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks_2" + }, "locked": { "lastModified": 1694422554, "narHash": "sha256-s5NTPzT66yIMmau+ZGP7q9z4NjgceDETL4xZ6HJ/TBg=", @@ -24,17 +118,19 @@ "type": "github" } }, - "devenv_2": { + "devenv_4": { "inputs": { - "flake-compat": "flake-compat_2", - "nix": "nix_2", + "flake-compat": "flake-compat_4", + "nix": "nix_4", "nixpkgs": [ + "ihp", + "ihp-boilerplate", "ihp", "ihp-boilerplate", "ihp", "nixpkgs" ], - "pre-commit-hooks": "pre-commit-hooks_2" + "pre-commit-hooks": "pre-commit-hooks_3" }, "locked": { "lastModified": 1686054274, @@ -67,6 +163,38 @@ } }, "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_4": { "flake": false, "locked": { "lastModified": 1673956053, @@ -83,6 +211,27 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "ihp", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1714641030, + "narHash": "sha256-yzcRNDoyVP7+SCNX0wmuDju1NUCt8Dz9+lyUXEI0dbI=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" }, @@ -100,7 +249,7 @@ "type": "github" } }, - "flake-parts_2": { + "flake-parts_3": { "inputs": { "nixpkgs-lib": "nixpkgs-lib_2" }, @@ -122,6 +271,42 @@ "inputs": { "systems": "systems" }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_3" + }, "locked": { "lastModified": 1685518550, "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", @@ -136,7 +321,7 @@ "type": "github" } }, - "flake-utils_2": { + "flake-utils_4": { "locked": { "lastModified": 1667395993, "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", @@ -160,6 +345,31 @@ "nixpkgs" ] }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "pre-commit-hooks", + "nixpkgs" + ] + }, "locked": { "lastModified": 1660459072, "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", @@ -174,9 +384,11 @@ "type": "github" } }, - "gitignore_2": { + "gitignore_3": { "inputs": { "nixpkgs": [ + "ihp", + "ihp-boilerplate", "ihp", "ihp-boilerplate", "ihp", @@ -204,21 +416,21 @@ "devenv": "devenv", "flake-parts": "flake-parts", "ihp-boilerplate": "ihp-boilerplate", - "nix-filter": "nix-filter", - "nixpkgs": "nixpkgs_2", - "systems": "systems_3" + "nix-filter": "nix-filter_2", + "nixpkgs": "nixpkgs_4", + "systems": "systems_6" }, "locked": { - "lastModified": 1700013490, - "narHash": "sha256-oQz7ZBrHe6WwYMwnxxUgnYM55CuH5Oxjz6mrLnYbB7U=", + "lastModified": 1714870134, + "narHash": "sha256-DmaIr9kF+TG24wVNPVufxC74TYMCLziLYS9hCZHBDTc=", "owner": "digitallyinduced", "repo": "ihp", - "rev": "d59a65d71943cb506eee3ad6255f017963237359", + "rev": "29436fd63f11ccad9b10168bba7d14df737ee287", "type": "github" }, "original": { "owner": "digitallyinduced", - "ref": "v1.2", + "ref": "v1.3", "repo": "ihp", "type": "github" } @@ -251,6 +463,56 @@ "systems" ] }, + "locked": { + "lastModified": 1710175252, + "narHash": "sha256-QIFqo64U69uUGJ7pgBr37T3yAKK0n1ueqagKmnm+XWw=", + "owner": "digitallyinduced", + "repo": "ihp-boilerplate", + "rev": "323591d6135f7a89b5b4e518d5d420cd5b046fe2", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "repo": "ihp-boilerplate", + "type": "github" + } + }, + "ihp-boilerplate_2": { + "inputs": { + "devenv": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "devenv" + ], + "flake-parts": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "flake-parts" + ], + "ihp": "ihp_3", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "nixpkgs" + ], + "systems": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "systems" + ] + }, "locked": { "lastModified": 1689954789, "narHash": "sha256-RsgD1YGSlx+K/GkTspOdg/tz47PyZZDc66PzfFZvqBk=", @@ -265,7 +527,7 @@ "type": "github" } }, - "ihp-boilerplate_2": { + "ihp-boilerplate_3": { "flake": false, "locked": { "lastModified": 1686165507, @@ -284,11 +546,35 @@ }, "ihp_2": { "inputs": { - "devenv": "devenv_2", + "devenv": "devenv_3", "flake-parts": "flake-parts_2", "ihp-boilerplate": "ihp-boilerplate_2", - "nixpkgs": "nixpkgs", - "systems": "systems_2" + "nix-filter": "nix-filter", + "nixpkgs": "nixpkgs_3", + "systems": "systems_5" + }, + "locked": { + "lastModified": 1700013490, + "narHash": "sha256-oQz7ZBrHe6WwYMwnxxUgnYM55CuH5Oxjz6mrLnYbB7U=", + "owner": "digitallyinduced", + "repo": "ihp", + "rev": "d59a65d71943cb506eee3ad6255f017963237359", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "ref": "v1.2", + "repo": "ihp", + "type": "github" + } + }, + "ihp_3": { + "inputs": { + "devenv": "devenv_4", + "flake-parts": "flake-parts_3", + "ihp-boilerplate": "ihp-boilerplate_3", + "nixpkgs": "nixpkgs_2", + "systems": "systems_4" }, "locked": { "lastModified": 1689949405, @@ -339,25 +625,27 @@ }, "nix": { "inputs": { - "lowdown-src": "lowdown-src", + "flake-compat": "flake-compat", "nixpkgs": [ "ihp", "devenv", + "cachix", + "devenv", "nixpkgs" ], "nixpkgs-regression": "nixpkgs-regression" }, "locked": { - "lastModified": 1676545802, - "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=", + "lastModified": 1712911606, + "narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=", "owner": "domenkozar", "repo": "nix", - "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f", + "rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12", "type": "github" }, "original": { "owner": "domenkozar", - "ref": "relaxed-flakes", + "ref": "devenv-2.21", "repo": "nix", "type": "github" } @@ -377,17 +665,115 @@ "type": "github" } }, + "nix-filter_2": { + "locked": { + "lastModified": 1710156097, + "narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "3342559a24e85fc164b295c3444e8a139924675b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "ihp", + "devenv", + "cachix", + "devenv", + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688870561, + "narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "165b1650b753316aa7f1787f3005a8d2da0f5301", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, "nix_2": { + "inputs": { + "flake-compat": [ + "ihp", + "devenv", + "flake-compat" + ], + "nixpkgs": [ + "ihp", + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression_2" + }, + "locked": { + "lastModified": 1712911606, + "narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=", + "owner": "domenkozar", + "repo": "nix", + "rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "devenv-2.21", + "repo": "nix", + "type": "github" + } + }, + "nix_3": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression_3" + }, + "locked": { + "lastModified": 1676545802, + "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=", + "owner": "domenkozar", + "repo": "nix", + "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "relaxed-flakes", + "repo": "nix", + "type": "github" + } + }, + "nix_4": { "inputs": { "lowdown-src": "lowdown-src_2", "nixpkgs": [ + "ihp", + "ihp-boilerplate", "ihp", "ihp-boilerplate", "ihp", "devenv", "nixpkgs" ], - "nixpkgs-regression": "nixpkgs-regression_2" + "nixpkgs-regression": "nixpkgs-regression_4" }, "locked": { "lastModified": 1676545802, @@ -406,17 +792,17 @@ }, "nixpkgs": { "locked": { - "lastModified": 1681488673, - "narHash": "sha256-PmojOyePBNvbY3snYE7NAQHTLB53t7Ro+pgiJ4wPCuk=", + "lastModified": 1692808169, + "narHash": "sha256-x9Opq06rIiwdwGeK2Ykj69dNc2IvUH1fY55Wm7atwrE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", + "rev": "9201b5ff357e781bf014d0330d18555695df7ba8", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", - "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", "type": "github" } }, @@ -488,7 +874,55 @@ "type": "github" } }, + "nixpkgs-regression_3": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-regression_4": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, "nixpkgs-stable": { + "locked": { + "lastModified": 1710695816, + "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "614b4613980a522ba49f0d194531beddbb7220d3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_2": { "locked": { "lastModified": 1685801374, "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", @@ -504,7 +938,7 @@ "type": "github" } }, - "nixpkgs-stable_2": { + "nixpkgs-stable_3": { "locked": { "lastModified": 1678872516, "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", @@ -521,6 +955,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1681488673, + "narHash": "sha256-PmojOyePBNvbY3snYE7NAQHTLB53t7Ro+pgiJ4wPCuk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1696291921, "narHash": "sha256-isKgVAoUxuxYEuO3Q4xhbfKcZrF/+UkJtOTv0eb/W5E=", @@ -536,6 +986,47 @@ "type": "github" } }, + "nixpkgs_4": { + "locked": { + "lastModified": 1714864423, + "narHash": "sha256-Wx3Y6arRJD1pd3c8SnD7dfW7KWuCr/r248P/5XLaMdM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "54b4bb956f9891b872904abdb632cea85a033ff2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "ihp", + "devenv", + "cachix", + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1692876271, + "narHash": "sha256-IXfZEkI0Mal5y1jr6IRWMqK8GW2/f28xJenZIPQqkY0=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "d5006be9c2c2417dafb2e2e5034d83fabd207ee3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, "pre-commit-hooks": { "inputs": { "flake-compat": [ @@ -543,7 +1034,7 @@ "devenv", "flake-compat" ], - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "gitignore": "gitignore", "nixpkgs": [ "ihp", @@ -553,11 +1044,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1688056373, - "narHash": "sha256-2+SDlNRTKsgo3LBRiMUcoEUb6sDViRNQhzJquZ4koOI=", + "lastModified": 1713775815, + "narHash": "sha256-Wu9cdYTnGQQwtT20QQMg7jzkANKQjwBD9iccfGKkfls=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "5843cf069272d92b60c3ed9e55b7a8989c01d4c7", + "rev": "2ac4dcbf55ed43f3be0bae15e181f08a57af24a4", "type": "github" }, "original": { @@ -575,7 +1066,7 @@ "devenv", "flake-compat" ], - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "gitignore": "gitignore_2", "nixpkgs": [ "ihp", @@ -586,6 +1077,44 @@ ], "nixpkgs-stable": "nixpkgs-stable_2" }, + "locked": { + "lastModified": 1688056373, + "narHash": "sha256-2+SDlNRTKsgo3LBRiMUcoEUb6sDViRNQhzJquZ4koOI=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "5843cf069272d92b60c3ed9e55b7a8989c01d4c7", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pre-commit-hooks_3": { + "inputs": { + "flake-compat": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "flake-compat" + ], + "flake-utils": "flake-utils_4", + "gitignore": "gitignore_3", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_3" + }, "locked": { "lastModified": 1682596858, "narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=", @@ -665,6 +1194,51 @@ "repo": "default", "type": "github" } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_6": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 08d108f..b82b7db 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - ihp.url = "github:digitallyinduced/ihp/v1.2"; + ihp.url = "github:digitallyinduced/ihp/v1.3"; nixpkgs.follows = "ihp/nixpkgs"; flake-parts.follows = "ihp/flake-parts"; devenv.follows = "ihp/devenv"; From 7f57e16e0836165c913635930174d0eeb982959f Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Thu, 1 Aug 2024 12:21:16 -0400 Subject: [PATCH 45/51] Added appName option --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index b82b7db..624da5f 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,7 @@ perSystem = { pkgs, ... }: { ihp = { + # appName = "app"; # Available with v1.4 or latest master enable = true; projectPath = ./.; packages = with pkgs; [ From c429ad8ba9585802b0f1ae4035f655c8297987ee Mon Sep 17 00:00:00 2001 From: Aron Novak Date: Mon, 5 Aug 2024 10:59:57 +0200 Subject: [PATCH 46/51] test and deploy using github actions --- .github/workflows/test.yml | 89 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f368d85 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,89 @@ +name: Test and Deploy + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [ main ] + pull_request: + branches: [ main ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +env: + ENV: "qa" + PROJECT_NAME: myproject + SSH_HOST: ${{ secrets.SSH_HOST }} + SSH_USER: ${{ secrets.SSH_USER }} + SSH_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + NIXPKGS: "https://github.com/NixOS/nixpkgs/archive/51bcdc4cdaac48535dabf0ad4642a66774c609ed.tar.gz" + +jobs: + tests: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v27 + with: + nix_path: nixpkgs=${{ env.NIXPKGS}} + + # Use the cachix cache for faster builds. + - name: Cachix Init + uses: cachix/cachix-action@v15 + with: + name: digitallyinduced + skipPush: true + + # Install direnv, which also `direnv allow`s the project. + - uses: HatsuneMiku3939/direnv-action@v1.0.7 + with: + direnvVersion: 2.32.3 + + - name: Run project and tests + run: | + # Build generated files. + nix-shell --run "make build/Generated/Types.hs" + + # Start the project in the background. + nix-shell --run "devenv up &" + + # Execute the tests. + nix-shell --run "runghc $(make print-ghc-extensions) -i. -ibuild -iConfig Test/Main.hs" + + deploy: + name: Deploy + needs: tests + if: contains(github.event.pull_request.head.ref, 'main') + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup SSH + run: | + mkdir -p ~/.ssh + echo "${{ env.SSH_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H ${{ env.SSH_HOST }} >> ~/.ssh/known_hosts + echo -e "Host ${{ env.PROJECT_NAME}}-${{ env.ENV }}\n HostName ${{ env.SSH_HOST }}\n User ${{ env.SSH_USER }}\n IdentityFile ~/.ssh/id_rsa" > ~/.ssh/config + chmod 600 ~/.ssh/config + + - uses: cachix/install-nix-action@v20 + with: + nix_path: nixpkgs=${{ env.NIXPKGS}} + + - name: Cachix Init + uses: cachix/cachix-action@v12 + with: + name: digitallyinduced + skipPush: true + + - uses: HatsuneMiku3939/direnv-action@v1 + with: + direnvVersion: 2.32.3 + + - name: Deploy + run: | + deploy-to-nixos ${{ env.PROJECT_NAME}}-${{ env.ENV }} From 54adb5235fb18cae620b545dabbbcd2586e2154a Mon Sep 17 00:00:00 2001 From: Aron Novak Date: Mon, 5 Aug 2024 11:30:14 +0200 Subject: [PATCH 47/51] initial README --- README.md | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..c3781e7 --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ +# IHP Boilerplate + +This repository contains a boilerplate for IHP (Integrated Haskell Platform) projects with GitHub Actions for testing and deployment, used by `ihp-new`, see the [Installation Guide](https://ihp.digitallyinduced.com/Guide/installation.html). + +## GitHub Actions Workflow + +The repository includes a GitHub Actions workflow for automated testing and deployment. The workflow is defined in `.github/workflows/test.yml`. + +### Workflow Triggers + +The workflow is triggered on: +- Push to the `main` branch +- Pull requests to the `main` branch +- Manual trigger from the GitHub Actions tab + +### Testing + +The testing job performs the following steps: +1. Checks out the code +2. Sets up Nix +3. Initializes Cachix for faster builds +4. Installs and allows direnv +5. Builds generated files +6. Starts the project in the background +7. Runs the tests + +### Deployment + +To have the proper NixOS server up and running, follow the [Deployment Guide](https://ihp.digitallyinduced.com/Guide/deployment.html#deploying-with-deploytonixos) and create a proper virtual machine for your project. + +The deployment job runs after successful tests and only for the `main` branch. It performs the following steps: +1. Checks out the code +2. Sets up SSH for deployment +3. Sets up Nix +4. Initializes Cachix +5. Sets up direnv +6. Deploys to a NixOS server + +## Setup Instructions + +To use this GitHub Actions workflow in your project: + + +1. Set up the following secrets in your GitHub [repository settings](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions): + - `SSH_HOST`: The hostname or IP address of your deployment server + - `SSH_USER`: The username for SSH access to the deployment server + - `SSH_PRIVATE_KEY`: The private SSH key for authentication + +1. Modify the `env` section in `.github/workflows/test.yml` if needed: + - Update `PROJECT_NAME` to match your project + - Adjust `ENV` if you want to use a different environment name + - Update `NIXPKGS` if you want to use a different Nixpkgs version + +1. Ensure your project has the necessary test files in the `Test` directory. + +1. If your deployment process differs, modify the `deploy` job in the workflow file accordingly. + +1Push your changes to the `main` branch to trigger the workflow. + +## Manual Workflow Trigger + +You can manually trigger the workflow from the Actions tab in your GitHub repository. This is useful for running tests or deploying without pushing changes. + +## Customization + +Feel free to customize the workflow file to fit your specific project needs. You may want to add additional steps, change the deployment process, or modify the testing procedure. + +## Support + +For issues related to this boilerplate or the GitHub Actions workflow, please open an issue in this repository. + +For general IHP support, refer to the [IHP documentation](https://ihp.digitallyinduced.com/Guide/) or the [IHP Forum](https://ihp.digitallyinduced.com/community/). \ No newline at end of file From e34e3c37b776fd335dfa6c51dc66934b16041294 Mon Sep 17 00:00:00 2001 From: Aron Novak Date: Mon, 5 Aug 2024 16:25:42 +0200 Subject: [PATCH 48/51] adapt wording --- README.md | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index c3781e7..9930bcc 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# IHP Boilerplate +# IHP Project -This repository contains a boilerplate for IHP (Integrated Haskell Platform) projects with GitHub Actions for testing and deployment, used by `ihp-new`, see the [Installation Guide](https://ihp.digitallyinduced.com/Guide/installation.html). +This is an IHP (Integrated Haskell Platform) project with GitHub Actions for testing and deployment. For more information about IHP, see the [IHP Documentation](https://ihp.digitallyinduced.com/Guide/). ## GitHub Actions Workflow -The repository includes a GitHub Actions workflow for automated testing and deployment. The workflow is defined in `.github/workflows/test.yml`. +This project includes a GitHub Actions workflow for automated testing and deployment. The workflow is defined in `.github/workflows/test.yml`. ### Workflow Triggers @@ -26,7 +26,7 @@ The testing job performs the following steps: ### Deployment -To have the proper NixOS server up and running, follow the [Deployment Guide](https://ihp.digitallyinduced.com/Guide/deployment.html#deploying-with-deploytonixos) and create a proper virtual machine for your project. +For deployment, follow the [IHP Deployment Guide](https://ihp.digitallyinduced.com/Guide/deployment.html#deploying-with-deploytonixos) to set up a proper NixOS server for your project. The deployment job runs after successful tests and only for the `main` branch. It performs the following steps: 1. Checks out the code @@ -38,24 +38,23 @@ The deployment job runs after successful tests and only for the `main` branch. I ## Setup Instructions -To use this GitHub Actions workflow in your project: - +To use the GitHub Actions workflow in this project: 1. Set up the following secrets in your GitHub [repository settings](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions): - - `SSH_HOST`: The hostname or IP address of your deployment server - - `SSH_USER`: The username for SSH access to the deployment server - - `SSH_PRIVATE_KEY`: The private SSH key for authentication + - `SSH_HOST`: The hostname or IP address of your deployment server + - `SSH_USER`: The username for SSH access to the deployment server + - `SSH_PRIVATE_KEY`: The private SSH key for authentication -1. Modify the `env` section in `.github/workflows/test.yml` if needed: - - Update `PROJECT_NAME` to match your project - - Adjust `ENV` if you want to use a different environment name - - Update `NIXPKGS` if you want to use a different Nixpkgs version +2. Modify the `env` section in `.github/workflows/test.yml` if needed: + - Update `PROJECT_NAME` to match your project + - Adjust `ENV` if you want to use a different environment name + - Update `NIXPKGS` if you want to use a different Nixpkgs version -1. Ensure your project has the necessary test files in the `Test` directory. +3. Ensure your project has the necessary test files in the `Test` directory. -1. If your deployment process differs, modify the `deploy` job in the workflow file accordingly. +4. If your deployment process differs, modify the `deploy` job in the workflow file accordingly. -1Push your changes to the `main` branch to trigger the workflow. +5. Push your changes to the `main` branch to trigger the workflow. ## Manual Workflow Trigger @@ -67,6 +66,6 @@ Feel free to customize the workflow file to fit your specific project needs. You ## Support -For issues related to this boilerplate or the GitHub Actions workflow, please open an issue in this repository. +For issues related to IHP or this project's setup, please refer to the [IHP documentation](https://ihp.digitallyinduced.com/Guide/) or seek help on the [IHP Forum](https://ihp.digitallyinduced.com/community/). -For general IHP support, refer to the [IHP documentation](https://ihp.digitallyinduced.com/Guide/) or the [IHP Forum](https://ihp.digitallyinduced.com/community/). \ No newline at end of file +For project-specific issues, please open an issue in this repository. \ No newline at end of file From 961968049c7b28f5a5365de49b73fcedbba04e34 Mon Sep 17 00:00:00 2001 From: Aron Novak Date: Tue, 6 Aug 2024 09:57:15 +0200 Subject: [PATCH 49/51] disk space issue workaround --- .github/workflows/test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f368d85..430d1ef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -43,6 +43,12 @@ jobs: - name: Run project and tests run: | + # @see https://github.com/actions/runner-images/issues/2840#issuecomment-1284059930 + # IHP - NixOS requires a lots of disk space. + # Larger projects could easily run into unexpected failures. + sudo rm -rf /usr/share/dotnet + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + # Build generated files. nix-shell --run "make build/Generated/Types.hs" From bb89c616788160fca842c377994bcca4ef2c660d Mon Sep 17 00:00:00 2001 From: Aron Novak Date: Thu, 8 Aug 2024 06:48:03 +0000 Subject: [PATCH 50/51] Fix deploy condition at GH actions Deploy job (#38) --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 430d1ef..ae30343 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -61,7 +61,7 @@ jobs: deploy: name: Deploy needs: tests - if: contains(github.event.pull_request.head.ref, 'main') + if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - name: Checkout code From bd0424becdd803823de059b9c8c42ce577d4ab61 Mon Sep 17 00:00:00 2001 From: Jakub Dubovsky Date: Sat, 21 Dec 2024 13:52:37 +0100 Subject: [PATCH 51/51] Build elm files --- flake.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flake.nix b/flake.nix index 624da5f..434937f 100644 --- a/flake.nix +++ b/flake.nix @@ -39,10 +39,13 @@ # Start Mailhog on local development to catch outgoing emails # services.mailhog.enable = true; + languages.elm.enable = true; + # Custom processes that don't appear in https://devenv.sh/reference/options/ processes = { # Uncomment if you use tailwindcss. # tailwind.exec = "tailwindcss -c tailwind/tailwind.config.js -i ./tailwind/app.css -o static/app.css --watch=always"; + frontend.exec = "npm run run-dev-elm"; }; }; };