-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathflake.nix
More file actions
124 lines (118 loc) · 4.35 KB
/
Copy pathflake.nix
File metadata and controls
124 lines (118 loc) · 4.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
118
119
120
121
122
123
124
#
# Nix flake.
#
# https://nix.dev/manual/nix/latest/command-ref/new-cli/nix3-flake#flake-format
# https://wiki.nixos.org/wiki/Flakes#Flake_schema
#
{
inputs = {
# https://nixos.org/manual/nixpkgs/unstable
# https://search.nixos.org/packages?channel=unstable
nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "refs/heads/nixos-unstable";
};
# Python 3.10 (EOL October 2026) was dropped early for NixOS 26.05.
#
# https://github.com/NixOS/nixpkgs/pull/490538
nixpkgs-python310 = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
# Commit right before drop.
rev = "91e18d3c384a4c5998e720324425b88f53bbe6e4";
};
};
outputs =
inputs:
{
# Nixpkgs overlays.
#
# Include dependency overlays with `inputs.nixpkgs.lib.fixedPoints.composeManyExtensions`.
#
# https://nixos.org/manual/nixpkgs/unstable#function-library-lib.fixedPoints.composeManyExtensions
overlays = {
# https://nixos.org/manual/nixpkgs/unstable#function-library-lib.fixedPoints.composeManyExtensions
development = inputs.nixpkgs.lib.fixedPoints.composeManyExtensions [
(final: prev: {
# Python 3.10 (EOL October 2026) was dropped early for NixOS 26.05.
#
# https://github.com/NixOS/nixpkgs/pull/490538
inherit (inputs.nixpkgs-python310.legacyPackages.${final.stdenv.hostPlatform.system}) python310;
})
(
final: prev:
# https://nixos.org/manual/nixpkgs/unstable#function-library-lib.attrsets.recursiveUpdate
inputs.nixpkgs.lib.attrsets.recursiveUpdate prev {
# https://nixos.org/manual/nixpkgs/unstable#function-library-lib.filesystem.packagesFromDirectoryRecursive
multi-storage-client = {
# Expose packages for other systems to support cross-compilation in development shells (e.g. macOS SDK).
pkgsNative = inputs.nixpkgs.legacyPackages;
};
}
)
(
final: prev:
# https://nixos.org/manual/nixpkgs/unstable#function-library-lib.attrsets.recursiveUpdate
inputs.nixpkgs.lib.attrsets.recursiveUpdate prev (
# https://nixos.org/manual/nixpkgs/unstable#function-library-lib.filesystem.packagesFromDirectoryRecursive
inputs.nixpkgs.lib.filesystem.packagesFromDirectoryRecursive {
inherit (final) callPackage;
directory = ./nix/overlays/development;
}
)
)
];
};
}
// (
let
# Override inputs.
#
# https://nixos.org/manual/nixpkgs/unstable#function-library-lib.attrsets.recursiveUpdate
developmentInputs = inputs.nixpkgs.lib.attrsets.recursiveUpdate inputs {
nixpkgs = {
# https://nixos.org/manual/nixpkgs/unstable#function-library-lib.attrsets.mapAttrs
legacyPackages = inputs.nixpkgs.lib.attrsets.mapAttrs (
localSystem: packages:
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/top-level/default.nix
import inputs.nixpkgs {
inherit localSystem;
overlays = [
inputs.self.overlays.development
];
}
) inputs.nixpkgs.legacyPackages;
};
};
# Output systems.
#
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/lib/systems/flake-systems.nix
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-linux"
];
# Return an attribute set of system to the result of applying `f`.
#
# https://nixos.org/manual/nixpkgs/unstable#function-library-lib.attrsets.genAttrs
genSystemAttrs = f: inputs.nixpkgs.lib.attrsets.genAttrs systems f;
in
{
# Packages.
#
# For `nix build`.
packages = genSystemAttrs (
system: developmentInputs.nixpkgs.legacyPackages.${system}.multi-storage-client.packages
);
# Development shells.
#
# For `nix develop` and direnv's `use flake`.
devShells = genSystemAttrs (
system: developmentInputs.nixpkgs.legacyPackages.${system}.multi-storage-client.devShells
);
}
);
}