-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathflake.nix
More file actions
146 lines (135 loc) · 4.28 KB
/
flake.nix
File metadata and controls
146 lines (135 loc) · 4.28 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
{
description = "R7RS-small scheme implementation based on s7 scheme";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
devshell.url = "github:numtide/devshell";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.flake-parts.flakeModules.easyOverlay
inputs.treefmt-nix.flakeModule
inputs.devshell.flakeModule
];
perSystem =
{
pkgs,
lib,
self',
config,
...
}:
let
goldfishFor =
pkgs:
{
static ? false,
}:
let
tbox = pkgs.tbox.overrideAttrs (
final: prev: {
version = "1.7.6";
src = pkgs.fetchFromGitHub {
owner = "tboox";
repo = "tbox";
rev = "v${final.version}";
hash = "sha256-cwpZ7F8WzT/46HrckHe0Aug2mxirCkNA68aCxg/FcsE=";
};
meta.platforms = prev.meta.platforms ++ pkgs.lib.platforms.windows;
}
);
isocline = pkgs.callPackage ./pkgs/isocline.nix { };
s7 = (pkgs.callPackage ./pkgs/s7.nix { }).override {
inherit static;
withGMP = false;
withArb = false;
withNrepl = false;
};
in
pkgs.callPackage ./pkgs/goldfish.nix {
inherit static;
inherit isocline s7 tbox;
};
in
{
packages = {
goldfish = goldfishFor pkgs { };
goldfish-musl = goldfishFor pkgs.pkgsMusl { static = true; };
default = self'.packages.goldfish;
goldfish-mingwW64-cross = goldfishFor pkgs.pkgsCross.mingwW64 { };
goldfish-mingwW64-cross-static = goldfishFor pkgs.pkgsCross.mingwW64 { static = true; };
};
overlayAttrs = {
inherit (config.packages)
goldfish
goldfish-musl
goldfish-mingwW64-cross
goldfish-mingwW64-cross-static
;
};
apps =
let
getGoldfish = lib.flip lib.getExe' "goldfish";
mkGoldfishApp = pkg: {
type = "app";
program = getGoldfish pkg;
meta.description = pkg.meta.description;
};
in
{
default = self'.apps.goldfish;
goldfish = mkGoldfishApp self'.packages.goldfish;
goldfish-musl = mkGoldfishApp self'.packages.goldfish-musl;
goldfish-mingwW64-cross = mkGoldfishApp self'.packages.goldfish-mingwW64-cross;
goldfish-mingwW64-cross-static = mkGoldfishApp self'.packages.goldfish-mingwW64-cross-static;
};
devshells.default = {
name = "NixConsole";
motd = ''
{italic}🐟 {220}Goldfish{reset} 👾
$(type -p menu &>/dev/null && menu)
'';
imports = [ "${inputs.devshell}/extra/language/c.nix" ];
language.c.compiler = pkgs.gcc;
language.c.includes = [ pkgs.curl.dev ];
language.c.libraries = [ ];
packages = with pkgs; [
xmake
clang-tools
pkg-config
gnumake
cmake
unzip
];
};
treefmt.config = {
projectRootFile = ".git/config";
package = pkgs.treefmt;
programs = {
keep-sorted.enable = true;
# nix
nixfmt.enable = true;
deadnix.enable = true;
statix.enable = true;
};
settings.formatter = {
keep-sorted = {
includes = lib.mkForce [ "*.nix" ];
};
};
};
};
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
};
}