124 lines
3.2 KiB
Nix
124 lines
3.2 KiB
Nix
{
|
|
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;
|
|
# Individual modules for selective imports
|
|
ports = ./modules/nixos/ports.nix;
|
|
};
|
|
|
|
# Home Manager modules - for user-level configuration
|
|
homeManagerModules = {
|
|
default = import ./modules/home-manager;
|
|
ports = import ./modules/home-manager/ports.nix;
|
|
zellij-ps = import ./modules/home-manager/zellij-ps.nix;
|
|
};
|
|
|
|
# Library functions - helper utilities for your configuration
|
|
lib = forAllSystems (
|
|
system: let
|
|
pkgs = pkgsFor system;
|
|
in
|
|
import ./lib {lib = pkgs.lib;}
|
|
);
|
|
|
|
# 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";
|
|
};
|
|
};
|
|
};
|
|
}
|