diff --git a/flake.lock b/flake.lock index e70081d..82d8765 100644 --- a/flake.lock +++ b/flake.lock @@ -2,16 +2,16 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1762778295, - "narHash": "sha256-5Ogu11rMpc3ytcfBLwO3O1l1MJl0pTT+uCz/OJixmVo=", + "lastModified": 1771246459, + "narHash": "sha256-r93GMW+p1/jjgaDU9Dadvo2lOcj6a8oza6QayP5ojYk=", "owner": "rstats-on-nix", "repo": "nixpkgs", - "rev": "b37b5950aa970ed7abe27144f2ca62e6029215e5", + "rev": "b56df64c453105d8e4ebaa0cefd7acd357685fb0", "type": "github" }, "original": { "owner": "rstats-on-nix", - "ref": "2025-11-10", + "ref": "2026-02-16", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 880b358..92df630 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "FRAN - The Flakey R Archiving Network"; inputs = { - nixpkgs.url = "github:rstats-on-nix/nixpkgs/2025-11-10"; + nixpkgs.url = "github:dwinkler1/rixpkgs/nixpkgs"; }; outputs = { @@ -78,9 +78,34 @@ franUpdate ]; }; + newpkg = pkgs.mkShell { + nativeBuildInputs = [ + pkgs.nix-prefetch-github + ]; + }; + } + ); + + checks = forAllSystems ( + system: let + pkgs = import nixpkgs { + inherit system; + overlays = [self.overlays.default]; + }; + rEnv = mkR { + inherit pkgs; + packages = builtins.attrValues pkgs.extraRPackages; + }; + in { + test-script = pkgs.runCommand "test-script" {} '' + mkdir -p $out + cp ${./test/test.R} test.R + ${rEnv}/bin/Rscript test.R > $out/result.log + ''; } ); }; + nixConfig = { extra-substituters = [ "https://rstats-on-nix.cachix.org" diff --git a/packages/default.nix b/packages/default.nix index be7a47e..2e170f5 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -1,33 +1,34 @@ { final, prev, -}: -let +}: 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 package modules that don't need 'final' baseArgs = { inherit prev fetchfromGitHubJSONFile versionsDir; }; - + # Arguments for packages that need access to 'final' (for cross-package dependencies) - argsWithFinal = baseArgs // { - inherit final; - }; + argsWithFinal = + baseArgs + // { + inherit final; + }; in { ## F fwildclusterboot = import ./f/fwildclusterboot.nix argsWithFinal; - - ## H - httpgd = import ./h/httpgd.nix baseArgs; - + + ## J + jgd = import ./j/jgd.nix (baseArgs // {lib = prev.lib;}); + ## M musicMetadata = import ./m/musicMetadata.nix baseArgs; - + ## S summclust = import ./s/summclust.nix baseArgs; synthdid = import ./s/synthdid.nix baseArgs; diff --git a/packages/h/httpgd.nix b/packages/h/httpgd.nix deleted file mode 100644 index 75e9f6f..0000000 --- a/packages/h/httpgd.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - 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/j/jgd.nix b/packages/j/jgd.nix new file mode 100644 index 0000000..46b2dcd --- /dev/null +++ b/packages/j/jgd.nix @@ -0,0 +1,25 @@ +{ + lib, + prev, + fetchfromGitHubJSONFile, + versionsDir, +}: let + repoSrc = fetchfromGitHubJSONFile "${versionsDir}/jgd.json"; + + rPkgSrc = lib.cleanSourceWith { + src = repoSrc; + filter = path: type: let + p = toString path; + in + # keep r-pkg/ and everything under it + (lib.hasPrefix (toString repoSrc + "/r-pkg") p); + }; +in + prev.rPackages.buildRPackage { + name = "jgd"; + src = rPkgSrc; + sourceRoot = "source/r-pkg"; + nativeBuildInputs = [ + prev.pkg-config + ]; + } diff --git a/test/test.R b/test/test.R index 77c0a61..d91e0df 100644 --- a/test/test.R +++ b/test/test.R @@ -1,13 +1,17 @@ cat("Testing\n") +cat("\n============================================================ jgd =========================================================================\n") +library(jgd) +jgd() + cat("\n============================================================ fwildclusterboot ============================================================\n") library(fwildclusterboot) data(voters) lm_fit <- lm( - proposition_vote ~ treatment + ideology1 + log_income + Q1_immigration , + proposition_vote ~ treatment + ideology1 + log_income + Q1_immigration , data = voters ) boot_lm <- boottest( - lm_fit, + lm_fit, clustid = "group_id1", param = "treatment", B = 999 @@ -21,7 +25,7 @@ boot_lmjl <- boottest( ) #setBoottest_engine("WildBootTests.jl") boot_lmjl2 <- boottest( - lm_fit, + lm_fit, clustid = "group_id1", param = "treatment", B = 999 @@ -30,10 +34,6 @@ summary(boot_lm) summary(boot_lmjl) summary(boot_lmjl2) -cat("\n============================================================ httpgd ============================================================\n") -library(httpgd) -hgd() - cat("\n============================================================ musicMetadata ============================================================\n") library(musicMetadata) print(classify_labels('Interscope')) diff --git a/versions/default.nix b/versions/default.nix index faa6d1a..3fcc8ea 100644 --- a/versions/default.nix +++ b/versions/default.nix @@ -1,8 +1,11 @@ pkgs: '' pg=${pkgs.nix-prefetch-github}/bin/nix-prefetch-github + $pg --json grantmcdermott jgd > versions/jgd.json $pg --json hannesdatta musicMetadata > versions/musicMetadata.json $pg --json nx10 httpgd > versions/httpgd.json $pg --json s3alfisc fwildclusterboot > versions/fwildclusterboot.json $pg --json s3alfisc summclust > versions/summclust.json $pg --json synth-inference synthdid > versions/synthdid.json + RVER=$( wget -qO- 'https://raw.githubusercontent.com/ropensci/rix/refs/heads/main/inst/extdata/available_df.csv' | tail -n 1 | head -n 1 | cut -d',' -f4 | tr -d '"' ) + ${pkgs.gnused}/bin/sed -i "s|nixpkgs.url = \"github:rstats-on-nix/nixpkgs/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\";|nixpkgs.url = \"github:rstats-on-nix/nixpkgs/$RVER\";|" flake.nix '' diff --git a/versions/httpgd.json b/versions/httpgd.json deleted file mode 100644 index ad2940b..0000000 --- a/versions/httpgd.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "owner": "nx10", - "repo": "httpgd", - "rev": "dd6ed3a687a2d7327bb28ca46725a0a203eb2a19", - "hash": "sha256-vs6MTdVJXhTdzPXKqQR+qu1KbhF+vfyzZXIrFsuKMtU=" -} diff --git a/versions/jgd.json b/versions/jgd.json new file mode 100644 index 0000000..3a7dbf6 --- /dev/null +++ b/versions/jgd.json @@ -0,0 +1,6 @@ +{ + "owner": "grantmcdermott", + "repo": "jgd", + "rev": "e51385ed656618ed3d2611c0ccc1feff22bf4e11", + "hash": "sha256-rWn8DVvH7JapCs1i0jQQQsWm00JPNUolVygcfDsSV1k=" +}