From 005404ec43b1be4a2749ffe0b46703419f6e8cd0 Mon Sep 17 00:00:00 2001 From: Julien Moutinho <julm@sourcephile.fr> Date: Thu, 3 Jun 2021 11:08:32 +0200 Subject: [PATCH] move from stack to flake.nix and cabal --- .envrc | 1 + .gitignore | 1 + cabal.project | 1 + default.nix | 38 +++++++++++++++++++++++++++++++++ flake.lock | 38 +++++++++++++++++++++++++++++++++ flake.nix | 12 +++++++++++ shell.nix | 1 + stack.yaml | 1 - symantic-document.cabal | 47 ++++++++++++++++++++++++----------------- 9 files changed, 120 insertions(+), 20 deletions(-) create mode 100644 .envrc create mode 100644 cabal.project create mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 shell.nix delete mode 100644 stack.yaml diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index bf52384..7580446 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.o .cabal-sandbox/ .stack-work/ +dist-newstyle/ bug/ cabal.sandbox.config dist/ diff --git a/cabal.project b/cabal.project new file mode 100644 index 0000000..dc68224 --- /dev/null +++ b/cabal.project @@ -0,0 +1 @@ +packages:. diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..50422f9 --- /dev/null +++ b/default.nix @@ -0,0 +1,38 @@ +{ pkgs ? import <nixpkgs> {} +, ghc ? null +, withHoogle ? false +}: +let + haskellPackages = + if ghc == null + then pkgs.haskellPackages + else pkgs.haskell.packages.${ghc}; + hs = haskellPackages.extend (with pkgs.haskell.lib; hself: hsuper: + { + } + ); +in hs.symantic-document // { + shell = hs.shellFor { + #doBenchmark = true; + packages = p: [ p.symantic-document ]; + nativeBuildInputs = [ + hs.cabal-install + #hs.ghc-events + #hs.hs-speedscope + #hs.profiteur + #hs.eventlog2html + hs.ghcid + #hs.threadscope + #hs.ghc-events-analyze + hs.haskell-language-server + #hs.hpc + ]; + buildInputs = [ + #hs.ghcid + #pkgs.ormolu + #pkgs.cabal2nix + #hs.hlint + ]; + inherit withHoogle; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ec1b57a --- /dev/null +++ b/flake.lock @@ -0,0 +1,38 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1622445595, + "narHash": "sha256-m+JRe6Wc5OZ/mKw2bB3+Tl0ZbtyxxxfnAWln8Q5qs+Y=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7d706970d94bc5559077eb1a6600afddcd25a7c8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "narHash": "sha256-6dR10Z9kkYML5DS6dga3eXQOYJx1hgn1bQQ/Tfp0Jxg=", + "path": "/nix/store/nr0xxrrlv1azzi69i303gxcqvgrm2g3w-nixpkgs-patched", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..494305f --- /dev/null +++ b/flake.nix @@ -0,0 +1,12 @@ +{ +inputs.nixpkgs.url = "flake:nixpkgs"; +inputs.flake-utils.url = "github:numtide/flake-utils"; +outputs = inputs: + inputs.flake-utils.lib.eachDefaultSystem (system: let + pkgs = inputs.nixpkgs.legacyPackages.${system}; + in { + defaultPackage = import ./default.nix { inherit pkgs; }; + devShell = (import ./default.nix { inherit pkgs; }).shell; + } + ); +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..0d9af5e --- /dev/null +++ b/shell.nix @@ -0,0 +1 @@ +(import ./. {}).shell diff --git a/stack.yaml b/stack.yaml deleted file mode 100644 index 427d534..0000000 --- a/stack.yaml +++ /dev/null @@ -1 +0,0 @@ -resolver: lts-15.4 diff --git a/symantic-document.cabal b/symantic-document.cabal index cbf852d..1c4315c 100644 --- a/symantic-document.cabal +++ b/symantic-document.cabal @@ -4,26 +4,35 @@ name: symantic-document -- | | | +--- code changes with no API change version: 1.5.2.20200320 category: Text -synopsis: Document symantics. -description: Symantics for generating documents. +synopsis: Symantics combinators for generating documents. +description: + Only generating plain text documents is supported for now, + those can however include ANSI escape sequences to use a 16 colors pallet. + . + Alternative: <ansi-wl-pprint https://hackage.haskell.org/package/ansi-wl-pprint>. extra-doc-files: license: GPL-3 license-file: COPYING stability: experimental -author: Julien Moutinho <julm+haskell@sourcephile.fr> -maintainer: Julien Moutinho <julm+haskell@sourcephile.fr> -bug-reports: Julien Moutinho <julm+haskell@sourcephile.fr> +author: Julien Moutinho <julm+symantic-document@sourcephile.fr> +maintainer: Julien Moutinho <julm+symantic-document@sourcephile.fr> +bug-reports: https://mails.sourcephile.fr/inbox/symantic-document -- homepage: build-type: Simple cabal-version: 1.24 -tested-with: GHC==8.8.3 +tested-with: GHC==8.10.4 extra-source-files: - stack.yaml + cabal.project + default.nix + .envrc + flake.lock + flake.nix + shell.nix extra-tmp-files: Source-Repository head - location: git://git.autogeree.net/symantic-document + location: git://git.sourcephile.fr/haskell/symantic-document type: git Library @@ -56,10 +65,10 @@ Library -fno-warn-tabs -fhide-source-paths build-depends: - ansi-terminal >= 0.7 - , base >= 4.6 && < 5 - , text >= 1.2 - , transformers >= 0.5 + ansi-terminal >= 0.7, + base >= 4.6 && < 5, + text >= 1.2, + transformers >= 0.5 Test-Suite symantic-document-test type: exitcode-stdio-1.0 @@ -94,10 +103,10 @@ Test-Suite symantic-document-test -- -fmax-simplifier-iterations=0 -- -dshow-passes build-depends: - symantic-document - , base >= 4.6 && < 5 - , containers >= 0.5 - , tasty >= 0.11 - , tasty-hunit >= 0.9 - , text >= 1.2 - , transformers >= 0.5 + symantic-document, + base >= 4.6 && < 5, + containers >= 0.5, + tasty >= 0.11, + tasty-hunit >= 0.9, + text >= 1.2, + transformers >= 0.5 -- 2.47.2