-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
149 lines (131 loc) · 5.75 KB
/
flake.nix
File metadata and controls
149 lines (131 loc) · 5.75 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
139
140
141
142
143
144
145
146
147
148
149
{
description = "SourceOS Linux realization root";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
lampstand-src = {
url = "github:SocioProphet/lampstand";
flake = false;
};
};
outputs = { self, nixpkgs, lampstand-src }:
let
lib = nixpkgs.lib;
systems = [ "x86_64-linux" "aarch64-linux" ];
forAllSystems = f: lib.genAttrs systems (system: f system);
in {
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
packages = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in rec {
meshd = pkgs.callPackage ./packages/mesh/meshd.nix { };
meshd-linkd = pkgs.callPackage ./packages/mesh/meshd-linkd.nix { };
meshd-exitd = pkgs.callPackage ./packages/mesh/meshd-exitd.nix { };
lampstand = pkgs.callPackage ./packages/search/lampstand.nix {
inherit lampstand-src;
};
default = meshd;
});
devShells = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
workstationV0Names = [
"git" "jq" "nixpkgs-fmt"
"fzf" "atuin" "bat" "zoxide" "yazi" "eza" "gum" "direnv" "tldr" "fd" "ripgrep"
"sd"
"lazygit" "gh" "diff-so-fancy" "tig" "svu"
"tmux" "sesh" "mprocs" "procs" "lazydocker" "k9s" "btop"
"jnv" "gojq" "fx" "jless" "jqp"
"dua" "dust" "kondo"
"glow" "hyperfine" "entr" "curlie"
"rclone" "rsync" "minio-client"
"albert"
];
haveAttr = n: builtins.hasAttr n pkgs;
missing = lib.filter (n: !(haveAttr n)) workstationV0Names;
presentPkgs = lib.filter (p: p != null) (map (n: if haveAttr n then pkgs.${n} else null) workstationV0Names);
missingStr = lib.concatStringsSep " " missing;
in {
default = pkgs.mkShell {
packages = with pkgs; [ git jq nixpkgs-fmt ];
shellHook = ''
echo "SourceOS Linux development shell"
echo "See docs/repository-layout.md, docs/agentplane-integration.md, and docs/mesh/README.md"
'';
};
workstation-v0 = pkgs.mkShell {
packages = presentPkgs ++ [ self.packages.${system}.lampstand ];
shellHook = ''
echo "SourceOS Workstation v0 dev shell"
echo "See docs/workstation/README.md"
if [ -n "${missingStr}" ]; then
echo "NOTE: missing nixpkgs attrs (not added): ${missingStr}"
fi
'';
};
});
nixosConfigurations = {
builder-aarch64 = lib.nixosSystem {
system = "aarch64-linux";
specialArgs = { inherit self; };
modules = [ ./hosts/builder-aarch64/default.nix ];
};
canary-x86_64 = lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit self; };
modules = [ ./hosts/canary-x86_64/default.nix ];
};
stable-x86_64 = lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit self; };
modules = [ ./hosts/stable-x86_64/default.nix ];
};
exit-x86_64 = lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit self; };
modules = [ ./hosts/exit-x86_64/default.nix ];
};
};
checks = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in lib.optionalAttrs (system == "x86_64-linux" || system == "aarch64-linux") {
builder-aarch64-smoke =
if system == "aarch64-linux"
then import ./tests/builder-aarch64-contract.nix { inherit pkgs; }
else pkgs.runCommand "builder-aarch64-smoke-skip" {} ''
mkdir -p $out
'';
canary-x86_64-smoke =
if system == "x86_64-linux"
then import ./tests/canary-x86_64-contract.nix { inherit pkgs; }
else pkgs.runCommand "canary-x86_64-smoke-skip" {} ''
mkdir -p $out
'';
stable-x86_64-smoke =
if system == "x86_64-linux"
then import ./tests/stable-x86_64-contract.nix { inherit pkgs; }
else pkgs.runCommand "stable-x86_64-smoke-skip" {} ''
mkdir -p $out
'';
exit-x86_64-smoke =
if system == "x86_64-linux"
then import ./tests/exit-x86_64-contract.nix { inherit pkgs; }
else pkgs.runCommand "exit-x86_64-smoke-skip" {} ''
mkdir -p $out
'';
mesh-module-contract = import ./tests/mesh-module-contract.nix { inherit pkgs; };
mesh-runtime-contract = import ./tests/mesh-runtime-contract.nix { inherit pkgs; };
mesh-package-contract = import ./tests/mesh-package-contract.nix { inherit pkgs; };
mesh-host-runtime-contract = import ./tests/mesh-host-runtime-contract.nix { inherit pkgs; };
sourceos-shell-module-contract = import ./tests/sourceos-shell-module-contract.nix { inherit pkgs; };
sourceos-shell-pdf-stack-contract = import ./tests/sourceos-shell-pdf-stack-contract.nix { inherit pkgs; };
meshd-package = self.packages.${system}.meshd;
meshd-linkd-package = self.packages.${system}.meshd-linkd;
meshd-exitd-package = self.packages.${system}.meshd-exitd;
lampstand-package = self.packages.${system}.lampstand;
});
sourceos = {
channels = [ "dev" "candidate" "stable" ];
notes = "This flake is the Linux realization root. Control-plane semantics live in SocioProphet/agentplane and shared channel/capability schemas live in SocioProphet/socioprophet-agent-standards.";
};
};
}