diff --git a/Cargo.lock b/Cargo.lock index 219c98b..ff3786a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -471,7 +471,6 @@ dependencies = [ "directories", "fastrand 1.9.0", "human-panic", - "lazy_static", "md5", "nix 0.20.2", "notify", diff --git a/Cargo.nix b/Cargo.nix index 34680f3..8b10048 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -398,6 +398,7 @@ rec { version = "0.1.10"; edition = "2018"; sha256 = "08h80ihs74jcyp24cd75wwabygbbdgl05k6p5dmq8akbr78vv1a7"; + libName = "cfg_if"; authors = [ "Alex Crichton " ]; @@ -412,6 +413,7 @@ rec { version = "1.0.0"; edition = "2018"; sha256 = "1za0vb97n4brpzpv8lsbnzmq5r8f2b0cpqqr0sy8h5bn751xxwds"; + libName = "cfg_if"; authors = [ "Alex Crichton " ]; @@ -491,6 +493,7 @@ rec { version = "0.5.12"; edition = "2021"; sha256 = "159gp30clv2ci3r473659ii04pjznspb3g9gwkhj2lavkhmb0gdb"; + libName = "crossbeam_channel"; dependencies = [ { name = "crossbeam-utils"; @@ -509,6 +512,7 @@ rec { version = "0.8.19"; edition = "2021"; sha256 = "0iakrb1b8fjqrag7wphl94d10irhbh2fw1g444xslsywqyn3p3i4"; + libName = "crossbeam_utils"; features = { "default" = [ "std" ]; "loom" = [ "dep:loom" ]; @@ -598,6 +602,7 @@ rec { version = "2.0.0"; edition = "2018"; sha256 = "1q9kr151h9681wwp6is18750ssghz6j9j7qm7qi1ngcwy7mzi35r"; + libName = "dirs_next"; authors = [ "The @xdg-rs members" ]; @@ -618,6 +623,7 @@ rec { version = "0.3.7"; edition = "2015"; sha256 = "19md1cnkazham8a6kh22v12d8hh3raqahfk6yb043vrjr68is78v"; + libName = "dirs_sys"; authors = [ "Simon Ochsenreither " ]; @@ -647,6 +653,7 @@ rec { version = "0.1.2"; edition = "2018"; sha256 = "0kavhavdxv4phzj4l0psvh55hszwnr0rcz8sxbvx20pyqi2a3gaf"; + libName = "dirs_sys_next"; authors = [ "The @xdg-rs members" ]; @@ -758,6 +765,7 @@ rec { edition = "2021"; crateBin = []; sha256 = "1jdg9xq830hghzrqkbnx8nda58a7z6mh8b6vlg5mj87v4l2ji135"; + libName = "file_id"; authors = [ "Daniel Faust " ]; @@ -810,6 +818,7 @@ rec { version = "4.1.0"; edition = "2018"; sha256 = "1liz67v8b0gcs8r31vxkvm2jzgl9p14i78yfqx81c8sdv817mvkn"; + libName = "fsevent_sys"; authors = [ "Pierre Baillet " ]; @@ -826,6 +835,7 @@ rec { version = "0.1.1"; edition = "2018"; sha256 = "1fnkqrbz7ixxzsb04bsz9p0zzazanma8znfdqjvh39n14vapfvx0"; + libName = "fuchsia_cprng"; authors = [ "Erick Tryzelaar " ]; @@ -943,6 +953,7 @@ rec { version = "0.1.19"; edition = "2018"; sha256 = "0cxcm8093nf5fyn114w8vxbrbcyvv91d4015rdnlgfll7cs6gd32"; + libName = "hermit_abi"; authors = [ "Stefan Lankes" ]; @@ -965,6 +976,7 @@ rec { version = "0.3.9"; edition = "2021"; sha256 = "092hxjbjnq5fmz66grd9plxd0sh6ssg5fhgwwwqbrzgzkjwdycfj"; + libName = "hermit_abi"; authors = [ "Stefan Lankes" ]; @@ -985,6 +997,7 @@ rec { src = if ((lib.versionOlder builtins.nixVersion "2.4pre20211007") || (lib.versionOlder "2.5" builtins.nixVersion )) then lib.cleanSourceWith { filter = sourceFilter; src = ./vendor/human-panic; } else ./vendor/human-panic; + libName = "human_panic"; authors = [ "Yoshua Wuyts " "Pascal Hertleif " @@ -1058,6 +1071,7 @@ rec { version = "0.1.5"; edition = "2015"; sha256 = "1syhjgvkram88my04kv03s0zwa66mdwa5v7ddja3pzwvx2sh4p70"; + libName = "inotify_sys"; authors = [ "Hanno Braun " ]; @@ -1096,6 +1110,7 @@ rec { version = "0.4.12"; edition = "2018"; sha256 = "12vk6g0f94zlxl6mdh5gc4jdjb469n9k9s7y3vb0iml05gpzagzj"; + libName = "is_terminal"; authors = [ "softprops " "Dan Gohman " @@ -1164,6 +1179,7 @@ rec { version = "1.0.4"; edition = "2018"; sha256 = "12w3wi90y4kwis4k9g6fp0kqjdmc6l00j16g8mgbhac7vbzjb5pd"; + libName = "kqueue_sys"; authors = [ "William Orr " "Daniel (dmilith) Dettlaff " @@ -1240,6 +1256,7 @@ rec { version = "0.4.13"; edition = "2021"; sha256 = "172k2c6422gsc914ig8rh99mb9yc7siw6ikc3d9xw1k7vx0s3k81"; + libName = "linux_raw_sys"; authors = [ "Dan Gohman " ]; @@ -1355,10 +1372,6 @@ rec { name = "human-panic"; packageId = "human-panic"; } - { - name = "lazy_static"; - packageId = "lazy_static"; - } { name = "md5"; packageId = "md5"; @@ -1824,6 +1837,7 @@ rec { version = "0.1.0"; edition = "2021"; sha256 = "1ndiyg82q73783jq18isi71a7mjh56wxrk52rlvyx0mi5z9ibmai"; + libName = "num_conv"; authors = [ "Jacob Pratt " ]; @@ -1834,6 +1848,7 @@ rec { version = "0.2.18"; edition = "2018"; sha256 = "0yjib8p2p9kzmaz48xwhs69w5dh1wipph9jgnillzd2x33jz03fs"; + libName = "num_traits"; authors = [ "The Rust Project Developers" ]; @@ -2002,6 +2017,7 @@ rec { version = "0.2.17"; edition = "2018"; sha256 = "1pp6g52aw970adv3x2310n7glqnji96z0a9wiamzw89ibf0ayh2v"; + libName = "ppv_lite86"; authors = [ "The CryptoCorrosion Contributors" ]; @@ -2015,6 +2031,7 @@ rec { version = "0.4.30"; edition = "2015"; sha256 = "0nd71fl24sys066jrha6j7i34nfkjv44yzw8yww9742wmc8j0gfg"; + libName = "proc_macro2"; authors = [ "Alex Crichton " ]; @@ -2034,6 +2051,7 @@ rec { version = "1.0.79"; edition = "2021"; sha256 = "0bn004ybzdqid81cqppr5c9jrvqsxv50x60sxc41cwpmk0igydg8"; + libName = "proc_macro2"; authors = [ "David Tolnay " "Alex Crichton " @@ -2125,6 +2143,7 @@ rec { version = "1.2.3"; edition = "2015"; sha256 = "1q6za3v78hsspisc197bg3g7rpc989qycy8ypr8ap8igv10ikl51"; + libName = "quick_error"; authors = [ "Paul Colomiets " "Colin Kiegel " @@ -2564,6 +2583,7 @@ rec { version = "0.4.6"; edition = "2021"; sha256 = "1spaq7y4im7s56d1gxa2hi4hzf6dwswb1bv8xyavzya7k25kpf46"; + libName = "regex_automata"; authors = [ "The Rust Project Developers" "Andrew Gallant " @@ -2624,6 +2644,7 @@ rec { version = "0.6.29"; edition = "2018"; sha256 = "1qgj49vm6y3zn1hi09x91jvgkl2b1fiaq402skj83280ggfwcqpi"; + libName = "regex_syntax"; authors = [ "The Rust Project Developers" ]; @@ -2638,6 +2659,7 @@ rec { version = "0.8.3"; edition = "2021"; sha256 = "0mhzkm1pkqg6y53xv056qciazlg47pq0czqs94cn302ckvi49bdd"; + libName = "regex_syntax"; authors = [ "The Rust Project Developers" "Andrew Gallant " @@ -2672,6 +2694,7 @@ rec { version = "0.1.23"; edition = "2015"; sha256 = "0xnbk2bmyzshacjm2g1kd4zzv2y2az14bw3sjccq5qkpmsfvn9nn"; + libName = "rustc_demangle"; authors = [ "Alex Crichton " ]; @@ -2819,6 +2842,7 @@ rec { version = "1.0.6"; edition = "2018"; sha256 = "00h5j1w87dmhnvbv9l8bic3y7xxsnjmssvifw2ayvgx9mb1ivz4k"; + libName = "same_file"; authors = [ "Andrew Gallant " ]; @@ -2971,6 +2995,7 @@ rec { version = "2.9.1"; edition = "2018"; sha256 = "1s0h8qhqnvy5a7m7gmnca2a2d5m5a4sz1hc26xfgxawqp7825q5n"; + libName = "slog_term"; authors = [ "Dawid Ciężarkiewicz " ]; @@ -3071,6 +3096,7 @@ rec { edition = "2015"; sha256 = "01sis9z5kqmyhvzbnmlzpdxcry99a0b9blypksgnhdsbm1hh40ak"; procMacro = true; + libName = "structopt_derive"; authors = [ "Guillaume Pinot " ]; @@ -3289,6 +3315,7 @@ rec { edition = "2021"; sha256 = "1xylyqcb8rv5yh2yf97hg4n4kg27qccc0ijafr1zqklrhahkn7y6"; procMacro = true; + libName = "thiserror_impl"; authors = [ "David Tolnay " ]; @@ -3414,6 +3441,7 @@ rec { version = "0.1.2"; edition = "2021"; sha256 = "1wx3qizcihw6z151hywfzzyd1y5dl804ydyxci6qm07vbakpr4pg"; + libName = "time_core"; authors = [ "Jacob Pratt " "Time contributors" @@ -3426,6 +3454,7 @@ rec { edition = "2021"; sha256 = "1kqwxvfh2jkpg38fy673d6danh1bhcmmbsmffww3mphgail2l99z"; procMacro = true; + libName = "time_macros"; authors = [ "Jacob Pratt " "Time contributors" @@ -3469,6 +3498,7 @@ rec { version = "1.0.12"; edition = "2018"; sha256 = "0jzf1znfpb2gx8nr8mvmyqs1crnv79l57nxnbiszc7xf7ynbjm1k"; + libName = "unicode_ident"; authors = [ "David Tolnay " ]; @@ -3479,6 +3509,7 @@ rec { version = "1.11.0"; edition = "2018"; sha256 = "00kjpwp1g8fqm45drmwivlacn3y9jx73bvs09n6s3x73nqi7vj6l"; + libName = "unicode_segmentation"; authors = [ "kwantam " "Manish Goregaokar " @@ -3491,6 +3522,7 @@ rec { version = "0.1.11"; edition = "2015"; sha256 = "11ds4ydhg8g7l06rlmh712q41qsrd0j0h00n1jm74kww3kqk65z5"; + libName = "unicode_width"; authors = [ "kwantam " "Manish Goregaokar " @@ -3508,6 +3540,7 @@ rec { version = "0.1.0"; edition = "2015"; sha256 = "1z57lqh4s18rr4x0j4fw4fmp9hf9346h0kmdgqsqx0fhjr3k0wpw"; + libName = "unicode_xid"; authors = [ "erick.tryzelaar " "kwantam " @@ -3661,6 +3694,7 @@ rec { version = "0.4.0"; edition = "2015"; sha256 = "1dmpa6mvcvzz16zg6d5vrfy4bxgg541wxrcip7cnshi06v38ffxc"; + libName = "winapi_i686_pc_windows_gnu"; authors = [ "Peter Atashian " ]; @@ -3671,6 +3705,7 @@ rec { version = "0.1.6"; edition = "2021"; sha256 = "15i5lm39wd44004i9d5qspry2cynkrpvwzghr6s2c3dsk28nz7pj"; + libName = "winapi_util"; authors = [ "Andrew Gallant " ]; @@ -3689,6 +3724,7 @@ rec { version = "0.4.0"; edition = "2015"; sha256 = "0gqq64czqb64kskjryj8isp62m2sgvx25yyj3kpc2myh85w24bki"; + libName = "winapi_x86_64_pc_windows_gnu"; authors = [ "Peter Atashian " ]; @@ -3699,6 +3735,7 @@ rec { version = "0.48.0"; edition = "2018"; sha256 = "1aan23v5gs7gya1lc46hqn9mdh8yph3fhxmhxlw36pn6pqc28zb7"; + libName = "windows_sys"; authors = [ "Microsoft" ]; @@ -3992,6 +4029,7 @@ rec { version = "0.52.0"; edition = "2021"; sha256 = "0gd3v4ji88490zgb6b5mq5zgbvwv7zx1ibn8v3x83rwcdbryaar8"; + libName = "windows_sys"; authors = [ "Microsoft" ]; @@ -4239,6 +4277,7 @@ rec { version = "0.48.5"; edition = "2018"; sha256 = "034ljxqshifs1lan89xwpcy1hp0lhdh4b5n0d2z4fwjx2piacbws"; + libName = "windows_targets"; authors = [ "Microsoft" ]; @@ -4286,6 +4325,7 @@ rec { version = "0.52.4"; edition = "2021"; sha256 = "06sdd7fin3dj9cmlg6n1dw0n1l10jhn9b8ckz1cqf0drb9z7plvx"; + libName = "windows_targets"; authors = [ "Microsoft" ]; diff --git a/Cargo.toml b/Cargo.toml index 8eb11b3..e3d4db8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,6 @@ bincode = "1.3.2" # nice-to-have ctrlc = { version = "3.1.8", features = ["termination"] } directories = "3.0.1" -lazy_static = "1.4.0" md5 = "0.7.0" vec1 = ">= 1.1.0, <1.7.0" human-panic = { path = "vendor/human-panic" } diff --git a/src/builder.rs b/src/builder.rs index c346134..dd9d49e 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -21,6 +21,7 @@ use std::io::{self, BufReader}; use std::os::unix::prelude::OsStrExt; use std::path::PathBuf; use std::process::{ChildStderr, ChildStdout, Command, ExitStatus, Stdio}; +use std::sync::LazyLock; use std::{fmt, thread}; /// An error that can occur during a build. @@ -625,26 +626,30 @@ fn parse_evaluation_line(line: T) -> LogDatum where T: AsRef, { - lazy_static::lazy_static! { - // These are the .nix files that are opened for evaluation. - static ref EVAL_FILE: Regex = - Regex::new("^evaluating file '(?P.*)'$").expect("invalid regex!"); - // When you reference a source file, nix copies it to the store and prints this. - // This the same is true for directories (e.g. `foo = ./abc` in a derivation). - static ref COPIED_SOURCE: Regex = - Regex::new("^copied source '(?P.*)' -> '(?:.*)'$").expect("invalid regex!"); - // These are printed for `builtins.readFile` and `builtins.filterSource`, - // by our instrumentation in `./logged-evaluation.nix`. - // They mean we should watch recursively this file or directory - static ref LORRI_READ: Regex = - Regex::new("^trace: lorri read: '(?P.*)'$").expect("invalid regex!"); - // These are printed for `builtins.readDir` and `builtins.filterSource`, - // by our instrumentation in `./logged-evaluation.nix`. - // They mean we should watch the file listing of this directory, but not - // its children. - static ref LORRI_READDIR: Regex = - Regex::new("^trace: lorri readdir: '(?P.*)'$").expect("invalid regex!"); - } + // These are the .nix files that are opened for evaluation. + static EVAL_FILE: LazyLock = + LazyLock::new(|| Regex::new("^evaluating file '(?P.*)'$").expect("invalid regex!")); + + // When you reference a source file, nix copies it to the store and prints this. This the + // same is true for directories (e.g. `foo = ./abc` in a derivation). + static COPIED_SOURCE: LazyLock = LazyLock::new(|| { + Regex::new("^copied source '(?P.*)' -> '(?:.*)'$").expect("invalid regex!") + }); + + // These are printed for `builtins.readFile` and `builtins.filterSource`, + // by our instrumentation in `./logged-evaluation.nix`. + // They mean we should watch recursively this file or directory + static LORRI_READ: LazyLock = LazyLock::new(|| { + Regex::new("^trace: lorri read: '(?P.*)'$").expect("invalid regex!") + }); + + // These are printed for `builtins.readDir` and `builtins.filterSource`, + // by our instrumentation in `./logged-evaluation.nix`. + // They mean we should watch the file listing of this directory, but not + // its children. + static LORRI_READDIR: LazyLock = LazyLock::new(|| { + Regex::new("^trace: lorri readdir: '(?P.*)'$").expect("invalid regex!") + }); // see the regexes above for explanations of the nix outputs match line.as_ref().to_str() { @@ -707,9 +712,12 @@ impl NixDevParser { // evaluating derivation 'git+file:///home/judson/dev/picklist#devShells.x86_64-linux.default'... // got tree '/nix/store/47b9j9bnhi1n7larnn6wy40xcyfbz9mr-source' from 'git+file:///home/judson/dev/picklist' // checking access to '/nix/store/47b9j9bnhi1n7larnn6wy40xcyfbz9mr-source/flake.nix' - lazy_static::lazy_static! { - static ref EVAL_DRV: Regex = Regex::new(r#"evaluating derivation '(?Pgit\+file://(?P[^?]*)[^#]*)#\S*'\.\.\."#).expect("regex to compile!"); - } + static EVAL_DRV: LazyLock = LazyLock::new(|| { + Regex::new( + r#"evaluating derivation '(?Pgit\+file://(?P[^?]*)[^#]*)#\S*'\.\.\."#, + ) + .expect("regex to compile!") + }); for (re, path) in self.tree_rees.values() { if let Some(matches) = re.captures(line) {