Skip to content

fix: secondary outputs (e.g. .python, etc) not being cached #26

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

Merged
merged 3 commits into from
Jul 8, 2025
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: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- id: enumerate_packages
name: Get all packages
run: |
echo "FLAKE_OUTPUTS=$(python3 ./.github/workflows/get_all_packages.py)" >> $GITHUB_ENV
echo "FLAKE_OUTPUTS=$(python3 ./.github/workflows/get_all_packages.py | tr '\n' ' ')" >> $GITHUB_ENV
- name: Build All
run: |
set +e
Expand Down
41 changes: 27 additions & 14 deletions .github/workflows/get_all_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,33 @@
import json
import subprocess

flake_meta_process = subprocess.Popen(
["nix", "flake", "show", "--json"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf8",
)
flake_meta_process.wait()
if flake_meta_process.returncode:
print(f"Failed to get flake metadata:", file=sys.stderr)
print(flake_meta_process.stderr.read(), file=sys.stderr)
exit(-1)
flake_meta = json.load(flake_meta_process.stdout)
def run(purpose, *args):
process = subprocess.Popen(
[*args],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
encoding="utf8",
)
process.wait()
if process.returncode:
print(f"Failed to {purpose}:", file=sys.stderr)
print(process.stderr.read(), file=sys.stderr)
exit(-1)
return process.stdout

flake_meta = json.load(run("get flake metadata", "nix", "flake", "show", "--json"))
packages = flake_meta["packages"]
for platform, packages in packages.items():
for package, package_info in packages.items():
if len(package_info):
print(f".#packages.{platform}.{package}", end=" ")
if len(package_info) == 0:
continue
tgt = f".#packages.{platform}.{package}"
outputs = []
drv = json.load(run(f"get derivation info for {package}", "nix", "derivation", "show", tgt))
keys = list(drv.keys())
if len(keys) != 1:
print(f"'nix derivation show' unexpectedly returned {len(keys)} paths, expected exactly 1: {tgt}", file=sys.stderr)
exit(-1)
output_list = drv[keys[0]]["outputs"]
for output in output_list:
print(f"{tgt}.{output}")
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
)
(
self.composePythonOverlay (pkgs': pkgs: pypkgs': pypkgs: let
callPythonPackage = lib.callPackageWith (pkgs' // pkgs'.python3.pkgs);
callPythonPackage = lib.callPackageWith (pkgs' // pypkgs');
in {
kfactory = pypkgs.kfactory.overrideAttrs (attrs': attrs: {
version = "1.9.3";
Expand Down
3 changes: 2 additions & 1 deletion nix/yosys.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
bash,
version ? "0.54",
sha256 ? "sha256-meKlZh6ZiiPHwQCvS7Y667lvE9XWgIaual8c6SDpeDw=",
darwin, # To fix codesigning issue for pyosys
# For environments
yosys,
buildEnv,
Expand Down Expand Up @@ -89,7 +90,7 @@ in let
pkg-config
bison
flex
];
] ++ lib.optionals clangStdenv.isDarwin [darwin.autoSignDarwinBinariesHook];

propagatedBuildInputs = [
tcl
Expand Down