From d5e91da10c89211c777a6ca5cbb8632c0d5d1831 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Wed, 13 Mar 2024 22:16:09 +0100 Subject: [PATCH 1/2] ci: remove deploy and fix after repo transfer The web demo will be retired from this repo soon anyways, see https://github.com/NixOS/nixfmt/issues/157 I believe it also relied on using Serokell's self-hosted action runners, which we can't use anymore now that the repo has been transferred, so we use the default ubuntu-latest instead. --- .github/workflows/main.yml | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) 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 '/*' From 52295a3891888c45c147ea85856da95c415930df Mon Sep 17 00:00:00 2001 From: Sergey Gulin Date: Thu, 14 Mar 2024 01:26:13 +0300 Subject: [PATCH 2/2] Remove webdemo The nixfmt-webdemo is moving to https://github.com/serokell/nixfmt-website. Remove all code associated with the webdemo, including the nixfmt-js distribution. --- flake.lock | 47 +++------- flake.nix | 31 +----- js/404.html | 7 -- js/JSInterface.hs | 37 -------- js/index.html | 234 ---------------------------------------------- nixfmt.cabal | 26 ------ 6 files changed, 17 insertions(+), 365 deletions(-) delete mode 100644 js/404.html delete mode 100644 js/JSInterface.hs delete mode 100644 js/index.html diff --git a/flake.lock b/flake.lock index 9b948906..a207da7d 100644 --- a/flake.lock +++ b/flake.lock @@ -853,22 +853,6 @@ "type": "github" } }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1696039360, - "narHash": "sha256-g7nIUV4uq1TOVeVIDEZLb005suTWCUjSY0zYOlSBsyE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "32dcb45f66c0487e92db8303a798ebc548cadedc", - "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" } }, @@ -1111,6 +1094,21 @@ "type": "github" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tullia": { "inputs": { "nix-nomad": "nix-nomad", @@ -1189,21 +1187,6 @@ "repo": "yants", "type": "github" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 8e4dca6b..11fe0661 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; [ @@ -91,7 +64,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 832b28e3..61016937 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 @@ -99,25 +95,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