From 7c8cdb47ff7d1563f9a03a543d5c575bae6b66b1 Mon Sep 17 00:00:00 2001 From: Daniel Firth Date: Tue, 6 Feb 2024 17:03:00 +0000 Subject: [PATCH 01/10] Use horizon-platform and horizon-devtools at GHC 9.6.x --- flake.lock | 424 +++++++++++++++++++++++++++++++++++++++-- flake.nix | 11 +- haskell-template.cabal | 2 +- 3 files changed, 420 insertions(+), 17 deletions(-) diff --git a/flake.lock b/flake.lock index 151428c..a88e290 100644 --- a/flake.lock +++ b/flake.lock @@ -18,13 +18,103 @@ "type": "github" } }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1704152458, + "narHash": "sha256-DS+dGw7SKygIWf9w4eNBUZsK+4Ug27NwEWmn2tnbycg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "88a2cd8166694ba0b6cb374700799cec53aef527", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_3" + }, + "locked": { + "lastModified": 1706830856, + "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_4": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_4" + }, + "locked": { + "lastModified": 1706830856, + "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_5": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_5" + }, + "locked": { + "lastModified": 1706830856, + "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "fourmolu-nix": { "locked": { - "lastModified": 1706843509, - "narHash": "sha256-/k9QrpJ+T1Z+7Fe8MJ9743Uysy8F+S8K46TjRNWipcs=", + "lastModified": 1707266073, + "narHash": "sha256-tCFzZQJicDdYjnuJiNK4hiiRAH7c2wQzMhOCdUMbVKE=", "owner": "jedimahdi", "repo": "fourmolu-nix", - "rev": "0bc8925542f3a5343bb23baf308b57e9fa87e09b", + "rev": "717f5a91b0d7b97b1be7ecc3a0fd42d37ffe1c9b", "type": "github" }, "original": { @@ -35,11 +125,11 @@ }, "haskell-flake": { "locked": { - "lastModified": 1707206928, - "narHash": "sha256-cEw1PQs1i3xIS267EpA4vqe+QmLVxTl7CimwHL8+bcY=", + "lastModified": 1708796980, + "narHash": "sha256-X2JLDtzBmQEbl9eFJO2HTUp3CuXAdX4NFr1wBhxqHrQ=", "owner": "srid", "repo": "haskell-flake", - "rev": "56c5550e18c583bcdf0ebd267efa4e6286619d28", + "rev": "593346d1c1388f726823dc9b1cd271df8a7218aa", "type": "github" }, "original": { @@ -48,18 +138,153 @@ "type": "github" } }, + "horizon-advance": { + "inputs": { + "flake-utils": "flake-utils", + "horizon-core": "horizon-core_2", + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1708781115, + "narHash": "sha256-faeJOYHrFvVL21RDsDplmX8XTK6nEH9Co3Bv06TlEms=", + "ref": "lts/ghc-9.6.x", + "rev": "c99e5f0f4635f5ab087f821775d018cce82c21b5", + "revCount": 165, + "type": "git", + "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-advance" + }, + "original": { + "ref": "lts/ghc-9.6.x", + "type": "git", + "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-advance" + } + }, + "horizon-core": { + "inputs": { + "flake-parts": "flake-parts_3", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1708779769, + "narHash": "sha256-qYkXoIgBr9YdSEFqzeyVU4y3jexGta7PSdp61/V+AQo=", + "ref": "lts/ghc-9.6.x", + "rev": "db1bd7ea51f239cad5dd7fa68c98e1ef4791c87f", + "revCount": 1255, + "type": "git", + "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-core" + }, + "original": { + "ref": "lts/ghc-9.6.x", + "type": "git", + "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-core" + } + }, + "horizon-core_2": { + "inputs": { + "flake-parts": "flake-parts_5", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1708779769, + "narHash": "sha256-qYkXoIgBr9YdSEFqzeyVU4y3jexGta7PSdp61/V+AQo=", + "ref": "lts/ghc-9.6.x", + "rev": "db1bd7ea51f239cad5dd7fa68c98e1ef4791c87f", + "revCount": 1255, + "type": "git", + "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-core" + }, + "original": { + "ref": "lts/ghc-9.6.x", + "type": "git", + "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-core" + } + }, + "horizon-devtools": { + "inputs": { + "flake-parts": "flake-parts_2", + "horizon-core": "horizon-core", + "horizon-hoogle": "horizon-hoogle", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1708795865, + "narHash": "sha256-qIh5BwQJaDBPJwzGNIgCrvkVI9tKxQwQ5LTidONEjsI=", + "ref": "lts/ghc-9.6.x", + "rev": "25eadfe744adb5cc9028c8bee14044b8f9451a69", + "revCount": 1217, + "type": "git", + "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-devtools" + }, + "original": { + "ref": "lts/ghc-9.6.x", + "type": "git", + "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-devtools" + } + }, + "horizon-hoogle": { + "locked": { + "lastModified": 1701521742, + "narHash": "sha256-huf/95jYL7mY0AHSziJYXx4m/sP+G+YAbJb+Q5Ph/Jg=", + "ref": "refs/heads/master", + "rev": "ddf3b08c6458c1a9e0d881f968c050bc828b9b8e", + "revCount": 2, + "type": "git", + "url": "https://gitlab.horizon-haskell.net/nix/horizon-hoogle" + }, + "original": { + "type": "git", + "url": "https://gitlab.horizon-haskell.net/nix/horizon-hoogle" + } + }, + "horizon-hoogle_2": { + "locked": { + "lastModified": 1701521742, + "narHash": "sha256-huf/95jYL7mY0AHSziJYXx4m/sP+G+YAbJb+Q5Ph/Jg=", + "ref": "refs/heads/master", + "rev": "ddf3b08c6458c1a9e0d881f968c050bc828b9b8e", + "revCount": 2, + "type": "git", + "url": "https://gitlab.horizon-haskell.net/nix/horizon-hoogle" + }, + "original": { + "type": "git", + "url": "https://gitlab.horizon-haskell.net/nix/horizon-hoogle" + } + }, + "horizon-platform": { + "inputs": { + "flake-parts": "flake-parts_4", + "horizon-advance": "horizon-advance", + "horizon-hoogle": "horizon-hoogle_2", + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1708788558, + "narHash": "sha256-i1UlVXPGSgGmwgC4g5AqbVsp+8WyAZAGIWbJ8n0gxTU=", + "ref": "lts/ghc-9.6.x", + "rev": "40a0e86806bdfed3aa17509ebc0d72e4577e848a", + "revCount": 1267, + "type": "git", + "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-platform" + }, + "original": { + "ref": "lts/ghc-9.6.x", + "type": "git", + "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-platform" + } + }, "nixpkgs": { "locked": { - "lastModified": 1707171055, - "narHash": "sha256-7ZiKRdhrScsDfhDkGy8yJWAT6BfHqa8PYMX04roU03k=", + "lastModified": 1707956935, + "narHash": "sha256-ZL2TrjVsiFNKOYwYQozpbvQSwvtV/3Me7Zwhmdsfyu4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4b1aab22192b787355733c9495d47f4c66af084c", + "rev": "a4d4fe8c5002202493e87ec8dbc91335ff55552c", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -82,13 +307,167 @@ "type": "github" } }, + "nixpkgs-lib_2": { + "locked": { + "dir": "lib", + "lastModified": 1703961334, + "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib_3": { + "locked": { + "dir": "lib", + "lastModified": 1706550542, + "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib_4": { + "locked": { + "dir": "lib", + "lastModified": 1706550542, + "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib_5": { + "locked": { + "dir": "lib", + "lastModified": 1706550542, + "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1704161960, + "narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "63143ac2c9186be6d9da6035fa22620018c85932", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1707956935, + "narHash": "sha256-ZL2TrjVsiFNKOYwYQozpbvQSwvtV/3Me7Zwhmdsfyu4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a4d4fe8c5002202493e87ec8dbc91335ff55552c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1707546158, + "narHash": "sha256-nYYJTpzfPMDxI8mzhQsYjIUX+grorqjKEU9Np6Xwy/0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d934204a0f8d9198e1e4515dd6fec76a139c87f0", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1708093448, + "narHash": "sha256-gohEm3/NVyu7WINFhRf83yJH8UM2ie/KY9Iw3VN6fiE=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c7763249f02b7786b4ca36e13a4d7365cfba162f", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1708751719, + "narHash": "sha256-0uWOKSpXJXmXswOvDM5Vk3blB74apFB6rNGWV5IjoN0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "f63ce824cd2f036216eb5f637dfef31e1a03ee89", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "flake-parts": "flake-parts", "fourmolu-nix": "fourmolu-nix", "haskell-flake": "haskell-flake", - "nixpkgs": "nixpkgs", - "systems": "systems", + "horizon-devtools": "horizon-devtools", + "horizon-platform": "horizon-platform", + "nixpkgs": "nixpkgs_6", + "systems": "systems_2", "treefmt-nix": "treefmt-nix" } }, @@ -107,6 +486,21 @@ "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" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ @@ -114,11 +508,11 @@ ] }, "locked": { - "lastModified": 1706462057, - "narHash": "sha256-7dG1D4iqqt0bEbBqUWk6lZiSqqwwAO0Hd1L5opVyhNM=", + "lastModified": 1708681819, + "narHash": "sha256-+YIvy0dDZw8KIFVPS9i+mTHf2RqSJ0+dBB9AXBvDTks=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "c6153c2a3ff4c38d231e3ae99af29b87f1df5901", + "rev": "36fd6923c122a983bc3915692e6cb3ff341ef083", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 0ba6717..cc85a02 100644 --- a/flake.nix +++ b/flake.nix @@ -2,6 +2,8 @@ description = "srid/haskell-template: Nix template for Haskell projects"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + horizon-devtools.url = "git+https://gitlab.horizon-haskell.net/package-sets/horizon-devtools?ref=lts/ghc-9.6.x"; + horizon-platform.url = "git+https://gitlab.horizon-haskell.net/package-sets/horizon-platform?ref=lts/ghc-9.6.x"; systems.url = "github:nix-systems/default"; flake-parts.url = "github:hercules-ci/flake-parts"; haskell-flake.url = "github:srid/haskell-flake"; @@ -24,7 +26,13 @@ # See https://github.com/srid/haskell-flake/blob/master/example/flake.nix haskellProjects.default = { # The base package set (this value is the default) - # basePackages = pkgs.haskellPackages; + basePackages = inputs.horizon-platform.legacyPackages.${system}; + + defaults.devShell.tools = _: + let devtools = inputs.horizon-devtools.legacyPackages.${system}; + in { + inherit (devtools) ghcid haskell-language-server; + }; # Packages to add on top of `basePackages` packages = { @@ -51,6 +59,7 @@ # Development shell configuration devShell = { hlsCheck.enable = false; + }; # What should haskell-flake add to flake outputs? diff --git a/haskell-template.cabal b/haskell-template.cabal index 8da86b6..7447d79 100644 --- a/haskell-template.cabal +++ b/haskell-template.cabal @@ -77,7 +77,7 @@ common shared build-depends: , aeson , async - , base >=4.13.0.0 && <4.18.0.0.0 + , base >=4.13.0.0 && <5 , data-default , directory , filepath From 83160c9f89105fb43dd1030bd3718bc820c8bac2 Mon Sep 17 00:00:00 2001 From: Daniel Firth Date: Sat, 24 Feb 2024 20:37:58 +0000 Subject: [PATCH 02/10] Add horizon cache --- flake.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flake.nix b/flake.nix index cc85a02..f531c8f 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,11 @@ { description = "srid/haskell-template: Nix template for Haskell projects"; + + nixConfig = { + extra-substituters = "https://horizon.cachix.org"; + extra-trusted-public-keys = "horizon.cachix.org-1:MeEEDRhRZTgv/FFGCv3479/dmJDfJ82G6kfUDxMSAw0="; + }; + inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; horizon-devtools.url = "git+https://gitlab.horizon-haskell.net/package-sets/horizon-devtools?ref=lts/ghc-9.6.x"; From 74bf421c2d7d2f32e1c5d175c63ce12f55e1e519 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Sat, 24 Feb 2024 15:48:48 -0500 Subject: [PATCH 03/10] devshell: add cabal --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index f531c8f..947d94d 100644 --- a/flake.nix +++ b/flake.nix @@ -37,7 +37,7 @@ defaults.devShell.tools = _: let devtools = inputs.horizon-devtools.legacyPackages.${system}; in { - inherit (devtools) ghcid haskell-language-server; + inherit (devtools) cabal-install ghcid haskell-language-server; }; # Packages to add on top of `basePackages` From a34f2d75c52575fd89d2db8ecc224fcfd6d96ba8 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar <3998+srid@users.noreply.github.com> Date: Sat, 24 Feb 2024 15:53:45 -0500 Subject: [PATCH 04/10] ci: use horizon cache --- .github/workflows/ci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 641ff68..aeecc58 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,6 +11,11 @@ jobs: steps: - uses: actions/checkout@v3 - uses: cachix/install-nix-action@v22 + - uses: DeterminateSystems/magic-nix-cache-action@main + with: + extra-conf: | + trusted-public-keys = horizon.cachix.org-1:MeEEDRhRZTgv/FFGCv3479/dmJDfJ82G6kfUDxMSAw0= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= + substituters = https://horizon.cachix.org https://cache.nixos.org/ - uses: DeterminateSystems/magic-nix-cache-action@main - uses: yaxitech/nix-install-pkgs-action@v3 with: From 4d2d9363dfeda488e87e2ee3e944e45f4acc3096 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar <3998+srid@users.noreply.github.com> Date: Sat, 24 Feb 2024 15:55:37 -0500 Subject: [PATCH 05/10] ci: install nix once --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index aeecc58..bec0c11 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,7 +10,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v22 - uses: DeterminateSystems/magic-nix-cache-action@main with: extra-conf: | From d5b80a342f33ca9eda1b942dc26670c167484ec2 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Sat, 24 Feb 2024 16:05:36 -0500 Subject: [PATCH 06/10] make it a module --- .envrc | 2 +- flake.nix | 12 +++--------- nix/horizon-package-set.nix | 12 ++++++++++++ 3 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 nix/horizon-package-set.nix diff --git a/.envrc b/.envrc index cc94b51..517837c 100644 --- a/.envrc +++ b/.envrc @@ -1,2 +1,2 @@ -nix_direnv_watch_file *.cabal +nix_direnv_watch_file *.cabal nix/*.nix use flake diff --git a/flake.nix b/flake.nix index 947d94d..77315bd 100644 --- a/flake.nix +++ b/flake.nix @@ -31,14 +31,9 @@ # has only one. # See https://github.com/srid/haskell-flake/blob/master/example/flake.nix haskellProjects.default = { - # The base package set (this value is the default) - basePackages = inputs.horizon-platform.legacyPackages.${system}; - - defaults.devShell.tools = _: - let devtools = inputs.horizon-devtools.legacyPackages.${system}; - in { - inherit (devtools) cabal-install ghcid haskell-language-server; - }; + imports = [ + (import ./nix/horizon-package-set.nix { inherit inputs; }) + ]; # Packages to add on top of `basePackages` packages = { @@ -65,7 +60,6 @@ # Development shell configuration devShell = { hlsCheck.enable = false; - }; # What should haskell-flake add to flake outputs? diff --git a/nix/horizon-package-set.nix b/nix/horizon-package-set.nix new file mode 100644 index 0000000..3fb3edc --- /dev/null +++ b/nix/horizon-package-set.nix @@ -0,0 +1,12 @@ +# Use horizon package set for haskell-flake +{ inputs, ... }: +{ pkgs, ... }: +{ + basePackages = inputs.horizon-platform.legacyPackages.${pkgs.system}; + # Horizon maintains separate package set for devtools. + defaults.devShell.tools = _: + let devtools = inputs.horizon-devtools.legacyPackages.${pkgs.system}; + in { + inherit (devtools) cabal-install ghcid haskell-language-server; + }; +} From e1ebd9ae7987b812b627a2c03e18fb31c1c10a93 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Sat, 24 Feb 2024 16:11:45 -0500 Subject: [PATCH 07/10] make it flake-parts module --- flake.nix | 3 ++- nix/horizon-package-set.nix | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index 77315bd..aabd7f4 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,7 @@ inputs.haskell-flake.flakeModule inputs.treefmt-nix.flakeModule inputs.fourmolu-nix.flakeModule + ./nix/horizon-package-set.nix ]; perSystem = { self', system, lib, config, pkgs, ... }: { # Our only Haskell project. You can have multiple projects, but this template @@ -32,7 +33,7 @@ # See https://github.com/srid/haskell-flake/blob/master/example/flake.nix haskellProjects.default = { imports = [ - (import ./nix/horizon-package-set.nix { inherit inputs; }) + inputs.self.haskellFlakeProjectModules.horizon-package-set ]; # Packages to add on top of `basePackages` diff --git a/nix/horizon-package-set.nix b/nix/horizon-package-set.nix index 3fb3edc..6956715 100644 --- a/nix/horizon-package-set.nix +++ b/nix/horizon-package-set.nix @@ -1,12 +1,14 @@ # Use horizon package set for haskell-flake { inputs, ... }: -{ pkgs, ... }: { - basePackages = inputs.horizon-platform.legacyPackages.${pkgs.system}; - # Horizon maintains separate package set for devtools. - defaults.devShell.tools = _: - let devtools = inputs.horizon-devtools.legacyPackages.${pkgs.system}; - in { - inherit (devtools) cabal-install ghcid haskell-language-server; - }; + flake.haskellFlakeProjectModules.horizon-package-set = { pkgs, ... }: { + basePackages = inputs.horizon-platform.legacyPackages.${pkgs.system}; + + # Horizon maintains separate package set for devtools. + defaults.devShell.tools = _: + let devtools = inputs.horizon-devtools.legacyPackages.${pkgs.system}; + in { + inherit (devtools) cabal-install ghcid haskell-language-server; + }; + }; } From b61334dd007afff53ed7e0d4cb6b162271f9ef96 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Sun, 25 Feb 2024 08:16:33 -0500 Subject: [PATCH 08/10] reference current inputs --- flake.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index aabd7f4..b441eb7 100644 --- a/flake.nix +++ b/flake.nix @@ -25,8 +25,10 @@ inputs.haskell-flake.flakeModule inputs.treefmt-nix.flakeModule inputs.fourmolu-nix.flakeModule - ./nix/horizon-package-set.nix + (import ./nix/horizon-package-set.nix { inherit inputs; }) ]; + flake.flakeModules.horizon-package-set = + import ./nix/horizon-package-set.nix { inherit inputs; }; perSystem = { self', system, lib, config, pkgs, ... }: { # Our only Haskell project. You can have multiple projects, but this template # has only one. From c1c35236f3caad1618773bf65977e79339e50588 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 26 Feb 2024 08:31:31 -0500 Subject: [PATCH 09/10] update horizon --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index a88e290..53af0f6 100644 --- a/flake.lock +++ b/flake.lock @@ -259,11 +259,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1708788558, - "narHash": "sha256-i1UlVXPGSgGmwgC4g5AqbVsp+8WyAZAGIWbJ8n0gxTU=", + "lastModified": 1708939820, + "narHash": "sha256-LC9wmK1rItd1lMX68Gpm4+0RL2mWQNcMxL81O/BHEoQ=", "ref": "lts/ghc-9.6.x", - "rev": "40a0e86806bdfed3aa17509ebc0d72e4577e848a", - "revCount": 1267, + "rev": "b67dc592c052a002ea11250e8abff96cd5d9de82", + "revCount": 1269, "type": "git", "url": "https://gitlab.horizon-haskell.net/package-sets/horizon-platform" }, From 6f23417174c8f5ab472d2504edee747ca7738ce2 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar <3998+srid@users.noreply.github.com> Date: Wed, 28 Feb 2024 15:41:02 -0500 Subject: [PATCH 10/10] ci: accept cache? --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7b3b9e0..0b93a1e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,4 +22,4 @@ jobs: - uses: yaxitech/nix-install-pkgs-action@v3 with: packages: "github:srid/nixci" - - run: nixci + - run: nixci -- --accept-flake-config