Nix User Repo for Atmosphere projects
1# SPDX-FileCopyrightText: atproto-nix.org 2026
2# SPDX-License-Identifier: CC0-1.0 OR Unlicense
3{
4 description = "atproto-nix.org nix user repository for atproto projects";
5 inputs = {
6 nixpkgs.url = "github:NixOS/nixpkgs?ref=25.11";
7 git-hooks.url = "github:cachix/git-hooks.nix";
8 alejandra.url = "github:kamadorueda/alejandra/4.0.0";
9 alejandra.inputs.nixpkgs.follows = "nixpkgs";
10 statix.url = "git+https://tangled.org/oppi.li/statix";
11 deadnix.url = "github:astro/deadnix";
12 };
13 outputs = inputs @ {
14 self,
15 nixpkgs,
16 ...
17 }: let
18 forAllSystems = function:
19 nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (
20 system:
21 function (
22 import nixpkgs {
23 inherit system;
24 config.allowUnfree = true;
25 }
26 )
27 );
28 in {
29 packages = forAllSystems (pkgs: import ./pkgs/default.nix {inherit pkgs;});
30
31 # Run the hooks with `nix fmt`.
32 formatter = forAllSystems (
33 pkgs: let
34 inherit (self.checks.${pkgs.system}.pre-commit-check) config;
35 inherit (config) package configFile;
36 script = ''
37 ${pkgs.lib.getExe package} run --all-files --config ${configFile}
38 '';
39 in
40 pkgs.writeShellScriptBin "pre-commit-run" script
41 );
42
43 # Run the hooks in a sandbox with `nix flake check`.
44 # Read-only filesystem and no internet access.
45 checks = forAllSystems (pkgs: {
46 pre-commit-check = inputs.git-hooks.lib.${pkgs.system}.run {
47 src = ./.;
48 hooks = {
49 alejandra.enable = true;
50 reuse.enable = true;
51 reuse.excludes = ["flake.lock"];
52 statix.enable = true;
53 deadnix.enable = true;
54 };
55 };
56 });
57
58 devShells = forAllSystems (pkgs: {
59 default = let
60 inherit (self.checks.${pkgs.system}.pre-commit-check) shellHook enabledPackages;
61 in
62 pkgs.mkShell {
63 inherit shellHook;
64 buildInputs = enabledPackages;
65 };
66 });
67 };
68}