Reproducible dotfiles in nix
1{
2 description = "Example Darwin system flake";
3
4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
6 nix-darwin.url = "github:LnL7/nix-darwin";
7 nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
8 home-manager.url = "github:nix-community/home-manager";
9 home-manager.inputs.nixpkgs.follows = "nixpkgs";
10 zig.url = "github:mitchellh/zig-overlay";
11 zls-flake = {
12 url = "github:zigtools/zls";
13 inputs.nixpkgs.follows = "nixpkgs";
14 };
15 superhtml.url = "https://flakehub.com/f/ethanholz/superhtml-flake/0.6.2.tar.gz";
16 ziggy.url = "github:kristoff-it/ziggy";
17 carbonfox = {
18 url = "https://raw.githubusercontent.com/EdenEast/nightfox.nvim/refs/heads/main/extra/carbonfox/carbonfox.ghostty";
19 flake = false;
20 };
21 determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/3";
22 flake-parts.url = "github:hercules-ci/flake-parts";
23 git-hooks-nix = {
24 url = "github:cachix/git-hooks.nix";
25 inputs.nixpkgs.follows = "nixpkgs";
26 };
27 };
28
29 outputs = inputs @ {self, ...}: let
30 mkDarwin = self.my_lib.mkDarwin {};
31 mkStandalone = self.my_lib.mkStandalone {};
32 in
33 inputs.flake-parts.lib.mkFlake {inherit inputs;} {
34 flake = {
35 my_lib = import ./lib {inherit inputs;};
36 darwinConfigurations."Ethans-Laptop" = mkDarwin {
37 system = "aarch64-darwin";
38 };
39 };
40
41 systems = ["aarch64-darwin"];
42 perSystem = {
43 pkgs,
44 system,
45 ...
46 }: let
47 pre-commit-config = {
48 src = ./.;
49 hooks = {
50 alejandra.enable = true;
51 flake-checker.enable = true;
52 };
53 };
54 in {
55 formatter = let
56 config = (inputs.git-hooks-nix.lib.${system}.run pre-commit-config).config;
57 inherit (config) package configFile;
58 script = ''
59 ${pkgs.lib.getExe package} run --all-files --config ${configFile}
60 '';
61 in
62 pkgs.writeShellScriptBin "pre-commit-run" script;
63
64 # # Run the hooks in a sandbox with `nix flake check`.
65 # # Read-only filesystem and no internet access.
66 # checks = {
67 # pre-commit-check = inputs.git-hooks-nix.lib.${system}.run pre-commit-config;
68 # };
69
70 devShells.default = pkgs.mkShell {
71 buildInputs = [pkgs.just pkgs.jq];
72 };
73 };
74 };
75 nixConfig = {
76 extra-substituters = ["https://attic-testing.fly.dev/system"];
77 extra-trusted-public-keys = ["system:jO6HbDP3xnQbHy/llnSubs8NPK7cVWwG827k6inRZkY="];
78 };
79}