my-nix.
Table of Contents
my-nix
Public Nix files extracted from my larger setup.
Current public building blocks include:
pkgs/frs-nvim: portable Neovim wrapper config exposed via this repo's flakepackagesandappslib/mkAgentBoxImage.nix: image builder for environments intended to run insideagent-box, exposed via this repo's flake aslib.mkAgentBoxImagehomeManagerModules.vcs: generic reusable Home Manager VCS identity projection modulehomeConfigs.fr: publicfrHome Manager config intended to be imported from a private configurationnixosConfigs.fr: publicfrNixOS config intended to be imported from a private configuration
Layout pattern
This repo separates generic reusable modules from public fr config:
modules/home/*: generic reusable Home Manager modules. These should be broadly useful and contain no personal identity/private host config.modules/nixos/*: generic reusable NixOS modules.config/fr/home.nix: publicfrHome Manager config consumed by private configs.config/fr/nixos.nix: publicfrNixOS config consumed by private configs.
Root flake exports them separately:
homeManagerModules.vcsexportsmodules/home/vcs.nixnixosModules.k3sMicrovmexportsmodules/nixos/k3s-microvm.nixhomeConfigs.frexportsconfig/fr/home.nixnixosConfigs.frexportsconfig/fr/nixos.nix
Public fr config should be gated behind fr.public.enable and use lib.mkDefault for values that a private repo may override. Generic modules should expose narrowly-scoped options and let users configure upstream Home Manager/NixOS modules directly where possible.
Public fr config pattern
This repo can export public Home Manager and NixOS config consumed from a private flake.
Current NixOS baseline:
- gates public config behind
fr.public.enable - keeps Home Manager baseline minimal for user-level config
- puts
ghmdin NixOS, not Home Manager - imports upstream
ghmd.nixosModules.default - enables upstream
services.ghmd - enables a Caddy vhost for
http://ghmd.localhost - serves Rust docs at
http://rustdoc.localhost - maps
ghmd.localhostandrustdoc.localhostto127.0.0.1withnetworking.hosts - sets opinionated defaults on upstream
services.ghmd:host = "127.0.0.1"port = 9000theme = "gruvbox"rootDir = /home/<user>derived fromfr.public.userunlessfr.public.homeDiroverrides it
Example private usage:
{
inputs.my-nix.url = "github:0xferrous/my-nix";
outputs = { nixpkgs, home-manager, my-nix, ... }: {
nixosConfigurations.machine = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
my-nix.nixosConfigs.fr
{
fr.public.enable = true;
fr.public.user = "dmnt";
# optional private overrides
fr.public.ghmd.domain = "ghmd.localhost";
services.ghmd.rootDir = /srv/docs;
}
];
};
homeConfigurations.me = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { system = "x86_64-linux"; };
modules = [
my-nix.homeConfigs.fr
{
fr.public.enable = true;
}
];
};
};
}
Notes:
- Caddy pattern follows NixOS-style
virtualHosts."http://...".extraConfig ghmd.localhostresolution comes fromnetworking.hosts, not Caddy alone- ghmd service itself comes from upstream
ghmdflake NixOS module - default ghmd content root is
/home/<fr.public.user>unlessfr.public.homeDirorservices.ghmd.rootDiroverrides it - default public URLs are
http://ghmd.localhostandhttp://rustdoc.localhost