added script to build all packages

This commit is contained in:
Jakub Kropáček 2024-12-02 20:32:38 +01:00
parent 5fac2a9657
commit f788899505
2 changed files with 53 additions and 9 deletions

View file

@ -27,11 +27,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1733045511, "lastModified": 1733133928,
"narHash": "sha256-n8AldXJRNVMm2UZ6yN0HwVxlARY2Cm/uhdOw76tQ0OI=", "narHash": "sha256-gU40r9AfpIr4eq+0noM8yH1Hxf+EA3dqfIpFtQl8Y1E=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "4964f3c6fc17ae4578e762d3dc86b10fe890860e", "rev": "873e39d5f4437d2f3ab06881fea8e63e45e1d011",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -57,11 +57,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1732483221, "lastModified": 1733139194,
"narHash": "sha256-kF6rDeCshoCgmQz+7uiuPdREVFuzhIorGOoPXMalL2U=", "narHash": "sha256-PVQW9ovo0CJbhuhCsrhFJGGdD1euwUornspKpBIgdok=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "45348ad6fb8ac0e8415f6e5e96efe47dd7f39405", "rev": "c6c90887f84c02ce9ebf33b95ca79ef45007bf88",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -73,11 +73,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1732837521, "lastModified": 1733015953,
"narHash": "sha256-jNRNr49UiuIwaarqijgdTR2qLPifxsVhlJrKzQ8XUIE=", "narHash": "sha256-t4BBVpwG9B4hLgc6GUBuj3cjU7lP/PJfpTHuSqE+crk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "970e93b9f82e2a0f3675757eb0bfc73297cc6370", "rev": "ac35b104800bff9028425fec3b6e8a41de2bbfff",
"type": "github" "type": "github"
}, },
"original": { "original": {

44
scripts/build_packages.py Executable file
View file

@ -0,0 +1,44 @@
#!/usr/bin/env python3.12
import json
import shutil
import subprocess as sp
from pathlib import Path
def main() -> int:
if not Path("./flake.nix").exists():
raise Exception(
"You need to be in the root of the project (where the `flake.nix` is)"
)
response = sp.run(
[shutil.which("nix"), "flake", "show", "--json"], capture_output=True
)
json_data = json.loads(response.stdout.decode("utf-8"))
packages = json_data.get("packages")
built_packages_paths = []
for package in packages.get("x86_64-linux").keys():
out_path = (
sp.check_output(
[
shutil.which("nix"),
"build",
f".#{package}",
"--no-link",
"--print-out-paths",
]
)
.decode("utf-8")
.strip()
)
built_packages_paths.append(out_path)
print(built_packages_paths)
return 0
if __name__ == "__main__":
raise SystemExit(main())