diff --git a/flake.nix b/flake.nix index f8a48b7..880b358 100644 --- a/flake.nix +++ b/flake.nix @@ -40,81 +40,7 @@ extraRPackageDeps = { julia-fwildclusterboot = prev.julia-bin.withPackages ["WildBootTests" "StableRNGs"]; }; - extraRPackages = let - fetchfromGitHubJSONFile = path: prev.fetchFromGitHub (builtins.fromJSON (builtins.readFile path)); - in { - ## F - fwildclusterboot = - (prev.rPackages.buildRPackage { - name = "fwildclusterboot"; - src = fetchfromGitHubJSONFile ./versions/fwildclusterboot.json; - propagatedBuildInputs = builtins.attrValues { - inherit - (prev.rPackages) - collapse - dqrng - dreamerr - Formula - generics - gtools - JuliaConnectoR - Matrix - Rcpp - rlang - RcppArmadillo - RcppEigen - ; - inherit (final.extraRPackages) summclust; - }; - }).overrideAttrs (old: { - passthru = (old.passthru or {}) // {juliaPackages = ["WildBootTests" "StableRNGs"];}; - }); - - ## H - httpgd = prev.rPackages.buildRPackage { - name = "httpgd"; - src = fetchfromGitHubJSONFile ./versions/httpgd.json; - propagatedBuildInputs = builtins.attrValues { - inherit - (prev.rPackages) - unigd - cpp11 - AsioHeaders - ; - }; - }; - - ## M - musicMetadata = prev.rPackages.buildRPackage { - name = "musicMetadata"; - src = fetchfromGitHubJSONFile ./versions/musicMetadata.json; - }; - - ## S - summclust = prev.rPackages.buildRPackage { - name = "summclust"; - - src = fetchfromGitHubJSONFile ./versions/summclust.json; - - propagatedBuildInputs = builtins.attrValues { - inherit - (prev.rPackages) - dreamerr - MASS - collapse - generics - cli - rlang - ; - }; - }; - - synthdid = prev.rPackages.buildRPackage { - name = "synthdid"; - src = fetchfromGitHubJSONFile ./versions/synthdid.json; - propagatedBuildInputs = [prev.rPackages.mvtnorm]; - }; - }; + extraRPackages = import ./packages {inherit final prev;}; }; in { # Helper to install R with system dependencies if required diff --git a/packages/default.nix b/packages/default.nix new file mode 100644 index 0000000..55313ec --- /dev/null +++ b/packages/default.nix @@ -0,0 +1,29 @@ +{ + final, + prev, +}: +let + # Shared helper function to fetch from GitHub using JSON version files + fetchfromGitHubJSONFile = path: prev.fetchFromGitHub (builtins.fromJSON (builtins.readFile path)); + + # Reference to the versions directory at the repo root + versionsDir = ../versions; + + # Common arguments passed to all package modules + commonArgs = { + inherit final prev fetchfromGitHubJSONFile versionsDir; + }; +in { + ## F + fwildclusterboot = import ./f/fwildclusterboot.nix commonArgs; + + ## H + httpgd = import ./h/httpgd.nix commonArgs; + + ## M + musicMetadata = import ./m/musicMetadata.nix commonArgs; + + ## S + summclust = import ./s/summclust.nix commonArgs; + synthdid = import ./s/synthdid.nix commonArgs; +} diff --git a/packages/f/fwildclusterboot.nix b/packages/f/fwildclusterboot.nix new file mode 100644 index 0000000..cb0cdbd --- /dev/null +++ b/packages/f/fwildclusterboot.nix @@ -0,0 +1,30 @@ +{ + final, + prev, + fetchfromGitHubJSONFile, + versionsDir, +}: +(prev.rPackages.buildRPackage { + name = "fwildclusterboot"; + src = fetchfromGitHubJSONFile "${versionsDir}/fwildclusterboot.json"; + propagatedBuildInputs = builtins.attrValues { + inherit + (prev.rPackages) + collapse + dqrng + dreamerr + Formula + generics + gtools + JuliaConnectoR + Matrix + Rcpp + rlang + RcppArmadillo + RcppEigen + ; + inherit (final.extraRPackages) summclust; + }; +}).overrideAttrs (old: { + passthru = (old.passthru or {}) // {juliaPackages = ["WildBootTests" "StableRNGs"];}; +}) diff --git a/packages/h/httpgd.nix b/packages/h/httpgd.nix new file mode 100644 index 0000000..75e9f6f --- /dev/null +++ b/packages/h/httpgd.nix @@ -0,0 +1,17 @@ +{ + prev, + fetchfromGitHubJSONFile, + versionsDir, +}: +prev.rPackages.buildRPackage { + name = "httpgd"; + src = fetchfromGitHubJSONFile "${versionsDir}/httpgd.json"; + propagatedBuildInputs = builtins.attrValues { + inherit + (prev.rPackages) + unigd + cpp11 + AsioHeaders + ; + }; +} diff --git a/packages/m/musicMetadata.nix b/packages/m/musicMetadata.nix new file mode 100644 index 0000000..8dcf4ff --- /dev/null +++ b/packages/m/musicMetadata.nix @@ -0,0 +1,9 @@ +{ + prev, + fetchfromGitHubJSONFile, + versionsDir, +}: +prev.rPackages.buildRPackage { + name = "musicMetadata"; + src = fetchfromGitHubJSONFile "${versionsDir}/musicMetadata.json"; +} diff --git a/packages/s/summclust.nix b/packages/s/summclust.nix new file mode 100644 index 0000000..49fff68 --- /dev/null +++ b/packages/s/summclust.nix @@ -0,0 +1,20 @@ +{ + prev, + fetchfromGitHubJSONFile, + versionsDir, +}: +prev.rPackages.buildRPackage { + name = "summclust"; + src = fetchfromGitHubJSONFile "${versionsDir}/summclust.json"; + propagatedBuildInputs = builtins.attrValues { + inherit + (prev.rPackages) + dreamerr + MASS + collapse + generics + cli + rlang + ; + }; +} diff --git a/packages/s/synthdid.nix b/packages/s/synthdid.nix new file mode 100644 index 0000000..ed5a819 --- /dev/null +++ b/packages/s/synthdid.nix @@ -0,0 +1,10 @@ +{ + prev, + fetchfromGitHubJSONFile, + versionsDir, +}: +prev.rPackages.buildRPackage { + name = "synthdid"; + src = fetchfromGitHubJSONFile "${versionsDir}/synthdid.json"; + propagatedBuildInputs = [prev.rPackages.mvtnorm]; +}