added full julia, python, r setup

This commit is contained in:
Daniel Winkler 2025-06-01 23:46:29 +02:00
commit 8193797c23
No known key found for this signature in database
22 changed files with 1853 additions and 0 deletions

143
templates/py/flake.nix Normal file
View file

@ -0,0 +1,143 @@
{
description = "Project Template";
inputs = {
rixpkgs.url = "https://github.com/rstats-on-nix/nixpkgs/archive/2025-05-19.tar.gz";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nCats.url = "github:dwinkler1/nixCatsConfig";
nCats.inputs.nixpkgs.follows = "nixpkgs";
pyproject-nix = {
url = "github:pyproject-nix/pyproject.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
uv2nix = {
url = "github:pyproject-nix/uv2nix";
inputs.pyproject-nix.follows = "pyproject-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
pyproject-build-systems = {
url = "github:pyproject-nix/build-system-pkgs";
inputs.pyproject-nix.follows = "pyproject-nix";
inputs.uv2nix.follows = "uv2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
nCats,
...
} @ inputs: let
forSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.all;
in {
packages = forSystems (
system: let
inherit (nCats) utils;
finalPackage = nCats.packages.${system}.default.override (prev: {
dependencyOverlays =
prev.dependencyOverlays
++ [
(utils.standardPluginOverlay inputs)
(final: prev: {
rpkgs = inputs.rixpkgs.legacyPackages.${system};
})
(final: prev: let
# Load a uv workspace from a workspace root.
# Uv2nix treats all uv projects as workspace projects.
workspace = uv2nix.lib.workspace.loadWorkspace {workspaceRoot = ./.;};
# Create package overlay from workspace.
overlay = workspace.mkPyprojectOverlay {
# Prefer prebuilt binary wheels as a package source.
# Sdists are less likely to "just work" because of the metadata missing from uv.lock.
# Binary wheels are more likely to, but may still require overrides for library dependencies.
sourcePreference = "wheel"; # or sourcePreference = "sdist";
# Optionally customise PEP 508 environment
# environ = {
# platform_release = "5.10.65";
# };
};
# Extend generated overlay with build fixups
#
# Uv2nix can only work with what it has, and uv.lock is missing essential metadata to perform some builds.
# This is an additional overlay implementing build fixups.
# See:
# - https://pyproject-nix.github.io/uv2nix/FAQ.html
pyprojectOverrides = _final: _prev: {
# Implement build fixups here.
# Note that uv2nix is _not_ using Nixpkgs buildPythonPackage.
# It's using https://pyproject-nix.github.io/pyproject.nix/build.html
};
# Construct package set
pythonSet =
# Use base package set from pyproject.nix builders
(pkgs.callPackage pyproject-nix.build.packages {inherit python;}).overrideScope
(
lib.composeManyExtensions [
pyproject-build-systems.overlays.default
overlay
pyprojectOverrides
]
);
in {
venv = pythonSet.mkVirtualEnv builtins.toString ./. workspace.deps.default;
})
(import (builtins.path {
path = ./rpkgs.nix;
name = "my-rpackages";
}))
];
categoryDefinitions = utils.mergeCatDefs prev.categoryDefinitions (
{
pkgs,
settings,
categories,
name,
extra,
mkPlugin,
...
} @ packageDef: let
myPy = pkgs.python313;
in {
lspsAndRuntimeDeps.rdev = with pkgs; [
myPy
uv
nodejs
ruff
just
wget
python313Packages.python-lsp-server
];
environmentVariables.rdev = {
# Prevent uv from managing Python downloads
UV_PYTHON_DOWNLOADS = "never";
# Force uv to use nixpkgs Python interpreter
UV_PYTHON = myPy.interpreter;
};
}
);
packageDefinitions =
prev.packageDefinitions
// {
nixCats = utils.mergeCatDefs prev.packageDefinitions.nixCats (
{...}: {
settings = {
suffix-path = false;
suffix-LD = false;
};
categories = {
rdev = true;
};
}
);
};
});
in
utils.mkAllWithDefault finalPackage
);
};
}

2
templates/sci/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
data/*
!data/.gitkeep

View file

@ -0,0 +1,67 @@
[formatting]
line_length = 79
[keymap]
preset = "vim"
[keymap.overrides]
[runtime]
auto_instantiate = true
std_stream_max_bytes = 1000000
on_cell_change = "autorun"
reactive_tests = true
default_sql_output = "auto"
auto_reload = "off"
watcher_on_save = "lazy"
output_max_bytes = 8000000
[language_servers.pylsp]
enable_pydocstyle = false
enable_flake8 = false
enable_ruff = true
enable_mypy = true
enable_pylint = false
enabled = true
enable_pyflakes = false
[experimental]
[completion]
activate_on_typing = true
copilot = "github"
[server]
browser = "default"
follow_symlink = false
[ai]
rules = ""
[ai.google]
[ai.bedrock]
[ai.open_ai]
[ai.anthropic]
[diagnostics]
[package_management]
manager = "uv"
[snippets]
include_default_snippets = true
custom_paths = []
[display]
default_table_page_size = 10
code_editor_font_size = 14
cell_output = "below"
dataframes = "rich"
theme = "dark"
default_width = "medium"
[save]
format_on_save = false
autosave = "after_delay"
autosave_delay = 1000

View file

@ -0,0 +1 @@
3.12

View file

@ -0,0 +1,199 @@
# zk configuration file
#
# Uncomment the properties you want to customize.
# NOTE SETTINGS
#
# Defines the default options used when generating new notes.
[note]
# Language used when writing notes.
# This is used to generate slugs or with date formats.
#language = "en"
# The default title used for new note, if no `--title` flag is provided.
#default-title = "Untitled"
# Template used to generate a note's filename, without extension.
extension = "md"
filename = "docs/{{slug title}}-{{format-date now '%Y-%m-%d'}}-{{id}}"
language = "en"
# The file extension used for the notes.
#extension = "md"
# Template used to generate a note's content.
# If not an absolute path or "~/unix/path", it's relative to .zk/templates/
template = "default.md"
# Path globs ignored while indexing existing notes.
#exclude = [
# "drafts/*",
# "log.md"
#]
# Configure random ID generation.
# The charset used for random IDs. You can use:
# * letters: only letters from a to z.
# * numbers: 0 to 9
# * alphanum: letters + numbers
# * hex: hexadecimal, from a to f and 0 to 9
# * custom string: will use any character from the provided value
#id-charset = "alphanum"
# Length of the generated IDs.
#id-length = 4
# Letter case for the random IDs, among lower, upper or mixed.
#id-case = "lower"
# EXTRA VARIABLES
#
# A dictionary of variables you can use for any custom values when generating
# new notes. They are accessible in templates with {{extra.<key>}}
[extra]
#key = "value"
# GROUP OVERRIDES
#
# You can override global settings from [note] and [extra] for a particular
# group of notes by declaring a [group."<name>"] section.
#
# Specify the list of directories which will automatically belong to the group
# with the optional `paths` property.
#
# Omitting `paths` is equivalent to providing a single path equal to the name of
# the group. This can be useful to quickly declare a group by the name of the
# directory it applies to.
#[group."<NAME>"]
#paths = ["<DIR1>", "<DIR2>"]
#[group."<NAME>".note]
#filename = "{{format-date now}}"
#[group."<NAME>".extra]
#key = "value"
# MARKDOWN SETTINGS
[format.markdown]
# Format used to generate links between notes.
# Either "wiki", "markdown" or a custom template. Default is "markdown".
link-format = "wiki"
# Indicates whether a link's path will be percent-encoded.
# Defaults to true for "markdown" format and false for "wiki" format.
#link-encode-path = true
# Indicates whether a link's path file extension will be removed.
# Defaults to true.
#link-drop-extension = true
# Enable support for #hashtags.
hashtags = false
# Enable support for :colon:separated:tags:.
colon-tags = true
# Enable support for Bear's #multi-word tags#
# Hashtags must be enabled for multi-word tags to work.
multiword-tags = false
# EXTERNAL TOOLS
[tool]
# Default editor used to open notes. When not set, the EDITOR or VISUAL
# environment variables are used.
#editor = "vim"
# Pager used to scroll through long output. If you want to disable paging
# altogether, set it to an empty string "".
#pager = "less -FIRX"
# Command used to preview a note during interactive fzf mode.
# Set it to an empty string "" to disable preview.
# bat is a great tool to render Markdown document with syntax highlighting.
#https://github.com/sharkdp/bat
#fzf-preview = "bat -p --color always {-1}"
# LSP
#
# Configure basic editor integration for LSP-compatible editors.
# See https://github.com/zk-org/zk/blob/main/docs/editors-integration.md
#
[lsp]
[lsp.diagnostics]
# Each diagnostic can have for value: none, hint, info, warning, error
# Report titles of wiki-links as hints.
wiki-title = "hint"
# Warn for dead links between notes.
dead-link = "error"
[lsp.completion]
# Customize the completion pop-up of your LSP client.
# Show the note title in the completion pop-up, or fallback on its path if empty.
#note-label = "{{title-or-path}}"
# Filter out the completion pop-up using the note title or its path.
#note-filter-text = "{{title}} {{path}}"
# Show the note filename without extension as detail.
#note-detail = "{{filename-stem}}"
# NAMED FILTERS
#
# A named filter is a set of note filtering options used frequently together.
#
[filter]
# Matches the notes created the last two weeks. For example:
# $ zk list recents --limit 15
# $ zk edit recents --interactive
#recents = "--sort created- --created-after 'last two weeks'"
# COMMAND ALIASES
#
# Aliases are user commands called with `zk <alias> [<flags>] [<args>]`.
#
# The alias will be executed with `$SHELL -c`, please refer to your shell's
# man page to see the available syntax. In most shells:
# * $@ can be used to expand all the provided flags and arguments
# * you can pipe commands together with the usual | character
#
[alias]
# Here are a few aliases to get you started.
# Shortcut to a command.
#ls = "zk list $@"
# Default flags for an existing command.
#list = "zk list --quiet $@"
# Edit the last modified note.
#editlast = "zk edit --limit 1 --sort modified- $@"
# Edit the notes selected interactively among the notes created the last two weeks.
# This alias doesn't take any argument, so we don't use $@.
#recent = "zk edit --sort created- --created-after 'last two weeks' --interactive"
# Print paths separated with colons for the notes found with the given
# arguments. This can be useful to expand a complex search query into a flag
# taking only paths. For example:
# zk list --link-to "`zk path -m potatoe`"
#path = "zk list --quiet --format {{path}} --delimiter , $@"
# Show a random note.
#lucky = "zk list --quiet --format full --sort random --limit 1"
# Returns the Git history for the notes found with the given arguments.
# Note the use of a pipe and the location of $@.
#hist = "zk list --format path --delimiter0 --quiet $@ | xargs -t -0 git log --patch --"
# Edit this configuration file.
#conf = '$EDITOR "$ZK_NOTEBOOK_DIR/.zk/config.toml"'

Binary file not shown.

View file

@ -0,0 +1,3 @@
# {{title}}
{{content}}

4
templates/sci/Justfile Normal file
View file

@ -0,0 +1,4 @@
rverurl := 'https://raw.githubusercontent.com/ropensci/rix/refs/heads/main/inst/extdata/available_df.csv'
update-r-version:
RVER=$( wget -qO- {{rverurl}} | tail -n 2 | head -n 1 | cut -d',' -f4 | tr -d '"' ) &&\
sed -i "s|rixpkgs.url = \"https://github.com/rstats-on-nix/nixpkgs/archive/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\.tar\.gz\";|rixpkgs.url = \"https://github.com/rstats-on-nix/nixpkgs/archive/$RVER.tar.gz\";|" flake.nix

0
templates/sci/README.md Normal file
View file

View file

View file

103
templates/sci/flake.lock generated Normal file
View file

@ -0,0 +1,103 @@
{
"nodes": {
"nCats": {
"inputs": {
"nixCats": "nixCats",
"nixpkgs": [
"nixpkgs"
],
"plugins-r": "plugins-r",
"rixpkgs": "rixpkgs"
},
"locked": {
"lastModified": 1748808131,
"owner": "dwinkler1",
"repo": "nixCatsConfig",
"rev": "b5cbf7502b5d7d58cd5dc8c73ac40a5744f2e767",
"type": "github"
},
"original": {
"owner": "dwinkler1",
"repo": "nixCatsConfig",
"type": "github"
}
},
"nixCats": {
"locked": {
"lastModified": 1748230488,
"owner": "BirdeeHub",
"repo": "nixCats-nvim",
"rev": "2a2f15a6c085524ac121f5da9a73ee2155c53d70",
"type": "github"
},
"original": {
"owner": "BirdeeHub",
"repo": "nixCats-nvim",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1748662220,
"owner": "nixos",
"repo": "nixpkgs",
"rev": "59138c7667b7970d205d6a05a8bfa2d78caa3643",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"plugins-r": {
"flake": false,
"locked": {
"lastModified": 1748371931,
"owner": "R-nvim",
"repo": "R.nvim",
"rev": "382858fcf23aabbf47ff06279baf69d52260b939",
"type": "github"
},
"original": {
"owner": "R-nvim",
"repo": "R.nvim",
"type": "github"
}
},
"rixpkgs": {
"locked": {
"lastModified": 1746476429,
"narHash": "sha256-KHNAOy8ILpIlz5rtwxURpcVOqbWRMoT/rXRgpy1pyG8=",
"type": "tarball",
"url": "https://github.com/rstats-on-nix/nixpkgs/archive/2025-04-29.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/rstats-on-nix/nixpkgs/archive/2025-04-29.tar.gz"
}
},
"rixpkgs_2": {
"locked": {
"lastModified": 1747664360,
"narHash": "sha256-DskCWKtHNGApsP3PI/HB+fETs3qXpwul3PtSgTb++N4=",
"type": "tarball",
"url": "https://github.com/rstats-on-nix/nixpkgs/archive/2025-05-19.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/rstats-on-nix/nixpkgs/archive/2025-05-19.tar.gz"
}
},
"root": {
"inputs": {
"nCats": "nCats",
"nixpkgs": "nixpkgs",
"rixpkgs": "rixpkgs_2"
}
}
},
"root": "root",
"version": 7
}

119
templates/sci/flake.nix Normal file
View file

@ -0,0 +1,119 @@
{
description = "Project Template";
inputs = {
rixpkgs.url = "https://github.com/rstats-on-nix/nixpkgs/archive/2025-05-19.tar.gz";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nCats.url = "github:dwinkler1/nixCatsConfig";
nCats.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
nixpkgs,
nCats,
...
} @ inputs: let
forSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.all;
in {
packages = forSystems (
system: let
inherit (nCats) utils;
finalPackage = nCats.packages.${system}.default.override (prev: {
dependencyOverlays =
prev.dependencyOverlays
++ [
(utils.standardPluginOverlay inputs)
(final: prev: {
rpkgs = inputs.rixpkgs.legacyPackages.${system};
})
(import (builtins.path {
path = ./rpkgs.nix;
name = "my-rpackages";
}))
(import (builtins.path {
path = ./pypkgs.nix;
name = "my-pypackages";
}))
];
categoryDefinitions = utils.mergeCatDefs prev.categoryDefinitions (
{
pkgs,
settings,
categories,
name,
extra,
mkPlugin,
...
} @ packageDef: {
lspsAndRuntimeDeps = {
meta = with pkgs; [
just
wget
gh
];
rdev = with pkgs; [
rWrapper
];
pydev = with pkgs; [
py
uv
pyright
nodejs
];
jldev = with pkgs; [
julia-bin
];
};
environmentVariables = {
rdev = {
R_LIBS_USER = "./.Rlibs";
};
pydev = {
# Prevent uv from managing Python downloads
UV_PYTHON_DOWNLOADS = "never";
# Force uv to use nixpkgs Python interpreter
UV_PYTHON = pkgs.py.interpreter;
};
};
extraWrapperArgs = {
pydev = [
"--unset PYTHONPATH"
];
};
}
);
packageDefinitions =
prev.packageDefinitions
// {
nixCats = utils.mergeCatDefs prev.packageDefinitions.nixCats (
{pkgs, ...}: {
settings = {
suffix-path = false;
suffix-LD = false;
hosts = {
python3.enable = true;
m = {
enable = true;
path = {
value = "${pkgs.uv}/bin/uv";
args = [ "--add-flags" "run marimo edit"];
};
};
};
};
categories = {
meta = true;
rdev = true;
pydev = true;
jldev = true;
};
}
);
};
});
in
utils.mkAllWithDefault finalPackage
);
};
}

9
templates/sci/pypkgs.nix Normal file
View file

@ -0,0 +1,9 @@
final: prev: let
reqPkgs = (pyPackages: with pyPackages;[
pandas
requests
]);
in {
py = prev.python3.withPackages reqPkgs;
}

View file

@ -0,0 +1,16 @@
[project]
name = "sci"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"marimo[recommended]>=0.13.15",
"polars>=1.30.0",
"pytest>=8.3.5",
"python-lsp-ruff>=2.2.2",
"python-lsp-server>=1.12.2",
"vegafusion>=2.0.2",
"vl-convert-python>=1.8.0",
"websockets>=15.0.1",
]

View file

@ -0,0 +1 @@
{ "venvPath": ".", "venv": ".venv" }

34
templates/sci/rpkgs.nix Normal file
View file

@ -0,0 +1,34 @@
final: prev: let
reqPkgs = with prev.rpkgs.rPackages; [
Hmisc
broom
data_table
dplyr
ggplot2
gt
janitor
psych
tidyr
languageserver
(buildRPackage {
name = "nvimcom";
src = prev.rpkgs.fetchFromGitHub {
owner = "R-nvim";
repo = "R.nvim";
rev = "382858fcf23aabbf47ff06279baf69d52260b939";
sha256 = "sha256-j2rXXO7246Nh8U6XyX43nNTbrire9ta9Ono9Yr+Eh9M=";
};
sourceRoot = "source/nvimcom";
buildInputs = with prev.rpkgs; [
R
stdenv.cc.cc
gnumake
];
propagatedBuildInputs = [];
})
];
in {
quarto = prev.rpkgs.quarto.override {extraRPackages = reqPkgs;};
rWrapper = prev.rpkgs.rWrapper.override {packages = reqPkgs;};
radianWrapper = prev.rpkgs.radianWrapper.override {packages = reqPkgs;};
}

View file

View file

View file

1152
templates/sci/uv.lock generated Normal file

File diff suppressed because it is too large Load diff