From cbcd09f1147c2353246444884b016b9fd5a3d6ee Mon Sep 17 00:00:00 2001 From: iko Date: Tue, 13 Jul 2021 11:53:53 +0300 Subject: [PATCH] Migrate to haskell.nix for everything (#46) * Migrate to haskell.nix for everything * Fixed build (?) * Fixed build * build frontend with ghcjs * Updated Makefile * Uglified js * Made frontend actually work (: * Increase swap * Added checkout back in (: * Updated VS Code settings * formatted cabal.project * cleaned up nix --- .github/workflows/build.yaml | 21 +- .vscode/settings.json | 4 +- Caddyfile | 2 +- Makefile | 30 +- build.sh | 48 ++- cabal.project | 29 ++ default.nix | 55 ++-- nix/default.nix | 192 ++++++------ nix/haskell-language-server-overrides.nix | 288 ------------------ nix/octo.nix | 35 --- nix/octopod-overrides.nix | 110 ------- nix/sources.json | 76 +---- octo-cli/octo-cli.cabal | 2 +- octo-cli/src/Octopod/CLI/Args.hs | 1 - octopod-api/octopod-api.cabal | 2 +- octopod-common/octopod-common.cabal | 2 +- octopod-frontend/index.html | 11 + octopod-frontend/octopod-frontend.cabal | 4 +- .../src/Reflex/MultiEventWriter/Class.hs | 1 - shell.nix | 12 +- stack.yaml | 10 +- 21 files changed, 239 insertions(+), 696 deletions(-) delete mode 100644 nix/haskell-language-server-overrides.nix delete mode 100644 nix/octo.nix delete mode 100644 nix/octopod-overrides.nix create mode 100644 octopod-frontend/index.html diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 175d36e..ea53828 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -38,12 +38,16 @@ jobs: steps: - uses: actions/checkout@v2 - uses: cachix/install-nix-action@v12 + with: + extra_nix_config: | + trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= + substituters = https://hydra.iohk.io https://cache.nixos.org/ - uses: cachix/cachix-action@v8 with: name: octopod signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" - name: Build - run: nix-build nix/octo.nix + run: nix-build -A projectCross.musl64.hsPkgs.octo-cli.components.exes.octo - uses: actions/upload-artifact@v2 with: name: octo-cli-linux @@ -53,10 +57,25 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 600 steps: + - name: Increase swap + run: | + free -h + + sudo swapoff /mnt/swapfile + sudo fallocate -l 8G /mnt/swapfile + sudo mkswap /mnt/swapfile + sudo swapon /mnt/swapfile + + free -h - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - name: Install Nix uses: cachix/install-nix-action@v12 + with: + extra_nix_config: | + trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= + substituters = https://hydra.iohk.io https://cache.nixos.org/ - name: Login to Cachix uses: cachix/cachix-action@v8 diff --git a/.vscode/settings.json b/.vscode/settings.json index 0243fe9..242b7f5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,3 @@ { - "nixEnvSelector.nixShellConfig": "${workspaceRoot}/shell.nix" -} \ No newline at end of file + "nixEnvSelector.nixFile": "${workspaceRoot}/shell.nix" +} diff --git a/Caddyfile b/Caddyfile index d82b158..85f8b6a 100644 --- a/Caddyfile +++ b/Caddyfile @@ -12,7 +12,7 @@ reverse_proxy /api/* localhost:3002 rewrite @production /octopod-css/production/{http.regexp.production.1} rewrite /config.json /dev/config.json -rewrite * /frontend-result/bin/frontend.jsexe/{path} +rewrite * /frontend-result/{path} @3003 { diff --git a/Makefile b/Makefile index 32cadb2..5c19aeb 100644 --- a/Makefile +++ b/Makefile @@ -1,45 +1,37 @@ -.PHONY: build-backend build-octo-cli build-frontend docs backend-docs frontend-docs repl shell shell-ghcjs ghcid ghcid-cli ghcid-frontend push-octopod run-backend-dev run-frontend-dev +.PHONY: build-backend build-octo-cli build-frontend backend-docs repl shell ghcid ghcid-cli ghcid-frontend push-octopod run-backend-dev run-frontend-dev build-backend: - nix-build . -A ghc.octopod-backend -j auto + nix-build . -A octopod-backend.components.exes.octopod-exe -j auto build-octo-cli: - nix-build . -A ghc.octo-cli -j auto + nix-build . -A octo-cli.components.exes.octo -j auto build-frontend: - nix-build . -A ghcjs.octopod-frontend -o frontend-result -j auto - -docs: backend-docs frontend-docs + nix-build . -A octopod-frontend-pretty -o frontend-result -j auto backend-docs: - nix-build . -A ghc.octopod-backend.doc -j auto - -frontend-docs: - nix-build . -A ghcjs.octopod-frontend.doc -j auto + nix-build . -A octopod-backend.components.library.doc -j auto repl: - nix-shell . -A shells.ghc --run "cabal repl lib:octopod-backend" -j auto + nix-shell --run "cabal repl lib:octopod-backend" -j auto shell: - nix-shell . -A shells.ghc -j auto - -shell-ghcjs: - nix-shell . -A shells.ghcjs -j auto + nix-shell -j auto ghcid-backend: - nix-shell . -A shells.ghc --run 'ghcid -c "cabal new-repl octopod-backend"' -j auto + nix-shell --run 'ghcid -c "cabal new-repl octopod-backend"' -j auto ghcid-cli: - nix-shell . -A shells.ghc --run 'ghcid -c "cabal new-repl octo-cli"' -j auto + nix-shell --run 'ghcid -c "cabal new-repl octo-cli"' -j auto ghcid-frontend: - nix-shell . -A shells.ghc --run 'ghcid -c "cabal new-repl octopod-frontend -fdevelopment --ghc-options=-Wwarn" --warnings --test 'Main.main'' -j auto + nix-shell --run 'ghcid -c "cabal new-repl octopod-frontend -fdevelopment --ghc-options=-Wwarn" --warnings --test 'Main.main'' -j auto push-octopod: ./build.sh build-and-push latest run-backend-dev: dev/certs/server_cert.pem dev/certs/server_key.pem - ./dev/dev_backend.sh `nix-build . -A ghc.octopod-backend` + ./dev/dev_backend.sh `nix-build -A octopod-backend.components.exes.octopod-exe -j auto` run-frontend-dev: build-frontend caddy run diff --git a/build.sh b/build.sh index f068c5f..2c3dfa6 100755 --- a/build.sh +++ b/build.sh @@ -3,16 +3,11 @@ set -e build_octo_cli_docker_image() { - nix build nixpkgs.octo-cli-container \ - -I nixpkgs=nix \ - -o "$1" + nix-build ./nix -A octo-cli-container -o "$1" } build_octopod_server_docker_image() { - nix build nixpkgs.octopod-server-container \ - --arg migrations "$1" \ - -I nixpkgs=nix \ - -o "$2" + nix-build ./nix -A octopod-server-container --arg migrations "$1" -o "$2" } push_docker_images() { @@ -41,26 +36,25 @@ export octo_cli_docker="octo-docker" export octopod_server_docker="octopod-server-docker" case "$1" in - build-and-push) - echo "$1 mode" +build-and-push) + echo "$1 mode" - if test -z "$2" - then - echo "Please provide a tag to upload to" - exit 1 - fi - - build_docker_images - push_docker_images $2 - ;; - build) - echo "$1 mode" - build_docker_images - ;; - *) - echo "usage:" - echo " $0 build Builds the docker images." - echo " $0 build-and-push Builds the docker images and uploads it to Docker Hub under the tag ." + if test -z "$2"; then + echo "Please provide a tag to upload to" exit 1 - ;; + fi + + build_docker_images + push_docker_images $2 + ;; +build) + echo "$1 mode" + build_docker_images + ;; +*) + echo "usage:" + echo " $0 build Builds the docker images." + echo " $0 build-and-push Builds the docker images and uploads it to Docker Hub under the tag ." + exit 1 + ;; esac diff --git a/cabal.project b/cabal.project index 1324643..cd931f1 100644 --- a/cabal.project +++ b/cabal.project @@ -4,3 +4,32 @@ packages: octopod-backend/ octopod-common/ octopod-frontend/ + +allow-newer: + servant-reflex:servant, + servant-reflex:servant-auth, + servant-reflex:reflex + +source-repository-package + type: git + location: https://github.com/ilyakooo0/obelisk + tag: e3c45d230bfc60351c82e8674bc190349fcfae3a + subdir: lib/route + --sha256: 1syczkabq8yz7fw5jpmax15770bbb12wgdmm3lbgvh4m9qvfmblg + +source-repository-package + type: git + location: https://github.com/obsidiansystems/obelisk + tag: 7ad33cbe3e84b209e83c505ce25486445bbd602e + subdir: lib/tabulation + --sha256: 0dlk8y6rxc87crw7764zq2py7nqn38lw496ca1y893m9gdq8qdkz + +source-repository-package + type: git + location: https://github.com/obsidiansystems/obelisk + tag: 7ad33cbe3e84b209e83c505ce25486445bbd602e + subdir: lib/executable-config/lookup + --sha256: 0dlk8y6rxc87crw7764zq2py7nqn38lw496ca1y893m9gdq8qdkz + +package reflex-dom + flags: +use-warp diff --git a/default.nix b/default.nix index e9429d8..fd0fd01 100644 --- a/default.nix +++ b/default.nix @@ -1,38 +1,23 @@ { sources ? import ./nix/sources.nix -, reflex-platform ? sources.reflex-platform -, hls ? false +, haskellNix ? import sources.haskellNix { } +, pkgs ? import haskellNix.sources.nixpkgs-2105 haskellNix.nixpkgsArgs }: -(import reflex-platform { }).project ({ pkgs, ... }: - let foldOs = pkgs.lib.foldl' pkgs.lib.composeExtensions (self: super: { }); - in - { - useWarp = true; - - packages = { - octopod-common = ./octopod-common; - octopod-frontend = ./octopod-frontend; - octopod-backend = ./octopod-backend; - octo-cli = ./octo-cli; - octopod-api = ./octopod-api; +let + hsPkgs = pkgs.haskell-nix.cabalProject { + src = pkgs.haskell-nix.haskellLib.cleanGit { + name = "octopod"; + src = ./.; }; - - overrides = foldOs [ - (import ./nix/haskell-language-server-overrides.nix { - inherit (pkgs.haskell) lib; - inherit sources; - } - ) - (import ./nix/octopod-overrides.nix { - inherit (pkgs.haskell) lib; - inherit sources; - } - ) - ]; - shellToolOverrides = ghc: super: - if hls then { inherit (ghc) haskell-language-server; } - else { }; - shells = { - ghc = [ "octopod-common" "octopod-backend" "octopod-frontend" "octopod-api" "octo-cli" ]; - ghcjs = [ "octopod-common" "octopod-frontend" ]; - }; - }) + index-state = "2021-07-02T00:00:00Z"; + compiler-nix-name = "ghc8105"; + }; +in +hsPkgs // { + octopod-frontend-pretty = + pkgs.runCommand "octopod-frontend-pretty" + { } '' + mkdir $out + cp ${./octopod-frontend/index.html} $out/index.html + cp ${hsPkgs.projectCross.ghcjs.hsPkgs.octopod-frontend.components.exes.frontend}/bin/frontend.jsexe/all.js $out/all.js + ''; +} diff --git a/nix/default.nix b/nix/default.nix index c943abb..d5921ab 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,122 +1,112 @@ { sources ? import ./sources.nix - , octopod-css ? ../octopod-css - , migrations ? "please use '--arg migration '" }: -with { - overlay = _: pkgs: - with pkgs; rec { - octo-cli = haskellPackages.octo-cli-static; - octopod-backend = haskellPackages.octopod-server-static; - octopod-frontend = haskellPackages.octopod-frontend-static; +let + hsPkgs = import ./.. { }; - cacert' = cacert.overrideAttrs (o: { - fixupPhase = '' - cat $out/etc/ssl/certs/* > $out/etc/ssl/certs/ca-certificates.crt - ''; - }); + pkgs = hsPkgs.pkgs; - octopod-server-container = dockerTools.buildImage { - name = "octopod-server-container-slim"; - contents = [ - octopod-backend - octopod-frontend - git - coreutils - bash - openssh - gnugrep - cacert' - shadow - findutils - ]; + octo-cli = hsPkgs.octo-cli.components.exes.octo; + octopod-backend = hsPkgs.octopod-backend.components.exes.octopod-exe; - runAsRoot = '' - mkdir /tmp - chmod 777 /tmp + terser = (import sources.nixpkgs { }).nodePackages.terser; - mkdir -p /home/octopod - useradd octopod -d /home/octopod - chown octopod.octopod /home/octopod + octopod-frontend-ugly = pkgs.runCommand "octopod-frontend-ugly" + { } '' + mkdir $out + cp ${hsPkgs.octopod-frontend-pretty}/index.html $out/index.html - mkdir /app - cp -av ${octopod-backend}/bin/octopod-exe /app/octopod-exe + ${terser}/bin/terser ${hsPkgs.octopod-frontend-pretty}/all.js -o $out/all.js -mangle -c + ''; - mkdir -p /migrations/{deploy,revert,verify} - cp -av ${migrations}/* /migrations/ + cacert' = pkgs.cacert.overrideAttrs (o: { + fixupPhase = '' + cat $out/etc/ssl/certs/* > $out/etc/ssl/certs/ca-certificates.crt + ''; + }); - mkdir /tls /tls_store + octopod-server-container = pkgs.dockerTools.buildImage { + name = "octopod-server-container-slim"; + contents = with pkgs; [ + octopod-backend + octopod-frontend-ugly + git + coreutils + bash + openssh + gnugrep + cacert' + shadow + findutils + ]; - mkdir -p /www/static/{images,styles,vendors/outline} - cp -av ${octopod-frontend}/bin/frontend.jsexe/* /www/ - cp -av ${octopod-css}/production/images/* /www/static/images/ - cp -av ${octopod-css}/production/styles/* /www/static/styles/ - cp -av ${octopod-css}/production/vendors/outline/* /www/static/vendors/outline/ - cp -av ${octopod-css}/favicons/* /www/ - ''; + runAsRoot = '' + mkdir /tmp + chmod 777 /tmp - config = { - Entrypoint = [ "/app/octopod-exe" ]; - Cmd = [ - "--port" - "4443" - "--ui-port" - "4000" - "--ws-port" - "4020" - "--db" - "host='127.0.0.1' port=5432 user='octopod' password='octopod'" - "--db-pool-size" - "10" - "--tls-cert-path" - "/tls/server_cert.pem" - "--tls-key-path" - "/tls/server_key.pem" - "--tls-store-path" - "/tls_store" - ]; - Env = [ - "PATH=/utils:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - "USER=octopod" - ]; - }; - }; + mkdir -p /home/octopod + useradd octopod -d /home/octopod + chown octopod.octopod /home/octopod - octo-cli-container = dockerTools.buildImage { - name = "octo-cli-container-slim"; - contents = [ octo-cli coreutils bash ]; + mkdir /app + cp -av ${octopod-backend}/bin/octopod-exe /app/octopod-exe - runAsRoot = '' - mkdir /app - cp -av ${octo-cli}/bin/octo /app/octo - ''; + mkdir -p /migrations/{deploy,revert,verify} + cp -av ${migrations}/* /migrations/ - config = { - Entrypoint = [ "/app/octo" ]; - Env = [ "EDITOR=${vim}/bin/vim" ]; - }; - }; + mkdir /tls /tls_store - niv = import sources.niv { }; + mkdir -p /www/static/{images,styles,vendors/outline} + cp -av ${octopod-frontend-ugly}/* /www/ + cp -av ${octopod-css}/production/images/* /www/static/images/ + cp -av ${octopod-css}/production/styles/* /www/static/styles/ + cp -av ${octopod-css}/production/vendors/outline/* /www/static/vendors/outline/ + cp -av ${octopod-css}/favicons/* /www/ + ''; - haskellPackages = pkgs.haskellPackages.override { - overrides = hself: hsuper: { - octo-cli-static = haskell.lib.justStaticExecutables - (hsuper.callPackage ../default.nix { }).ghc.octo-cli; - - octopod-server-static = haskell.lib.justStaticExecutables - (hsuper.callPackage ../default.nix { }).ghc.octopod-backend; - - octopod-frontend-static = haskell.lib.justStaticExecutables - (hsuper.callPackage ../default.nix { }).ghcjs.octopod-frontend; - }; - }; + config = { + Entrypoint = [ "/app/octopod-exe" ]; + Cmd = [ + "--port" + "4443" + "--ui-port" + "4000" + "--ws-port" + "4020" + "--db" + "host='127.0.0.1' port=5432 user='octopod' password='octopod'" + "--db-pool-size" + "10" + "--tls-cert-path" + "/tls/server_cert.pem" + "--tls-key-path" + "/tls/server_key.pem" + "--tls-store-path" + "/tls_store" + ]; + Env = [ + "PATH=/utils:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + "USER=octopod" + ]; }; -}; -import - sources.nixpkgs # and use them again! + }; + + octo-cli-container = pkgs.dockerTools.buildImage { + name = "octo-cli-container-slim"; + contents = with pkgs; [ octo-cli coreutils bash ]; + + runAsRoot = '' + mkdir /app + cp -av ${octo-cli}/bin/octo /app/octo + ''; + + config = { + Entrypoint = [ "/app/octo" ]; + Env = [ "EDITOR=${pkgs.vim}/bin/vim" ]; + }; + }; +in { - overlays = [ overlay ]; - config = { }; + inherit octo-cli-container octopod-server-container octopod-frontend-ugly; } diff --git a/nix/haskell-language-server-overrides.nix b/nix/haskell-language-server-overrides.nix deleted file mode 100644 index cdc430d..0000000 --- a/nix/haskell-language-server-overrides.nix +++ /dev/null @@ -1,288 +0,0 @@ -{ lib, sources ? import ./sources.nix }: hself: hsuper: -{ - haskell-language-server = lib.dontCheck (hsuper.callCabal2nix "haskell-language-server" (sources.haskell-language-server) { }); - hls-hlint-plugin = hsuper.callCabal2nix "hls-hlint-plugin" (sources.haskell-language-server + "/plugins/hls-hlint-plugin") { }; - hls-explicit-imports-plugin = hsuper.callCabal2nix "hls-explicit-imports-plugin" (sources.haskell-language-server + "/plugins/hls-explicit-imports-plugin") { }; - hls-retrie-plugin = hsuper.callCabal2nix "hls-retrie-plugin" (sources.haskell-language-server + "/plugins/hls-retrie-plugin") { }; - hls-plugin-api = hsuper.callCabal2nix "hls-plugin-api" (sources.haskell-language-server + "/hls-plugin-api") { }; - hls-tactics-plugin = hsuper.callCabal2nix "hls-tactics-plugin" (sources.haskell-language-server + "/plugins/hls-tactics-plugin") { }; - hls-class-plugin = hsuper.callCabal2nix "hls-class-plugin" (sources.haskell-language-server + "/plugins/hls-class-plugin") { }; - hls-eval-plugin = hsuper.callCabal2nix "hls-eval-plugin" (sources.haskell-language-server + "/plugins/hls-eval-plugin") { }; - hls-haddock-comments-plugin = hsuper.callCabal2nix "hls-haddock-comments-plugin" (sources.haskell-language-server + "/plugins/hls-haddock-comments-plugin") { }; - hls-splice-plugin = hsuper.callCabal2nix "hls-splice-plugin" (sources.haskell-language-server + "/plugins/hls-splice-plugin") { }; - shake-bench = hsuper.callCabal2nix "shake-bench" (sources.haskell-language-server + "/shake-bench") { }; - ghcide = lib.dontCheck (hsuper.callCabal2nix "ghcide" (sources.haskell-language-server + "/ghcide") { }); - hie-compat = hsuper.callCabal2nix "hie-compat" (sources.haskell-language-server + "/hie-compat") { }; - hls-exactprint-utils = hsuper.callCabal2nix "hls-exactprint-utils" (sources.haskell-language-server + "/hls-exactprint-utils") { }; - with-utf8 = (hsuper.callHackageDirect - { - pkg = "with-utf8"; - ver = "1.0.2.1"; - sha256 = "1hpqc0ljk1c1vl4671zb290hbvdcjpg66bcxmf1cz8h0vb382xp7"; - } { } - ); - hiedb = lib.dontCheck (hsuper.callHackageDirect - { - pkg = "hiedb"; - ver = "0.3.0.1"; - sha256 = "0n6m13lybnb6vl0lh69i2v6xykcd0bl5svkk18964k4wza8a5b12"; - } { } - ); - algebraic-graphs = (hsuper.callHackageDirect - { - pkg = "algebraic-graphs"; - ver = "0.5"; - sha256 = "0z8mgzdis72a9zd9x9f185phqr4bx8s06piggis4rlih1rly61nr"; - } { } - ); - inspection-testing = (hsuper.callHackageDirect - { - pkg = "inspection-testing"; - ver = "0.4.2.4"; - sha256 = "01mgxxjayv41cdmdm8dxmap3c7i289jw72sfa1gmi6v1bd8mbzh8"; - } { } - ); - fourmolu = lib.doJailbreak (hsuper.callHackageDirect - { - pkg = "fourmolu"; - ver = "0.3.0.0"; - sha256 = "sha256-SFBwhkXfDArITiBSxGSp2qf8gl+yBpWHglBB5aKeaBU="; - } { } - ); - heapsize = lib.doJailbreak (hsuper.callHackageDirect - { - pkg = "heapsize"; - ver = "0.3.0.1"; - sha256 = "0c8lqndpbx9ahjrqyfxjkj0z4yhm1zlcn8al0ir4ldlahql2xv3r"; - } { } - ); - opentelemetry = hsuper.callHackageDirect - { - pkg = "opentelemetry"; - ver = "0.6.1"; - sha256 = "08k71z7bns0i6r89nmxqsl00kyksicq619rqy6pf5m7hq1r4zs9m"; - } { }; - ghc-trace-events = hsuper.callHackageDirect - { - pkg = "ghc-trace-events"; - ver = "0.1.2.1"; - sha256 = "10vrm7hmg97fn8xf0r79d9vfph0j2s105lsgm0hgqay1qz1x7sp7"; - } { }; - haskell-lsp = hsuper.callHackageDirect - { - pkg = "haskell-lsp"; - ver = "0.23.0.0"; - sha256 = "0d9bk1cqkk41frm81j683h2vd1hghl4hlvj8g17690d2qk5pq3c0"; - } { }; - haskell-lsp-types = hsuper.callHackageDirect - { - pkg = "haskell-lsp-types"; - ver = "0.23.0.0"; - sha256 = "17mfc2zxkbwipxiy0g3qwqnyp8ds4mrg0z1v7jchcm89hnf8mmmq"; - } { }; - ormolu = - hsuper.callHackageDirect - { - pkg = "ormolu"; - ver = "0.1.4.1"; - sha256 = "07gfag591dsys33q2i80f3afxjqny2zpiq4z35d1ajyp7di73m7z"; - } { }; - ghc-check = - hsuper.callHackageDirect - { - pkg = "ghc-check"; - ver = "0.5.0.1"; - sha256 = "1zlbss7h6infzhhpilvkpk50gxypkb2li8fspi69jlll5l7wqi3d"; - } { }; - implicit-hie-cradle = - hsuper.callHackageDirect - { - pkg = "implicit-hie-cradle"; - ver = "0.3.0.2"; - sha256 = "1fhc8zccd7g7ixka05cba3cd4qf5jvq1zif29bhn593dfkzy89lz"; - } { }; - implicit-hie = - hsuper.callHackageDirect - { - pkg = "implicit-hie"; - ver = "0.1.2.5"; - sha256 = "1l0rz4r4hamvmqlb68a7y4s3n73y6xx76zyprksd0pscd9axznnv"; - } { }; - lsp-test = lib.dontCheck (hsuper.callHackageDirect - { - pkg = "lsp-test"; - ver = "0.12.0.0"; - sha256 = "1v6zg2pvjw31645129sbj2qss0zf1npk7m25dv0iiiq3gw0wqls4"; - } { } - ); - floskell = lib.dontCheck ( - hsuper.callHackageDirect - { - pkg = "floskell"; - ver = "0.10.4"; - sha256 = "0n1gy6yf7lzzh9l67712rr7bjliyifi9xjnc6i9rppiv5adj2xyf"; - } { } - ); - monad-dijkstra = lib.dontCheck (lib.doJailbreak ( - hsuper.callHackageDirect - { - pkg = "monad-dijkstra"; - ver = "0.1.1.2"; - sha256 = "1vyw7az18yy5s9jwi3icq76zvi9myr0y9gja3jaywlykcdn6frsz"; - } { } - )); - HsYAML-aeson = lib.doJailbreak ( - hsuper.callHackageDirect - { - pkg = "HsYAML-aeson"; - ver = "0.2.0.0"; - sha256 = "0zgcp93y93h7rsg9dv202hf3l6sqr95iadd67lmfclb0npfs640m"; - } { } - ); - ghc-lib-parser-ex = - hsuper.callHackageDirect - { - pkg = "ghc-lib-parser-ex"; - ver = "8.10.0.16"; - sha256 = "0dp8plj708ss3im6rmp41kpj0df71kjzpw1kqkpn0dhms9yr1g0x"; - } { }; - retrie = lib.doJailbreak (lib.dontCheck ( - hsuper.callHackageDirect - { - pkg = "retrie"; - ver = "0.1.1.1"; - sha256 = "0gnp6j35jnk1gcglrymvvn13sawir0610vh0z8ya6599kyddmw7l"; - } { } - )); - ghc-lib = - hsuper.callHackageDirect - { - pkg = "ghc-lib"; - ver = "8.10.2.20200916"; - sha256 = "1gx0ijay9chachmd1fbb61md3zlvj24kk63fk3dssx8r9c2yp493"; - } { }; - ghc-lib-parser = - hsuper.callHackageDirect - { - pkg = "ghc-lib-parser"; - ver = "8.10.2.20200916"; - sha256 = "1apm9zn484sm6b8flbh6a2kqnv1wjan4l58b81cic5fc1jsqnyjk"; - } { }; - parser-combinators = - hsuper.callHackageDirect - { - pkg = "parser-combinators"; - ver = "1.2.1"; - sha256 = "1990d6c1zm2wq4w9521bx7l3arg4ly02hq1ass9n19gs273bxx5h"; - } { }; - regex-tdfa = - hsuper.callHackageDirect - { - pkg = "regex-tdfa"; - ver = "1.3.1.0"; - sha256 = "1a0l7kdjzp98smfp969mgkwrz60ph24xy0kh2dajnymnr8vd7b8g"; - } { }; - regex-posix = - hsuper.callHackageDirect - { - pkg = "regex-posix"; - ver = "0.96.0.0"; - sha256 = "0js977ahpz10642sbpb55mw9h01pilai6z201wgkncgkg2d69hl3"; - } { }; - ansi-terminal = - hsuper.callHackageDirect - { - pkg = "ansi-terminal"; - ver = "0.10.3"; - sha256 = "1aa8lh7pl054kz7i59iym49s8w473nhdqgc3pq16cp5v4358hw5k"; - } { }; - ghc-exactprint = - hsuper.callHackageDirect - { - pkg = "ghc-exactprint"; - ver = "0.6.3.2"; - sha256 = "0l9piqqgdi8xd46nj1jizp0r0v526d7f61y05xm8k4aamjaj59d0"; - } { }; - stylish-haskell = - hsuper.callHackageDirect - { - pkg = "stylish-haskell"; - ver = "0.12.2.0"; - sha256 = "1ck8i550rvzbvzrm7dvgir73slai8zmvfppg3n5v4igi7y3jy0mr"; - } { }; - shake = lib.dontCheck ( - hsuper.callHackageDirect - { - pkg = "shake"; - ver = "0.19.2"; - sha256 = "03p5hq0sg13ii39j9hf3nvy8v20mkh8czb59djn6zrg7fypy9ivv"; - } { } - ); - regex-base = - hsuper.callHackageDirect - { - pkg = "regex-base"; - ver = "0.94.0.0"; - sha256 = "0x2ip8kn3sv599r7yc9dmdx7hgh5x632m45ga99ib5rnbn6kvn8x"; - } { }; - quickcheck-instances = - hsuper.callHackageDirect - { - pkg = "quickcheck-instances"; - ver = "0.3.22"; - sha256 = "05mam3x4x7c881bqbq8lcbclmz914yziqh6s04icxzp12zq7c7ks"; - } { }; - apply-refact = lib.doJailbreak (hsuper.callHackageDirect - { - pkg = "apply-refact"; - ver = "0.9.0.0"; - sha256 = "1vxxzfajg248lk4s6lh1jjkn1rym8x6zs5985i5kpz989k6cpyx5"; - } { } - ); - hlint = - hsuper.callHackageDirect - { - pkg = "hlint"; - ver = "3.2.3"; - sha256 = "1ka150d227ssyzg7ahj0q69svdsviszh65jv8yg6yybwz0in8kgi"; - } { }; - Diff = - hsuper.callHackageDirect - { - pkg = "Diff"; - ver = "0.4.0"; - sha256 = "1phz4cz7i53jx3d1bj0xnx8vpkk482g4ph044zv5c6ssirnzq3ng"; - } { }; - refinery = lib.dontCheck ( - hsuper.callHackageDirect - { - pkg = "refinery"; - ver = "0.3.0.0"; - sha256 = "08s5pw6j3ncz96zfc2j0cna2zbf4vy7045d6jpzmq2sa161qnpgi"; - } { } - ); - hie-bios = lib.dontCheck ( - hsuper.callHackageDirect - { - pkg = "hie-bios"; - ver = "0.7.1"; - sha256 = "137f1dy0fmlrzngwcmgnxghcih7f2rfq5bdnizbwy9534dn4dr42"; - } { } - ); - megaparsec = - hsuper.callHackageDirect - { - pkg = "megaparsec"; - ver = "9.0.1"; - sha256 = "1279c0snq1w13scikiakdm25ybpnvbpm7khjq4wyy0gj1vvh8r6z"; - } { }; - test-framework = lib.doJailbreak hsuper.test-framework; - aeson = lib.dontCheck hsuper.aeson; - tree-diff = lib.doJailbreak hsuper.tree-diff; - brittany = hsuper.callHackageDirect - { - pkg = "brittany"; - ver = "0.13.1.0"; - sha256 = "172mg0ch2awfzhz8vzvjrfdjylfzawrbgfr5z82l1qzjh6g9z295"; - } { }; -} diff --git a/nix/octo.nix b/nix/octo.nix deleted file mode 100644 index ff28a10..0000000 --- a/nix/octo.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ sources ? import ./sources.nix -, compiler ? "ghc865" -, pkgs-expr ? sources.nixpkgs -, static-haskell-nix ? sources.static-haskell-nix -}: -let - foldOs = normalPkgs.lib.foldl' normalPkgs.lib.composeExtensions (self: super: { }); - normalPkgs = import pkgs-expr { - overlays = [ - (self: super: { - haskell = super.haskell // { - packages = super.haskell.packages // { - "${compiler}" = super.haskell.packages."${compiler}".override { - overrides = - foldOs [ - (import ./octopod-overrides.nix { - inherit (normalPkgs.haskell) lib; - inherit sources; - } - ) - (hself: hsuper: { - octo-cli = hsuper.callCabal2nix "octo-cli" ../octo-cli { }; - octopod-api = hsuper.callCabal2nix "octopod-api" ../octopod-api { }; - octopod-common = hsuper.callCabal2nix "octopod-common" ../octopod-common { }; - }) - ]; - }; - }; - }; - }) - ]; - }; - static-haskell = import "${static-haskell-nix}/survey" { inherit normalPkgs compiler; }; -in -static-haskell.haskellPackages.octo-cli diff --git a/nix/octopod-overrides.nix b/nix/octopod-overrides.nix deleted file mode 100644 index cb540a1..0000000 --- a/nix/octopod-overrides.nix +++ /dev/null @@ -1,110 +0,0 @@ -{ lib, sources ? import ./sources.nix }: hself: hsuper: -{ - tabulation = hsuper.callCabal2nix "tabulation" "${sources.obelisk}/lib/tabulation" { }; - obelisk-executable-config-lookup = hsuper.callCabal2nix "obelisk-executable-config-lookup" "${sources.obelisk}/lib/executable-config/lookup" { }; - obelisk-route = hsuper.callCabal2nix "obelisk-route" "${sources.obelisk}/lib/route" { }; - hspec-webdriver = hsuper.callCabal2nix "hspec-webdriver" sources.hspec-webdriver-clone { }; - servant-reflex = lib.doJailbreak (hsuper.callHackageDirect - { - pkg = "servant-reflex"; - ver = "0.3.5"; - sha256 = "1cj5b7hl4jhsqxfg8vdw50z8zvfxkj42f41hmyx217w6bv3s3fdb"; - } { } - ); - servant = hsuper.callHackageDirect - { - pkg = "servant"; - ver = "0.18.2"; - sha256 = "0l2k895nxvw2ngr9201g3br6s9zab7mk5mhpjibyg8mxfbv75a8y"; - } { }; - servant-client-core = hsuper.callHackageDirect - { - pkg = "servant-client-core"; - ver = "0.18.2"; - sha256 = "1hazxk1laklpm2c65zgkk2gn8mvlp682437071s04bqggk9b59sx"; - } { }; - servant-server = hsuper.callHackageDirect - { - pkg = "servant-server"; - ver = "0.18.2"; - sha256 = "1kynxl7qg5z45bhi0k61sxn79xkgnq1z97ccqqs39wjyf45fj5yy"; - } { }; - servant-client = hsuper.callHackageDirect - { - pkg = "servant-client"; - ver = "0.18.2"; - sha256 = "0yip2s63ivrlrpficdipq60j2a6czg8agn18lpkkaxf3n55j4jr3"; - } { }; - servant-websockets = hsuper.callHackageDirect - { - pkg = "servant-websockets"; - ver = "2.0.0"; - sha256 = "01bmwg3ysj8gijcqghykxfsd62sqz1pfby2irpzh5ybwyh285pvg"; - } { }; - deriving-aeson = hsuper.callHackageDirect - { - pkg = "deriving-aeson"; - ver = "0.2.3"; - sha256 = "0ckwdi9pr4aqp9psag4mdbx30nygxkkpdf21rg9rfz16cz8079j7"; - } { }; - table-layout = hsuper.callHackageDirect - { - pkg = "table-layout"; - ver = "0.9.0.1"; - sha256 = "12nllfnh6b5mjda9qxfy192v0r0sx181w9zc9j70kvjdn7hgrb0y"; - } { }; - data-default-instances-base = hsuper.callHackageDirect - { - pkg = "data-default-instances-base"; - ver = "0.1.0.1"; - sha256 = "18basdy4qjn246phw008ll9zbi3rpdn6bh2dk0i81a60gsmyn58q"; - } { }; - postgresql-simple = hsuper.callHackageDirect - { - pkg = "postgresql-simple"; - ver = "0.6.3"; - sha256 = "16kk1bc23gc23cd79c2iy90zh03x5n6b9r2kinjspy7hl9jlzs2a"; - } { }; - concurrent-output = hsuper.callHackageDirect - { - pkg = "concurrent-output"; - ver = "1.10.12"; - sha256 = "1ysvahlf6frjfxpv6lwzxn05ps6b4zy1f5xb0yg6z688wbw1f6a7"; - } { }; - hspec-wai = hsuper.callHackageDirect - { - pkg = "hspec-wai"; - ver = "0.11.0"; - sha256 = "1kqbk2by70smhd9p1zff6ilimvvxc54dkh2l0wpn03zqvydjnwl2"; - } { }; - patch = lib.doJailbreak (hsuper.callHackageDirect - { - pkg = "patch"; - ver = "0.0.3.2"; - sha256 = "10alg64zwx72lz42z9i5hfwdpk0r79zfli57l41akyznj4pwrvgh"; - } { } - ); - path = hsuper.callHackageDirect - { - pkg = "path"; - ver = "0.8.0"; - sha256 = "0isldidz2gypw2pz399g6rn77x9mppd1mvj5h6ify4pj4mpla0pb"; - } { }; - path-io = hsuper.callHackageDirect - { - pkg = "path-io"; - ver = "1.6.2"; - sha256 = "1s7cahx8cf85kwz9l8cm6x6kvjwsv0spwv78pybsspb1ap5q287p"; - } { }; - extra = - hsuper.callHackageDirect - { - pkg = "extra"; - ver = "1.7.9"; - sha256 = "0q64x7qiw0zsi8dv958nrqidjlgv9w20wva1y73affq8470m28vh"; - } { }; - reflex = lib.dontCheck (lib.doJailbreak hsuper.reflex); - reflex-dom-core = lib.dontCheck hsuper.reflex-dom-core; - chronos = lib.doJailbreak hsuper.chronos; - hedgehog = lib.doJailbreak hsuper.hedgehog; -} diff --git a/nix/sources.json b/nix/sources.json index e211a60..1ee0f87 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -1,26 +1,14 @@ { - "haskell-language-server": { + "haskellNix": { "branch": "master", - "description": "Integration point for ghcide and haskell-ide-engine. One IDE to rule them all.", - "homepage": "", - "owner": "haskell", - "repo": "haskell-language-server", - "rev": "9c40dcff1b989b14e05b5aebe96f3da78c6ea25c", - "sha256": "0i17ssfmcgh6z1b8q7cy3x46xi81x5z82ngik86h8d5cb6w98lsn", + "description": "Alternative Haskell Infrastructure for Nixpkgs", + "homepage": "https://input-output-hk.github.io/haskell.nix", + "owner": "input-output-hk", + "repo": "haskell.nix", + "rev": "920ac43ee13d95f56d7539bece1f5ee41b10c8a9", + "sha256": "0px60yvag24ayj9zl82cbnpixm41slj2wqw4p2vgbwnbz125hgsx", "type": "tarball", - "url": "https://github.com/haskell/haskell-language-server/archive/9c40dcff1b989b14e05b5aebe96f3da78c6ea25c.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "hspec-webdriver-clone": { - "branch": "master", - "description": "Clone of hspec-webdriver, as the original source is inaccesible", - "homepage": null, - "owner": "dfordivam", - "repo": "hspec-webdriver-clone", - "rev": "0d748b7bb7cd74dce0a55a1ec86b01dbb8a71cd8", - "sha256": "1criynifhvmnqwhrshmzylikqkvlgq98xf72w9cdd2zpjw539qf0", - "type": "tarball", - "url": "https://github.com/dfordivam/hspec-webdriver-clone/archive/0d748b7bb7cd74dce0a55a1ec86b01dbb8a71cd8.tar.gz", + "url": "https://github.com/input-output-hk/haskell.nix/archive/920ac43ee13d95f56d7539bece1f5ee41b10c8a9.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "niv": { @@ -36,51 +24,15 @@ "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { - "branch": "63ad5ab28ee380a4c6a974c9f70639f81a15f6ad", - "description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to", - "homepage": "https://github.com/NixOS/nixpkgs", + "branch": "master", + "description": "Nix Packages collection", + "homepage": "", "owner": "NixOS", "repo": "nixpkgs", - "rev": "63ad5ab28ee380a4c6a974c9f70639f81a15f6ad", - "sha256": "1lppx6rsr52hdd1bp25ni4d6c8b76ip6lvr0iphfv0d1jjdf9r4h", + "rev": "eb93bf6eed08d06bc4eb08b534e544b1f9b4e966", + "sha256": "0sm6n0m396szc5wzrkmyqff26qlf3vi9naykyj5vb0lzm485r99n", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/63ad5ab28ee380a4c6a974c9f70639f81a15f6ad.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "obelisk": { - "branch": "master", - "description": "Functional reactive web and mobile applications, with batteries included.", - "homepage": "https://reflex-frp.org", - "owner": "obsidiansystems", - "repo": "obelisk", - "rev": "11beb6e8cd2419b2429925b76a98f24035e40985", - "sha256": "0b4m33b7yyzsbkvfz2kwg4v9hlnvbjlmjikbvwd7pg52vy84and0", - "type": "tarball", - "url": "https://github.com/obsidiansystems/obelisk/archive/11beb6e8cd2419b2429925b76a98f24035e40985.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "reflex-platform": { - "branch": "rc/0.6.0.0", - "description": "A curated package set and set of tools that let you build Haskell packages so they can run on a variety of platforms. reflex-platform is built on top of the nix package manager.", - "homepage": "https://reflex-frp.org", - "owner": "reflex-frp", - "repo": "reflex-platform", - "rev": "8d421e9e06b0477cbc065346aaf596c9db6cc387", - "sha256": "06fy5b0mk5k2ps1h78yihf4j76cb855r86y9p4jv5d91nfyl2dck", - "type": "tarball", - "url": "https://github.com/reflex-frp/reflex-platform/archive/8d421e9e06b0477cbc065346aaf596c9db6cc387.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - }, - "static-haskell-nix": { - "branch": "master", - "description": "easily build most Haskell programs into fully static Linux executables", - "homepage": "", - "owner": "nh2", - "repo": "static-haskell-nix", - "rev": "382150290ba43b6eb41981c1ab3b32aa31798140", - "sha256": "0zsyplzf1k235rl26irm27y5ljd8ciayw80q575msxa69a9y2nvd", - "type": "tarball", - "url": "https://github.com/nh2/static-haskell-nix/archive/382150290ba43b6eb41981c1ab3b32aa31798140.tar.gz", + "url": "https://github.com/NixOS/nixpkgs/archive/eb93bf6eed08d06bc4eb08b534e544b1f9b4e966.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } diff --git a/octo-cli/octo-cli.cabal b/octo-cli/octo-cli.cabal index 1ffb332..0aea5be 100644 --- a/octo-cli/octo-cli.cabal +++ b/octo-cli/octo-cli.cabal @@ -36,7 +36,7 @@ executable octo OverloadedLabels build-depends: aeson, - base ^>=4.12.0.0, + base, bytestring, chronos, connection, diff --git a/octo-cli/src/Octopod/CLI/Args.hs b/octo-cli/src/Octopod/CLI/Args.hs index 000c2f4..935a60b 100644 --- a/octo-cli/src/Octopod/CLI/Args.hs +++ b/octo-cli/src/Octopod/CLI/Args.hs @@ -6,7 +6,6 @@ Description : octo CLI arguments parser utils. module Octopod.CLI.Args where import Common.Types -import Data.Semigroup ((<>)) import Data.Text import Options.Applicative diff --git a/octopod-api/octopod-api.cabal b/octopod-api/octopod-api.cabal index fa43bd6..4a346f0 100644 --- a/octopod-api/octopod-api.cabal +++ b/octopod-api/octopod-api.cabal @@ -32,7 +32,7 @@ library TypeApplications TypeOperators build-depends: - base ^>=4.12.0.0, + base, servant, octopod-common, if !impl(ghcjs) diff --git a/octopod-common/octopod-common.cabal b/octopod-common/octopod-common.cabal index 3c8ad05..3bd9c68 100644 --- a/octopod-common/octopod-common.cabal +++ b/octopod-common/octopod-common.cabal @@ -34,7 +34,7 @@ library , ScopedTypeVariables , TypeApplications , TypeOperators - build-depends: base >=4.12 && <4.13 + build-depends: base , aeson , bytestring , deriving-aeson diff --git a/octopod-frontend/index.html b/octopod-frontend/index.html new file mode 100644 index 0000000..5e445eb --- /dev/null +++ b/octopod-frontend/index.html @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/octopod-frontend/octopod-frontend.cabal b/octopod-frontend/octopod-frontend.cabal index 1f6aab2..68cec20 100644 --- a/octopod-frontend/octopod-frontend.cabal +++ b/octopod-frontend/octopod-frontend.cabal @@ -15,6 +15,7 @@ extra-source-files: CHANGELOG.md cabal-version: >=1.10 + flag development default: False description: mock host @@ -40,6 +41,7 @@ executable frontend -Werror -Wno-missing-home-modules -Wno-error=missing-home-modules + -threaded default-extensions: BlockArguments , ConstraintKinds , DataKinds @@ -70,7 +72,7 @@ executable frontend , OverloadedLabels -- other-extensions: build-depends: aeson - , base >=4.12 && <4.13 + , base , bytestring , containers , deriving-aeson diff --git a/octopod-frontend/src/Reflex/MultiEventWriter/Class.hs b/octopod-frontend/src/Reflex/MultiEventWriter/Class.hs index a757367..3339bf0 100644 --- a/octopod-frontend/src/Reflex/MultiEventWriter/Class.hs +++ b/octopod-frontend/src/Reflex/MultiEventWriter/Class.hs @@ -3,7 +3,6 @@ module Reflex.MultiEventWriter.Class ) where import Control.Monad.Reader (ReaderT, lift) -import Data.Semigroup (Semigroup) import Data.Type.Equality import Reflex.Dom diff --git a/shell.nix b/shell.nix index c44e446..8df613b 100644 --- a/shell.nix +++ b/shell.nix @@ -1 +1,11 @@ -(import ./default.nix { hls = true; }).shells.ghc +(import ./default.nix { }).shellFor { + tools = { + cabal = "3.2.0.0"; + hlint = "latest"; + haskell-language-server = "latest"; + ghcid = "latest"; + }; + + withHoogle = true; + exactDeps = true; +} diff --git a/stack.yaml b/stack.yaml index a1282ce..1d72d9b 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-14.27 +resolver: lts-18.2 packages: - octo-cli @@ -7,12 +7,6 @@ packages: - octopod-common extra-deps: - - deriving-aeson-0.2.3 - servant-websockets-2.0.0 - - postgresql-error-codes-1.0.1 - - table-layout-0.9.0.1 + - table-layout-0.9.1.0 - data-default-instances-base-0.1.0.1 - - servant-0.18.2 - - servant-client-0.18.2 - - servant-client-core-0.18.2 - - servant-server-0.18.2