first
This commit is contained in:
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user