~kaction/cookiecutter-haskell

1f98496c6aba63905d2e568b39bc313e29666e20 — Dmitry Bogatov 1 year, 5 months ago 56b8d2c
Setup treefmt/alejandra in containing directory
2 files changed, 19 insertions(+), 18 deletions(-)

M ci.nix
A treefmt.toml
M ci.nix => ci.nix +15 -18
@@ 1,23 1,20 @@
{
  add_executable_section ? "no"
}:

let
{add_executable_section ? "no"}: let
  sources = import (./. + "/{{cookiecutter.project_name}}/nix/sources.nix");
  pkgs = import sources.nixpkgs {};
in
rec {
  generated = pkgs.runCommand "hs-nix-template" {
    buildInputs = [ pkgs.cookiecutter ];
    preferLocalBuild = true;
  } ''
    HOME="$(mktemp -d)"
    mkdir "$out"
    cookiecutter \
      --no-input --output-dir "$out" ${./.} \
      add_executable_section="${add_executable_section}"
  '';
in rec {
  generated =
    pkgs.runCommand "hs-nix-template" {
      buildInputs = [pkgs.cookiecutter];
      preferLocalBuild = true;
    } ''
      HOME="$(mktemp -d)"
      mkdir "$out"
      cookiecutter \
        --no-input --output-dir "$out" ${./.} \
        add_executable_section="${add_executable_section}"
    '';

  build = pkgs.recurseIntoAttrs
  build =
    pkgs.recurseIntoAttrs
    (import "${generated}/your-project-name" {});
}

A treefmt.toml => treefmt.toml +4 -0
@@ 0,0 1,4 @@
[formatter.nix]
command = "alejandra"
options = []
includes = [ "ci.nix" ]