Skip to content
Open
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: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rippkgs"
version = "1.2.0"
version = "1.2.1"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
104 changes: 57 additions & 47 deletions lib/genRegistry.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{lib, ...}: pkgs: let
{
lib,
buildPropagatedInputs ? false,
...
}: pkgs: let
inherit (builtins) deepSeq filter listToAttrs map parseDrvName seq tryEval;
inherit (lib) filterAttrs flatten foldl isDerivation mapAttrsToList optional optionals removePrefix traceVal;

Expand All @@ -25,55 +29,61 @@
in
listToAttrs outputs-list;

propagatedBuildInputs = let
collectInputs = inputList: let
directInputs = lib.filter (x: x != null) (lib.lists.flatten inputList);
recursiveInputs = lib.flatten (
map
(
x:
if lib.isAttrs x && x ? propagatedBuildInputs
then collectInputs x.propagatedBuildInputs
else []
)
directInputs
);
propagatedBuildInputs =
if buildPropagatedInputs
then let
collectInputs = inputList: let
directInputs = lib.filter (x: x != null) (lib.lists.flatten inputList);
recursiveInputs = lib.flatten (
map
(
x:
if lib.isAttrs x && x ? propagatedBuildInputs
then collectInputs x.propagatedBuildInputs
else []
)
directInputs
);
in
lib.unique (directInputs ++ recursiveInputs);
in
lib.unique (directInputs ++ recursiveInputs);
in
map (x:
removePrefix "/nix/store/" (
if lib.isAttrs x
then x.outPath
else x
)) (
collectInputs (safeVal.propagatedBuildInputs or [])
);
map (x:
removePrefix "/nix/store/" (
if lib.isAttrs x
then x.outPath
else x
)) (
collectInputs (safeVal.propagatedBuildInputs or [])
)
else [];

propagatedNativeBuildInputs = let
collectInputs = inputList: let
directInputs = lib.filter (x: x != null) (lib.lists.flatten inputList);
recursiveInputs = lib.flatten (
map
(
x:
if lib.isAttrs x && x ? propagatedNativeBuildInputs
then collectInputs x.propagatedNativeBuildInputs
else []
)
directInputs
);
propagatedNativeBuildInputs =
if buildPropagatedInputs
then let
collectInputs = inputList: let
directInputs = lib.filter (x: x != null) (lib.lists.flatten inputList);
recursiveInputs = lib.flatten (
map
(
x:
if lib.isAttrs x && x ? propagatedNativeBuildInputs
then collectInputs x.propagatedNativeBuildInputs
else []
)
directInputs
);
in
lib.unique (directInputs ++ recursiveInputs);
in
lib.unique (directInputs ++ recursiveInputs);
in
map (x:
removePrefix "/nix/store/" (
if lib.isAttrs x
then x.outPath
else x
)) (
collectInputs (safeVal.propagatedNativeBuildInputs or [])
);
map (x:
removePrefix "/nix/store/" (
if lib.isAttrs x
then x.outPath
else x
)) (
collectInputs (safeVal.propagatedNativeBuildInputs or [])
)
else [];

meta = {
description = safeVal.meta.description or null;
Expand Down
7 changes: 6 additions & 1 deletion src/bin/index/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ struct IndexNixpkgs {
/// passing the `-I` flag to nix.
nixpkgs: Option<PathBuf>,

/// Whether to include propagated build inputs in the index.
#[clap(long)]
build_propagated_inputs: bool,

/// The location to write the saved index to.
#[clap(short, long, default_value = "rippkgs-index.sqlite")]
output: PathBuf,
Expand Down Expand Up @@ -170,6 +174,7 @@ fn index_nixpkgs(
save_registry,
nixpkgs_arg,
nixpkgs,
build_propagated_inputs,
..
}: &IndexNixpkgs,
) -> Result<Registry> {
Expand All @@ -178,7 +183,7 @@ fn index_nixpkgs(
genRegistry:

let pkgs = import <nixpkgs> {nixpkgs_arg};
genRegistry' = genRegistry pkgs;
genRegistry' = genRegistry (pkgs // {{ buildPropagatedInputs = {build_propagated_inputs}; }});
in genRegistry' pkgs
"#,
);
Expand Down
Loading