Skip to content

Commit

Permalink
Nix flakes and GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
int-index committed Jan 8, 2024
1 parent 685c825 commit b5046fc
Show file tree
Hide file tree
Showing 15 changed files with 126 additions and 191 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Foundry CI
on: push
jobs:
minimal:
runs-on: ubuntu-latest
steps:
- uses: nixbuild/nix-quick-install-action@v26
- uses: actions/checkout@v4
- run: nix --version
- run: nix flake check
- run: nix build
1 change: 0 additions & 1 deletion .travis.yml

This file was deleted.

10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Godsmen Foundry

[![Build Status](https://dev.azure.com/int-index/Personal/_apis/build/status/serokell.foundry?branchName=master)](https://dev.azure.com/int-index/Personal/_build/latest?definitionId=3&branchName=master)
[![Build Status](https://travis-ci.org/serokell/foundry.svg?branch=master)](https://travis-ci.org/serokell/foundry)

Godsmen Foundry is a Morte IDE based on Source.

Implementation status:
Expand All @@ -15,13 +12,12 @@ Implementation status:
* [ ] local storage
* [ ] browsing Sigil

[sigil.place/tutorial/morte/1.7.1/even](http://sigil.place/tutorial/morte/1.7.1/even)
![Rendering Morte](examples/expr.svg)

## Getting Started

```
$ nix-build
$ nix build
$ result/bin/morte-to-sdam "./examples/expr.morte" > expr.sd
$ result/bin/sdam-to-svg --morte expr.sd
$ result/bin/foundry expr.sd
Expand All @@ -30,14 +26,14 @@ $ result/bin/foundry expr.sd
## Tooling

```
$ nix-shell -p haskellPackages.fast-tags haskellPackages.ormolu
$ nix develop -c $SHELL
$ make tags
$ make fmt
```

## SVG Optimization

```
$ nix-shell -p nodePackages.svgo
$ nix shell nixpkgs#nodePackages.svgo
$ svgo expr.svg
```
60 changes: 0 additions & 60 deletions azure-pipelines.yml

This file was deleted.

2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
packages:
foundry.cabal
src/foundry.cabal

allow-newer:
morte:optparse-applicative
101 changes: 0 additions & 101 deletions default.nix

This file was deleted.

26 changes: 26 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
description = "foundry - a structure for Morte";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
};

outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux";
ghc = "ghc92";
pkgs = nixpkgs.legacyPackages.${system};
sdam-git =
pkgs.fetchFromGitHub {
owner = "int-index";
repo = "sdam";
rev = "3943cd2662eff11e1a36bc629ac832652ec43a6e";
sha256 = "05p43wvmx41rlnj5nwlcngr8rxhms5dxlh210ag2r04gxwra2mrv";
};
slay-git =
pkgs.fetchFromGitHub {
owner = "int-index";
repo = "slay";
rev = "1c9d39b8cb4f32f0b4778677c21ebb85cc1cddf7";
sha256 = "0x9xqaykdw5z3ggi7mkm7f5605c7z4jalhydvf9p1asdi5i34f8j";
};
morte-git =
pkgs.fetchFromGitHub {
owner = "Gabriella439";
repo = "Haskell-Morte-Library";
rev = "b7ebbcbea21e3894b889ebd882856ffcdb154160";
hash = "sha256-jO4EpCA+Xm7+oo0Xa8TIN+TX/bAjvQIcVYfQfbtAC5k=";
};
haskellPackages =
pkgs.haskell.packages.${ghc}.extend(hself: hsuper: {
foundry = hself.callCabal2nix "foundry" "${self}/src/" {};
inj-base = pkgs.haskell.lib.appendPatch (hself.callHackage "inj-base" "0.2.0.0" {}) ./patches/inj-base.patch;
morte = pkgs.haskell.lib.doJailbreak (hself.callCabal2nix "morte" "${morte-git}" {});
lrucaching = pkgs.haskell.lib.doJailbreak (hself.callHackage "lrucaching" "0.3.3" {});
ListLike = pkgs.haskell.lib.dontCheck hsuper.ListLike;
sdam = hself.callCabal2nix "sdam" sdam-git {};
slay-core = hself.callCabal2nix "slay-core" "${slay-git}/core" {};
slay-combinators = hself.callCabal2nix "slay-combinators" "${slay-git}/combinators" {};
slay-cairo = hself.callCabal2nix "slay-cairo" "${slay-git}/cairo" {};
});
in
{
packages.${system} = {
foundry = haskellPackages.foundry;
default = self.packages.${system}.foundry;
};

devShells.${system}.default = pkgs.mkShell {
buildInputs = [
(haskellPackages.ghcWithPackages(p:
p.foundry.getCabalDeps.libraryHaskellDepends ++
p.foundry.getCabalDeps.executableHaskellDepends
))
haskellPackages.foundry.getCabalDeps.executableToolDepends
haskellPackages.hie-bios
haskellPackages.haskell-language-server
haskellPackages.cabal-install
haskellPackages.fast-tags
haskellPackages.ormolu
];
};
};
}
7 changes: 0 additions & 7 deletions nix/nixpkgs-pin.nix

This file was deleted.

2 changes: 1 addition & 1 deletion src/bin/Foundry.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Source
import Source.Language.Morte
import System.Environment (getArgs)
import System.Exit (die)
import Text.Megaparsec as Megaparsec
import Text.Megaparsec as Megaparsec (errorBundlePretty)

main :: IO ()
main = do
Expand Down
2 changes: 1 addition & 1 deletion src/bin/Hask.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Source
import Source.Language.Haskell
import System.Environment (getArgs)
import System.Exit (die)
import Text.Megaparsec as Megaparsec
import Text.Megaparsec as Megaparsec (errorBundlePretty)

main :: IO ()
main = do
Expand Down
4 changes: 3 additions & 1 deletion src/bin/HaskellToSdam.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import qualified GHC.Data.StringBuffer as GHC
import qualified GHC.Data.FastString as GHC
import qualified GHC.Unit.Module as GHC
import qualified GHC.Data.EnumSet as GHC.EnumSet
import qualified GHC.Utils.Outputable as GHC
import qualified GHC.Utils.Error as GHC

main :: IO ()
main = do
Expand Down Expand Up @@ -167,7 +169,7 @@ runGhcParser p s =
initPState :: GHC.PState
initPState = GHC.initParserState opts buffer location
opts :: GHC.ParserOpts
opts = GHC.mkParserOpts GHC.EnumSet.empty GHC.EnumSet.empty False False False False
opts = GHC.mkParserOpts GHC.EnumSet.empty (GHC.DiagOpts GHC.EnumSet.empty GHC.EnumSet.empty False False Nothing GHC.defaultSDocContext) [] False False False False
buffer :: GHC.StringBuffer
buffer = GHC.stringToStringBuffer s
location :: GHC.RealSrcLoc
Expand Down
2 changes: 1 addition & 1 deletion src/bin/SdamToSvg.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Source.NewGen
import System.Environment (getArgs)
import System.Exit (die)
import System.FilePath
import Text.Megaparsec as Megaparsec
import Text.Megaparsec as Megaparsec (errorBundlePretty)

main :: IO ()
main = do
Expand Down
2 changes: 1 addition & 1 deletion src/driver/Source.hs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ runSource plugin mParsedValue = do
createMainWindow :: NG.PluginInfo -> IORef NG.EditorState -> IO Gtk.Window
createMainWindow pluginInfo esRef = do
window <- Gtk.windowNew
Gtk.widgetSetAppPaintable window True
Gtk.widgetSetAppPaintable window True -- FIXME: broken on Wayland, use a drawing area
Gtk.windowSetDefaultSize window 800 500
_ <- Gtk.on window Gtk.objectDestroy Gtk.mainQuit
-- TODO: PointerMotionHintMask; eventRequestMotions
Expand Down
Loading

0 comments on commit b5046fc

Please sign in to comment.