3 Commits

Author SHA1 Message Date
be2a207bf1 Merge branch 'main' into feature/logging-and-exit
Some checks failed
Check Nix flake / Build nix outputs (ubuntu-latest) (pull_request) Failing after 55s
Check flake.lock / Check health of `flake.lock` (pull_request) Failing after 9s
Check Nix formatting / Perform Nix format checks (pull_request) Has been cancelled
Check Nix flake / Perform Nix flake checks (ubuntu-latest) (pull_request) Successful in 6m27s
2025-05-26 19:56:44 -04:00
742124d8e6 add determinate nix installer mirror
Some checks failed
Check Nix formatting / Perform Nix format checks (pull_request) Has been cancelled
Check Nix flake / Perform Nix flake checks (ubuntu-latest) (pull_request) Has been cancelled
Check Nix flake / Build nix outputs (ubuntu-latest) (pull_request) Has been cancelled
Check flake.lock / Check health of `flake.lock` (pull_request) Failing after 10s
2025-05-26 19:56:19 -04:00
2e8930cf1d allow IFD in nix flake show
Some checks failed
Check Nix flake / Build nix outputs (ubuntu-latest) (pull_request) Has been cancelled
Check Nix flake / Perform Nix flake checks (ubuntu-latest) (pull_request) Has been cancelled
Check Nix formatting / Perform Nix format checks (pull_request) Has been cancelled
Check flake.lock / Check health of `flake.lock` (pull_request) Failing after 13s
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
2025-05-26 19:53:24 -04:00
8 changed files with 61 additions and 46 deletions

View File

@@ -31,3 +31,25 @@ jobs:
skip-push: "true" skip-push: "true"
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: nix flake check --accept-flake-config - run: nix flake check --accept-flake-config
- run: nix ./utils/attic-push.bash
build-checks:
name: "Build nix outputs"
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- uses: DeterminateSystems/nix-installer-action@main
- name: Setup Attic cache
uses: ryanccn/attic-action@v0
with:
endpoint: ${{ secrets.ATTIC_ENDPOINT }}
cache: ${{ secrets.ATTIC_CACHE }}
token: ${{ secrets.ATTIC_TOKEN }}
skip-push: "true"
- uses: actions/checkout@v4
- name: Build all outputs
run: nix run git+https://nayeonie.com/ahuston-0/flake-update-diff -- --build .
- name: Push to Attic
run: nix ./utils/attic-push.bash
continue-on-error: true

View File

@@ -28,3 +28,6 @@ jobs:
skip-push: "true" skip-push: "true"
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: nix fmt -- --check . - run: nix fmt -- --check .
- name: Push to Attic
run: nix ./utils/attic-push.bash
continue-on-error: true

30
flake.lock generated
View File

@@ -57,11 +57,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1749099048, "lastModified": 1744174375,
"narHash": "sha256-VGYeEFGrvIAaHy6z0br58yA+BAhw2sJ3MIhh65BlUUA=", "narHash": "sha256-oxI9TLgnQbQ/WL0tIwVSIooLbXq4PW1QUhf5aQmXFgk=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0437b19f91616ae7e605253bb6b1944aa087d006", "rev": "ef3a956f697525883b77192cbe208233ea0f8f79",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -80,11 +80,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1747372754, "lastModified": 1742649964,
"narHash": "sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=", "narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46", "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -106,11 +106,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1748562898, "lastModified": 1744284767,
"narHash": "sha256-STk4QklrGpM3gliPKNJdBLSQvIrqRuwHI/rnYb/5rh8=", "narHash": "sha256-f0Z1OqugZjvofIud0Mpr+ySTJwyYR9UO7lSxY8jRd4g=",
"owner": "pyproject-nix", "owner": "pyproject-nix",
"repo": "build-system-pkgs", "repo": "build-system-pkgs",
"rev": "33bd58351957bb52dd1700ea7eeefe34de06a892", "rev": "38947cfda923e44ce63db057e7772f4a48b7ebbd",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -126,11 +126,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1746540146, "lastModified": 1743438845,
"narHash": "sha256-QxdHGNpbicIrw5t6U3x+ZxeY/7IEJ6lYbvsjXmcxFIM=", "narHash": "sha256-1GSaoubGtvsLRwoYwHjeKYq40tLwvuFFVhGrG8J9Oek=",
"owner": "pyproject-nix", "owner": "pyproject-nix",
"repo": "pyproject.nix", "repo": "pyproject.nix",
"rev": "e09c10c24ebb955125fda449939bfba664c467fd", "rev": "8063ec98edc459571d042a640b1c5e334ecfca1e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -174,11 +174,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1748916602, "lastModified": 1744279763,
"narHash": "sha256-GiwjjmPIISDFD0uQ1DqQ+/38hZ+2z1lTKVj/TkKaWwQ=", "narHash": "sha256-0k6eJPWfI56e9WbjNFTKKYoP8YX31gXHOcKz/zeLdBs=",
"owner": "pyproject-nix", "owner": "pyproject-nix",
"repo": "uv2nix", "repo": "uv2nix",
"rev": "a4dd471de62b27928191908f57bfcd702ec2bfc9", "rev": "2b0fbb003988891c44b01b3e556f5fac817253ed",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -23,9 +23,7 @@ def build_output(path: str, output: str) -> str | None:
""" """
logger.info(f"build {output}") logger.info(f"build {output}")
logger.debug(f"outputting to {OUTPUT_DIR}/{output}.nixoutput") logger.debug(f"outputting to {OUTPUT_DIR}/{output}.nixoutput")
out = bash_wrapper( out = bash_wrapper(f"nix build {path}#{output} -o {OUTPUT_DIR}/{output}.nixoutput --accept-flake-config")
f"nix build {path}#{output} -o {OUTPUT_DIR}/{output}.nixoutput --accept-flake-config"
)
logger.debug("output") logger.debug("output")
logger.debug(out[0]) logger.debug(out[0])
logger.debug("error") logger.debug("error")

