Skip to content

Commit

Permalink
Merge nix apps
Browse files Browse the repository at this point in the history
  • Loading branch information
tbidne committed Nov 7, 2024
1 parent becbb15 commit 2e5daed
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 32 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,11 @@ jobs:
- name: Formatting
run: |
nix run .#format
nix run .#format-yaml
git diff --exit-code --color=always
- name: Lint
run: |
nix run .#lint
nix run .#lint-yaml
release_osx:
needs: [cabal, stack, nix, notify-tests, lint]
Expand Down
6 changes: 3 additions & 3 deletions flake.lock

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

45 changes: 18 additions & 27 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@
wrapProgram $out/bin/stack --add-flags "--no-nix --system-ghc"
'';
};

pkgsMkDrv = {
inherit pkgs;
mkDrv = false;
};
in
{
packages.default = mkPkg false;
Expand All @@ -153,35 +158,21 @@
};

apps = {
format = nix-hs-utils.format compilerPkgs;
lint = nix-hs-utils.lint compilerPkgs;
lintRefactor = nix-hs-utils.lintRefactor compilerPkgs;
format = nix-hs-utils.mergeApps {
apps = [
(nix-hs-utils.format (compilerPkgs // pkgsMkDrv))
(nix-hs-utils.format-yaml pkgsMkDrv)
];
};

format-yaml =
let
drv = pkgs.writeShellApplication {
name = "format-yaml";
text = "prettier -w -- **/*yaml";
runtimeInputs = [ pkgs.nodePackages.prettier ];
};
in
{
type = "app";
program = "${drv}/bin/${drv.name}";
};
lint = nix-hs-utils.mergeApps {
apps = [
(nix-hs-utils.lint (compilerPkgs // pkgsMkDrv))
(nix-hs-utils.lint-yaml pkgsMkDrv)
];
};

lint-yaml =
let
drv = pkgs.writeShellApplication {
name = "lint-yaml";
text = "yamllint .";
runtimeInputs = [ pkgs.yamllint ];
};
in
{
type = "app";
program = "${drv}/bin/${drv.name}";
};
lintRefactor = nix-hs-utils.lintRefactor compilerPkgs;
};
};
systems = [
Expand Down

0 comments on commit 2e5daed

Please sign in to comment.