mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
remove usage of IFD in nix packages
Lix builders have IFD disabled, and the changes needed to support this are minimal. We do need to do slightly more manual work to keep rust-toolchain.toml in sync with flake.nix, but it's not significant.
This commit is contained in:
parent
b45c0afe37
commit
992e6b945a
3 changed files with 45 additions and 17 deletions
15
flake.lock
generated
15
flake.lock
generated
|
|
@ -226,7 +226,8 @@
|
||||||
"flake-compat": "flake-compat_2",
|
"flake-compat": "flake-compat_2",
|
||||||
"flake-utils": "flake-utils_2",
|
"flake-utils": "flake-utils_2",
|
||||||
"nix-filter": "nix-filter",
|
"nix-filter": "nix-filter",
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2",
|
||||||
|
"rust-manifest": "rust-manifest"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-analyzer-src": {
|
"rust-analyzer-src": {
|
||||||
|
|
@ -246,6 +247,18 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"rust-manifest": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"narHash": "sha256-aZFye4UrtlcvLHrISldx4g9uGt3thDbVlLMK5keBSj0=",
|
||||||
|
"type": "file",
|
||||||
|
"url": "https://static.rust-lang.org/dist/channel-rust-1.78.0.toml"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "file",
|
||||||
|
"url": "https://static.rust-lang.org/dist/channel-rust-1.78.0.toml"
|
||||||
|
}
|
||||||
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681028828,
|
"lastModified": 1681028828,
|
||||||
|
|
|
||||||
37
flake.nix
37
flake.nix
|
|
@ -8,6 +8,12 @@
|
||||||
flake-utils.url = "github:numtide/flake-utils?ref=main";
|
flake-utils.url = "github:numtide/flake-utils?ref=main";
|
||||||
nix-filter.url = "github:numtide/nix-filter?ref=main";
|
nix-filter.url = "github:numtide/nix-filter?ref=main";
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
||||||
|
|
||||||
|
rust-manifest = {
|
||||||
|
# Keep version in sync with rust-toolchain.toml
|
||||||
|
url = "https://static.rust-lang.org/dist/channel-rust-1.78.0.toml";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs:
|
outputs = inputs:
|
||||||
|
|
@ -29,16 +35,27 @@
|
||||||
shell = self.callPackage ./nix/shell.nix {};
|
shell = self.callPackage ./nix/shell.nix {};
|
||||||
|
|
||||||
# The Rust toolchain to use
|
# The Rust toolchain to use
|
||||||
toolchain = inputs
|
# Using fromManifestFile and parsing the toolchain file with importTOML
|
||||||
.fenix
|
# instead of fromToolchainFile to avoid IFD
|
||||||
.packages
|
toolchain = let
|
||||||
.${pkgs.pkgsBuildHost.system}
|
toolchainFile = pkgs.lib.importTOML ./rust-toolchain.toml;
|
||||||
.fromToolchainFile {
|
defaultProfileComponents = [
|
||||||
file = ./rust-toolchain.toml;
|
"rustc"
|
||||||
|
"cargo"
|
||||||
# See also `rust-toolchain.toml`
|
"rust-docs"
|
||||||
sha256 = "sha256-opUgs6ckUQCyDxcB9Wy51pqhd0MPGHUVbwRKKPGiwZU=";
|
"rustfmt"
|
||||||
};
|
"clippy"
|
||||||
|
];
|
||||||
|
components = defaultProfileComponents ++
|
||||||
|
toolchainFile.toolchain.components;
|
||||||
|
targets = toolchainFile.toolchain.targets;
|
||||||
|
fenix = inputs.fenix.packages.${pkgs.pkgsBuildHost.system};
|
||||||
|
in
|
||||||
|
fenix.combine (builtins.map
|
||||||
|
(target:
|
||||||
|
(fenix.targets.${target}.fromManifestFile inputs.rust-manifest)
|
||||||
|
.withComponents components)
|
||||||
|
targets);
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
inputs.flake-utils.lib.eachDefaultSystem (system:
|
inputs.flake-utils.lib.eachDefaultSystem (system:
|
||||||
|
|
|
||||||
|
|
@ -71,12 +71,10 @@ let
|
||||||
} // buildDepsOnlyEnv;
|
} // buildDepsOnlyEnv;
|
||||||
|
|
||||||
commonAttrs = {
|
commonAttrs = {
|
||||||
inherit
|
# Reading from cargoManifest directly instead of using
|
||||||
(craneLib.crateNameFromCargoToml {
|
# createNameFromCargoToml to avoid IFD
|
||||||
cargoToml = "${inputs.self}/Cargo.toml";
|
pname = cargoManifest.package.name;
|
||||||
})
|
version = cargoManifest.package.version;
|
||||||
pname
|
|
||||||
version;
|
|
||||||
|
|
||||||
src = let filter = inputs.nix-filter.lib; in filter {
|
src = let filter = inputs.nix-filter.lib; in filter {
|
||||||
root = inputs.self;
|
root = inputs.self;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue