Shelffiles is a portable environment configuration system that uses Nix to manage packages and configuration files. It's designed to be easy to set up and use across different systems.
- Nix package manager with flakes enabled
-
Clone the repository:
git clone https://github.com/yourusername/shelffiles.git cd shelffiles -
Build the environment:
nix build
-
Enter the environment:
# Use the shell-specific entrypoint ./entrypoint/zsh # For zsh ./entrypoint/fish # For fish ./entrypoint/bash # For bash
-
Copy the example package configuration to the repository root:
cp example/packages.nix packages.nix
-
Edit
packages.nixto add or remove packages:pkgs: with pkgs; [ # Core utilities git # Version control system ripgrep # Fast text search tool fzf # Command-line fuzzy finder # Uncomment or add packages you need # zsh # Z Shell # neovim # Vim-based text editor # nodejs # Node.js runtime ]
-
Rebuild the environment:
nix build
Note: You must create
packages.nixbefore runningnix build. Copy fromexample/packages.nixand customize it. You can track yourpackages.nixin your own fork without causing merge conflicts when pulling upstream changes.
To add your own configuration files:
-
Create the appropriate directory structure in the repository:
mkdir -p config/app-name
-
Add your configuration files to this directory:
# Example: Adding a Neovim configuration mkdir -p config/nvim touch config/nvim/init.lua # Example: Adding a Git configuration mkdir -p config/git touch config/git/config
-
Edit the configuration files with your preferred settings:
# Example: Basic Neovim configuration echo 'vim.opt.number = true' > config/nvim/init.lua # Example: Basic Git configuration cat > config/git/config << EOF [user] name = Your Name email = your.email@example.com [core] editor = vim EOF
When you enter the environment using the shell-specific entrypoint scripts (./entrypoint/bash, ./entrypoint/zsh, or ./entrypoint/fish), these configuration files will be used automatically because the script sets the appropriate XDG environment variables to point to the directories within the repository.
To find available packages that you can add to your configuration:
-
Search on the Nixpkgs website:
- Visit search.nixos.org to search for packages
- The package name shown in the search results is what you should add to your
packages.nixfile
-
Search using the command line:
nix search nixpkgs package-name
-
Browse the Nixpkgs repository:
- Visit the Nixpkgs GitHub repository to explore available packages
- Packages are organized by category in the
pkgsdirectory
shelffiles/
├── config/ # Configuration files
│ └── nix/ # Nix-related configuration
├── cache/ # XDG_CACHE_HOME
├── share/ # XDG_DATA_HOME
├── state/ # XDG_STATE_HOME
├── example/
│ └── packages.nix # Example package definitions (template)
├── packages.nix # User package definitions (copy from example/)
├── entrypoint/ # Shell-specific entrypoint scripts
│ ├── bash # Bash entrypoint
│ ├── fish # Fish entrypoint
│ └── zsh # Zsh entrypoint
├── user_env.sh # User-specific environment settings (git-ignored)
└── flake.nix # Nix flake configuration
To run tests for a specific shell:
# Test with zsh
./test/test.sh zsh
# Test with fish
./test/test.sh fish
# Test with bash
./test/test.sh bashShelffiles works by:
- Setting XDG environment variables to point to directories within the repository
- Using Nix flakes to manage packages in a reproducible way
- Providing a consistent environment across different systems
- Using a central package configuration file for easy customization
The example/git directory contains Git filter settings for devcontainer.json files. This filter automatically excludes lines containing "shelffiles" when committing.
This allows you to add shelffiles-specific settings to your devcontainer.json for your local environment without sharing them in the repository.
To use this feature, copy the files in example/git to your Git configuration directory or reference them in your Git settings.
Here's an example of how you might customize your devcontainer.json with shelffiles-specific settings:
{
"name": "My Development Container",
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
// Standard settings (shared with everyone)
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-vscode.cpptools"
]
}
},
// Shelffiles-specific settings (will be filtered out when committing)
"mounts": [
"source=${localWorkspaceFolder}/shelffiles,target=/home/vscode/shelffiles,type=bind"
]
}