From 7820548927e773ad8df21afc8e3f5e4113a585b6 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar <3998+srid@users.noreply.github.com> Date: Sat, 8 Apr 2023 10:21:13 -0400 Subject: [PATCH] Simplify devShell composition using `inputsFrom` (#99) --- flake.lock | 18 +++++++++--------- flake.nix | 19 ++++++++++++++----- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/flake.lock b/flake.lock index 10de5af..d0d2905 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "flake-root": { "locked": { - "lastModified": 1671378805, - "narHash": "sha256-yqGxyzMN2GuppwG3dTWD1oiKxi+jGYP7D1qUSc5vKhI=", + "lastModified": 1680210152, + "narHash": "sha256-VgFdqsu2i2oUcId9n8BFlRRc4GJHFvrmprdamcSZR1o=", "owner": "srid", "repo": "flake-root", - "rev": "dc7ba6166e478804a9da6881aa48c45d300075cf", + "rev": "6000244701c8ae8cf43263564095fd357d89c328", "type": "github" }, "original": { @@ -35,11 +35,11 @@ }, "haskell-flake": { "locked": { - "lastModified": 1679690126, - "narHash": "sha256-u6pQejlTLC1QSKLMB/8Ch+2VvgILlxuZsBHAbDn0zHM=", + "lastModified": 1680963459, + "narHash": "sha256-amqQMQi8D8dACHR717LcZ3X51Vg4UJqHtlQLJbCjV8c=", "owner": "srid", "repo": "haskell-flake", - "rev": "d63943b612dbe30e2aba8aab0e60f1011c369973", + "rev": "c74e7c596792e0baf5cd22a9fd0f213e05679b7a", "type": "github" }, "original": { @@ -50,11 +50,11 @@ }, "mission-control": { "locked": { - "lastModified": 1679674077, - "narHash": "sha256-hGz63fsyRGthjE6LLqB08IHApcBvHhI87gWrFN/Uu5w=", + "lastModified": 1680209746, + "narHash": "sha256-P8Q0mPdeo2SvKQUejvl7nOKO2ahIXb6aintYofCxcP8=", "owner": "Platonic-Systems", "repo": "mission-control", - "rev": "d07854a616f559370b71c1c440d916ab6869f084", + "rev": "c1bd7344283d4006efb02cc660c5fd9befb73980", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 9eb4f49..4ecd6e0 100644 --- a/flake.nix +++ b/flake.nix @@ -20,9 +20,10 @@ inputs.mission-control.flakeModule ]; perSystem = { self', system, lib, config, pkgs, ... }: { - # The "main" project. You can have multiple projects, but this template + # Our only Haskell project. You can have multiple projects, but this template # has only one. - haskellProjects.main = { + # See https://github.com/srid/haskell-flake/blob/master/example/flake.nix + haskellProjects.default = { # packages.haskell-template.root = ./.; # Auto-discovered by haskell-flake overrides = self: super: { }; devShell = { @@ -31,6 +32,7 @@ } // config.treefmt.build.programs; hlsCheck.enable = true; }; + autoWire = false; # Enables us to wire flake outputs manually. }; # Auto formatters. This also adds a flake check to ensure that the @@ -87,11 +89,18 @@ }; # Default package. - packages.default = self'.packages.main-haskell-template; + packages.default = config.haskellProjects.default.outputs.localPackages.haskell-template; + + checks = config.haskellProjects.default.outputs.checks; # Default shell. - devShells.default = - config.mission-control.installToDevShell self'.devShells.main; + devShells.default = pkgs.mkShell { + inputsFrom = [ + config.haskellProjects.default.outputs.devShell + config.flake-root.devShell + config.mission-control.devShell + ]; + }; }; }; }