-
|
🚨anyone copying this be warned: light theme 🔆📸😵💫🚨 I am struggling a bit to define a neovide host in a flake that I want to use as a project template which overrides my main config. I define the following new package where I expect to call packageDefinitions =
prev.packageDefinitions
// {
p = utils.mergeCatDefs prev.packageDefinitions.n (
{
pkgs,
name,
...
}: {
settings = {
suffix-path = false;
suffix-LD = false;
# your alias may not conflict with your other packages.
aliases = ["newvim"];
hosts = {
g = {
enable = true;
path = {
value = "${pkgs.neovide}/bin/neovide";
args = [
"--add-flags"
"--neovim-bin ${name}"
];
};
};
m = {
enable = true;
path = {
value = "${pkgs.uv}/bin/uv";
args = ["--add-flags" "run marimo edit"];
};
};
};
};
categories = {
julia = false;
python = true;
r = true;
project = true;
gitPlugins = true;
};
}
);
};So I recreate the in {
packages = projectConfig; # this is the output of the overrides
devShells = forSystems (system: let
pkgs = import nixpkgs {inherit system;};
in {
default = pkgs.mkShell {
name = defaultPackageName;
packages = [ projectConfig.${system}.default ];
inputsFrom = [];
shellHook = ''
'';
};
});
};Is this the correct way to do it or am I missing something? Full config for completeness: {
description = "New Project";
inputs = {
rixpkgs.url = "https://github.com/rstats-on-nix/nixpkgs/archive/2025-08-11.tar.gz";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixCats.url = "github:dwinkler1/nixCatsConfig";
nixCats.inputs.nixpkgs.follows = "nixpkgs";
## All git packages managed per project
"plugins-r" = {
url = "github:R-nvim/R.nvim";
flake = false;
};
"plugins-cmp-r" = {
url = "github:R-nvim/cmp-r";
flake = false;
};
"plugins-cmp-pandoc-references" = {
url = "github:jmbuhr/cmp-pandoc-references";
flake = false;
};
};
outputs = {
self,
nixpkgs,
nixCats,
...
} @ inputs: let
forSystems = nixpkgs.lib.genAttrs nixpkgs.lib.platforms.all;
defaultPackageName = "p";
projectConfig = forSystems (
system: let
inherit (nixCats) utils;
inherit defaultPackageName;
prevPackage = nixCats.packages.${system}.default;
finalPackage = prevPackage.override (prev: {
name = "p";
dependencyOverlays =
prev.dependencyOverlays
++ [
(utils.standardPluginOverlay inputs)
## Pull in local rix copy
(final: prev: {
rpkgs = inputs.rixpkgs.legacyPackages.${prev.system};
})
## Define project level R packages
(
final: prev: let
reqPkgs = with prev.rpkgs.rPackages; [
Hmisc
Rcpp
arm
broom
car
data_table
devtools
janitor
konfound
languageserver
quarto
reprex
styler
tidyverse
(buildRPackage {
name = "nvimcom";
src = inputs.plugins-r;
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;};
}
)
## Define project level Python Packages
(
final: prev: let
reqPkgs = pyPackages:
with pyPackages; [
ipython
numpy
optuna
polars
requests
scikit-learn
statsmodels
xgboost
];
in {
python = prev.python3.withPackages reqPkgs;
}
)
];
categoryDefinitions = utils.mergeCatDefs prev.categoryDefinitions (
{
pkgs,
settings,
categories,
name,
extra,
mkPlugin,
...
} @ packageDef: {
lspsAndRuntimeDeps = {
project = with pkgs; [
];
julia = with pkgs; [
julia-bin
];
python = with pkgs; [
python
nodejs
pyright
uv
];
r = with pkgs; [
rWrapper
radianWrapper
quarto
air-formatter
];
};
startupPlugins = {
project = with pkgs.vimPlugins; [
];
gitPlugins = with pkgs.neovimPlugins; [
{
plugin = r;
config.lua = "vim.notify('Using project local R plugin')";
}
];
};
optionalPlugins = {
project = with pkgs.vimPlugins; [
];
gitPlugins = with pkgs.neovimPlugins; [
cmp-r
cmp-pandoc-references
];
};
optionalLuaPreInit = {
project = [];
};
optionalLuaAdditions = {
project = [
"vim.notify('Project loaded: ${name}')"
];
};
sharedLibraries = {
project = {
};
};
environmentVariables = {
project = {
};
r = {
R_LIBS_USER = "./.Rlibs";
};
python = {
# Prevent uv from managing Python downloads
UV_PYTHON_DOWNLOADS = "never";
# Force uv to use nixpkgs Python interpreter
UV_PYTHON = pkgs.python.interpreter;
};
};
extraWrapperArgs = {
python = [
"--unset PYTHONPATH"
];
};
}
);
packageDefinitions =
prev.packageDefinitions
// {
p = utils.mergeCatDefs prev.packageDefinitions.n (
{
pkgs,
name,
...
}: {
settings = {
suffix-path = false;
suffix-LD = false;
# your alias may not conflict with your other packages.
aliases = ["newvim"];
hosts = {
g = {
enable = true;
path = {
value = "${pkgs.neovide}/bin/neovide";
args = [
"--add-flags"
"--neovim-bin ${name}"
];
};
};
m = {
enable = true;
path = {
value = "${pkgs.uv}/bin/uv";
args = ["--add-flags" "run marimo edit"];
};
};
};
};
categories = {
julia = false;
python = true;
r = true;
project = true;
gitPlugins = true;
};
}
);
};
});
in
utils.mkAllWithDefault finalPackage
);
in {
packages = projectConfig;
devShells = forSystems (system: let
pkgs = import nixpkgs {inherit system;};
in {
default = pkgs.mkShell {
name = defaultPackageName;
packages = [ projectConfig.${system}.default ];
inputsFrom = [];
shellHook = ''
'';
};
});
};
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
|
I'm not sure. It looks correct, and I just copy pasted that whole thing into a flake.nix file with no changes and it builds and gets added to path in the shell (I got flashbanged tho by the light mode) So, I'm not super sure what would be breaking it on your system? Especially if it builds fine with nix build? Make sure you don't have something you are doing which starts a subshell which doesn't get the environment of the dev shell? |
Beta Was this translation helpful? Give feedback.
I'm not sure.
It looks correct, and I just copy pasted that whole thing into a flake.nix file with no changes and it builds and gets added to path in the shell (I got flashbanged tho by the light mode)
So, I'm not super sure what would be breaking it on your system? Especially if it builds fine with nix build? Make sure you don't have something you are doing which starts a subshell which doesn't get the environment of the dev shell?