From 93b17fb3b01331f94970b312a25ece87dfa67c53 Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Mon, 2 Dec 2024 19:55:58 -0800 Subject: [PATCH 1/5] Fix broken test --- flake.lock | 29 ++++++++----------- flake.nix | 4 +-- src/flake.rs | 4 ++- .../{cel-condition.txt => cel-condition.cel} | 2 +- 4 files changed, 18 insertions(+), 21 deletions(-) rename tests/{cel-condition.txt => cel-condition.cel} (50%) diff --git a/flake.lock b/flake.lock index e8c9183..fa56252 100644 --- a/flake.lock +++ b/flake.lock @@ -1,36 +1,31 @@ { "nodes": { "crane": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, "locked": { - "lastModified": 1717383740, - "narHash": "sha256-559HbY4uhNeoYvK3H6AMZAtVfmR3y8plXZ1x6ON/cWU=", - "rev": "b65673fce97d277934488a451724be94cc62499a", - "revCount": 580, + "lastModified": 1731974531, + "narHash": "sha256-z7hiGBWsbWwSnu5UMmYyfHEehlSmfB8sCA8iH4nmxm8=", + "rev": "8ff9c457d60951bdd37a05ae903423de7ff55c6e", + "revCount": 654, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/ipetkov/crane/0.17.3/018fdc0e-176b-7a0f-92ce-cc2d0db7b735/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/ipetkov/crane/0.19.3/019341bb-a47c-7229-bccd-4586c6148192/source.tar.gz" }, "original": { "type": "tarball", - "url": "https://flakehub.com/f/ipetkov/crane/0.17.%2A" + "url": "https://flakehub.com/f/ipetkov/crane/0.19.%2A" } }, "nixpkgs": { "locked": { - "lastModified": 1731797254, - "narHash": "sha256-df3dJApLPhd11AlueuoN0Q4fHo/hagP75LlM5K1sz9g=", - "rev": "e8c38b73aeb218e27163376a2d617e61a2ad9b59", - "revCount": 636838, + "lastModified": 1732981179, + "narHash": "sha256-F7thesZPvAMSwjRu0K8uFshTk3ZZSNAsXTIFvXBT+34=", + "rev": "62c435d93bf046a5396f3016472e8f7c8e2aed65", + "revCount": 710050, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2405.636838%2Brev-e8c38b73aeb218e27163376a2d617e61a2ad9b59/01933af8-1a6e-73c9-86e6-04b8a0066d59/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.710050%2Brev-62c435d93bf046a5396f3016472e8f7c8e2aed65/01938188-9ae4-7095-9c6e-c6e2ce4adf18/source.tar.gz" }, "original": { "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2405.%2A" + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2411.%2A" } }, "root": { diff --git a/flake.nix b/flake.nix index 69fd2a3..3bf22e6 100644 --- a/flake.nix +++ b/flake.nix @@ -1,12 +1,12 @@ { inputs = { - nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2405.*"; + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2411.*"; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; crane = { - url = "https://flakehub.com/f/ipetkov/crane/0.17.*"; + url = "https://flakehub.com/f/ipetkov/crane/0.19.*"; inputs.nixpkgs.follows = "nixpkgs"; }; }; diff --git a/src/flake.rs b/src/flake.rs index 84ebd93..364cdc3 100644 --- a/src/flake.rs +++ b/src/flake.rs @@ -157,7 +157,7 @@ mod test { fn cel_conditions() { // (condition, expected) let cases: Vec<(&str, bool)> = vec![ - (include_str!("../tests/cel-condition.txt"), true), + (include_str!("../tests/cel-condition.cel"), true), ( "has(gitRef) && has(numDaysOld) && has(owner) && has(supportedRefs) && supportedRefs.contains(gitRef) && owner != 'NixOS'", @@ -189,6 +189,8 @@ mod test { ); if expected { + println!("{result:?}"); + assert!(result.is_ok()); assert!(result.unwrap().is_empty()); } else { diff --git a/tests/cel-condition.txt b/tests/cel-condition.cel similarity index 50% rename from tests/cel-condition.txt rename to tests/cel-condition.cel index 7231db3..c9cf303 100644 --- a/tests/cel-condition.txt +++ b/tests/cel-condition.cel @@ -1,4 +1,4 @@ -supportedRefs == ['nixos-24.05', 'nixos-24.05-small', 'nixos-unstable', 'nixos-unstable-small', 'nixpkgs-24.05-darwin', 'nixpkgs-unstable'] +['nixos-unstable', 'nixos-unstable-small', 'nixpkgs-unstable'].map(rev, supportedRefs.contains(rev)) && owner == 'NixOS' && gitRef == 'nixos-unstable' && supportedRefs.contains(gitRef) From 3680ce66e4845e8fd848632427b7730eb06e652f Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Mon, 2 Dec 2024 19:57:19 -0800 Subject: [PATCH 2/5] Bump patch version --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2540604..30bd5e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -347,7 +347,7 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flake-checker" -version = "0.2.0" +version = "0.2.1" dependencies = [ "cel-interpreter", "chrono", diff --git a/Cargo.toml b/Cargo.toml index e12a6fa..74140eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "flake-checker" -version = "0.2.0" +version = "0.2.1" edition = "2021" [workspace] From 01c246d37ac98a5558a33641988c10f7637da3ef Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Mon, 2 Dec 2024 20:01:44 -0800 Subject: [PATCH 3/5] Remove follows directive from crane input --- flake.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 3bf22e6..cf179ff 100644 --- a/flake.nix +++ b/flake.nix @@ -5,10 +5,7 @@ url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; - crane = { - url = "https://flakehub.com/f/ipetkov/crane/0.19.*"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + crane.url = "https://flakehub.com/f/ipetkov/crane/0.19.*"; }; outputs = { self, ... }@inputs: From e03d79efea6c951c2b706c56c29fde534943e22e Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Mon, 2 Dec 2024 22:39:42 -0800 Subject: [PATCH 4/5] Revert to Nixpkgs 24.05 --- flake.lock | 12 ++++++------ flake.nix | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/flake.lock b/flake.lock index fa56252..a913acf 100644 --- a/flake.lock +++ b/flake.lock @@ -16,16 +16,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1732981179, - "narHash": "sha256-F7thesZPvAMSwjRu0K8uFshTk3ZZSNAsXTIFvXBT+34=", - "rev": "62c435d93bf046a5396f3016472e8f7c8e2aed65", - "revCount": 710050, + "lastModified": 1733016324, + "narHash": "sha256-8qwPSE2g1othR1u4uP86NXxm6i7E9nHPyJX3m3lx7Q4=", + "rev": "7e1ca67996afd8233d9033edd26e442836cc2ad6", + "revCount": 637020, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2411.710050%2Brev-62c435d93bf046a5396f3016472e8f7c8e2aed65/01938188-9ae4-7095-9c6e-c6e2ce4adf18/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2405.637020%2Brev-7e1ca67996afd8233d9033edd26e442836cc2ad6/01938271-595b-797a-b079-b2b4fda246ca/source.tar.gz" }, "original": { "type": "tarball", - "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2411.%2A" + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.2405.%2A" } }, "root": { diff --git a/flake.nix b/flake.nix index cf179ff..f8b3e49 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2411.*"; + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2405.*"; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; From bc88126e5dfdc7c8102f10fd8e4d89a39000c949 Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Mon, 2 Dec 2024 23:02:32 -0800 Subject: [PATCH 5/5] Switch rust-overlay to FlakeHub input --- flake.lock | 17 ++++++++--------- flake.nix | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index a913acf..d9287a3 100644 --- a/flake.lock +++ b/flake.lock @@ -42,17 +42,16 @@ ] }, "locked": { - "lastModified": 1729477859, - "narHash": "sha256-r0VyeJxy4O4CgTB/PNtfQft9fPfN1VuGvnZiCxDArvg=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "ada8266712449c4c0e6ee6fcbc442b3c217c79e1", - "type": "github" + "lastModified": 1733193245, + "narHash": "sha256-nwvKoPi3S6XyliqBRuC+01QFF0k94ZOvnoZtbGi/ObM=", + "rev": "3458f7f946ba61d1a1069aedcc17d7b7616f23cd", + "revCount": 1613, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/oxalica/rust-overlay/0.1.1613%2Brev-3458f7f946ba61d1a1069aedcc17d7b7616f23cd/01938a5f-fd1d-7a15-b29a-f49c2e4acf7e/source.tar.gz" }, "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" + "type": "tarball", + "url": "https://flakehub.com/f/oxalica/rust-overlay/%2A" } } }, diff --git a/flake.nix b/flake.nix index f8b3e49..2eeb7c4 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ inputs = { nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.2405.*"; rust-overlay = { - url = "github:oxalica/rust-overlay"; + url = "https://flakehub.com/f/oxalica/rust-overlay/*"; inputs.nixpkgs.follows = "nixpkgs"; }; crane.url = "https://flakehub.com/f/ipetkov/crane/0.19.*";