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: drop all public dependencies except for nixpkgs #437

Merged
merged 4 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
approach to avoid redundancy. Old behavior (taking a full snapshot of the
cargo artifacts) can be achieved by setting `doCompressAndInstallFullArchive =
true`.
* All dependencies (outside of `nixpkgs`) have been dropped from the (main)
flake.lock file so they do not pollute downstream projects' lock files.

## [0.14.3] - 2023-10-17

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
inputs = {
crane.url = "github:ipetkov/crane";
nixpkgs.follows = "crane/nixpkgs";
flake-utils.follows = "crane/flake-utils";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { flake-utils, crane, ... }: flake-utils.lib.eachDefaultSystem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
inputs = {
crane.url = "github:ipetkov/crane";
nixpkgs.follows = "crane/nixpkgs";
flake-utils.follows = "crane/flake-utils";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, flake-utils, crane, ... }: flake-utils.lib.eachDefaultSystem
Expand Down
2 changes: 1 addition & 1 deletion extra-tests/fetch-cargo-git/flake.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
inputs = {
crane.url = "github:ipetkov/crane";
flake-utils.follows = "crane/flake-utils";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { flake-utils, crane, ... }: flake-utils.lib.eachDefaultSystem
Expand Down
77 changes: 1 addition & 76 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 38 additions & 21 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,35 +1,52 @@
{
description = "A Nix library for building cargo projects. Never build twice thanks to incremental artifact caching.";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};

flake-utils.url = "github:numtide/flake-utils";

rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
flake-utils.follows = "flake-utils";
nixpkgs.follows = "nixpkgs";
};
};
};
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

nixConfig = {
extra-substituters = [ "https://crane.cachix.org" ];
extra-trusted-public-keys = [ "crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk=" ];
};

outputs = { nixpkgs, flake-utils, rust-overlay, ... }:
outputs = { nixpkgs, ... }:
let
mkLib = pkgs: import ./lib {
inherit (pkgs) lib newScope;
};

nodes = (builtins.fromJSON (builtins.readFile ./test/flake.lock)).nodes;
inputFromLock = name:
let
locked = nodes.${name}.locked;
in
fetchTarball {
url = "https://github.com/${locked.owner}/${locked.repo}/archive/${locked.rev}.tar.gz";
sha256 = locked.narHash;
};

eachSystem = systems: f:
let
# Merge together the outputs for all systems.
op = attrs: system:
let
ret = f system;
op = attrs: key: attrs //
{
${key} = (attrs.${key} or { })
// { ${system} = ret.${key}; };
}
;
in
builtins.foldl' op attrs (builtins.attrNames ret);
in
builtins.foldl' op { } systems;

eachDefaultSystem = eachSystem [
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
];
in
{
inherit mkLib;
Expand Down Expand Up @@ -88,7 +105,7 @@
path = ./examples/trunk-workspace;
};
};
} // flake-utils.lib.eachDefaultSystem (system:
} // eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
Expand All @@ -107,7 +124,7 @@
pkgsChecks = import nixpkgs {
inherit system;
overlays = [
rust-overlay.overlays.default
(import (inputFromLock "rust-overlay"))
];
};
in
Expand Down
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
lock = builtins.fromJSON (builtins.readFile ./test/flake.lock);
locked = lock.nodes.flake-compat.locked;
compat = fetchTarball {
url = "https://github.com/${locked.owner}/${locked.repo}/archive/${locked.rev}.tar.gz";
Expand Down