Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
138 lines (128 loc) · 4.27 KB
/
Copy pathflake.nix
File metadata and controls
138 lines (128 loc) · 4.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
{
description = "Nix-built OCI image for exe.dev machines";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
assistant.url = "github:ngalaiko/assistant";
nix-darwin = {
url = "github:nix-darwin/nix-darwin/nix-darwin-26.05";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-26.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim/nixos-26.05";
inputs.nixpkgs.follows = "nixpkgs";
};
# Installs and owns the Homebrew prefix itself, so a fresh Mac doesn't need
# brew pre-installed — the first darwin-rebuild switch bootstraps it. The
# nix-darwin `homebrew` module only manages an already-installed brew.
# (No nixpkgs input to follow; it pins Homebrew/brew via its own brew-src.)
nix-homebrew.url = "github:zhaofengli/nix-homebrew";
# One `nix fmt` / `nix flake check` gate over the whole tree (nix, python,
# shell, yaml) instead of nix-only. Config lives in ./treefmt.nix.
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# encore binaries
encore = {
url = "github:encoredev/encore-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
# dash0 cli
dash0-cli = {
url = "github:dash0hq/dash0-cli";
inputs.nixpkgs.follows = "nixpkgs";
};
# encore shared agent skills (private; fetched over ssh)
encore-agents-setup = {
url = "git+ssh://git@github.com/encoredev/agents-setup";
flake = false;
};
};
outputs =
inputs@{
self,
nixpkgs,
nix-darwin,
...
}:
let
lib = nixpkgs.lib;
linuxSystems = [
"x86_64-linux"
"aarch64-linux"
];
# darwin builds the matching-arch Linux image via the linux-builder VM.
darwinToLinux = {
"aarch64-darwin" = "aarch64-linux";
"x86_64-darwin" = "x86_64-linux";
};
allSystems = linuxSystems ++ builtins.attrNames darwinToLinux;
linuxOf = system: darwinToLinux.${system} or system;
configFor =
linuxSystem:
(import ./modules/exedev {
pkgs = nixpkgs.legacyPackages.${linuxSystem};
specialArgs = { inherit inputs; };
}).eval
./hosts/exedev;
releaseFor = system: import ./packages/release { pkgs = nixpkgs.legacyPackages.${system}; };
treefmtFor =
system: inputs.treefmt-nix.lib.evalModule nixpkgs.legacyPackages.${system} ./treefmt.nix;
in
{
# This Mac, configured with a Linux builder VM (so it can build *-linux).
darwinConfigurations.macbook = nix-darwin.lib.darwinSystem {
specialArgs = { inherit inputs; };
modules = [ ./hosts/macbook ];
};
# `nix build .#exedev` (base image) or `.#system` (the in-place generation);
# `.#packages.<sys>.{exedev,system}` for a specific arch.
packages = lib.genAttrs allSystems (
system:
let
cfg = configFor (linuxOf system);
in
{
exedev = cfg.build.image;
system = cfg.build.system;
default = cfg.build.image;
}
// releaseFor system
);
devShells = lib.genAttrs allSystems (system: {
default =
let
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.mkShell {
packages = [
pkgs.gh
pkgs.gitMinimal
pkgs.regctl
pkgs.jujutsu
pkgs.skopeo
]
++ lib.attrValues (releaseFor system);
};
});
formatter = lib.genAttrs allSystems (system: (treefmtFor system).config.build.wrapper);
# `nix flake check` fails if the tree isn't treefmt-clean. CI relies on this
# instead of a bespoke `nix fmt && git diff` step.
checks = lib.genAttrs allSystems (
system:
{
formatting = (treefmtFor system).config.build.check self;
}
// lib.optionalAttrs (lib.elem system linuxSystems) {
s6-runtime = import ./packages/s6-overlay/test.nix {
pkgs = nixpkgs.legacyPackages.${system};
};
}
);
};
}