mirror of
https://github.com/srid/ema.git
synced 2024-11-25 20:12:20 +03:00
Update nixpkgs, and use treefmt
This commit is contained in:
parent
05c8a21273
commit
a8e344c0e8
10
.github/workflows/ci.yaml
vendored
10
.github/workflows/ci.yaml
vendored
@ -9,13 +9,17 @@ jobs:
|
||||
MAINLINE: refs/heads/master
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: cachix/install-nix-action@v16
|
||||
- uses: cachix/install-nix-action@v17
|
||||
with:
|
||||
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
|
||||
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
|
||||
extra_nix_config: |
|
||||
experimental-features = nix-command flakes
|
||||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Cache Nix dependencies
|
||||
run: |
|
||||
nix develop -j 4 -c echo
|
||||
- name: Format check
|
||||
run: |
|
||||
nix develop -j auto -c treefmt --fail-on-change
|
||||
- name: Build 🔧
|
||||
run: |
|
||||
nix build -j4 --no-link
|
||||
|
46
flake.lock
46
flake.lock
@ -31,56 +31,19 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1644229661,
|
||||
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"lint-utils": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1650427214,
|
||||
"narHash": "sha256-9m66rRSSM614ocRXNPAArwnrS6zzCQYYhd3nw8g4QUg=",
|
||||
"ref": "overengineered",
|
||||
"rev": "5555def5a25c5437834c06cbe79b3945916ec59f",
|
||||
"revCount": 28,
|
||||
"type": "git",
|
||||
"url": "https://gitlab.homotopic.tech/nix/lint-utils.git"
|
||||
},
|
||||
"original": {
|
||||
"ref": "overengineered",
|
||||
"type": "git",
|
||||
"url": "https://gitlab.homotopic.tech/nix/lint-utils.git"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1650882267,
|
||||
"narHash": "sha256-BFKiz8srATQIBuFEN2HgS2EHisK29EjZ/HV34wSr2lU=",
|
||||
"lastModified": 1651634615,
|
||||
"narHash": "sha256-VtvcS61bLh5mIBm9cV3idUHdlfPRFus/NwdJfaj5s8o=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2ea2f7b6d0cb7ce0712f2aa80303cda08deb0de2",
|
||||
"rev": "abfd31179174133ab8131139d650297bf4da63b7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2ea2f7b6d0cb7ce0712f2aa80303cda08deb0de2",
|
||||
"rev": "abfd31179174133ab8131139d650297bf4da63b7",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
@ -88,7 +51,6 @@
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"lint-utils": "lint-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
|
41
flake.nix
41
flake.nix
@ -1,17 +1,11 @@
|
||||
{
|
||||
description = "Ema project";
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/2ea2f7b6d0cb7ce0712f2aa80303cda08deb0de2";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/abfd31179174133ab8131139d650297bf4da63b7";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
flake-utils.inputs.nixpkgs.follows = "nixpkgs";
|
||||
flake-compat.url = "github:edolstra/flake-compat";
|
||||
flake-compat.flake = false;
|
||||
lint-utils = {
|
||||
type = "git";
|
||||
url = "https://gitlab.homotopic.tech/nix/lint-utils.git";
|
||||
ref = "overengineered";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem
|
||||
@ -39,17 +33,9 @@
|
||||
haskell-language-server
|
||||
ormolu
|
||||
pkgs.nixpkgs-fmt
|
||||
pkgs.treefmt
|
||||
]);
|
||||
};
|
||||
|
||||
lintSpec = {
|
||||
nixpkgs-fmt = { };
|
||||
cabal-fmt = { };
|
||||
fourmolu = {
|
||||
ghcOpts = "-o-XTypeApplications -o-XImportQualifiedPost";
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
rec {
|
||||
# Used by `nix build`
|
||||
@ -63,29 +49,6 @@
|
||||
default = emaProject false;
|
||||
};
|
||||
|
||||
# Used by `nix run ...`
|
||||
apps = {
|
||||
format = inputs.lint-utils.mkApp.${system} lintSpec;
|
||||
};
|
||||
|
||||
# Used by `nix flake check` (but see next attribute)
|
||||
checks = {
|
||||
format = inputs.lint-utils.mkChecks.${system} lintSpec;
|
||||
};
|
||||
|
||||
# We need this hack because `nix flake check` won't work for Haskell
|
||||
# projects: https://nixos.wiki/wiki/Import_From_Derivation#IFD_and_Haskell
|
||||
#
|
||||
# Instead, run: `nix build .#check.x86_64-linux` (replace with your system)
|
||||
check =
|
||||
pkgs.runCommand "combined-checks"
|
||||
{
|
||||
checksss = builtins.attrValues self.checks.${system};
|
||||
} ''
|
||||
echo $checksss
|
||||
touch $out
|
||||
'';
|
||||
|
||||
}) // {
|
||||
herculesCI.ciSystems = [ "x86_64-linux" ];
|
||||
};
|
||||
|
16
treefmt.toml
Normal file
16
treefmt.toml
Normal file
@ -0,0 +1,16 @@
|
||||
[formatter.haskell]
|
||||
command = "fourmolu"
|
||||
options = [
|
||||
"--ghc-opt",
|
||||
"-XImportQualifiedPost",
|
||||
"--ghc-opt",
|
||||
"-XTypeApplications",
|
||||
"--mode",
|
||||
"inplace",
|
||||
"--check-idempotence",
|
||||
]
|
||||
includes = ["*.hs"]
|
||||
|
||||
[formatter.nix]
|
||||
command = "nixpkgs-fmt"
|
||||
includes = ["*.nix"]
|
Loading…
Reference in New Issue
Block a user