forked from DeterminateSystems/determinate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
117 lines (100 loc) · 3.35 KB
/
flake.nix
File metadata and controls
117 lines (100 loc) · 3.35 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
{
description = "Determinate";
inputs = {
nix.url = "https://flakehub.com/f/DeterminateSystems/nix-src/*";
nixpkgs.url = "https://flakehub.com/f/DeterminateSystems/nixpkgs-weekly/0.1";
determinate-nixd-aarch64-linux = {
url = "https://install.determinate.systems/determinate-nixd/tag/v3.17.1/aarch64-linux";
flake = false;
};
determinate-nixd-x86_64-linux = {
url = "https://install.determinate.systems/determinate-nixd/tag/v3.17.1/x86_64-linux";
flake = false;
};
determinate-nixd-aarch64-darwin = {
url = "https://install.determinate.systems/determinate-nixd/tag/v3.17.1/macOS";
flake = false;
};
};
outputs =
{ self, nixpkgs, ... }@inputs:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
forEachSupportedSystem =
f:
nixpkgs.lib.genAttrs supportedSystems (
system:
f {
inherit system;
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
};
}
);
# Exa eval-performance patches ported from exa-labs/nix.
# Applied via nix-src's built-in appendPatches mechanism so every
# component (libstore, libutil, libexpr, nix-cli) is rebuilt from
# the patched source tree.
exaEvalPatches = [
./patches/001-checkname-lookup-table.patch
./patches/002-nix32-presized-write.patch
./patches/003-base16-hex-table.patch
./patches/004-printstring-scan-and-copy.patch
./patches/005-gc-free-space-divisor.patch
./patches/006-eval-cache-fast-path.patch
];
# Patched nix package per system.
patchedNixPackages = forEachSupportedSystem (
{ system, ... }: inputs.nix.packages.${system}.default.appendPatches exaEvalPatches
);
in
{
packages = forEachSupportedSystem (
{ system, pkgs, ... }:
{
nix-exa-patched = patchedNixPackages.${system};
default = pkgs.stdenvNoCC.mkDerivation {
pname = "determinate-nixd";
inherit (inputs.nix.packages.${system}.default) version;
src = inputs."determinate-nixd-${system}";
dontUnpack = true;
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/determinate-nixd
chmod +x $out/bin/determinate-nixd
'';
doInstallCheck = true;
installCheckPhase = ''
$out/bin/determinate-nixd --help
'';
};
}
);
devShells = forEachSupportedSystem (
{ system, pkgs, ... }:
{
default = pkgs.mkShell {
name = "determinate-dev";
packages = with pkgs; [
self.formatter.${system}
];
};
}
);
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt);
darwinModules = {
default = ./modules/nix-darwin/default.nix;
# In case we come across anyone who still needs to migrate
migration = ./modules/nix-darwin/migration.nix;
};
homeManagerModules.default = ./modules/home-manager/default.nix;
nixosModules.default = import ./modules/nixos.nix (inputs // { inherit patchedNixPackages; });
};
}