From 1b6156f28620638bd2529b3ee57af32ffe2d3881 Mon Sep 17 00:00:00 2001 From: Kirill Elagin Date: Wed, 3 Nov 2021 17:23:52 -0400 Subject: [PATCH] meta: Use haskell.nix flake lib --- flake.lock | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++--- flake.nix | 42 +++++---------- 2 files changed, 154 insertions(+), 36 deletions(-) diff --git a/flake.lock b/flake.lock index 08e4fb7..2196cf1 100644 --- a/flake.lock +++ b/flake.lock @@ -66,6 +66,21 @@ "type": "github" } }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1627913399, + "narHash": "sha256-hY8g6H2KFL8ownSiFeMOjwPC8P0ueXpCVEbxgda3pko=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "12c64ca55c1014cdc1b16ed5a804aa8576601ff2", + "type": "github" + }, + "original": { + "id": "flake-compat", + "type": "indirect" + } + }, "flake-utils": { "locked": { "lastModified": 1634851050, @@ -95,6 +110,20 @@ "type": "github" } }, + "flake-utils_3": { + "locked": { + "lastModified": 1631561581, + "narHash": "sha256-3VQMV5zvxaVLvqqUrNz3iJelLw30mIVSfZmAaauM3dA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7e5bf3925f6fbdfaf50a2a7ca0be2879c4261d19", + "type": "github" + }, + "original": { + "id": "flake-utils", + "type": "indirect" + } + }, "ghc-8.6.5-iohk": { "flake": false, "locked": { @@ -112,6 +141,22 @@ "type": "github" } }, + "gitignore-nix": { + "flake": false, + "locked": { + "lastModified": 1611672876, + "narHash": "sha256-qHu3uZ/o9jBHiA3MEKHJ06k7w4heOhA+4HCSIvflRxo=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "211907489e9f198594c0eb0ca9256a1949c9d412", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "hackage": { "flake": false, "locked": { @@ -182,6 +227,40 @@ "type": "github" } }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1632468475, + "narHash": "sha256-NNOm9CbdA8cuwbvaBHslGbPTiU6bh1Ao+MpEPx4rSGo=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "6bd668af3fd098bdd07a1bedd399564141e275da", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "nix": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1633098935, + "narHash": "sha256-UtuBczommNLwUNEnfRI7822z4vPA7OoRKsgAZ8zsHQI=", + "owner": "nixos", + "repo": "nix", + "rev": "4f496150eb4e0012914c11f0a3ff4df2412b1d09", + "type": "github" + }, + "original": { + "id": "nix", + "type": "indirect" + } + }, "nix-tools": { "flake": false, "locked": { @@ -200,15 +279,17 @@ }, "nixpkgs": { "locked": { - "lastModified": 1632176121, - "narHash": "sha256-N2oSOhbW38rbc53R1R8qXC/Xstht1PIsAcTzJfmCpTc=", - "path": "/nix/store/cdlpia48vzmh87l8xhmi2a4ylrd3969a-source", - "rev": "3397f0ede9ea2ded1f8b6fa689dda71a7a67b806", - "type": "path" + "lastModified": 1632495107, + "narHash": "sha256-4NGE56r+FJGBaCYu3CTH4O83Ys4TrtnEPXrvdwg1TDs=", + "owner": "serokell", + "repo": "nixpkgs", + "rev": "be220b2dc47092c1e739bf6aaf630f29e71fe1c4", + "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "serokell", + "repo": "nixpkgs", + "type": "github" } }, "nixpkgs-2003": { @@ -275,6 +356,35 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1632864508, + "narHash": "sha256-d127FIvGR41XbVRDPVvozUPQ/uRHbHwvfyKHwEt5xFM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "82891b5e2c2359d7e58d08849e4c89511ab94234", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-21.05-small", + "type": "indirect" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1632495107, + "narHash": "sha256-4NGE56r+FJGBaCYu3CTH4O83Ys4TrtnEPXrvdwg1TDs=", + "owner": "serokell", + "repo": "nixpkgs", + "rev": "be220b2dc47092c1e739bf6aaf630f29e71fe1c4", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, "old-ghc-nix": { "flake": false, "locked": { @@ -298,9 +408,33 @@ "hackage": "hackage", "haskell-nix": "haskell-nix", "nixpkgs": "nixpkgs", + "serokell-nix": "serokell-nix", "stackage": "stackage" } }, + "serokell-nix": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils_3", + "gitignore-nix": "gitignore-nix", + "nix": "nix", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1635980912, + "narHash": "sha256-NcakB9y37eBr6p2sJcl7Fdt1snLrYBRWvx+gWw4cNVw=", + "owner": "serokell", + "repo": "serokell.nix", + "rev": "949eeebdbb055463c8de214766219e69a48b94b9", + "type": "github" + }, + "original": { + "owner": "serokell", + "ref": "kirelagin/lib.haskell.makeFlake", + "repo": "serokell.nix", + "type": "github" + } + }, "stackage": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index 11964be..0711eb7 100644 --- a/flake.nix +++ b/flake.nix @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2020 Serokell +# SPDX-FileCopyrightText: 2021 Serokell # # SPDX-License-Identifier: MPL-2.0 @@ -10,6 +10,8 @@ }; inputs = { + serokell-nix.url = "github:serokell/serokell.nix/kirelagin/lib.haskell.makeFlake"; + nixpkgs.url = "github:serokell/nixpkgs"; haskell-nix = { inputs.hackage.follows = "hackage"; inputs.stackage.follows = "stackage"; @@ -18,37 +20,19 @@ stackage.flake = false; }; - outputs = { self, nixpkgs, flake-utils, haskell-nix, hackage, stackage }: + outputs = { self, nixpkgs, flake-utils, serokell-nix, haskell-nix, hackage, stackage }: flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: let pkgs = nixpkgs.legacyPackages.${system}.extend haskell-nix.overlay; - inherit (pkgs) lib; - src = ./.; - project = args: pkgs.haskell-nix.stackProject ({ inherit src; } // args); - with-utf8 = (project {}).with-utf8; - check = args: (project args).with-utf8.checks.with-utf8-test; - in rec { - packages = { - with-utf8 = with-utf8.components.library; - }; - defaultPackage = packages.with-utf8; - - checks = - let - mkGhcCheck = ghcVersion: { - name = "test-ghc${ghcVersion}"; - value = check { ghc = pkgs.haskell-nix.compiler."ghc${ghcVersion}"; }; - }; - in { - test = with-utf8.checks.with-utf8-test; - } // lib.listToAttrs (map mkGhcCheck [ "884" "8107" "901" ]); - - apps.utf8-troubleshoot = { - type = "app"; - program = "${with-utf8.components.exes.utf8-troubleshoot}/bin/utf8-troubleshoot"; - }; - defaultApp = apps.utf8-troubleshoot; - } + flake = + serokell-nix.lib.haskell.makeFlake pkgs.haskell-nix pkgs.haskell-nix.stackProject { + src = ./.; + ghcVersions = [ "884" "8107" "901" ]; + }; + in flake // { + defaultPackage = flake.packages."with-utf8:lib:with-utf8"; + defaultApp = flake.apps."with-utf8:exe:utf8-troubleshoot"; + } ); }