-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
flake.nix
67 lines (53 loc) · 2.12 KB
/
flake.nix
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
65
66
67
{
description = "A VTE-based terminal emulator configurable in Haskell";
# Nixpkgs / NixOS version to use.
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let
# Generate a user-friendly version numer.
version = builtins.substring 0 8 self.lastModifiedDate;
# System types to support.
#
# TODO: Since callCabal2nix uses IFD, adding multiple systems to
# supportedSystems doesn't currently work with flakes. Commands like
# `nix flake check` and `nix flake show` don't work.
#
# https://github.com/NixOS/nix/issues/4265
#
# Termonad is likely to also work aarch64-linux, but you'll have to edit
# this line to enable it.
supportedSystems = [ "x86_64-linux" ];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; });
in
{
# A Nixpkgs overlay that defines Termonad.
overlay = final: prev:
let
overlays = import ./.nix-helpers/overlays.nix;
in
prev.lib.composeManyExtensions overlays final prev;
# Provide some binary packages for selected system types.
packages = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in {
termonad = pkgs.termonad;
}
);
# The default package for 'nix build'. This makes sense if the
# flake provides only one package or there is a clear "main"
# package.
defaultPackage = forAllSystems (system: self.packages.${system}.termonad);
devShell = forAllSystems (system: nixpkgsFor.${system}.termonadShell);
defaultApp = forAllSystems (system: self.apps.${system}.termonad);
apps = forAllSystems (system: {
termonad = {
type = "app";
program = "${self.packages.${system}.termonad}/bin/termonad";
};
});
};
}