Files
NixOS/modules/dev/nix/common.nix
2026-03-16 15:49:43 -06:00

46 lines
839 B
Nix
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
pkgs,
hostName ? null,
}:
let
packages = builtins.attrValues {
inherit (pkgs)
nixfmt-rfc-style
cachix
nixd
deadnix
statix
mcp-nixos
;
};
in
{
inherit packages;
devShell = pkgs.mkShell {
inherit packages;
name = "nix-dev-shell";
shellHook = ''
echo " Nix dev environment"
'';
};
shellAliases = {
nixformat = ''
deadnix -e && \
nix run nixpkgs#nixfmt-tree && \
statix fix
'';
}
// (
if hostName == null then
{ }
else
{
nix-push-cache = ''
nix build $NH_FLAKE#nixosConfigurations.${hostName}.config.system.build.toplevel \
--print-out-paths --fallback --max-jobs 100 --cores 0 |
nix run nixpkgs#attic-client -- push lan:nixos --stdin
'';
}
);
}