forked from cdepillabout/termonad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
100 lines (79 loc) · 3.19 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
{
description = "A VTE-based terminal emulator configurable in Haskell";
# Nixpkgs / NixOS version to use.
#
# TODO: Nixpkgs is switching to use GHC-9.0.2 as the default compiler as of
# 2022-02-21, but the switch has currently only happened on the
# haskell-updates branch. This temporarily makes Termonad use that branch.
# When https://github.com/NixOS/nixpkgs/pull/160733 is merged into master,
# switch back to nixos-unstable.
inputs.nixpkgs.url = "github:NixOS/nixpkgs/haskell-updates";
# 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-with-packages;
}
);
# 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";
};
});
# Tests run by 'nix flake check' and by Hydra.
# checks = forAllSystems
# (system:
# with nixpkgsFor.${system};
# {
# inherit (self.packages.${system}) hello;
# # Additional tests, if applicable.
# test = stdenv.mkDerivation {
# name = "hello-test-${version}";
# buildInputs = [ hello ];
# unpackPhase = "true";
# buildPhase = ''
# echo 'running some integration tests'
# [[ $(hello) = 'Hello Nixers!' ]]
# '';
# installPhase = "mkdir -p $out";
# };
# }
# );
};
}