diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3406e519..f42f9e24 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,49 +10,17 @@ on: branches: - master -env: - CDN_DISTRIBUTION_ID: E13UN1J1JFIWUZ - CDN_BUCKET: s3://nixfmt.serokell.io - jobs: check: - runs-on: [self-hosted, nix] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v26 + - name: reuse lint run: nix shell .#packages.x86_64-linux.reuse -c reuse lint - # - name: hlint - # run: nix build -L .#checks.x86_64-linux.hlint - # if: success() || failure() - - # - name: stylish-haskell - # run: nix build -L .#checks.x86_64-linux.stylish-haskell - # if: success() || failure() - - name: build nixfmt run: nix build -L .#nixfmt-static if: success() || failure() - - - name: build webdemo - run: nix build -L .#nixfmt-webdemo - if: success() || failure() - - - name: build awscli - run: nix shell .#awscli - if: success() || failure() - - deploy: - runs-on: [self-hosted, nix] - if: ${{ github.ref == 'refs/heads/master' }} - steps: - - uses: actions/checkout@v4 - - - name: deploy webdemo - run: | - nix build .#nixfmt-webdemo - nix shell .#awscli -c aws s3 cp --recursive result/ "$CDN_BUCKET" - # delete files that don't exist anymore, use `--size-only` so behavior won't depend on local file timestamps - nix shell .#awscli -c aws s3 sync --delete --size-only result/ "$CDN_BUCKET" - nix shell .#awscli -c aws cloudfront create-invalidation --distribution-id "$CDN_DISTRIBUTION_ID" --paths '/*' diff --git a/flake.lock b/flake.lock index d2ec1f15..76b87778 100644 --- a/flake.lock +++ b/flake.lock @@ -853,22 +853,6 @@ "type": "github" } }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1704290814, - "narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.05", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs-unstable": { "locked": { "lastModified": 1675758091, @@ -1016,7 +1000,6 @@ "flake-compat": "flake-compat", "flake-utils": "flake-utils", "nixpkgs": "nixpkgs", - "nixpkgs-stable": "nixpkgs-stable", "serokell-nix": "serokell-nix" } }, diff --git a/flake.nix b/flake.nix index 496440ca..05badb17 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,6 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.05"; flake-utils.url = "github:numtide/flake-utils"; @@ -22,7 +21,7 @@ }; }; - outputs = { self, nixpkgs, nixpkgs-stable, flake-utils, serokell-nix, ... }: + outputs = { self, nixpkgs, flake-utils, serokell-nix, ... }: flake-utils.lib.eachDefaultSystem (system: let overlay = self: super: { @@ -38,26 +37,8 @@ overlays = [ overlay serokell-nix.overlay ]; }; - pkgs-stable = import nixpkgs-stable { - inherit system; - overlays = [ overlay ]; - }; - inherit (pkgs) haskell lib; - ghcjsPackages = pkgs-stable.haskell.packages.ghcjs810.override (old: { - overrides = (self: super: { - QuickCheck = haskell.lib.dontCheck super.QuickCheck; - tasty-quickcheck = haskell.lib.dontCheck super.tasty-quickcheck; - scientific = haskell.lib.dontCheck super.scientific; - temporary = haskell.lib.dontCheck super.temporary; - time-compat = haskell.lib.dontCheck super.time-compat; - text-short = haskell.lib.dontCheck super.text-short; - vector = haskell.lib.dontCheck super.vector; - aeson = super.aeson_1_5_6_0; - }); - }); - regexes = [ ".*.cabal$" "^src.*" "^main.*" "^Setup.hs$" "^js.*" "LICENSE" ]; src = builtins.path { @@ -74,14 +55,6 @@ nixfmt = pkgs.haskellPackages.nixfmt; nixfmt-static = haskell.lib.justStaticExecutables nixfmt; nixfmt-deriver = nixfmt-static.cabal2nixDeriver; - nixfmt-js = ghcjsPackages.callCabal2nix "nixfmt" src { }; - nixfmt-webdemo = pkgs.runCommandNoCC "nixfmt-webdemo" { } '' - mkdir $out - cp ${./js/index.html} $out/index.html - cp ${./js/404.html} $out/404.html - cp ${nixfmt-js}/bin/js-interface.jsexe/{rts,lib,out,runmain}.js $out - substituteInPlace $out/index.html --replace ../dist/build/js-interface/js-interface.jsexe/ ./ - ''; nixfmt-shell = nixfmt.env.overrideAttrs (oldAttrs: { buildInputs = oldAttrs.buildInputs ++ (with pkgs; [ @@ -92,7 +65,7 @@ ]); }); - inherit (pkgs) awscli reuse; + inherit (pkgs) reuse; }; apps.default = { diff --git a/js/404.html b/js/404.html deleted file mode 100644 index 31fab38e..00000000 --- a/js/404.html +++ /dev/null @@ -1,7 +0,0 @@ - - -404 Page Not Found diff --git a/js/JSInterface.hs b/js/JSInterface.hs deleted file mode 100644 index dc1bb895..00000000 --- a/js/JSInterface.hs +++ /dev/null @@ -1,37 +0,0 @@ -{- © 2019 Serokell - - - - SPDX-License-Identifier: MPL-2.0 - -} - -{-# LANGUAGE OverloadedStrings #-} -import GHCJS.Marshal -import GHCJS.Foreign -import GHCJS.Foreign.Callback -import GHCJS.Types -import JavaScript.Object -import qualified JavaScript.Object.Internal as O -import Data.JSString.Text -import qualified Data.JSString as S - -import Nixfmt - -foreign import javascript unsafe "window.nixfmt_ = $1" - js_set_logic :: JSVal -> IO () - -main :: IO () -main = do - callback <- syncCallback2 ThrowWouldBlock $ \text_ o -> do - let obj = O.Object o - Just width <- getProp (textToJSString "width") obj >>= fromJSVal - Just filename_ <- getProp (textToJSString "filename") obj >>= fromJSVal - let filename = S.unpack filename_ - let text = textFromJSVal text_ - out <- case format width filename text of - Left err -> do - setProp "err" (toJSBool True) obj - toJSVal $ S.pack err - Right out_ -> do - setProp "err" (toJSBool False) obj - toJSVal out_ - setProp "ret" out obj - js_set_logic $ jsval callback diff --git a/js/index.html b/js/index.html deleted file mode 100644 index 4bcbf42c..00000000 --- a/js/index.html +++ /dev/null @@ -1,234 +0,0 @@ - - - - - - - - nixfmt online demo - - - - - - - - - - - - - - -
# nixfmt loading
-
xxx
- - Fork me on GitHub - - - diff --git a/nixfmt.cabal b/nixfmt.cabal index 4f503d96..776d1f80 100644 --- a/nixfmt.cabal +++ b/nixfmt.cabal @@ -36,10 +36,6 @@ executable nixfmt Paths_nixfmt other-extensions: DeriveDataTypeable hs-source-dirs: main - if impl(ghcjs) - buildable: False - else - buildable: True build-depends: base >= 4.12.0 && < 4.19 , cmdargs >= 0.10.20 && < 0.11 @@ -101,25 +97,3 @@ library -Wincomplete-uni-patterns -Wredundant-constraints -Wno-orphans - -executable js-interface - main-is: JSInterface.hs - - if impl(ghcjs) - buildable: True - ghc-options: - -Wall - -Wcompat - -Wincomplete-record-updates - -Wincomplete-uni-patterns - -Wredundant-constraints - -Wno-orphans - build-depends: - base >= 4.12.0 && < 4.19 - , ghcjs-base >= 0.2.0 && < 0.3 - , nixfmt - hs-source-dirs: js/ - else - buildable: False - - default-language: Haskell2010