From e4968ed9f513d6180a1c76dd4cb89afc23a02cba Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Fri, 10 Apr 2020 20:44:24 -0700 Subject: [PATCH] do commit cabal file, simplify development instructions * it isn't necessary to run cabal2nix directly (developPackage) takes care of that. * the cabal file is committed, so it only needs to be updated when adding dependencies or new files --- .gitignore | 1 - README.md | 17 ++-- nixpkgs-update.cabal | 202 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 212 insertions(+), 8 deletions(-) create mode 100644 nixpkgs-update.cabal diff --git a/.gitignore b/.gitignore index 7dd4844..1f2f806 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ /result dist/ dist-newstyle/ -/nixpkgs-update.cabal /nixpkgs-update.nix .ghc* store-path-pre-build \ No newline at end of file diff --git a/README.md b/README.md index c2c561d..1a92a66 100644 --- a/README.md +++ b/README.md @@ -240,24 +240,22 @@ test a package with one command. # Development -Setup a Cabal file (also run this when adding new dependencies): +Incremental development: ```bash -nix run nixpkgs.haskellPackages.hpack -c hpack && nix run nixpkgs.cabal2nix -c cabal2nix --hpack . > nixpkgs-update.nix +nix-shell --run "cabal v2-repl" ``` -For incremental building, first make a Cabal file with the above command, then use nix-shell +Run the tests: ```bash -nix run nixpkgs.haskellPackages.hpack -c hpack && nix run nixpkgs.cabal2nix -c cabal2nix --hpack . > nixpkgs-update.nix -nix-shell -cabal v2-repl +nix-shell --run "cabal v2-test" ``` Run a type checker in the background for quicker type checking feedback: ```bash -nix-shell --run ghcid +nix-shell --run "ghcid" ``` Run a type checker for the app code: @@ -272,6 +270,11 @@ Run a type checker for the test code: nix-shell --run 'ghcid -c "cabal v2-repl tests"' ``` +Updating the Cabal file when adding new dependencies or options: + +```bash +nix run nixpkgs.haskellPackages.hpack -c hpack +``` Source files are formatted with [Ormolu](https://github.com/tweag/ormolu). diff --git a/nixpkgs-update.cabal b/nixpkgs-update.cabal new file mode 100644 index 0000000..be8d93a --- /dev/null +++ b/nixpkgs-update.cabal @@ -0,0 +1,202 @@ +cabal-version: 2.2 + +-- This file has been generated from package.yaml by hpack version 0.33.0. +-- +-- see: https://github.com/sol/hpack +-- +-- hash: 09aa8671b0f8077c9c194e15f72bc2aec790275993b5122ab17c192622236836 + +name: nixpkgs-update +version: 0.2.0 +synopsis: Tool for semi-automatic updating of nixpkgs repository +description: nixpkgs-update provides tools for updating of nixpkgs packages in a semi-automatic way. Mainly, it is used to run the GitHub bot @r-ryantm, but the underlying update mechanisms should be generally useful and in a later version should be exposed as a command-line tool. +category: Web +homepage: https://github.com/ryantm/nixpkgs-update#readme +bug-reports: https://github.com/ryantm/nixpkgs-update/issues +author: Ryan Mulligan et al. +maintainer: ryan@ryantm.com +copyright: 2018-2020 Ryan Mulligan et al. +license: CC0-1.0 +license-file: LICENSE +build-type: Simple +extra-source-files: + README.md + +source-repository head + type: git + location: https://github.com/ryantm/nixpkgs-update + +library + exposed-modules: + Blacklist + Check + CVE + Data.Hex + DeleteMerged + File + GH + Git + Nix + NVD + NVDRules + OurPrelude + Outpaths + Process + Repology + Rewrite + Time + Update + Utils + Version + other-modules: + Paths_nixpkgs_update + hs-source-dirs: + src + default-extensions: DataKinds FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables TypeApplications TypeFamilies TypeOperators BlockArguments + ghc-options: -Wall -O2 -flate-specialise -fspecialise-aggressively -fplugin=Polysemy.Plugin + build-depends: + aeson + , base >=4.13 && <5 + , bytestring + , conduit + , containers + , cryptohash-sha256 + , directory + , errors + , filepath + , github + , http-client-tls + , http-conduit + , iso8601-time + , lifted-base + , mtl + , neat-interpolation + , optparse-applicative + , parsec + , parsers + , partial-order + , polysemy + , polysemy-plugin + , regex-applicative-text + , servant + , servant-client + , sqlite-simple + , template-haskell + , temporary + , text + , time + , transformers + , typed-process + , unix + , unordered-containers + , vector + , versions + , xdg-basedir + , zlib + default-language: Haskell2010 + +executable nixpkgs-update + main-is: Main.hs + other-modules: + Paths_nixpkgs_update + hs-source-dirs: + app + default-extensions: DataKinds FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables TypeApplications TypeFamilies TypeOperators BlockArguments + ghc-options: -Wall -O2 -flate-specialise -fspecialise-aggressively -fplugin=Polysemy.Plugin + build-depends: + aeson + , base >=4.13 && <5 + , bytestring + , conduit + , containers + , cryptohash-sha256 + , directory + , errors + , filepath + , github + , http-client-tls + , http-conduit + , iso8601-time + , lifted-base + , mtl + , neat-interpolation + , nixpkgs-update + , optparse-applicative + , parsec + , parsers + , partial-order + , polysemy + , polysemy-plugin + , regex-applicative-text + , servant + , servant-client + , sqlite-simple + , template-haskell + , temporary + , text + , time + , transformers + , typed-process + , unix + , unordered-containers + , vector + , versions + , xdg-basedir + , zlib + default-language: Haskell2010 + +test-suite spec + type: exitcode-stdio-1.0 + main-is: Spec.hs + other-modules: + DoctestSpec + RewriteSpec + Paths_nixpkgs_update + hs-source-dirs: + test + default-extensions: DataKinds FlexibleContexts GADTs LambdaCase PolyKinds RankNTypes ScopedTypeVariables TypeApplications TypeFamilies TypeOperators BlockArguments + ghc-options: -Wall -O2 -flate-specialise -fspecialise-aggressively -fplugin=Polysemy.Plugin + build-depends: + aeson + , base >=4.13 && <5 + , bytestring + , conduit + , containers + , cryptohash-sha256 + , directory + , doctest + , errors + , filepath + , github + , hspec + , hspec-discover + , http-client-tls + , http-conduit + , iso8601-time + , lifted-base + , mtl + , neat-interpolation + , nixpkgs-update + , optparse-applicative + , parsec + , parsers + , partial-order + , polysemy + , polysemy-plugin + , regex-applicative-text + , servant + , servant-client + , sqlite-simple + , template-haskell + , temporary + , text + , time + , transformers + , typed-process + , unix + , unordered-containers + , vector + , versions + , xdg-basedir + , zlib + default-language: Haskell2010