View File

@@ -53,9 +53,7 @@ def get_derivations_from_check(nix_path: str, path_to_flake: str) -> list[str]:
:param path_to_flake: path to flake to be checked :param path_to_flake: path to flake to be checked
:returns a list of all valid derivations in the flake :returns a list of all valid derivations in the flake
""" """
flake_check = bash_wrapper( flake_check = bash_wrapper(f"{nix_path} flake check --verbose --keep-going --accept-flake-config", path=path_to_flake)
f"{nix_path} flake check --verbose --keep-going --accept-flake-config", path=path_to_flake
)
if flake_check[2] != 0: if flake_check[2] != 0:
logger.warning( logger.warning(
"nix flake check returned non-zero exit code, collecting all available outputs" "nix flake check returned non-zero exit code, collecting all available outputs"
@@ -73,9 +71,7 @@ def get_derivations_from_check(nix_path: str, path_to_flake: str) -> list[str]:
return derivations return derivations
def get_derivations( def get_derivations(path_to_flake: str, *, allow_import_from_derivation: False = False) -> list[str]:
path_to_flake: str, *, allow_import_from_derivation: False = False
) -> list[str]:
"""Gets all derivations present in a flake. """Gets all derivations present in a flake.
:param path_to_flake: path to flake to be checked :param path_to_flake: path to flake to be checked
@@ -87,7 +83,7 @@ def get_derivations(
if nix_path is None: if nix_path is None:
status_msg = "nix is not available in the PATH, please verify that it is installed" status_msg = "nix is not available in the PATH, please verify that it is installed"
raise RuntimeError(status_msg) raise RuntimeError(status_msg)
cmd = f"{nix_path} flake show --json --accept-flake-config --all-systems" cmd = f"{nix_path} flake show --json --accept-flake-path"
cmd += " --allow-import-from-derivation" if allow_import_from_derivation else "" cmd += " --allow-import-from-derivation" if allow_import_from_derivation else ""
flake_show = bash_wrapper(cmd, path=path_to_flake) flake_show = bash_wrapper(cmd, path=path_to_flake)
if flake_show[2] != 0: if flake_show[2] != 0:

View File

@@ -99,8 +99,7 @@ def build_or_eval(args: Namespace) -> None:
""" """
flake_path = args.flake_path flake_path = args.flake_path
derivations, hydra_jobs = partition( derivations, hydra_jobs = partition(
lambda s: s.startswith("hydraJobs"), lambda s: s.startswith("hydraJobs"), get_derivations(flake_path, args["allow-import-from-derivation"])
get_derivations(flake_path, allow_import_from_derivation=args.allow_import_from_derivation),
) )
derivations, hydra_jobs = list(derivations), list(hydra_jobs) derivations, hydra_jobs = list(derivations), list(hydra_jobs)
logger.info(f"derivations: {list(derivations)}") logger.info(f"derivations: {list(derivations)}")

View File

@@ -19,6 +19,7 @@ let
prs = readJSONFile pulls; prs = readJSONFile pulls;
refs = readJSONFile branches; refs = readJSONFile branches;
repo = "RAD-Development/flake-update-diff";
# template for creating a job # template for creating a job
makeJob = makeJob =
@@ -27,7 +28,6 @@ let
keepnr ? 3, keepnr ? 3,
description, description,
flake, flake,
enabled ? 1,
}: }:
{ {
inherit inherit
@@ -35,39 +35,36 @@ let
flake flake
schedulingshares schedulingshares
keepnr keepnr
enabled
; ;
enabled = 1;
type = 1; type = 1;
hidden = false; hidden = false;
checkinterval = 300; # every 5 minutes checkinterval = 300; # every 6 months
enableemail = false; enableemail = false;
emailoverride = ""; emailoverride = "";
}; };
giteaHost = "ssh://gitea@nayeonie.com:2222"; # Create a hydra job for a branch
repo = "ahuston-0/flake-update-diff";
# # Create a hydra job for a branch
jobOfRef = jobOfRef =
name: name:
{ ref, ... }: { ref, ... }:
if ((builtins.match "^refs/heads/(.*)$" ref) == null) then if (builtins.match "^refs/heads/(.*)$" ref) == null then
null null
else else
{ {
name = builtins.replaceStrings [ "/" ] [ "-" ] "branch-${name}"; name = builtins.replaceStrings [ "/" ] [ "-" ] "branch-${name}";
value = makeJob { value = makeJob {
description = "Branch ${name}"; description = "Branch ${name}";
flake = "git+${giteaHost}/${repo}?ref=${ref}"; flake = "git+ssh://git@github.com/${repo}?ref=${ref}";
}; };
}; };
# Create a hydra job for a PR # Create a hydra job for a PR
jobOfPR = id: info: { jobOfPR = id: info: {
name = if info.draft then "draft-${id}" else "pr-${id}"; name = "pr-${id}";
value = makeJob { value = makeJob {
description = "PR ${id}: ${info.title}"; description = "PR ${id}: ${info.title}";
flake = "git+${giteaHost}/${repo}?ref=${info.head.ref}"; flake = "git+ssh://git@github.com/${info.head.repo.full_name}?ref=${info.head.ref}";
enabled = info.state == "open";
}; };
}; };
@@ -77,7 +74,7 @@ let
# wrapper function for reading json from file # wrapper function for reading json from file
readJSONFile = f: builtins.fromJSON (builtins.readFile f); readJSONFile = f: builtins.fromJSON (builtins.readFile f);
# remove null values from a set, in-case of branches that don't exist # remove null values from a set, in-case of branches that don't exist
mapFilter = f: l: builtins.filter (x: (x != null)) (map f l); mapFilter = f: l: builtins.filter (x: x != null) (map f l);
# Create job set from PRs and branches # Create job set from PRs and branches
jobs = makeSpec ( jobs = makeSpec (

View File

@@ -1,7 +1,7 @@
{ {
"enabled": 1, "enabled": 1,
"hidden": false, "hidden": false,
"description": "Flake Update Diff Tool (flupdt)", "description": "Flake update diff tool",
"nixexprinput": "nixexpr", "nixexprinput": "nixexpr",
"nixexprpath": "hydra/jobsets.nix", "nixexprpath": "hydra/jobsets.nix",
"checkinterval": 60, "checkinterval": 60,
@@ -12,23 +12,23 @@
"type": 0, "type": 0,
"inputs": { "inputs": {
"nixexpr": { "nixexpr": {
"value": "ssh://gitea@nayeonie.com:2222/ahuston-0/flake-update-diff.git main", "value": "https://github.com/RAD-Development/flake-update-diff main",
"type": "git", "type": "git",
"emailresponsible": false "emailresponsible": false
}, },
"nixpkgs": { "nixpkgs": {
"value": "https://github.com/NixOS/nixpkgs nixos-unstable", "value": "https://github.com/NixOS/nixpkgs nixos-unstable-small",
"type": "git", "type": "git",
"emailresponsible": false "emailresponsible": false
}, },
"pulls": { "pulls": {
"type": "giteapulls", "type": "githubpulls",
"value": "nayeonie.com ahuston-0 flake-update-diff https", "value": "RAD-Development flake-update-diff",
"emailresponsible": false "emailresponsible": false
}, },
"branches": { "branches": {
"type": "gitea_refs", "type": "github_refs",
"value": "nayeonie.com ahuston-0 flake-update-diff heads https -", "value": "RAD-Development flake-update-diff heads -",
"emailresponsible": false "emailresponsible": false
} }
} }