summaryrefslogtreecommitdiffhomepage
path: root/nix/flake.nix
blob: b422c9ae02299743e9de8f7fea7d957cdab7c246 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    git-ignore-nix.url = "github:hercules-ci/gitignore.nix/master";
    flake-utils.url = "github:numtide/flake-utils";
  };
  outputs =
    {
      self,
      nixpkgs,
      flake-utils,
      git-ignore-nix,
    }:
    let
      overlay = final: prev: {
        haskellPackages = prev.haskellPackages.override (old: {
          overrides = prev.lib.composeExtensions (old.overrides or (_: _: { })) (
            hself: hsuper: {
              xmobar = prev.haskell.lib.compose.dontCheck (
                hself.callCabal2nix "xmobar" (git-ignore-nix.lib.gitignoreSource ./.) { }
              );
            }
          );
        });
      };
      overlays = [ overlay ];

      homeModules.mainmodule = import ./default.nix;
    in
    flake-utils.lib.eachDefaultSystem (
      system:
      let
        pkgs = import nixpkgs { inherit system overlays; };
        dynamicLibraries = with pkgs; [
          xorg.libX11
          xorg.libXrandr
          xorg.libXrender
          xorg.libXScrnSaver
          xorg.libXext
          xorg.libXft
          xorg.libXpm.out
          xorg.libXrandr
          xorg.libXrender
        ];
      in
      {
        devShell = pkgs.haskellPackages.shellFor {
          packages = p: [ p.xmobar ];
          buildInputs =
            with pkgs;
            [
              haskellPackages.cabal-install
            ]
            ++ dynamicLibraries;

          LD_LIBRARY_PATH = pkgs.lib.strings.makeLibraryPath dynamicLibraries;
        };
        defaultPackage = pkgs.haskellPackages.xmobar;
      }
    )
    // {
      inherit overlay overlays homeModules;
    };
}