Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): only use extra substituters #59

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 73 additions & 70 deletions tools/nix/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
description = "tripsu";

nixConfig = {
substituters = [
# Add here some other mirror if needed.
"https://cache.nixos.org/"
];
extra-substituters = [
# Nix community's cache server
"https://nix-community.cachix.org"
Expand Down Expand Up @@ -35,79 +31,86 @@
};
};

outputs = {
nixpkgs,
flake-utils,
rust-overlay,
...
}: let
# This is string (without toString it would be a `path` which is put into the store)
rootDir = toString ./. + "../../..";
in
outputs =
{
nixpkgs,
flake-utils,
rust-overlay,
...
}:
let
# This is string (without toString it would be a `path` which is put into the store)
rootDir = toString ./. + "../../..";
in
flake-utils.lib.eachDefaultSystem
# Creates an attribute map `{ devShells.<system>.default = ...}`
# by calling this function:
(
system: let
overlays = [(import rust-overlay)];

# Import nixpkgs and load it into pkgs.
# Overlay the rust toolchain
lib = nixpkgs.lib;
pkgs = import nixpkgs {
inherit system overlays;
};

# Set the rust toolchain from the `rust-toolchain.toml`.
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml;

# Things needed only at compile-time.
nativeBuildInputsBasic = with pkgs; [
findutils
coreutils
bash
zsh
curl
git
jq
];

# Things needed only at compile-time.
nativeBuildInputsDev = with pkgs; [
rustToolchain
cargo-watch
just

skopeo
dasel
];

benchInputs = with pkgs; [
hyperfine
heaptrack
];

# Things needed at runtime.
buildInputs = [];

# The package of this CLI tool.
# The global version for tripsu.
# This is gonna get tooled later.
tripsu = (import ./pkgs/tripsu.nix) {
inherit rootDir rustToolchain pkgs lib;
};
in
with pkgs; rec {
# Creates an attribute map `{ devShells.<system>.default = ...}`
# by calling this function:
(
system:
let
overlays = [ (import rust-overlay) ];

# Import nixpkgs and load it into pkgs.
# Overlay the rust toolchain
lib = nixpkgs.lib;
pkgs = import nixpkgs {
inherit system overlays;
};

# Set the rust toolchain from the `rust-toolchain.toml`.
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ../../rust-toolchain.toml;

# Things needed only at compile-time.
nativeBuildInputsBasic = with pkgs; [
findutils
coreutils
bash
zsh
curl
git
jq
];

# Things needed only at compile-time.
nativeBuildInputsDev = with pkgs; [
rustToolchain
cargo-watch
just

skopeo
dasel
];

benchInputs = with pkgs; [
hyperfine
heaptrack
];

# Things needed at runtime.
buildInputs = [ ];

# The package of this CLI tool.
# The global version for tripsu.
# This is gonna get tooled later.
tripsu = (import ./pkgs/tripsu.nix) {
inherit
rootDir
rustToolchain
pkgs
lib
;
};
in
with pkgs;
rec {
devShells = {
default = mkShell {
inherit buildInputs;
nativeBuildInputs = nativeBuildInputsBasic ++ nativeBuildInputsDev;
};
bench = mkShell {
inherit buildInputs;
nativeBuildInputs = nativeBuildInputsBasic
++ nativeBuildInputsDev
++ benchInputs;
nativeBuildInputs = nativeBuildInputsBasic ++ nativeBuildInputsDev ++ benchInputs;
};

ci = mkShell {
Expand Down Expand Up @@ -138,5 +141,5 @@
};
};
}
);
);
}