Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# nullkomma:r:start
[.]nix$
^flake[.]lock$
^[.]agents$
^AGENTS[.]md$
^[.]envrc$
^[.]Renviron$
^[.]Rprofile$
Expand All @@ -13,9 +15,11 @@
^[.]github$
^[.]vscode$
^[.]nvim[.]lua$
^[.]nullkomma$
^result(-.*)?$
^docs$
^pkgdown$
^coverage[.]xml$
^pkg[.]lock$
^docs$
# nullkomma:r:end
2 changes: 0 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ concurrency:
jobs:
nullkomma:
uses: dataheld/nullkomma/.github/workflows/ci.yml@main
with:
visibility: unlisted
permissions:
contents: read
id-token: write
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ result
result-*
.direnv/
/.nullkomma/cloudflare/
/.nullkomma/processes/
.R/library/
/.nvim.lua
/.agents/skills/nullkomma-resolve-file-conflicts
/.agents/skills/nullkomma-upgrade
/.vscode/extensions.json
/.vscode/settings.json
!man/figures/
Expand Down
21 changes: 21 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!-- nullkomma:agents:start -->
## nullkomma

This project's development environment comes from [nullkomma](https://github.com/dataheld/nullkomma).
Run commands inside its dev shell:
`direnv exec . <command>`, or `nix develop --command <command>` without direnv.
`tasks` lists the project's workflows.

Check your work locally, from fastest to strictest:

1. While you work, run the narrowest task that covers the change,
e.g. `check <name>` or a single language task.
1. Before you report a change as done, run `tasks all`, then `nix flake check`,
and fix what fails.
`tasks all` formats, regenerates files and runs the checks in the working tree.
`nix flake check` runs the checks sandboxed, as CI does,
and sees only files that Git tracks: `git add` new files first.

Skills for nullkomma itself are in `.agents/skills/nullkomma-*`;
if they are missing, run `nk-generate-files`.
<!-- nullkomma:agents:end -->
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ pak::pak("dataheld/elf")
<!--
The block between the nullkomma:r-development markers is generated by
nullkomma's r-non-nix plugin. Do not edit it directly: `nix develop --command
write-files` refreshes it. See https://github.com/dataheld/nullkomma#readme
nk-write-files` refreshes it. See https://github.com/dataheld/nullkomma#readme
for plugin configuration and development documentation.
-->
<!-- nullkomma:r-development:start -->
## R development without Nix {.callout-tip}

You do not need Nix or direnv to run or develop this package.

> **Note:**
> [! NOTE]
> Developing without nix provides only limited reproducibility of the environment.
> The PPM date *approximates* the Nix package set:
> R package versions can differ,
Expand Down
96 changes: 66 additions & 30 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@
inputs = {
nullkomma.url = "https://flakehub.com/f/dataheld/nullkomma/*";
nixpkgs.follows = "nullkomma/nixpkgs";
brand = {
url = "https://flakehub.com/f/dataheld/brand/*";
maxheld = {
url = "https://flakehub.com/f/dataheld/maxheld/*";
inputs.nullkomma.follows = "nullkomma";
};
};

outputs =
inputs:
inputs.nullkomma.lib.mkFlake { inherit inputs; } {
nullkomma.r-non-nix.enable = true;
nullkomma.brand = inputs.brand;
nullkomma.r = {
enable = true;
nonNix.enable = true;
pkgdown.brand.enable = true;
};
nullkomma.brand = inputs.maxheld;
nullkomma.cloudflare = {
enable = true;
domain = "maxheld.de";
Expand Down
6 changes: 4 additions & 2 deletions tests/testthat/test-dependencies.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
test_that("missing package is identified", {
withr::local_options(rlib_message_verbosity = "verbose")
expect_message(source_pef_elf("dependencies", "is_installed2", "missing"))
expect_false(source_pef_elf("dependencies", "is_installed2", "missing"))
expect_message(
installed <- source_pef_elf("dependencies", "is_installed2", "missing")
)
expect_false(installed)
})

test_that("present package is identified", {
Expand Down
7 changes: 4 additions & 3 deletions tests/testthat/test-options.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
test_that("locally setting options works", {
options::define_option("foo", default = "bar")
expect_equal(options::opt("foo"), "bar")
opt_set_local2("foo", "baz")
expect_equal(options::opt("foo"), "baz")
withr::deferred_run()
local({
opt_set_local2("foo", "baz")
expect_equal(options::opt("foo"), "baz")
})
expect_equal(options::opt("foo"), "bar")
})
Loading