Skip to content

Commit 8d397ee

Browse files
authored
chore(ci): use only extra substituters (#26)
* fix: use only extra substituters - Only add extra-substituters for enabling CI caching. Otherwise CI cannot add a extra substituter in `/etc/nix/nix.conf` (before eval. this flake) since the substituters are hard coded in here. * fix: remove default cache
1 parent 985c457 commit 8d397ee

1 file changed

Lines changed: 81 additions & 85 deletions

File tree

tools/nix/flake.nix

Lines changed: 81 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
description = "fuzon";
33

44
nixConfig = {
5-
substituters = [
6-
# Add here some other mirror if needed.
7-
"https://cache.nixos.org/"
8-
];
95
extra-substituters = [
106
# Nix community's cache server
117
"https://nix-community.cachix.org"
@@ -35,93 +31,93 @@
3531
};
3632
};
3733

38-
outputs = {
39-
self,
40-
nixpkgs,
41-
flake-utils,
42-
rust-overlay,
43-
...
44-
}:
34+
outputs =
35+
{
36+
self,
37+
nixpkgs,
38+
flake-utils,
39+
rust-overlay,
40+
...
41+
}:
4542
flake-utils.lib.eachDefaultSystem
46-
# Creates an attribute map `{ devShells.<system>.default = ...}`
47-
# by calling this function:
48-
(
49-
system: let
50-
rootSrc = ./../..;
51-
52-
overlays = [(import rust-overlay)];
53-
54-
# Import nixpkgs and load it into pkgs.
55-
# Overlay the rust toolchain
56-
pkgs = import nixpkgs {
57-
inherit system overlays;
58-
};
59-
60-
# Set the rust toolchain from the `rust-toolchain.toml`.
61-
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml;
62-
63-
# Things needed only at compile-time.
64-
basic-deps = with pkgs; [
65-
maturin
66-
findutils
67-
coreutils
68-
bash
69-
zsh
70-
curl
71-
git
72-
jq
73-
];
74-
75-
# Things needed only at compile-time.
76-
general-deps = [
77-
rustToolchain
78-
pkgs.cargo-watch
79-
pkgs.just
80-
81-
pkgs.skopeo
82-
pkgs.dasel
83-
pkgs.python313
84-
];
85-
86-
benchmark-deps = with pkgs; [
87-
hyperfine
88-
heaptrack
89-
];
90-
91-
# The package of this CLI tool.
92-
# The global version for fuzon.
93-
# This is gonna get tooled later.
94-
fuzon = pkgs.callPackage ./pkgs/fuzon {
95-
inherit rootSrc;
96-
inherit rustToolchain;
97-
};
98-
in rec {
99-
devShells = {
100-
default = pkgs.mkShell {
101-
packages = basic-deps ++ general-deps;
43+
# Creates an attribute map `{ devShells.<system>.default = ...}`
44+
# by calling this function:
45+
(
46+
system:
47+
let
48+
rootSrc = ./../..;
49+
50+
overlays = [ (import rust-overlay) ];
51+
52+
# Import nixpkgs and load it into pkgs.
53+
# Overlay the rust toolchain
54+
pkgs = import nixpkgs {
55+
inherit system overlays;
56+
};
57+
58+
# Set the rust toolchain from the `rust-toolchain.toml`.
59+
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml;
60+
61+
# Things needed only at compile-time.
62+
basic-deps = with pkgs; [
63+
maturin
64+
findutils
65+
coreutils
66+
bash
67+
zsh
68+
curl
69+
git
70+
jq
71+
];
72+
73+
# Things needed only at compile-time.
74+
general-deps = [
75+
rustToolchain
76+
pkgs.cargo-watch
77+
pkgs.just
78+
79+
pkgs.skopeo
80+
pkgs.dasel
81+
pkgs.python313
82+
];
83+
84+
benchmark-deps = with pkgs; [
85+
hyperfine
86+
heaptrack
87+
];
88+
89+
# The package of this CLI tool.
90+
# The global version for fuzon.
91+
# This is gonna get tooled later.
92+
fuzon = pkgs.callPackage ./pkgs/fuzon {
93+
inherit rootSrc;
94+
inherit rustToolchain;
10295
};
103-
bench = pkgs.mkShell {
104-
packages =
105-
basic-deps
106-
++ general-deps
107-
++ benchmark-deps;
96+
in
97+
rec {
98+
devShells = {
99+
default = pkgs.mkShell {
100+
packages = basic-deps ++ general-deps;
101+
};
102+
bench = pkgs.mkShell {
103+
packages = basic-deps ++ general-deps ++ benchmark-deps;
104+
};
108105
};
109-
};
110106

111-
packages = {
112-
fuzon = fuzon;
107+
packages = {
108+
fuzon = fuzon;
113109

114-
images = {
115-
dev = (import ./images/dev.nix) {
116-
inherit pkgs;
117-
devShellDrv = devShells.default;
118-
};
110+
images = {
111+
dev = (import ./images/dev.nix) {
112+
inherit pkgs;
113+
devShellDrv = devShells.default;
114+
};
119115

120-
fuzon = (import ./images/fuzon.nix) {
121-
inherit pkgs fuzon;
116+
fuzon = (import ./images/fuzon.nix) {
117+
inherit pkgs fuzon;
118+
};
122119
};
123120
};
124-
};
125-
}
126-
);
121+
}
122+
);
127123
}

0 commit comments

Comments
 (0)