Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
docs: Describe 'debug' option
  • Loading branch information
srid committed Jan 11, 2024
commit 7a6c8993e768b62ff81307ae5309dd033a1b8feb
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<img src="./doc/logo.webp" width=100 />

There are [several ways](https://nixos.wiki/wiki/Haskell) to manage Haskell packages using Nix with varying degrees of integration. `haskell-flake` makes Haskell development, packaging and deployment with Nix flakes a lot [simpler](https://community.flake.parts/haskell-flake/start#under-the-hood) than other existing approaches. This project is set up as a modern [`flake-parts`](https://flake.parts/) module to integrate easily into other Nix projects and shell development environments in a lightweight and modular way.
There are [several ways](https://nixos.asia/en/haskell) to manage Haskell packages using [Nix](https://nixos.asia/en/nix) with varying degrees of integration. `haskell-flake` makes Haskell development, packaging and deployment with Nix flakes a lot [simpler](https://community.flake.parts/haskell-flake/start#under-the-hood) than other existing approaches. This project is set up as a modern [`flake-parts`](https://flake.parts/) module to integrate easily into other Nix projects and shell development environments in a lightweight and modular way.

To see more background information, guides and best practices, visit https://community.flake.parts/haskell-flake

Expand Down
39 changes: 39 additions & 0 deletions doc/guide/debugging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
slug: /haskell-flake/debugging
---

# Debugging logs

Enabling the `debug` option causes haskell-flake to print verbose logging of its activity. To enable it:

```nix
haskellProjects.default = {
debug = true; # Turn on verbose logging
projectRoot = ./.;
...
}
```

>[!tip] Timestamps in logs
> `moreutils` provides the `ts` command that you can pipe your nix command output to in order to get timestamps in the logs.

With debug option enabled, you can execute your `nix` commands piped through `ts` to get timestamps in the debug logs. The below is a sample output when building [haskell-multi-nix](https://github.com/srid/haskell-multi-nix/tree/debug):

```
$ nix build github:srid/haskell-multi-nix/debug#bar 2>&1 | ts '[%Y-%m-%d %H:%M:%S]'
[2024-01-11 15:33:32] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: default.findPackagesInCabalProject = {"bar":"/nix/store/k0ad89r6pa70rly68ibff1jkw59bljgh-source/./bar","foo":"/nix/store/k0ad89r6pa70rly68ibff1jkw59bljgh-source/./foo"}
[2024-01-11 15:33:32] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: defaults.packages = {"bar":{"imports":[{"_file":"/nix/store/n2nb5achv6p0bv3nvqw731mfr907d8ny-source/nix/modules/project/defaults.nix, via option perSystem.aarch64-darwin.haskellProjects.default.defaults.packages.bar","imports":[{"source":"/nix/store/k0ad89r6pa70rly68ibff1jkw59bljgh-source/./bar"}]}]},"foo":{"imports":[{"_file":"/nix/store/n2nb5achv6p0bv3nvqw731mfr907d8ny-source/nix/modules/project/defaults.nix, via option perSystem.aarch64-darwin.haskellProjects.default.defaults.packages.foo","imports":[{"source":"/nix/store/k0ad89r6pa70rly68ibff1jkw59bljgh-source/./foo"}]}]}}
[2024-01-11 15:33:32] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: bar.getCabalExecutables = bar
[2024-01-11 15:33:32] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: foo.getCabalExecutables =
[2024-01-11 15:33:32] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: default.packages:apply {"bar":{"cabal":{"executables":["bar"]},"local":{"toCurrentProject":true,"toDefinedProject":true},"source":"/nix/store/k0ad89r6pa70rly68ibff1jkw59bljgh-source/./bar"},"foo":{"cabal":{"executables":[]},"local":{"toCurrentProject":true,"toDefinedProject":true},"source":"/nix/store/k0ad89r6pa70rly68ibff1jkw59bljgh-source/./foo"}}
[2024-01-11 15:33:34] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: settings.bar {"haddock":false,"libraryProfiling":false}
[2024-01-11 15:33:34] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: bar.callCabal2nix /nix/store/k0ad89r6pa70rly68ibff1jkw59bljgh-source/./bar
[2024-01-11 15:33:34] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: bar.mkNewStorePath /nix/store/hr0a6v8wwwvw323clv9x28zknd5fqz84-source-bar
[2024-01-11 15:33:35] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: bar.cabal2nixDeriver /nix/store/pxcqizj7mvmwflx7hxlq7ll5bdmcis2a-cabal2nix-bar
[2024-01-11 15:33:35] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: settings.foo {"haddock":false,"libraryProfiling":false}
[2024-01-11 15:33:35] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: foo.callCabal2nix /nix/store/k0ad89r6pa70rly68ibff1jkw59bljgh-source/./foo
[2024-01-11 15:33:35] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: foo.mkNewStorePath /nix/store/bpybsny4gd5jnw0lvk5khpq7md6nwg5f-source-foo
[2024-01-11 15:33:35] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: foo.cabal2nixDeriver /nix/store/i36x01zcdpm7c3m3fjjq1qa4slv61jpw-cabal2nix-foo
[2024-01-11 15:33:35] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: foo.fromSdist /nix/store/qrsy0bm4khcs1hxy0rhb6m3g2bvi15sm-foo-0.1.0.0
[2024-01-11 15:33:35] trace: DEBUG[haskell-flake] [k0ad89r6pa70rly68ibff1jkw59bljgh-source#haskellProjects.default]: bar.fromSdist /nix/store/anyx51rm5gjdclafcz5is7jpqgfq2i4w-bar-0.1.0.0
```
2 changes: 1 addition & 1 deletion doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ slug: /haskell-flake

# Haskell development using `haskell-flake`

[haskell-flake](https://github.com/srid/haskell-flake) is a [flake-parts](https://flake.parts/) module to make Haskell development [simpler](/haskell-flake/start#under-the-hood) with Nix.
[haskell-flake](https://github.com/srid/haskell-flake) is a [flake-parts](https://flake.parts/) module to make Haskell development [simpler](/haskell-flake/start#under-the-hood) with [Nix](https://nixos.asia/en/nix).

To get started, see [Getting Started](/haskell-flake/start).