ALPHA: wire is a tool to deploy nixos systems
wire.althaea.zone/
1{
2 inputs = {
3 flake-parts.url = "github:hercules-ci/flake-parts";
4 flake-compat.url = "https://git.lix.systems/lix-project/flake-compat/archive/main.tar.gz";
5 git-hooks.url = "github:cachix/git-hooks.nix";
6 systems.url = "github:nix-systems/default";
7 crane.url = "github:ipetkov/crane";
8 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
9 fenix.url = "github:nix-community/fenix";
10 fenix.inputs.nixpkgs.follows = "nixpkgs";
11 treefmt-nix.url = "github:numtide/treefmt-nix";
12
13 # determines systems available for deployment
14 linux-systems.url = "github:nix-systems/default-linux";
15
16 # testing inputs
17 nixpkgs_current_stable.url = "github:NixOS/nixpkgs/nixos-25.11";
18
19 # benchmarking
20 colmena_benchmarking.url = "github:zhaofengli/colmena/v0.4.0";
21 };
22 outputs =
23 {
24 self,
25 flake-parts,
26 systems,
27 git-hooks,
28 crane,
29 treefmt-nix,
30 ...
31 }@inputs:
32 flake-parts.lib.mkFlake { inherit inputs; } {
33 imports = [
34 git-hooks.flakeModule
35 treefmt-nix.flakeModule
36 ./nix/hooks.nix # pre-commit hooks
37 ./nix/utils.nix # utility functions
38 ./nix/shells.nix
39 ./nix/tests.nix
40 ./crates/cli
41 ./crates/key_agent
42 ./doc
43 ./tests/nix
44 ./runtime
45 ./bench/runner.nix
46 ];
47 systems = import systems;
48
49 flake = {
50 makeHive = import ./runtime/makeHive.nix;
51 hydraJobs =
52 let
53 inherit (inputs.nixpkgs) lib;
54 in
55 {
56 packages = {
57 inherit (self.packages.x86_64-linux) docs;
58 }
59 // lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] (system: {
60 inherit (self.packages.${system}) wire wire-small cargo-tests;
61 });
62
63 tests = lib.filterAttrs (n: _: (lib.hasPrefix "vm" n)) self.checks.x86_64-linux;
64 inherit (self) devShells;
65 };
66 };
67
68 perSystem =
69 {
70 pkgs,
71 inputs',
72 config,
73 lib,
74 ...
75 }:
76 {
77 _module.args = {
78 toolchain = inputs'.fenix.packages.complete;
79 craneLib = (crane.mkLib pkgs).overrideToolchain config._module.args.toolchain.toolchain;
80 inherit self;
81 };
82 treefmt = {
83 programs = {
84 # rfc style
85 nixfmt.enable = true;
86 # docs only
87 alejandra.enable = true;
88 rustfmt.enable = true;
89 prettier.enable = true;
90 protolint.enable = true;
91 taplo.enable = true;
92 ruff-format.enable = true;
93 };
94 settings.formatter = {
95 nixfmt.excludes = [ "doc/snippets/*.nix" ];
96 prettier.excludes = [ ".sqlx/*" ];
97 alejandra = {
98 includes = lib.mkForce [ "doc/snippets/*.nix" ];
99 };
100 };
101 };
102 };
103 };
104}