NixOS Configuration #151
Replies: 6 comments 3 replies
-
|
hi @guttermonk, great idea im confident this is solvable, since there are other nixOS users using it fine: perhaps @CG-GeisT could chime in? 👀 |
Beta Was this translation helpful? Give feedback.
-
|
I gave cursor access to my codebase, and here's what it said and some solutions: ExplanationYazelix + Home-Manager Integration SolutionThe ProblemThe error you're encountering: Occurs because Yazelix expects to write to its own configuration directory for several operations:
However, your current home-manager configuration makes the entire ".config/yazelix".source = pkgs.stdenv.mkDerivation { ... };SolutionsSolution 1: Modify Your Current Home-Manager Config (Quick Fix)Replace your current configuration with this: { pkgs, ... }: {
home.file = {
# Only manage individual files, not the entire directory
".config/yazelix/yazelix_default.nix".source = pkgs.fetchFromGitHub {
owner = "luccahuguet";
repo = "yazelix";
rev = "0192328ea8ccabd6035cb91426c870d1bc057914";
hash = "sha256-021nmyuENYPqW3PbIZaoBZ897xf/ZAcF6dLJ8kB6YoE=";
} + "/yazelix_default.nix";
".config/yazelix/zellij/config.kdl".source = pkgs.stdenv.mkDerivation {
name = "yazelix-zellij-config";
src = pkgs.fetchFromGitHub {
owner = "luccahuguet";
repo = "yazelix";
rev = "0192328ea8ccabd6035cb91426c870d1bc057914";
hash = "sha256-021nmyuENYPqW3PbIZaoBZ897xf/ZAcF6dLJ8kB6YoE=";
};
installPhase = ''
mkdir -p $out
cp zellij/config.kdl $out/
# Add your custom config.kdl here if needed
# cp ${./apps/yazelix/config.kdl} $out/
'';
} + "/config.kdl";
};
# Create writable directories that Yazelix needs
home.activation = {
setupYazelix = lib.hm.dag.entryAfter ["writeBoundary"] ''
$DRY_RUN_CMD mkdir -p $VERBOSE_ARG $HOME/.config/yazelix/logs
$DRY_RUN_CMD mkdir -p $VERBOSE_ARG $HOME/.config/yazelix/bash/initializers
$DRY_RUN_CMD mkdir -p $VERBOSE_ARG $HOME/.config/yazelix/nushell/initializers
$DRY_RUN_CMD mkdir -p $VERBOSE_ARG $HOME/.config/yazelix/fish/initializers
$DRY_RUN_CMD mkdir -p $VERBOSE_ARG $HOME/.config/yazelix/zsh/initializers
# Copy yazelix_default.nix to yazelix.nix if it doesn't exist
if [ ! -f "$HOME/.config/yazelix/yazelix.nix" ]; then
$DRY_RUN_CMD cp $VERBOSE_ARG $HOME/.config/yazelix/yazelix_default.nix $HOME/.config/yazelix/yazelix.nix
fi
'';
};
}Solution 2: Use the Home-Manager Module (Recommended)Create a proper home-manager module for Yazelix. Add this to your home-manager configuration: { config, lib, pkgs, ... }:
let
yazelixSrc = pkgs.fetchFromGitHub {
owner = "luccahuguet";
repo = "yazelix";
rev = "0192328ea8ccabd6035cb91426c870d1bc057914";
hash = "sha256-021nmyuENYPqW3PbIZaoBZ897xf/ZAcF6dLJ8kB6YoE=";
};
in {
# Create writable directories
home.activation = {
createYazelixDirs = lib.hm.dag.entryAfter ["writeBoundary"] ''
$DRY_RUN_CMD mkdir -p $VERBOSE_ARG $HOME/.config/yazelix/logs
$DRY_RUN_CMD mkdir -p $VERBOSE_ARG $HOME/.config/yazelix/bash/initializers
$DRY_RUN_CMD mkdir -p $VERBOSE_ARG $HOME/.config/yazelix/nushell/initializers
$DRY_RUN_CMD mkdir -p $VERBOSE_ARG $HOME/.config/yazelix/fish/initializers
$DRY_RUN_CMD mkdir -p $VERBOSE_ARG $HOME/.config/yazelix/zsh/initializers
'';
setupYazelixConfig = lib.hm.dag.entryAfter ["createYazelixDirs"] ''
if [ ! -f "$HOME/.config/yazelix/yazelix.nix" ]; then
$DRY_RUN_CMD cp $VERBOSE_ARG $HOME/.config/yazelix/yazelix_default.nix $HOME/.config/yazelix/yazelix.nix
fi
'';
};
# Manage individual files
home.file = {
".config/yazelix/yazelix_default.nix".source = "${yazelixSrc}/yazelix_default.nix";
".config/yazelix/zellij/config.kdl".source = "${yazelixSrc}/zellij/config.kdl";
".config/yazelix/zellij/layouts/yazelix.kdl".source = "${yazelixSrc}/zellij/layouts/yazelix.kdl";
".config/yazelix/yazi/yazi.toml".source = "${yazelixSrc}/yazi/yazi.toml";
".config/yazelix/flake.nix".source = "${yazelixSrc}/flake.nix";
".config/yazelix/flake.lock".source = "${yazelixSrc}/flake.lock";
};
}Solution 3: Don't Use Home-Manager for Yazelix (Simplest)The simplest solution is to not manage Yazelix with home-manager at all:
# Clone Yazelix manually
git clone https://github.com/luccahuguet/yazelix ~/.config/yazelix
# Use it as a Nix flake
cd ~/.config/yazelix
nix develop --impureWhy This HappensYazelix is designed as a self-contained Nix flake that manages its own environment. It expects to:
Home-manager's read-only file management conflicts with this design. RecommendationI recommend Solution 2 (the home-manager module approach) because it:
Testing Your FixAfter applying any solution:
Future ConsiderationsYou might want to discuss with Lucca (the Yazelix maintainer) about:
The core issue is that Yazelix wasn't designed with home-manager in mind, but these solutions bridge that gap effectively. |
Beta Was this translation helpful? Give feedback.
-
|
ok, here is a plan for yazelix Implementation Priority
|
Beta Was this translation helpful? Give feedback.
-
|
we can follow it here: |
Beta Was this translation helpful? Give feedback.
-
|
hi @guttermonk, there has been a development: #74 (comment) |
Beta Was this translation helpful? Give feedback.
-
|
I think this project is very cool, but one of the benefits of using nix is that you don't pollute your home directory with mutable .config files and moves away from hardcoded links. In this regard, this project seems like a step backwards as it requires you to clone the repo to your home directory, which seems like more work than just fully embracing nix integration and creating a home manager module that actually installs everything for you. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Yazelix used to work fine, but I used zide for a while until a yazi update introduced a bug in zide. Now I'm trying to switch back to Yazelix, but I'm getting the following error when opening a file in Helix (which I don't get in yazi):
Here's my home-manager config:
I know Lucca, the repo owner, isn't a nixos user. So I wanted to start a discussion. Any suggestions?
Beta Was this translation helpful? Give feedback.
All reactions