![Logo](https://avatars.githubusercontent.com/u/1778670?v=4)
NixOS Config for Khaneliman
Welcome to khanelinix, a personal Nix configuration repository. This repository contains my NixOS and Nixpkgs configurations, along with various tools and customizations to enhance the Nix experience.
Before diving in, ensure that you have Nix installed on your system. If not, you can download and install it from the official Nix website or from the Determinate Systems installer. If running on macOS, you need to have Nix-Darwin installed, as well. You can follow the installation instruction on GitHub.
git clone https://github.com/khaneliman/khanelinix.git
cd khanelinix
# linux
sudo nixos-rebuild switch --flake .
# macos
darwin-rebuild switch --flake .
# with direnv
flake switch
Here's an overview of what my Nix configuration offers:
-
External Dependency Integrations:
- Nixvim neovim configuration.
- Access the Nix User Repository (NUR) for additional packages and enhancements.
- Incorporate Nixpkgs-Wayland to provide an up-to-date Wayland package repository.
-
macOS Support: Seamlessly configure and manage Nix on macOS using the power of Nix-darwin, also leveraging homebrew for GUI applications.
-
Home Manager: Manage your dotfiles, home environment, and user-specific configurations with Home Manager.
-
DevShell Support: The flake provides a development shell (
devShell
) to support maintaining this flake. You can use the devShell for convenient development and maintenance of your Nix environment. -
CI with Cachix: The configuration includes continuous integration (CI) that pushes built artifacts to Cachix. This ensures efficient builds and reduces the need to build dependencies on your local machine.
-
Utilize sops-nix: Secret management with sops-nix for secure and encrypted handling of sensitive information.
My Nix configuration, based on the SnowfallOrg lib structure, provides a flexible and organized approach to managing your Nix environment. Here's how it works:
-
Custom Library: An optional custom library in the
lib/
directory contains a Nix function called withinputs
,snowfall-inputs
, andlib
. The function should return an attribute set to merge withlib
. -
Modular Directory Structure: You can create any (nestable) directory structure within
lib/
,packages/
,modules/
,overlays/
,systems/
, andhomes/
. Each directory should contain a Nix function that returns an attribute set to merge with the corresponding section. -
Package Overlays: The
packages/
directory includes an optional set of packages to export. Each package is instantiated withcallPackage
, and the files should contain functions that take an attribute set of packages and the requiredlib
to return a derivation. -
Modules for Configuration: In the
modules/
directory, you can define NixOS modules for various platforms, such asnixos
,darwin
, andhome
. This modular approach simplifies system configuration management. -
Custom Overlays: The
overlays/
directory is for optional custom overlays. Each overlay file should contain a function that takes three arguments: an attribute set of your flake's inputs and achannels
attribute containing all available channels, the final set ofpkgs
, and the previous set ofpkgs
. This allows you to customize package sets effectively. -
System Configurations: The
systems/
directory organizes system configurations based on architecture and format. You can create configurations for different architectures and formats, such asx86_64-linux
,aarch64-darwin
, and more. -
Home Configurations: Similar to system configurations, the
homes/
directory organizes home configurations based on architecture and format. This is especially useful if you want to manage home environments with Nix.
This structured approach to Nix configuration makes it easier to manage and customize your Nix environment while maintaining flexibility and modularity.
Run packages directly with:
nix run github:khaneliman/khanelinix#packageName
Or install from the packages
output. For example:
# flake.nix
{
inputs.khanelinix = {
url = "github:khaneliman/khanelinix";
inputs.nixpkgs.follows = "nixpkgs";
};
}
# configuration.nix
{pkgs, inputs, system, ...}: {
environment.systemPackages = [
inputs.khanelinix.packages."${system}".packageName
];
}
![image](https://private-user-images.githubusercontent.com/1778670/311476789-abbd501e-60c4-46c3-927d-12890dadd811.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM3MjEzNzksIm5iZiI6MTcyMzcyMTA3OSwicGF0aCI6Ii8xNzc4NjcwLzMxMTQ3Njc4OS1hYmJkNTAxZS02MGM0LTQ2YzMtOTI3ZC0xMjg5MGRhZGQ4MTEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MTVUMTEyNDM5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTIzMjkzYmQwZjJiMGFhYWE0MTYxZDY4NWM3NzM3ZjNlZGI4ZGZjNjc1MzQ1MzQ5ZmE1Y2I2MmYzOTA2ZDAxNyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.EUruAlmjRjyIs4teQ5IhEa9wC1guxFCkpgn8rB9gNf4)
Other configurations from where I learned and copied:
- JakeHamilton/config *Main inspiration and started with
- FelixKrats/dotfiles *Sketchybar design and implementation
- Fufexan/dotfiles
- NotAShelf/nyx