first
This commit is contained in:
36
.gitignore
vendored
Normal file
36
.gitignore
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# Nix build outputs
|
||||||
|
result
|
||||||
|
result-*
|
||||||
|
|
||||||
|
# Direnv
|
||||||
|
.direnv/
|
||||||
|
.envrc
|
||||||
|
|
||||||
|
# Development shells
|
||||||
|
shell.nix
|
||||||
|
|
||||||
|
# Editor files
|
||||||
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*~
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Nix-specific
|
||||||
|
.pre-commit-config.yaml
|
||||||
|
.envrc.local
|
||||||
|
|
||||||
|
# Temporary files
|
||||||
|
*.tmp
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Testing
|
||||||
|
test-result/
|
||||||
|
|
||||||
|
# Local configuration (if you want to keep local overrides)
|
||||||
|
local.nix
|
||||||
|
flake.lock.bak
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
docs/
|
450
CONTRIBUTING.md
Normal file
450
CONTRIBUTING.md
Normal file
@@ -0,0 +1,450 @@
|
|||||||
|
# Contributing to m3ta-nixpkgs
|
||||||
|
|
||||||
|
Thank you for your interest in contributing to m3ta-nixpkgs! This guide will help you get started with adding packages, modules, and improvements to this repository.
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
|
||||||
|
- [Getting Started](#getting-started)
|
||||||
|
- [Adding a New Package](#adding-a-new-package)
|
||||||
|
- [Adding a NixOS Module](#adding-a-nixos-module)
|
||||||
|
- [Adding a Home Manager Module](#adding-a-home-manager-module)
|
||||||
|
- [Code Style Guidelines](#code-style-guidelines)
|
||||||
|
- [Testing Your Changes](#testing-your-changes)
|
||||||
|
- [Submitting Changes](#submitting-changes)
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
- Nix with flakes enabled
|
||||||
|
- Git
|
||||||
|
- Basic understanding of Nix expressions
|
||||||
|
|
||||||
|
### Enable Flakes
|
||||||
|
|
||||||
|
Add to `~/.config/nix/nix.conf` or `/etc/nix/nix.conf`:
|
||||||
|
|
||||||
|
```
|
||||||
|
experimental-features = nix-command flakes
|
||||||
|
```
|
||||||
|
|
||||||
|
### Clone and Setup
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://code.m3ta.dev/m3tam3re/nixpkgs
|
||||||
|
cd m3ta-nixpkgs
|
||||||
|
nix develop # Enter development environment
|
||||||
|
```
|
||||||
|
|
||||||
|
## Adding a New Package
|
||||||
|
|
||||||
|
### Step 1: Create Package Directory
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir pkgs/my-package
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 2: Write the Package Expression
|
||||||
|
|
||||||
|
Create `pkgs/my-package/default.nix` using the template:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp templates/package/default.nix pkgs/my-package/default.nix
|
||||||
|
```
|
||||||
|
|
||||||
|
Edit the file to match your package:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
fetchFromGitHub,
|
||||||
|
}:
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "my-package";
|
||||||
|
version = "1.0.0";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "owner";
|
||||||
|
repo = "repo";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = lib.fakeHash; # Use this initially
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "A short description";
|
||||||
|
homepage = "https://github.com/owner/repo";
|
||||||
|
license = licenses.mit;
|
||||||
|
platforms = platforms.linux;
|
||||||
|
mainProgram = "my-package";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 3: Get the Correct Hash
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix build .#my-package
|
||||||
|
# The error message will show the correct hash
|
||||||
|
# Replace lib.fakeHash with the actual hash
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 4: Register the Package
|
||||||
|
|
||||||
|
Add to `pkgs/default.nix`:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{pkgs, ...}: {
|
||||||
|
# ... existing packages ...
|
||||||
|
my-package = pkgs.callPackage ./my-package {};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 5: Test the Package
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build the package
|
||||||
|
nix build .#my-package
|
||||||
|
|
||||||
|
# Run the package
|
||||||
|
nix run .#my-package
|
||||||
|
|
||||||
|
# Check if it works
|
||||||
|
./result/bin/my-package --version
|
||||||
|
```
|
||||||
|
|
||||||
|
## Adding a NixOS Module
|
||||||
|
|
||||||
|
### Step 1: Create Module File
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp templates/nixos-module/default.nix modules/nixos/my-module.nix
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 2: Implement the Module
|
||||||
|
|
||||||
|
Edit `modules/nixos/my-module.nix`:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.m3ta.myModule;
|
||||||
|
in {
|
||||||
|
options.m3ta.myModule = {
|
||||||
|
enable = mkEnableOption "my custom module";
|
||||||
|
# Add your options here
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# Add your configuration here
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 3: Register the Module
|
||||||
|
|
||||||
|
Add to `modules/nixos/default.nix`:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
imports = [
|
||||||
|
./my-module.nix # Add this line
|
||||||
|
];
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 4: Test the Module
|
||||||
|
|
||||||
|
Create a test configuration or add to your existing NixOS configuration:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
inputs.m3ta-nixpkgs.url = "path:/path/to/m3ta-nixpkgs";
|
||||||
|
|
||||||
|
outputs = {nixpkgs, m3ta-nixpkgs, ...}: {
|
||||||
|
nixosConfigurations.test = nixpkgs.lib.nixosSystem {
|
||||||
|
modules = [
|
||||||
|
m3ta-nixpkgs.nixosModules.default
|
||||||
|
{
|
||||||
|
m3ta.myModule.enable = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Adding a Home Manager Module
|
||||||
|
|
||||||
|
### Step 1: Create Module File
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp templates/home-manager-module/default.nix modules/home-manager/my-module.nix
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 2: Implement the Module
|
||||||
|
|
||||||
|
Edit `modules/home-manager/my-module.nix`:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.programs.myProgram;
|
||||||
|
in {
|
||||||
|
options.programs.myProgram = {
|
||||||
|
enable = mkEnableOption "my program";
|
||||||
|
# Add your options here
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# Add your configuration here
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 3: Register the Module
|
||||||
|
|
||||||
|
Add to `modules/home-manager/default.nix`:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
# ... existing modules ...
|
||||||
|
myModule = import ./my-module.nix;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 4: Test the Module
|
||||||
|
|
||||||
|
Test with Home Manager:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
inputs.m3ta-nixpkgs.url = "path:/path/to/m3ta-nixpkgs";
|
||||||
|
|
||||||
|
outputs = {home-manager, m3ta-nixpkgs, ...}: {
|
||||||
|
homeConfigurations.test = home-manager.lib.homeManagerConfiguration {
|
||||||
|
modules = [
|
||||||
|
m3ta-nixpkgs.homeManagerModules.default
|
||||||
|
{
|
||||||
|
programs.myProgram.enable = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Code Style Guidelines
|
||||||
|
|
||||||
|
### Nix Code Style
|
||||||
|
|
||||||
|
1. **Formatting**: Use `nixpkgs-fmt` for consistent formatting
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix fmt
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Naming Conventions**:
|
||||||
|
- Package names: lowercase with hyphens (`my-package`)
|
||||||
|
- Module options: camelCase (`myModule`)
|
||||||
|
- Variables: camelCase (`cfg`, `myVar`)
|
||||||
|
|
||||||
|
3. **File Structure**:
|
||||||
|
- One package per directory
|
||||||
|
- Use `default.nix` for the main expression
|
||||||
|
- Keep related files together
|
||||||
|
|
||||||
|
4. **Comments**:
|
||||||
|
- Add comments for non-obvious code
|
||||||
|
- Document complex expressions
|
||||||
|
- Explain why, not what
|
||||||
|
|
||||||
|
### Example Good Practice
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
fetchFromGitHub,
|
||||||
|
# Group related dependencies
|
||||||
|
# Build tools
|
||||||
|
cmake,
|
||||||
|
pkg-config,
|
||||||
|
# Libraries
|
||||||
|
openssl,
|
||||||
|
zlib,
|
||||||
|
}:
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "example";
|
||||||
|
version = "1.0.0";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "example";
|
||||||
|
repo = pname;
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-...";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
cmake
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
openssl
|
||||||
|
zlib
|
||||||
|
];
|
||||||
|
|
||||||
|
# Explain non-obvious configuration
|
||||||
|
cmakeFlags = [
|
||||||
|
"-DENABLE_FEATURE=ON" # Required for proper functionality
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Clear, concise description";
|
||||||
|
homepage = "https://example.com";
|
||||||
|
license = licenses.mit;
|
||||||
|
maintainers = with maintainers; [];
|
||||||
|
platforms = platforms.linux;
|
||||||
|
mainProgram = "example";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Testing Your Changes
|
||||||
|
|
||||||
|
### 1. Check Flake Validity
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix flake check
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Build All Packages
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix flake show # See all outputs
|
||||||
|
nix build .#package-name
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Test in a Clean Environment
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build without any cached results
|
||||||
|
nix build .#package-name --rebuild
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Test Module Integration
|
||||||
|
|
||||||
|
Test modules in a VM:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nixos-rebuild build-vm --flake .#test-config
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. Verify Metadata
|
||||||
|
|
||||||
|
Check that package metadata is complete:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix eval .#packages.x86_64-linux.my-package.meta --json | jq
|
||||||
|
```
|
||||||
|
|
||||||
|
## Submitting Changes
|
||||||
|
|
||||||
|
### Before Submitting
|
||||||
|
|
||||||
|
- [ ] Code follows style guidelines
|
||||||
|
- [ ] Package builds successfully
|
||||||
|
- [ ] Tests pass (if applicable)
|
||||||
|
- [ ] Documentation is updated
|
||||||
|
- [ ] Commit messages are clear and descriptive
|
||||||
|
|
||||||
|
- [ ] CI workflows pass (check GitHub Actions)
|
||||||
|
|
||||||
|
### Commit Message Format
|
||||||
|
|
||||||
|
```
|
||||||
|
type: brief description
|
||||||
|
|
||||||
|
Longer explanation if needed.
|
||||||
|
|
||||||
|
- Detail 1
|
||||||
|
- Detail 2
|
||||||
|
```
|
||||||
|
|
||||||
|
Types:
|
||||||
|
|
||||||
|
- `feat`: New feature (package, module)
|
||||||
|
- `fix`: Bug fix
|
||||||
|
- `docs`: Documentation changes
|
||||||
|
- `style`: Code style changes
|
||||||
|
- `refactor`: Code refactoring
|
||||||
|
- `chore`: Maintenance tasks
|
||||||
|
|
||||||
|
### Examples
|
||||||
|
|
||||||
|
```
|
||||||
|
feat: add hyprpaper-random package
|
||||||
|
|
||||||
|
Add a random wallpaper selector for Hyprpaper.
|
||||||
|
Includes systemd timer integration.
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
fix: correct msty-studio dependencies
|
||||||
|
|
||||||
|
Add missing libGL dependency that caused runtime errors.
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
docs: update README with usage instructions
|
||||||
|
|
||||||
|
Add detailed instructions for using packages and modules.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Best Practices
|
||||||
|
|
||||||
|
### Security
|
||||||
|
|
||||||
|
- Never include API keys, passwords, or secrets
|
||||||
|
- Use `lib.fakeHash` initially, then update with correct hash
|
||||||
|
- Review dependencies for known vulnerabilities
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
- Use `callPackage` for better caching
|
||||||
|
- Avoid unnecessary `import` statements
|
||||||
|
- Use overlays efficiently
|
||||||
|
|
||||||
|
### Maintainability
|
||||||
|
|
||||||
|
- Keep packages focused and simple
|
||||||
|
- Document complex logic
|
||||||
|
- Follow nixpkgs conventions
|
||||||
|
- Update regularly
|
||||||
|
|
||||||
|
## Getting Help
|
||||||
|
|
||||||
|
- Check [Nix Pills](https://nixos.org/guides/nix-pills/)
|
||||||
|
- Read [Nixpkgs Manual](https://nixos.org/manual/nixpkgs/stable/)
|
||||||
|
- Ask in [NixOS Discourse](https://discourse.nixos.org/)
|
||||||
|
- Join [NixOS Matrix](https://matrix.to/#/#nix:nixos.org)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
By contributing, you agree that your contributions will be licensed under the same license as the project.
|
240
QUICKSTART.md
Normal file
240
QUICKSTART.md
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
# Quick Start Guide
|
||||||
|
|
||||||
|
Get started with m3ta-nixpkgs in 5 minutes! This guide covers the most common use cases.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
Ensure Nix flakes are enabled:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Add to ~/.config/nix/nix.conf or /etc/nix/nix.conf
|
||||||
|
mkdir -p ~/.config/nix
|
||||||
|
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
|
||||||
|
```
|
||||||
|
|
||||||
|
## Quick Usage
|
||||||
|
|
||||||
|
### 1. Try a Package Without Installing
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Run a package directly
|
||||||
|
nix run git+https://code.m3ta.dev/m3tam3re/nixpkgs#code2prompt
|
||||||
|
|
||||||
|
# Try it in a temporary shell
|
||||||
|
nix shell git+https://code.m3ta.dev/m3tam3re/nixpkgs#zellij-ps
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Install to Your Profile
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install a package
|
||||||
|
nix profile install git+https://code.m3ta.dev/m3tam3re/nixpkgs#msty-studio
|
||||||
|
|
||||||
|
# List installed packages
|
||||||
|
nix profile list
|
||||||
|
|
||||||
|
# Remove a package
|
||||||
|
nix profile remove <index>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Add to Your NixOS Configuration
|
||||||
|
|
||||||
|
Edit your `flake.nix`:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
m3ta-nixpkgs.url = "git+https://code.m3ta.dev/m3tam3re/nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {nixpkgs, m3ta-nixpkgs, ...}: {
|
||||||
|
nixosConfigurations.yourhostname = nixpkgs.lib.nixosSystem {
|
||||||
|
modules = [
|
||||||
|
{
|
||||||
|
nixpkgs.overlays = [m3ta-nixpkgs.overlays.default];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
code2prompt
|
||||||
|
hyprpaper-random
|
||||||
|
zellij-ps
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Then rebuild:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo nixos-rebuild switch --flake .#yourhostname
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Add to Home Manager (Standalone)
|
||||||
|
|
||||||
|
Edit your Home Manager `flake.nix`:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
home-manager.url = "github:nix-community/home-manager";
|
||||||
|
m3ta-nixpkgs.url = "git+https://code.m3ta.dev/m3tam3re/nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {nixpkgs, home-manager, m3ta-nixpkgs, ...}: {
|
||||||
|
homeConfigurations.m3tam3re = home-manager.lib.homeManagerConfiguration {
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
overlays = [m3ta-nixpkgs.overlays.default];
|
||||||
|
};
|
||||||
|
|
||||||
|
modules = [
|
||||||
|
{
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
code2prompt
|
||||||
|
pomodoro-timer
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Then activate:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
home-manager switch --flake .#m3tam3re
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. Use During Development (Local Path)
|
||||||
|
|
||||||
|
When working on your system configuration:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
# Use local path during development
|
||||||
|
m3ta-nixpkgs.url = "path:/home/you/projects/m3ta-nixpkgs";
|
||||||
|
# Or use git+file for uncommitted changes
|
||||||
|
# m3ta-nixpkgs.url = "git+file:///home/you/projects/m3ta-nixpkgs";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Available Packages
|
||||||
|
|
||||||
|
| Package | Description | Command |
|
||||||
|
| ------------------ | ------------------------------- | ---------------------------- |
|
||||||
|
| `code2prompt` | Convert code to LLM prompts | `nix run .#code2prompt` |
|
||||||
|
| `hyprpaper-random` | Random wallpaper for Hyprpaper | `nix run .#hyprpaper-random` |
|
||||||
|
| `launch-webapp` | Launch web applications | `nix run .#launch-webapp` |
|
||||||
|
| `msty-studio` | Msty Studio application | `nix run .#msty-studio` |
|
||||||
|
| `pomodoro-timer` | Pomodoro timer utility | `nix run .#pomodoro-timer` |
|
||||||
|
| `tuxedo-backlight` | Tuxedo laptop backlight control | `nix run .#tuxedo-backlight` |
|
||||||
|
| `zellij-ps` | Process viewer for Zellij | `nix run .#zellij-ps` |
|
||||||
|
|
||||||
|
## Common Commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Show all available packages
|
||||||
|
nix flake show git+https://code.m3ta.dev/m3tam3re/nixpkgs
|
||||||
|
|
||||||
|
# Update the flake lock file
|
||||||
|
nix flake update
|
||||||
|
|
||||||
|
# Build a specific package
|
||||||
|
nix build git+https://code.m3ta.dev/m3tam3re/nixpkgs#code2prompt
|
||||||
|
|
||||||
|
# Check flake validity
|
||||||
|
nix flake check git+https://code.m3ta.dev/m3tam3re/nixpkgs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development Workflow
|
||||||
|
|
||||||
|
### Adding Your Own Package
|
||||||
|
|
||||||
|
1. **Clone the repo:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://code.m3ta.dev/m3tam3re/nixpkgs
|
||||||
|
cd m3ta-nixpkgs
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Create package directory:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir pkgs/my-package
|
||||||
|
cp templates/package/default.nix pkgs/my-package/
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Edit `pkgs/my-package/default.nix`** with your package details
|
||||||
|
|
||||||
|
4. **Register in `pkgs/default.nix`:**
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{pkgs, ...}: {
|
||||||
|
# ... existing packages ...
|
||||||
|
my-package = pkgs.callPackage ./my-package {};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
5. **Test it:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git add -A # Nix flakes require git tracking
|
||||||
|
nix build .#my-package
|
||||||
|
```
|
||||||
|
|
||||||
|
6. **Commit and push:**
|
||||||
|
```bash
|
||||||
|
git commit -m "feat: add my-package"
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Issue: "experimental-features" error
|
||||||
|
|
||||||
|
**Solution:** Enable flakes in nix.conf (see Prerequisites)
|
||||||
|
|
||||||
|
### Issue: "path is not tracked by Git"
|
||||||
|
|
||||||
|
**Solution:** `git add` your files before running Nix commands
|
||||||
|
|
||||||
|
### Issue: Package fails to build
|
||||||
|
|
||||||
|
**Solution:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Check build logs
|
||||||
|
nix build .#package-name --show-trace
|
||||||
|
|
||||||
|
# Try with fresh build
|
||||||
|
nix build .#package-name --rebuild
|
||||||
|
```
|
||||||
|
|
||||||
|
### Issue: Hash mismatch
|
||||||
|
|
||||||
|
**Solution:** Use `lib.fakeHash` first, then replace with the correct hash from the error message
|
||||||
|
|
||||||
|
## Next Steps
|
||||||
|
|
||||||
|
- 📖 Read the full [README.md](README.md) for detailed documentation
|
||||||
|
- 🤝 Check [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines
|
||||||
|
- 💡 Browse [examples/](examples/) for more configuration examples
|
||||||
|
- 🔍 Explore the [templates/](templates/) for creating new packages and modules
|
||||||
|
|
||||||
|
## Getting Help
|
||||||
|
|
||||||
|
- 💬 [NixOS Discourse](https://discourse.nixos.org/)
|
||||||
|
- 💭 [NixOS Matrix Chat](https://matrix.to/#/#nix:nixos.org)
|
||||||
|
- 📚 [Nix Pills](https://nixos.org/guides/nix-pills/)
|
||||||
|
- 📖 [Nixpkgs Manual](https://nixos.org/manual/nixpkgs/stable/)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Ready to contribute?** See [CONTRIBUTING.md](CONTRIBUTING.md) to get started!
|
254
README.md
Normal file
254
README.md
Normal file
@@ -0,0 +1,254 @@
|
|||||||
|
# m3ta-nixpkgs
|
||||||
|
|
||||||
|
My personal Nix repository containing custom packages, overlays, NixOS modules, and Home Manager modules.
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- 🎁 **Custom Packages**: Collection of personal Nix packages
|
||||||
|
- 🔄 **Overlays**: Package modifications and enhancements
|
||||||
|
- ⚙️ **NixOS Modules**: System-level configuration modules
|
||||||
|
- 🏠 **Home Manager Modules**: User-level configuration modules
|
||||||
|
- ❄️ **Flakes Only**: Modern Nix flakes support (no channels)
|
||||||
|
|
||||||
|
## Repository Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
m3ta-nixpkgs/
|
||||||
|
├── flake.nix # Main flake configuration
|
||||||
|
├── pkgs/ # Custom packages
|
||||||
|
│ ├── default.nix # Package registry
|
||||||
|
│ ├── code2prompt/
|
||||||
|
│ ├── hyprpaper-random/
|
||||||
|
│ ├── launch-webapp/
|
||||||
|
│ ├── msty-studio/
|
||||||
|
│ ├── pomodoro-timer/
|
||||||
|
│ ├── tuxedo-backlight/
|
||||||
|
│ └── zellij-ps/
|
||||||
|
├── overlays/ # Overlays
|
||||||
|
│ ├── default.nix
|
||||||
|
│ └── mods/ # Package modifications
|
||||||
|
│ ├── default.nix
|
||||||
|
│ └── n8n.nix
|
||||||
|
├── modules/
|
||||||
|
│ ├── nixos/ # NixOS modules
|
||||||
|
│ │ └── default.nix
|
||||||
|
│ └── home-manager/ # Home Manager modules
|
||||||
|
│ ├── default.nix
|
||||||
|
│ └── zellij-ps.nix
|
||||||
|
└── templates/ # Templates for new packages/modules
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Adding to Your Flake
|
||||||
|
|
||||||
|
Add this repository to your flake inputs:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
m3ta-nixpkgs.url = "git+https://code.m3ta.dev/m3tam3re/nixpkgs";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using Packages in NixOS Configuration
|
||||||
|
|
||||||
|
#### Method 1: Using the Overlay
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
inputs.m3ta-nixpkgs.overlays.default
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
code2prompt
|
||||||
|
hyprpaper-random
|
||||||
|
msty-studio
|
||||||
|
# ... any other custom packages
|
||||||
|
];
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Method 2: Direct Package Reference
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
environment.systemPackages = [
|
||||||
|
inputs.m3ta-nixpkgs.packages.${system}.code2prompt
|
||||||
|
inputs.m3ta-nixpkgs.packages.${system}.hyprpaper-random
|
||||||
|
];
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using in Home Manager
|
||||||
|
|
||||||
|
#### With Overlay
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
inputs.m3ta-nixpkgs.overlays.default
|
||||||
|
];
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
zellij-ps
|
||||||
|
pomodoro-timer
|
||||||
|
];
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### With Home Manager Modules
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
inputs.m3ta-nixpkgs.homeManagerModules.default
|
||||||
|
# Or specific modules:
|
||||||
|
# inputs.m3ta-nixpkgs.homeManagerModules.zellij-ps
|
||||||
|
];
|
||||||
|
|
||||||
|
# Module-specific configuration here
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using NixOS Modules
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
inputs.m3ta-nixpkgs.nixosModules.default
|
||||||
|
];
|
||||||
|
|
||||||
|
# Your custom module options will be available here
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Building Packages Directly
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Build a specific package
|
||||||
|
nix build git+https://code.m3ta.dev/m3tam3re/nixpkgs#code2prompt
|
||||||
|
|
||||||
|
# Run a package without installing
|
||||||
|
nix run git+https://code.m3ta.dev/m3tam3re/nixpkgs#zellij-ps
|
||||||
|
|
||||||
|
# Install to your profile
|
||||||
|
nix profile install git+https://code.m3ta.dev/m3tam3re/nixpkgs#msty-studio
|
||||||
|
|
||||||
|
# List all available packages
|
||||||
|
nix flake show git+https://code.m3ta.dev/m3tam3re/nixpkgs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Development
|
||||||
|
|
||||||
|
### Setting Up Development Environment
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clone the repository
|
||||||
|
git clone https://code.m3ta.dev/m3tam3re/nixpkgs
|
||||||
|
cd m3ta-nixpkgs
|
||||||
|
|
||||||
|
# Enter development shell
|
||||||
|
nix develop
|
||||||
|
|
||||||
|
# Check flake validity
|
||||||
|
nix flake check
|
||||||
|
|
||||||
|
# Format code
|
||||||
|
nix fmt
|
||||||
|
```
|
||||||
|
|
||||||
|
### Adding a New Package
|
||||||
|
|
||||||
|
1. Create a new directory under `pkgs/`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir pkgs/my-package
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Create `pkgs/my-package/default.nix`:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
fetchFromGitHub,
|
||||||
|
}:
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "my-package";
|
||||||
|
version = "1.0.0";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "owner";
|
||||||
|
repo = "repo";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Description of my package";
|
||||||
|
homepage = "https://github.com/owner/repo";
|
||||||
|
license = licenses.mit;
|
||||||
|
maintainers = with maintainers; [ ];
|
||||||
|
platforms = platforms.linux;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Add to `pkgs/default.nix`:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
# ... existing packages ...
|
||||||
|
my-package = pkgs.callPackage ./my-package {};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Adding a New NixOS Module
|
||||||
|
|
||||||
|
1. Create `modules/nixos/my-module.nix`
|
||||||
|
2. Add import to `modules/nixos/default.nix`
|
||||||
|
3. Update `flake.nix` to expose it:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
nixosModules = {
|
||||||
|
default = ./modules/nixos;
|
||||||
|
my-module = ./modules/nixos/my-module.nix;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
### Adding a New Home Manager Module
|
||||||
|
|
||||||
|
1. Create `modules/home-manager/my-module.nix`
|
||||||
|
2. Add to `modules/home-manager/default.nix`
|
||||||
|
3. Update `flake.nix` to expose it:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
homeManagerModules = {
|
||||||
|
default = import ./modules/home-manager;
|
||||||
|
my-module = import ./modules/home-manager/my-module.nix;
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
## Available Packages
|
||||||
|
|
||||||
|
| Package | Description |
|
||||||
|
| ------------------ | ------------------------------------- |
|
||||||
|
| `code2prompt` | Convert code to prompts |
|
||||||
|
| `hyprpaper-random` | Random wallpaper setter for Hyprpaper |
|
||||||
|
| `launch-webapp` | Launch web applications |
|
||||||
|
| `msty-studio` | Msty Studio application |
|
||||||
|
| `pomodoro-timer` | Pomodoro timer utility |
|
||||||
|
| `tuxedo-backlight` | Backlight control for Tuxedo laptops |
|
||||||
|
| `zellij-ps` | Process viewer for Zellij |
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Individual packages may have their own licenses. Check each package's `meta.license` attribute.
|
||||||
|
|
||||||
|
## Maintainer
|
||||||
|
|
||||||
|
[@m3tam3re](https://github.com/m3tam3re)
|
193
examples/home-manager-standalone.nix
Normal file
193
examples/home-manager-standalone.nix
Normal file
@@ -0,0 +1,193 @@
|
|||||||
|
# Example Standalone Home Manager Configuration using m3ta-nixpkgs
|
||||||
|
# This file demonstrates how to use m3ta-nixpkgs with standalone Home Manager
|
||||||
|
# (without NixOS)
|
||||||
|
{
|
||||||
|
description = "Example Home Manager configuration with m3ta-nixpkgs";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
|
home-manager = {
|
||||||
|
url = "github:nix-community/home-manager";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Add m3ta-nixpkgs as an input
|
||||||
|
m3ta-nixpkgs = {
|
||||||
|
url = "git+https://code.m3ta.dev/m3tam3re/nixpkgs";
|
||||||
|
# Or use a local path during development:
|
||||||
|
# url = "path:/home/user/projects/m3ta-nixpkgs";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
home-manager,
|
||||||
|
m3ta-nixpkgs,
|
||||||
|
...
|
||||||
|
} @ inputs: let
|
||||||
|
system = "x86_64-linux"; # Change to your system: aarch64-linux, x86_64-darwin, aarch64-darwin
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
# Apply m3ta-nixpkgs overlays
|
||||||
|
overlays = [
|
||||||
|
m3ta-nixpkgs.overlays.default
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
homeConfigurations = {
|
||||||
|
# Replace 'm3tam3re' with your actual username
|
||||||
|
m3tam3re = home-manager.lib.homeManagerConfiguration {
|
||||||
|
inherit pkgs;
|
||||||
|
|
||||||
|
# Pass inputs as extra special args
|
||||||
|
extraSpecialArgs = {inherit inputs;};
|
||||||
|
|
||||||
|
modules = [
|
||||||
|
# Import m3ta's Home Manager modules
|
||||||
|
m3ta-nixpkgs.homeManagerModules.default
|
||||||
|
|
||||||
|
# Main Home Manager configuration
|
||||||
|
{
|
||||||
|
# ============================================
|
||||||
|
# User Information
|
||||||
|
# ============================================
|
||||||
|
home.username = "m3tam3re";
|
||||||
|
home.homeDirectory = "/home/m3tam3re";
|
||||||
|
home.stateVersion = "24.05";
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# Packages from m3ta-nixpkgs
|
||||||
|
# ============================================
|
||||||
|
# Since we applied the overlay above, packages are available directly
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
# Custom packages from m3ta-nixpkgs
|
||||||
|
code2prompt
|
||||||
|
hyprpaper-random
|
||||||
|
launch-webapp
|
||||||
|
msty-studio
|
||||||
|
pomodoro-timer
|
||||||
|
zellij-ps
|
||||||
|
|
||||||
|
# Regular packages from nixpkgs
|
||||||
|
git
|
||||||
|
vim
|
||||||
|
htop
|
||||||
|
fzf
|
||||||
|
ripgrep
|
||||||
|
];
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# Custom Home Manager Modules
|
||||||
|
# ============================================
|
||||||
|
# If you've defined custom Home Manager modules
|
||||||
|
# programs.myProgram = {
|
||||||
|
# enable = true;
|
||||||
|
# package = pkgs.myProgram;
|
||||||
|
# settings = {
|
||||||
|
# theme = "dark";
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# Shell Configuration
|
||||||
|
# ============================================
|
||||||
|
programs.bash = {
|
||||||
|
enable = true;
|
||||||
|
shellAliases = {
|
||||||
|
ll = "ls -l";
|
||||||
|
".." = "cd ..";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
enableCompletion = true;
|
||||||
|
autosuggestion.enable = true;
|
||||||
|
syntaxHighlighting.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# Git Configuration
|
||||||
|
# ============================================
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
userName = "Your Name";
|
||||||
|
userEmail = "your.email@example.com";
|
||||||
|
extraConfig = {
|
||||||
|
init.defaultBranch = "main";
|
||||||
|
pull.rebase = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# Additional Programs
|
||||||
|
# ============================================
|
||||||
|
programs.direnv = {
|
||||||
|
enable = true;
|
||||||
|
nix-direnv.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.fzf = {
|
||||||
|
enable = true;
|
||||||
|
enableBashIntegration = true;
|
||||||
|
enableZshIntegration = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# Environment Variables
|
||||||
|
# ============================================
|
||||||
|
home.sessionVariables = {
|
||||||
|
EDITOR = "vim";
|
||||||
|
VISUAL = "vim";
|
||||||
|
};
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# File Management
|
||||||
|
# ============================================
|
||||||
|
# Create custom config files
|
||||||
|
home.file.".config/my-app/config.json".text = ''
|
||||||
|
{
|
||||||
|
"setting": "value"
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# Allow Home Manager to manage itself
|
||||||
|
# ============================================
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# Minimal Example Configuration
|
||||||
|
# ============================================
|
||||||
|
minimal = home-manager.lib.homeManagerConfiguration {
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [m3ta-nixpkgs.overlays.default];
|
||||||
|
};
|
||||||
|
|
||||||
|
modules = [
|
||||||
|
{
|
||||||
|
home.username = "m3tam3re";
|
||||||
|
home.homeDirectory = "/home/m3tam3re";
|
||||||
|
home.stateVersion = "24.05";
|
||||||
|
|
||||||
|
# Just use a couple of custom packages
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
code2prompt
|
||||||
|
zellij-ps
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
153
examples/nixos-configuration.nix
Normal file
153
examples/nixos-configuration.nix
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
# Example NixOS Configuration using m3ta-nixpkgs
|
||||||
|
# This file demonstrates how to integrate m3ta-nixpkgs into your NixOS system
|
||||||
|
{
|
||||||
|
description = "Example NixOS configuration with m3ta-nixpkgs";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
|
# Add m3ta-nixpkgs as an input
|
||||||
|
m3ta-nixpkgs = {
|
||||||
|
url = "git+https://code.m3ta.dev/m3tam3re/nixpkgs";
|
||||||
|
# Or use a local path during development:
|
||||||
|
# url = "path:/home/user/projects/m3ta-nixpkgs";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager = {
|
||||||
|
url = "github:nix-community/home-manager";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
m3ta-nixpkgs,
|
||||||
|
home-manager,
|
||||||
|
...
|
||||||
|
} @ inputs: {
|
||||||
|
nixosConfigurations = {
|
||||||
|
# Replace 'hostname' with your actual hostname
|
||||||
|
hostname = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
|
||||||
|
specialArgs = {inherit inputs;};
|
||||||
|
|
||||||
|
modules = [
|
||||||
|
# Your hardware configuration
|
||||||
|
./hardware-configuration.nix
|
||||||
|
|
||||||
|
# Import m3ta's NixOS modules (if any are defined)
|
||||||
|
m3ta-nixpkgs.nixosModules.default
|
||||||
|
|
||||||
|
# Main configuration
|
||||||
|
({pkgs, ...}: {
|
||||||
|
# ============================================
|
||||||
|
# METHOD 1: Using Overlays (Recommended)
|
||||||
|
# ============================================
|
||||||
|
# This makes custom packages available as if they were in nixpkgs
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
m3ta-nixpkgs.overlays.default
|
||||||
|
# Or use individual overlays for more control:
|
||||||
|
# m3ta-nixpkgs.overlays.additions
|
||||||
|
# m3ta-nixpkgs.overlays.modifications
|
||||||
|
];
|
||||||
|
|
||||||
|
# Now you can use packages normally
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
# Custom packages from m3ta-nixpkgs
|
||||||
|
code2prompt
|
||||||
|
hyprpaper-random
|
||||||
|
msty-studio
|
||||||
|
pomodoro-timer
|
||||||
|
tuxedo-backlight
|
||||||
|
zellij-ps
|
||||||
|
|
||||||
|
# Regular nixpkgs packages
|
||||||
|
vim
|
||||||
|
git
|
||||||
|
htop
|
||||||
|
];
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# METHOD 2: Direct Package Reference
|
||||||
|
# ============================================
|
||||||
|
# Use this if you don't want to use overlays
|
||||||
|
# environment.systemPackages = [
|
||||||
|
# inputs.m3ta-nixpkgs.packages.${pkgs.system}.code2prompt
|
||||||
|
# inputs.m3ta-nixpkgs.packages.${pkgs.system}.zellij-ps
|
||||||
|
# ];
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# Using Custom NixOS Modules
|
||||||
|
# ============================================
|
||||||
|
# If you've defined custom NixOS modules, configure them here
|
||||||
|
# m3ta.myModule = {
|
||||||
|
# enable = true;
|
||||||
|
# # module-specific options
|
||||||
|
# };
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# System Configuration
|
||||||
|
# ============================================
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
networking.hostName = "hostname";
|
||||||
|
|
||||||
|
# Enable flakes
|
||||||
|
nix.settings.experimental-features = ["nix-command" "flakes"];
|
||||||
|
})
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# Home Manager Integration
|
||||||
|
# ============================================
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
{
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.users.m3tam3re = {pkgs, ...}: {
|
||||||
|
# Import m3ta's Home Manager modules
|
||||||
|
imports = [
|
||||||
|
m3ta-nixpkgs.homeManagerModules.default
|
||||||
|
# Or import specific modules:
|
||||||
|
# m3ta-nixpkgs.homeManagerModules.zellij-ps
|
||||||
|
];
|
||||||
|
|
||||||
|
# Home Manager packages with overlay
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
launch-webapp
|
||||||
|
# Other packages...
|
||||||
|
];
|
||||||
|
|
||||||
|
# Configure custom Home Manager modules
|
||||||
|
# programs.myProgram = {
|
||||||
|
# enable = true;
|
||||||
|
# # options...
|
||||||
|
# };
|
||||||
|
|
||||||
|
home.stateVersion = "24.05";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# ============================================
|
||||||
|
# Alternative: Minimal Configuration
|
||||||
|
# ============================================
|
||||||
|
minimal = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
modules = [
|
||||||
|
({pkgs, ...}: {
|
||||||
|
nixpkgs.overlays = [m3ta-nixpkgs.overlays.default];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
code2prompt
|
||||||
|
];
|
||||||
|
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1759381078,
|
||||||
|
"narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "7df7ff7d8e00218376575f0acdcc5d66741351ee",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
115
flake.nix
Normal file
115
flake.nix
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
{
|
||||||
|
description = "m3ta's personal Nix repository - Custom packages, overlays, and modules";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
|
# Optional: Add stable channel if needed
|
||||||
|
# nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = {
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
...
|
||||||
|
} @ inputs: let
|
||||||
|
# Supported systems
|
||||||
|
systems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
|
||||||
|
# Helper function to generate an attrset for each system
|
||||||
|
forAllSystems = nixpkgs.lib.genAttrs systems;
|
||||||
|
|
||||||
|
# Helper to create pkgs for a given system
|
||||||
|
pkgsFor = system:
|
||||||
|
import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
# Custom packages - accessible via 'nix build .#package-name'
|
||||||
|
packages = forAllSystems (
|
||||||
|
system: let
|
||||||
|
pkgs = pkgsFor system;
|
||||||
|
in
|
||||||
|
import ./pkgs {inherit pkgs;}
|
||||||
|
);
|
||||||
|
|
||||||
|
# Overlays - can be imported in your system configuration
|
||||||
|
overlays = {
|
||||||
|
# Default overlay: adds all custom packages
|
||||||
|
default = final: prev:
|
||||||
|
import ./pkgs {pkgs = final;};
|
||||||
|
|
||||||
|
# Individual overlays for more granular control
|
||||||
|
additions = final: prev:
|
||||||
|
import ./pkgs {pkgs = final;};
|
||||||
|
|
||||||
|
modifications = final: prev:
|
||||||
|
import ./overlays/mods {inherit prev;};
|
||||||
|
};
|
||||||
|
|
||||||
|
# NixOS modules - for system-level configuration
|
||||||
|
nixosModules = {
|
||||||
|
default = ./modules/nixos;
|
||||||
|
# Add individual modules here as needed
|
||||||
|
# example: myModule = ./modules/nixos/my-module.nix;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Home Manager modules - for user-level configuration
|
||||||
|
homeManagerModules = {
|
||||||
|
default = import ./modules/home-manager;
|
||||||
|
zellij-ps = import ./modules/home-manager/zellij-ps.nix;
|
||||||
|
# Add more individual modules as you create them
|
||||||
|
};
|
||||||
|
|
||||||
|
# Development shell for working on this repository
|
||||||
|
devShells = forAllSystems (
|
||||||
|
system: let
|
||||||
|
pkgs = pkgsFor system;
|
||||||
|
in {
|
||||||
|
default = pkgs.mkShell {
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
nil # Nix LSP
|
||||||
|
nixpkgs-fmt # Nix formatter
|
||||||
|
nix-tree # Explore dependency trees
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
echo "🚀 m3ta-nixpkgs development environment"
|
||||||
|
echo "Available commands:"
|
||||||
|
echo " nix flake check - Check flake validity"
|
||||||
|
echo " nix flake show - Show flake outputs"
|
||||||
|
echo " nix build .#<pkg> - Build a package"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
# Formatter for 'nix fmt'
|
||||||
|
formatter = forAllSystems (
|
||||||
|
system:
|
||||||
|
(pkgsFor system).nixpkgs-fmt
|
||||||
|
);
|
||||||
|
|
||||||
|
# Templates for creating new packages/modules
|
||||||
|
templates = {
|
||||||
|
package = {
|
||||||
|
path = ./templates/package;
|
||||||
|
description = "Template for a new package";
|
||||||
|
};
|
||||||
|
nixos-module = {
|
||||||
|
path = ./templates/nixos-module;
|
||||||
|
description = "Template for a new NixOS module";
|
||||||
|
};
|
||||||
|
home-manager-module = {
|
||||||
|
path = ./templates/home-manager-module;
|
||||||
|
description = "Template for a new Home Manager module";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
6
modules/home-manager/cli/default.nix
Normal file
6
modules/home-manager/cli/default.nix
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# CLI/Terminal-related Home Manager modules
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./zellij-ps.nix
|
||||||
|
];
|
||||||
|
}
|
45
modules/home-manager/cli/zellij-ps.nix
Normal file
45
modules/home-manager/cli/zellij-ps.nix
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.cli.zellij-ps;
|
||||||
|
in {
|
||||||
|
options.cli.zellij-ps = {
|
||||||
|
enable = mkEnableOption "Zellij Project Selector";
|
||||||
|
|
||||||
|
projectFolders = mkOption {
|
||||||
|
type = types.listOf types.path;
|
||||||
|
description = "List of project folders for zellij-ps.";
|
||||||
|
default = ["${config.home.homeDirectory}/projects"];
|
||||||
|
};
|
||||||
|
|
||||||
|
layout = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "Layout for zellij";
|
||||||
|
default = ''
|
||||||
|
layout {
|
||||||
|
pane size=1 borderless=true {
|
||||||
|
plugin location="zellij:tab-bar"
|
||||||
|
}
|
||||||
|
pane
|
||||||
|
pane split_direction="vertical" {
|
||||||
|
pane
|
||||||
|
pane command="htop"
|
||||||
|
}
|
||||||
|
pane size=2 borderless=true {
|
||||||
|
plugin location="zellij:status-bar"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = [pkgs.zellij-ps];
|
||||||
|
home.sessionVariables.PROJECT_FOLDERS = lib.concatStringsSep ":" cfg.projectFolders;
|
||||||
|
home.file.".config/zellij/layouts/zellij-ps.kdl".text = cfg.layout;
|
||||||
|
};
|
||||||
|
}
|
6
modules/home-manager/coding/default.nix
Normal file
6
modules/home-manager/coding/default.nix
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Coding-related Home Manager modules
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./editors.nix
|
||||||
|
];
|
||||||
|
}
|
199
modules/home-manager/coding/editors.nix
Normal file
199
modules/home-manager/coding/editors.nix
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.coding.editors;
|
||||||
|
in {
|
||||||
|
options.coding.editors = {
|
||||||
|
neovim = {
|
||||||
|
enable = mkEnableOption "neovim with LazyVim configuration";
|
||||||
|
};
|
||||||
|
|
||||||
|
zed = {
|
||||||
|
enable = mkEnableOption "zed editor with custom configuration";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkMerge [
|
||||||
|
# Neovim configuration
|
||||||
|
(mkIf cfg.neovim.enable {
|
||||||
|
programs.neovim = {
|
||||||
|
enable = true;
|
||||||
|
defaultEditor = true;
|
||||||
|
viAlias = true;
|
||||||
|
vimAlias = true;
|
||||||
|
vimdiffAlias = true;
|
||||||
|
withNodeJs = true;
|
||||||
|
withPython3 = true;
|
||||||
|
|
||||||
|
# This is your init.lua content
|
||||||
|
extraLuaConfig = ''
|
||||||
|
-- Bootstrap lazy.nvim
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system({
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--filter=blob:none",
|
||||||
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
|
"--branch=stable",
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- Bootstrap LazyVim via lazy.nvim
|
||||||
|
-- Docs: https://github.com/folke/lazy.nvim and https://www.lazyvim.org/
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||||
|
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||||
|
{ import = "lazyvim.plugins.extras.lang.python" },
|
||||||
|
{ import = "lazyvim.plugins.extras.lang.go" },
|
||||||
|
{ import = "lazyvim.plugins.extras.lang.nix" },
|
||||||
|
{ import = "lazyvim.plugins.extras.lang.rust" },
|
||||||
|
{ import = "lazyvim.plugins.extras.lang.nushell" },
|
||||||
|
{ "Mofiqul/dracula.nvim" },
|
||||||
|
},
|
||||||
|
defaults = { lazy = false, version = false },
|
||||||
|
install = { colorscheme = { "dracula", "tokyonight", "habamax" } },
|
||||||
|
checker = { enabled = false },
|
||||||
|
performance = {
|
||||||
|
rtp = {
|
||||||
|
disabled_plugins = {
|
||||||
|
"gzip", "tarPlugin", "tohtml", "tutor", "zipPlugin",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
vim.o.termguicolors = true
|
||||||
|
vim.cmd.colorscheme("dracula")
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
# Zed editor configuration
|
||||||
|
(mkIf cfg.zed.enable {
|
||||||
|
programs.zed-editor = {
|
||||||
|
enable = true;
|
||||||
|
userSettings = {
|
||||||
|
# UI and Theme
|
||||||
|
theme = "Dracula";
|
||||||
|
ui_font_size = 16;
|
||||||
|
buffer_font_size = 16;
|
||||||
|
buffer_font_family = "FiraCode Nerd Font";
|
||||||
|
|
||||||
|
# Editor Behavior
|
||||||
|
vim_mode = true;
|
||||||
|
auto_update = false;
|
||||||
|
format_on_save = "on";
|
||||||
|
load_direnv = "shell_hook";
|
||||||
|
|
||||||
|
# AI Features
|
||||||
|
features = {
|
||||||
|
edit_prediction_provider = "zed";
|
||||||
|
};
|
||||||
|
edit_predictions = {
|
||||||
|
mode = "subtle";
|
||||||
|
};
|
||||||
|
show_edit_predictions = true;
|
||||||
|
|
||||||
|
agent = {
|
||||||
|
default_model = {
|
||||||
|
provider = "zed.dev";
|
||||||
|
model = "claude-sonnet-4";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
assistant = {
|
||||||
|
version = "2";
|
||||||
|
default_model = {
|
||||||
|
provider = "anthropic";
|
||||||
|
model = "claude-4";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Language Models
|
||||||
|
language_models = {
|
||||||
|
anthropic = {
|
||||||
|
api_url = "https://api.anthropic.com";
|
||||||
|
};
|
||||||
|
openai = {
|
||||||
|
api_url = "https://api.openai.com/v1";
|
||||||
|
};
|
||||||
|
ollama = {
|
||||||
|
api_url = "http://localhost:11434";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Languages Configuration
|
||||||
|
languages = {
|
||||||
|
Nix = {
|
||||||
|
language_servers = ["nixd"];
|
||||||
|
formatter = {
|
||||||
|
external = {
|
||||||
|
command = "alejandra";
|
||||||
|
arguments = [
|
||||||
|
"-q"
|
||||||
|
"-"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
Python = {
|
||||||
|
language_servers = ["pyrefly"];
|
||||||
|
formatter = {
|
||||||
|
external = {
|
||||||
|
command = "black";
|
||||||
|
arguments = ["-"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# LSP Configuration
|
||||||
|
lsp = {
|
||||||
|
rust-analyzer = {
|
||||||
|
initialization_options = {
|
||||||
|
check = {
|
||||||
|
command = "clippy";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
pyrefly = {
|
||||||
|
binary = {
|
||||||
|
arguments = ["--lsp"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Context Servers
|
||||||
|
context_servers = {
|
||||||
|
some-context-server = {
|
||||||
|
source = "custom";
|
||||||
|
command = "some-command";
|
||||||
|
args = [
|
||||||
|
"arg-1"
|
||||||
|
"arg-2"
|
||||||
|
];
|
||||||
|
env = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Privacy
|
||||||
|
telemetry = {
|
||||||
|
metrics = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
# Common packages (always installed if either editor is enabled)
|
||||||
|
(mkIf (cfg.neovim.enable || cfg.zed.enable) {
|
||||||
|
home.packages = with pkgs; [zig];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
7
modules/home-manager/default.nix
Normal file
7
modules/home-manager/default.nix
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Home Manager modules organized by category
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./cli
|
||||||
|
./coding
|
||||||
|
];
|
||||||
|
}
|
28
modules/nixos/default.nix
Normal file
28
modules/nixos/default.nix
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# NixOS Modules
|
||||||
|
# Import this in your NixOS configuration with:
|
||||||
|
# imports = [ inputs.m3ta-nixpkgs.nixosModules.default ];
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# This is the main entry point for all custom NixOS modules
|
||||||
|
# Add your custom modules here as imports or inline definitions
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
# Example: ./my-service.nix
|
||||||
|
# Add more module files here as you create them
|
||||||
|
];
|
||||||
|
|
||||||
|
# You can also define inline options here
|
||||||
|
# options = {
|
||||||
|
# m3ta = {
|
||||||
|
# # Your custom options
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
|
||||||
|
# config = {
|
||||||
|
# # Your custom configuration
|
||||||
|
# };
|
||||||
|
}
|
71
overlays/default.nix
Normal file
71
overlays/default.nix
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
{inputs, ...}: {
|
||||||
|
# This one brings our custom packages from the 'pkgs' directory
|
||||||
|
additions = final: prev:
|
||||||
|
(import ../pkgs {pkgs = final;})
|
||||||
|
# // (inputs.hyprpanel.overlay final prev)
|
||||||
|
// {rose-pine-hyprcursor = inputs.rose-pine-hyprcursor.packages.${prev.system}.default;}
|
||||||
|
// {
|
||||||
|
crush = inputs.nix-ai-tools.packages.${prev.system}.crush;
|
||||||
|
};
|
||||||
|
|
||||||
|
# This one contains whatever you want to overlay
|
||||||
|
# You can change versions, add patches, set compilation flags, anything really.
|
||||||
|
# https://nixos.wiki/wiki/Overlays
|
||||||
|
modifications = final: prev: {
|
||||||
|
n8n = import ./mods/n8n.nix {inherit prev;};
|
||||||
|
|
||||||
|
brave = prev.brave.override {
|
||||||
|
commandLineArgs = "--password-store=gnome-libsecret";
|
||||||
|
};
|
||||||
|
|
||||||
|
# nodejs_24 = inputs.nixpkgs-stable.legacyPackages.${prev.system}.nodejs_24;
|
||||||
|
# paperless-ngx = inputs.nixpkgs-45570c2.legacyPackages.${prev.system}.paperless-ngx;
|
||||||
|
# anytype-heart = inputs.nixpkgs-9e58ed7.legacyPackages.${prev.system}.anytype-heart;
|
||||||
|
# trezord = inputs.nixpkgs-2744d98.legacyPackages.${prev.system}.trezord;
|
||||||
|
# mesa = inputs.nixpkgs-master.legacyPackages.${prev.system}.mesa;
|
||||||
|
# hyprpanel = inputs.hyprpanel.packages.${prev.system}.default.overrideAttrs (prev: {
|
||||||
|
# version = "latest"; # or whatever version you want
|
||||||
|
# src = final.fetchFromGitHub {
|
||||||
|
# owner = "Jas-SinghFSU";
|
||||||
|
# repo = "HyprPanel";
|
||||||
|
# rev = "master"; # or a specific commit hash
|
||||||
|
# hash = "sha256-l623fIVhVCU/ylbBmohAtQNbK0YrWlEny0sC/vBJ+dU=";
|
||||||
|
# };
|
||||||
|
# });
|
||||||
|
};
|
||||||
|
|
||||||
|
temp-packages = final: _prev: {
|
||||||
|
temp = import inputs.nixpkgs-9e9486b {
|
||||||
|
system = final.system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
stable-packages = final: _prev: {
|
||||||
|
stable = import inputs.nixpkgs-stable {
|
||||||
|
system = final.system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
pinned-packages = final: _prev: {
|
||||||
|
pinned = import inputs.nixpkgs-9472de4 {
|
||||||
|
system = final.system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
locked-packages = final: _prev: {
|
||||||
|
locked = import inputs.nixpkgs-locked {
|
||||||
|
system = final.system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
master-packages = final: _prev: {
|
||||||
|
master = import inputs.nixpkgs-master {
|
||||||
|
system = final.system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
9
overlays/mods/default.nix
Normal file
9
overlays/mods/default.nix
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{prev}: {
|
||||||
|
# Package modifications
|
||||||
|
# This overlay contains package overrides and modifications
|
||||||
|
|
||||||
|
n8n = import ./n8n.nix {inherit prev;};
|
||||||
|
|
||||||
|
# Add more modifications here as needed
|
||||||
|
# example-package = prev.example-package.override { ... };
|
||||||
|
}
|
18
overlays/mods/n8n.nix
Normal file
18
overlays/mods/n8n.nix
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{prev}:
|
||||||
|
prev.n8n.overrideAttrs (oldAttrs: rec {
|
||||||
|
version = "1.112.6";
|
||||||
|
|
||||||
|
src = prev.fetchFromGitHub {
|
||||||
|
owner = "n8n-io";
|
||||||
|
repo = "n8n";
|
||||||
|
rev = "n8n@${version}";
|
||||||
|
hash = "sha256-r/MCU/S1kkKQPkhmp9ZHTtgZxMu5TFCl5Yejp73gATw=";
|
||||||
|
};
|
||||||
|
|
||||||
|
pnpmDeps = prev.pnpm_10.fetchDeps {
|
||||||
|
pname = oldAttrs.pname;
|
||||||
|
inherit version src;
|
||||||
|
fetcherVersion = 1;
|
||||||
|
hash = "sha256-j+HJhvzrcu8JsezcFJxfgteOgTspWQb2ZSN2fEl7Voo=";
|
||||||
|
};
|
||||||
|
})
|
37
pkgs/code2prompt/default.nix
Normal file
37
pkgs/code2prompt/default.nix
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
fetchFromGitHub,
|
||||||
|
rustPlatform,
|
||||||
|
pkg-config,
|
||||||
|
perl,
|
||||||
|
openssl,
|
||||||
|
}:
|
||||||
|
rustPlatform.buildRustPackage rec {
|
||||||
|
pname = "code2prompt";
|
||||||
|
version = "4.0.2";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "mufeedvh";
|
||||||
|
repo = "code2prompt";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-2ac/ZobL+4cQz94JjtS+JC7qsPE5lktznlhMAgSJa8g=";
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoLock = {
|
||||||
|
lockFile = src + "/Cargo.lock";
|
||||||
|
};
|
||||||
|
|
||||||
|
buildAndTestSubdir = "crates/code2prompt";
|
||||||
|
|
||||||
|
nativeBuildInputs = [pkg-config perl];
|
||||||
|
|
||||||
|
buildInputs = [openssl];
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "A CLI tool that converts your codebase into a single LLM prompt with a source tree, prompt templating, and token counting";
|
||||||
|
homepage = "https://github.com/mufeedvh/code2prompt";
|
||||||
|
license = licenses.mit;
|
||||||
|
platforms = platforms.linux;
|
||||||
|
mainProgram = "code2prompt";
|
||||||
|
};
|
||||||
|
}
|
11
pkgs/default.nix
Normal file
11
pkgs/default.nix
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{pkgs, ...}: {
|
||||||
|
# Custom packages registry
|
||||||
|
# Each package is defined in its own directory under pkgs/
|
||||||
|
code2prompt = pkgs.callPackage ./code2prompt {};
|
||||||
|
hyprpaper-random = pkgs.callPackage ./hyprpaper-random {};
|
||||||
|
launch-webapp = pkgs.callPackage ./launch-webapp {};
|
||||||
|
msty-studio = pkgs.callPackage ./msty-studio {};
|
||||||
|
pomodoro-timer = pkgs.callPackage ./pomodoro-timer {};
|
||||||
|
tuxedo-backlight = pkgs.callPackage ./tuxedo-backlight {};
|
||||||
|
zellij-ps = pkgs.callPackage ./zellij-ps {};
|
||||||
|
}
|
72
pkgs/hyprpaper-random/default.nix
Normal file
72
pkgs/hyprpaper-random/default.nix
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
writeShellScriptBin,
|
||||||
|
fd,
|
||||||
|
hyprland,
|
||||||
|
coreutils,
|
||||||
|
gawk,
|
||||||
|
}: let
|
||||||
|
script = writeShellScriptBin "hyprpaper-random" ''
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Directory (override with WALLPAPER_DIR)
|
||||||
|
DIR="''${WALLPAPER_DIR:-''${XDG_CONFIG_HOME:-$HOME/.config}/hypr/wallpapers}"
|
||||||
|
|
||||||
|
HYPRCTL="${hyprland}/bin/hyprctl"
|
||||||
|
FD="${fd}/bin/fd"
|
||||||
|
SHUF="${coreutils}/bin/shuf"
|
||||||
|
TR="${coreutils}/bin/tr"
|
||||||
|
AWK="${gawk}/bin/awk"
|
||||||
|
|
||||||
|
# Pick one random image (null-safe)
|
||||||
|
WALLPAPER="$(
|
||||||
|
"$FD" . "$DIR" -t f -e jpg -e jpeg -e png -e webp -e avif -0 --follow --hidden \
|
||||||
|
| "$SHUF" -z -n1 \
|
||||||
|
| "$TR" -d '\0'
|
||||||
|
)"
|
||||||
|
|
||||||
|
if [[ -z "''${WALLPAPER:-}" ]]; then
|
||||||
|
echo "No wallpapers found in: $DIR" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Preload so hyprpaper can use it
|
||||||
|
"$HYPRCTL" hyprpaper preload "$WALLPAPER" >/dev/null 2>&1 || true
|
||||||
|
|
||||||
|
# Apply to all monitors
|
||||||
|
"$HYPRCTL" monitors \
|
||||||
|
| "$AWK" '/^Monitor /{print $2}' \
|
||||||
|
| while IFS= read -r mon; do
|
||||||
|
[ -n "$mon" ] && "$HYPRCTL" hyprpaper wallpaper "$mon,$WALLPAPER"
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "hyprpaper-random";
|
||||||
|
version = "0.1.1";
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
fd
|
||||||
|
hyprland
|
||||||
|
coreutils
|
||||||
|
gawk
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p "$out/bin"
|
||||||
|
ln -s ${script}/bin/hyprpaper-random "$out/bin/hyprpaper-random"
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Minimal random wallpaper setter for Hyprpaper";
|
||||||
|
license = lib.licenses.mit;
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
|
mainProgram = "hyprpaper-random";
|
||||||
|
};
|
||||||
|
}
|
41
pkgs/launch-webapp/default.nix
Normal file
41
pkgs/launch-webapp/default.nix
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
writeShellScriptBin,
|
||||||
|
}: let
|
||||||
|
launcher = writeShellScriptBin "launch-webapp" ''
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
browser=$(xdg-settings get default-web-browser)
|
||||||
|
|
||||||
|
case "$browser" in
|
||||||
|
google-chrome*) browser_bin="google-chrome" ;;
|
||||||
|
brave-browser*) browser_bin="brave-browser" ;;
|
||||||
|
microsoft-edge*) browser_bin="microsoft-edge" ;;
|
||||||
|
opera*) browser_bin="opera" ;;
|
||||||
|
vivaldi*) browser_bin="vivaldi" ;;
|
||||||
|
*) browser_bin="chromium" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exec_cmd="/etc/profiles/per-user/$USER/bin/$browser_bin"
|
||||||
|
exec setsid uwsm app -- "$exec_cmd" --app="$1" ''${@:2}
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "launch-webapp";
|
||||||
|
version = "0.1.0";
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
ln -s ${launcher}/bin/launch-webapp $out/bin/launch-webapp
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Launches a web app using your default browser in app mode.";
|
||||||
|
license = lib.licenses.mit;
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
|
mainProgram = "launch-webapp";
|
||||||
|
};
|
||||||
|
}
|
45
pkgs/msty-studio/default.nix
Normal file
45
pkgs/msty-studio/default.nix
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
appimageTools,
|
||||||
|
fetchurl,
|
||||||
|
lib,
|
||||||
|
nodejs,
|
||||||
|
nodePackages,
|
||||||
|
uv,
|
||||||
|
python3,
|
||||||
|
makeWrapper,
|
||||||
|
}: let
|
||||||
|
pname = "msty-studio";
|
||||||
|
version = "2.0.0-beta.4";
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://next-assets.msty.studio/app/alpha/linux/MstyStudio_x86_64.AppImage";
|
||||||
|
sha256 = "sha256-zJcGK7QEL3ROgVJy13mMdY/437H3Zx8EwSXy7rEhV9w=";
|
||||||
|
};
|
||||||
|
appimageContents = appimageTools.extractType2 {inherit pname version src;};
|
||||||
|
in
|
||||||
|
appimageTools.wrapType2 {
|
||||||
|
inherit pname version src;
|
||||||
|
nativeBuildInputs = [makeWrapper];
|
||||||
|
|
||||||
|
extraPkgs = pkgs: [
|
||||||
|
nodejs
|
||||||
|
nodePackages.npm
|
||||||
|
uv
|
||||||
|
python3
|
||||||
|
];
|
||||||
|
|
||||||
|
extraInstallCommands = ''
|
||||||
|
install -m 444 -D ${appimageContents}/MstyStudio.desktop -t $out/share/applications
|
||||||
|
substituteInPlace $out/share/applications/MstyStudio.desktop \
|
||||||
|
--replace 'Exec=AppRun' 'Exec=${pname}'
|
||||||
|
install -m 444 -D ${appimageContents}/MstyStudio.png \
|
||||||
|
$out/share/icons/hicolor/256x256/apps/MstyStudio.png
|
||||||
|
wrapProgram $out/bin/${pname} \
|
||||||
|
--prefix PATH : ${nodejs}/bin:${nodePackages.npm}/bin:${uv}/bin:${python3}/bin
|
||||||
|
'';
|
||||||
|
meta = {
|
||||||
|
description = "Msty Studio enables advanced, privacy‑preserving AI workflows entirely on your local machine.";
|
||||||
|
license = lib.licenses.unfree;
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
|
mainProgram = "msty-studio";
|
||||||
|
};
|
||||||
|
}
|
92
pkgs/pomodoro-timer/default.nix
Normal file
92
pkgs/pomodoro-timer/default.nix
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
writeShellScriptBin,
|
||||||
|
timer,
|
||||||
|
kitty,
|
||||||
|
rofi,
|
||||||
|
libnotify,
|
||||||
|
speechd,
|
||||||
|
}: let
|
||||||
|
launcher = writeShellScriptBin "launch-timer" ''
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
validate_time() {
|
||||||
|
local input=$1
|
||||||
|
if [[ $input =~ ^[0-9]+[mhs]$ ]]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
notify_end() {
|
||||||
|
local session_name=$1
|
||||||
|
${libnotify}/bin/notify-send "Pomodoro" "$session_name session ended!"
|
||||||
|
${speechd}/bin/spd-say "$session_name session ended"
|
||||||
|
}
|
||||||
|
|
||||||
|
start_timer() {
|
||||||
|
local duration=$1
|
||||||
|
local session_name=$2
|
||||||
|
kitty \
|
||||||
|
--class="floating-pomodoro" \
|
||||||
|
--title="floating-pomodoro" \
|
||||||
|
${timer}/bin/timer $duration
|
||||||
|
notify_end "$session_name"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Show rofi menu with options
|
||||||
|
selected=$(printf "work\nbreak\ncustom" | rofi -dmenu -p "Work Timer:" -l 3)
|
||||||
|
|
||||||
|
# Exit if no selection was made
|
||||||
|
[ -z "$selected" ] && exit
|
||||||
|
|
||||||
|
case $selected in
|
||||||
|
"work")
|
||||||
|
start_timer "45m" "work"
|
||||||
|
;;
|
||||||
|
"break")
|
||||||
|
start_timer "10m" "break"
|
||||||
|
;;
|
||||||
|
"custom")
|
||||||
|
# Show input dialog for custom time
|
||||||
|
custom_time=$(rofi -dmenu -p "Enter time (e.g., 25m, 1h, 30s):" -l 0)
|
||||||
|
|
||||||
|
# Validate input and start timer
|
||||||
|
if [ ! -z "$custom_time" ] && validate_time "$custom_time"; then
|
||||||
|
start_timer "$custom_time" "custom"
|
||||||
|
else
|
||||||
|
${libnotify}/bin/notify-send "Invalid time format" "Please use format: 30s, 25m, or 1h"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "work-timer";
|
||||||
|
version = "0.1.0";
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
timer
|
||||||
|
kitty
|
||||||
|
rofi
|
||||||
|
libnotify
|
||||||
|
speechd
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
ln -s ${launcher}/bin/launch-timer $out/bin/launch-timer
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "A Work timer.";
|
||||||
|
license = lib.licenses.mit;
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
|
mainProgram = "launch-timer";
|
||||||
|
};
|
||||||
|
}
|
26
pkgs/tuxedo-backlight/default.nix
Normal file
26
pkgs/tuxedo-backlight/default.nix
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{writeShellScriptBin}:
|
||||||
|
writeShellScriptBin "tuxedo-backlight" ''
|
||||||
|
# all keys
|
||||||
|
echo '0 150 255' | tee /sys/class/leds/rgb:kbd_backlight*/multi_intensity
|
||||||
|
|
||||||
|
# DEL key
|
||||||
|
echo '255 0 155' | tee /sys/class/leds/rgb:kbd_backlight_15/multi_intensity
|
||||||
|
|
||||||
|
# ESC key
|
||||||
|
echo '255 0 155' | tee /sys/class/leds/rgb:kbd_backlight/multi_intensity
|
||||||
|
|
||||||
|
# function and Fn keys
|
||||||
|
for i in {1..12} 102; do
|
||||||
|
echo '0 255 80' | tee /sys/class/leds/rgb:kbd_backlight_$i/multi_intensity
|
||||||
|
done
|
||||||
|
|
||||||
|
# complete numblock and keys above
|
||||||
|
for i in {16..19} {36..39} {56..59} {76..79} {96..99} {117..119}; do
|
||||||
|
echo '255 150 0' | tee /sys/class/leds/rgb:kbd_backlight_$i/multi_intensity
|
||||||
|
done
|
||||||
|
|
||||||
|
# arrow keys
|
||||||
|
for i in 95 {114..116}; do
|
||||||
|
echo '0 255 80' | tee /sys/class/leds/rgb:kbd_backlight_$i/multi_intensity
|
||||||
|
done
|
||||||
|
''
|
42
pkgs/zellij-ps/default.nix
Normal file
42
pkgs/zellij-ps/default.nix
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
fetchFromGitea,
|
||||||
|
fish,
|
||||||
|
fd,
|
||||||
|
fzf,
|
||||||
|
zellij,
|
||||||
|
}:
|
||||||
|
with lib;
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "zellij-ps";
|
||||||
|
version = "0.1.0";
|
||||||
|
|
||||||
|
src = fetchFromGitea {
|
||||||
|
domain = "code.m3ta.dev";
|
||||||
|
owner = "m3tam3re";
|
||||||
|
repo = "helper-scripts";
|
||||||
|
rev = "08a3217b83391c1110545c1ee3161eecd5dbe5e9";
|
||||||
|
sha256 = "1sc4i58mwcg3qsq0wwl5rvk08ykbxc497bq7mrxiirndsarskby7";
|
||||||
|
};
|
||||||
|
|
||||||
|
propagatedBuildInputs = [fish fd fzf zellij];
|
||||||
|
|
||||||
|
nativeBuildInputs = [];
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
substitute zellij-ps.fish $out/bin/zellij-ps \
|
||||||
|
--replace-fail 'fd --type' '${fd}/bin/fd --type' \
|
||||||
|
--replace-fail 'fzf --preview' '${fzf}/bin/fzf --preview' \
|
||||||
|
--replace-fail 'zellij --layout' '${zellij}/bin/zellij --layout' \
|
||||||
|
--replace-fail 'pgrep -c zellij' 'pgrep -c ${zellij}/bin/zellij'
|
||||||
|
chmod +x $out/bin/zellij-ps
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "A small project script for zellij";
|
||||||
|
license = lib.licenses.mit;
|
||||||
|
platforms = platforms.unix;
|
||||||
|
mainProgram = "zelli-ps";
|
||||||
|
};
|
||||||
|
}
|
144
templates/home-manager-module/default.nix
Normal file
144
templates/home-manager-module/default.nix
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
# Home Manager Module Template
|
||||||
|
# This is a template for creating new Home Manager modules in m3ta-nixpkgs
|
||||||
|
# Copy this template and modify it for your specific module
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.programs.myProgram; # Replace 'myProgram' with your program/module name
|
||||||
|
# Common locations: config.programs.*, config.services.*, config.m3ta.*
|
||||||
|
in {
|
||||||
|
# Define options that users can set in their Home Manager configuration
|
||||||
|
options.programs.myProgram = {
|
||||||
|
enable = mkEnableOption "my custom program"; # Replace with your program description
|
||||||
|
|
||||||
|
# Example: Package option
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.hello; # Replace with your package
|
||||||
|
defaultText = literalExpression "pkgs.hello";
|
||||||
|
description = "The package to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Example: String option
|
||||||
|
configDir = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "${config.xdg.configHome}/myprogram";
|
||||||
|
defaultText = literalExpression ''"''${config.xdg.configHome}/myprogram"'';
|
||||||
|
description = "Directory to store configuration";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Example: Boolean option
|
||||||
|
enableBashIntegration = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Whether to enable Bash integration";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Example: Attribute set for settings
|
||||||
|
settings = mkOption {
|
||||||
|
type = types.attrs;
|
||||||
|
default = {};
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
theme = "dark";
|
||||||
|
fontSize = 12;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
description = "Configuration settings written to config file";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Example: Lines of text (for config files)
|
||||||
|
extraConfig = mkOption {
|
||||||
|
type = types.lines;
|
||||||
|
default = "";
|
||||||
|
example = ''
|
||||||
|
# Custom configuration
|
||||||
|
option = value
|
||||||
|
'';
|
||||||
|
description = "Extra configuration to append to the config file";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Example: Environment variables
|
||||||
|
environmentVariables = mkOption {
|
||||||
|
type = types.attrsOf types.str;
|
||||||
|
default = {};
|
||||||
|
example = {MY_VAR = "value";};
|
||||||
|
description = "Environment variables to set";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Define what happens when the module is enabled
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# Add package to user profile
|
||||||
|
home.packages = [cfg.package];
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
home.sessionVariables = cfg.environmentVariables;
|
||||||
|
|
||||||
|
# Create configuration file
|
||||||
|
# Method 1: Using xdg.configFile
|
||||||
|
xdg.configFile."myprogram/config.conf" = {
|
||||||
|
text = ''
|
||||||
|
# Generated by Home Manager
|
||||||
|
${builtins.toJSON cfg.settings}
|
||||||
|
${cfg.extraConfig}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Method 2: Using home.file for non-XDG locations
|
||||||
|
# home.file.".myprogramrc".text = ''
|
||||||
|
# # Configuration here
|
||||||
|
# '';
|
||||||
|
|
||||||
|
# Example: Bash integration
|
||||||
|
programs.bash.initExtra = mkIf cfg.enableBashIntegration ''
|
||||||
|
# My program bash integration
|
||||||
|
eval "$(${cfg.package}/bin/myprogram init bash)"
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Example: Zsh integration
|
||||||
|
programs.zsh.initExtra = mkIf cfg.enableBashIntegration ''
|
||||||
|
# My program zsh integration
|
||||||
|
eval "$(${cfg.package}/bin/myprogram init zsh)"
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Example: Fish integration
|
||||||
|
# programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration ''
|
||||||
|
# ${cfg.package}/bin/myprogram init fish | source
|
||||||
|
# '';
|
||||||
|
|
||||||
|
# Example: Systemd user service
|
||||||
|
systemd.user.services.myprogram = {
|
||||||
|
Unit = {
|
||||||
|
Description = "My Program Service";
|
||||||
|
After = ["graphical-session.target"];
|
||||||
|
};
|
||||||
|
|
||||||
|
Service = {
|
||||||
|
Type = "simple";
|
||||||
|
ExecStart = "${cfg.package}/bin/myprogram daemon";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = 5;
|
||||||
|
};
|
||||||
|
|
||||||
|
Install = {
|
||||||
|
WantedBy = ["default.target"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Example: Create directories
|
||||||
|
# home.file."${cfg.configDir}/.keep".text = "";
|
||||||
|
|
||||||
|
# Example: Manage symlinks
|
||||||
|
# home.file."bin/myprogram".source = "${cfg.package}/bin/myprogram";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Module metadata (optional)
|
||||||
|
meta = {
|
||||||
|
maintainers = with lib.maintainers; []; # Add your name if in nixpkgs
|
||||||
|
};
|
||||||
|
}
|
136
templates/nixos-module/default.nix
Normal file
136
templates/nixos-module/default.nix
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
# NixOS Module Template
|
||||||
|
# This is a template for creating new NixOS modules in m3ta-nixpkgs
|
||||||
|
# Copy this template and modify it for your specific module
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
|
cfg = config.m3ta.myModule; # Replace 'myModule' with your module name
|
||||||
|
in {
|
||||||
|
# Define options that users can set in their configuration
|
||||||
|
options.m3ta.myModule = {
|
||||||
|
enable = mkEnableOption "my custom module"; # Replace with your module description
|
||||||
|
|
||||||
|
# Example: String option
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.hello; # Replace with your default package
|
||||||
|
defaultText = literalExpression "pkgs.hello";
|
||||||
|
description = "The package to use for this module";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Example: String option
|
||||||
|
dataDir = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "/var/lib/mymodule";
|
||||||
|
description = "Directory where data will be stored";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Example: Port number
|
||||||
|
port = mkOption {
|
||||||
|
type = types.port;
|
||||||
|
default = 8080;
|
||||||
|
description = "Port to listen on";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Example: String option
|
||||||
|
user = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "mymodule";
|
||||||
|
description = "User account under which the service runs";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Example: Group option
|
||||||
|
group = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "mymodule";
|
||||||
|
description = "Group under which the service runs";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Example: Boolean option
|
||||||
|
openFirewall = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Whether to open the firewall for the service port";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Example: List of strings
|
||||||
|
extraArgs = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [];
|
||||||
|
example = ["--verbose" "--debug"];
|
||||||
|
description = "Additional command-line arguments to pass";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Example: Attribute set (key-value pairs)
|
||||||
|
settings = mkOption {
|
||||||
|
type = types.attrs;
|
||||||
|
default = {};
|
||||||
|
example = literalExpression ''
|
||||||
|
{
|
||||||
|
logLevel = "info";
|
||||||
|
timeout = 30;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
description = "Configuration settings as attribute set";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Define what happens when the module is enabled
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# Create a system user
|
||||||
|
users.users.${cfg.user} = {
|
||||||
|
isSystemUser = true;
|
||||||
|
group = cfg.group;
|
||||||
|
home = cfg.dataDir;
|
||||||
|
createHome = true;
|
||||||
|
description = "My module service user";
|
||||||
|
};
|
||||||
|
|
||||||
|
users.groups.${cfg.group} = {};
|
||||||
|
|
||||||
|
# Define a systemd service
|
||||||
|
systemd.services.mymodule = {
|
||||||
|
description = "My Custom Module Service";
|
||||||
|
wantedBy = ["multi-user.target"];
|
||||||
|
after = ["network.target"];
|
||||||
|
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
User = cfg.user;
|
||||||
|
Group = cfg.group;
|
||||||
|
WorkingDirectory = cfg.dataDir;
|
||||||
|
ExecStart = "${cfg.package}/bin/myprogram ${concatStringsSep " " cfg.extraArgs}";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = 5;
|
||||||
|
|
||||||
|
# Security hardening
|
||||||
|
PrivateTmp = true;
|
||||||
|
NoNewPrivileges = true;
|
||||||
|
ProtectSystem = "strict";
|
||||||
|
ProtectHome = true;
|
||||||
|
ReadWritePaths = [cfg.dataDir];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Open firewall if requested
|
||||||
|
networking.firewall = mkIf cfg.openFirewall {
|
||||||
|
allowedTCPPorts = [cfg.port];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Add package to system packages (optional)
|
||||||
|
environment.systemPackages = [cfg.package];
|
||||||
|
|
||||||
|
# Example: Create configuration file
|
||||||
|
# environment.etc."mymodule/config.json".text = builtins.toJSON cfg.settings;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Module metadata
|
||||||
|
meta = {
|
||||||
|
maintainers = with lib.maintainers; []; # Add your name if in nixpkgs
|
||||||
|
doc = ./default.md; # Optional: Link to documentation
|
||||||
|
};
|
||||||
|
}
|
85
templates/package/default.nix
Normal file
85
templates/package/default.nix
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# Package Template
|
||||||
|
# This is a template for creating new packages in m3ta-nixpkgs
|
||||||
|
# Copy this template and modify it for your specific package
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
fetchFromGitHub,
|
||||||
|
# Add build dependencies here
|
||||||
|
# pkg-config,
|
||||||
|
# cmake,
|
||||||
|
# rustPlatform,
|
||||||
|
# python3,
|
||||||
|
# nodejs,
|
||||||
|
# Add runtime dependencies here
|
||||||
|
# openssl,
|
||||||
|
# libxml2,
|
||||||
|
}:
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "package-name"; # Replace with your package name
|
||||||
|
version = "0.1.0"; # Replace with actual version
|
||||||
|
|
||||||
|
# Source fetching - choose one method:
|
||||||
|
|
||||||
|
# Method 1: From GitHub
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "owner-name";
|
||||||
|
repo = "repo-name";
|
||||||
|
rev = "v${version}"; # or use a specific commit hash
|
||||||
|
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||||
|
# To get the correct hash, first set it to lib.fakeHash, then run:
|
||||||
|
# nix build .#package-name
|
||||||
|
# The error message will show the correct hash
|
||||||
|
};
|
||||||
|
|
||||||
|
# Method 2: From URL
|
||||||
|
# src = fetchurl {
|
||||||
|
# url = "https://example.com/package-${version}.tar.gz";
|
||||||
|
# hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||||
|
# };
|
||||||
|
|
||||||
|
# Build-time dependencies (tools needed to build the package)
|
||||||
|
nativeBuildInputs = [
|
||||||
|
# pkg-config
|
||||||
|
# cmake
|
||||||
|
# makeWrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
# Runtime dependencies (libraries needed at runtime)
|
||||||
|
buildInputs = [
|
||||||
|
# openssl
|
||||||
|
# libxml2
|
||||||
|
];
|
||||||
|
|
||||||
|
# Build phase (optional, only if you need custom build steps)
|
||||||
|
# buildPhase = ''
|
||||||
|
# make
|
||||||
|
# '';
|
||||||
|
|
||||||
|
# Install phase (optional, only if you need custom install steps)
|
||||||
|
# installPhase = ''
|
||||||
|
# mkdir -p $out/bin
|
||||||
|
# cp binary $out/bin/
|
||||||
|
# '';
|
||||||
|
|
||||||
|
# Post-install hook (optional, for wrapping binaries, etc.)
|
||||||
|
# postInstall = ''
|
||||||
|
# wrapProgram $out/bin/program \
|
||||||
|
# --prefix PATH : ${lib.makeBinPath [ dependency ]}
|
||||||
|
# '';
|
||||||
|
|
||||||
|
# Metadata - REQUIRED
|
||||||
|
meta = with lib; {
|
||||||
|
description = "A short description of the package";
|
||||||
|
longDescription = ''
|
||||||
|
A longer, more detailed description of what the package does.
|
||||||
|
This can span multiple lines.
|
||||||
|
'';
|
||||||
|
homepage = "https://github.com/owner/repo";
|
||||||
|
changelog = "https://github.com/owner/repo/releases/tag/v${version}";
|
||||||
|
license = licenses.mit; # Change to appropriate license
|
||||||
|
maintainers = with maintainers; []; # Add your name if you're in nixpkgs
|
||||||
|
platforms = platforms.linux; # or platforms.unix, platforms.all, etc.
|
||||||
|
mainProgram = "program-name"; # The main executable name
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user