added jgd

This commit is contained in:
Daniel Winkler 2026-02-09 16:51:27 +11:00
commit c46bc7dea5
6 changed files with 79 additions and 14 deletions

View file

@ -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"

View file

@ -1,33 +1,37 @@
{
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;

25
packages/j/jgd.nix Normal file
View file

@ -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
];
}

View file

@ -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

View file

@ -1,5 +1,6 @@
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

6
versions/jgd.json Normal file
View file

@ -0,0 +1,6 @@
{
"owner": "grantmcdermott",
"repo": "jgd",
"rev": "ec39bb7f9cf56727d4c47990bca02cd3256efcfc",
"hash": "sha256-ceJUPVRPZMwIeth7gfv8ULXAEzeQ2KRoqEhtp5rIGrw="
}