Skip to content

Commit 6984be9

Browse files
committed
feat: add larva
1 parent 9c04c5e commit 6984be9

11 files changed

+571
-622
lines changed

.editorconfig

+22-30
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,27 @@
1-
# Editor configuration, see http://editorconfig.org
2-
root = true
1+
root=true
32

43
[*]
5-
end_of_line = lf
6-
insert_final_newline = true
7-
trim_trailing_whitespace = true
8-
charset = utf-8
9-
indent_style = space
10-
indent_size = unset
4+
charset=utf-8
5+
end_of_line=lf
6+
indent_size=2
7+
indent_style=space
8+
insert_final_newline=true
9+
trim_trailing_whitespace=true
1110

12-
[*.{js,ts,rs}]
13-
indent_size = 4
14-
15-
[*.{nix,nu,hs,sh}]
16-
indent_size = 2
17-
18-
# Ignore diffs/patches
19-
[*.{lock,diff,patch}]
20-
end_of_line = unset
21-
insert_final_newline = unset
22-
trim_trailing_whitespace = unset
23-
indent_size = unset
11+
[*.md]
12+
max_line_length=off
13+
trim_trailing_whitespace=false
2414

25-
[{.*,secrets}/**]
26-
end_of_line = unset
27-
insert_final_newline = unset
28-
trim_trailing_whitespace = unset
29-
charset = unset
30-
indent_style = unset
31-
indent_size = unset
15+
[*.{diff,patch}]
16+
end_of_line=unset
17+
indent_size=unset
18+
insert_final_newline=unset
19+
trim_trailing_whitespace=unset
3220

33-
[*.md]
34-
max_line_length = off
35-
trim_trailing_whitespace = false
21+
[{LICENSES/**,LICENSE}]
22+
charset=unset
23+
end_of_line=unset
24+
indent_size=unset
25+
indent_style=unset
26+
insert_final_newline=unset
27+
trim_trailing_whitespace=unset

.envrc

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
watch_file shell/* flake.nix flake.lock
2-
use flake || use nix
1+
#!/bin/sh
2+
3+
source_url \
4+
"https://raw.githubusercontent.com/divnix/std/main/direnv_lib.sh" \
5+
"sha256-VUQ8udjXodlT6JyUZ+0Nq3T6NBVhyoU34vzWVux79wo="
6+
use std . //_queen/devshells:default

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@ result
33
doc/index.html
44

55
pkgs/_sources/.shake*
6+
7+
.std
8+
9+
# nixago: ignore-linked-files
10+
.conform.yaml
11+
lefthook.yml
12+
treefmt.toml

comb/_queen/colmenaConfigurations.nix

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
inputs,
3+
cell,
4+
}: let
5+
inherit (cell) nixosSuites;
6+
in {
7+
larva = {
8+
bee.system = "x86_64-linux";
9+
bee.pkgs = inputs.nixpkgs.legacyPackages;
10+
deployment = {
11+
targetHost = "fe80::47";
12+
targetPort = 22;
13+
targetUser = "root";
14+
allowLocalDeployment = false;
15+
buildOnTarget = false;
16+
};
17+
imports = [nixosSuites.larva];
18+
};
19+
}

comb/_queen/devshells.nix

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
inputs,
3+
cell,
4+
}: let
5+
lib = inputs.nixpkgs.lib // builtins;
6+
in
7+
lib.mapAttrs (_: inputs.std.lib.dev.mkShell) {
8+
default = {...}: {
9+
name = "Hive";
10+
nixago = with inputs.std-data-collection.data.configs; [
11+
treefmt
12+
lefthook
13+
editorconfig
14+
(conform {data = {inherit (inputs) cells;};})
15+
];
16+
commands = let
17+
inherit (inputs) disko nixos-generators colmena;
18+
hexagon = attrset: attrset // {category = "hexagon";};
19+
in [
20+
(hexagon {package = disko.packages.disko;})
21+
(hexagon {package = colmena.packages.colmena;})
22+
(hexagon {package = nixos-generators.packages.nixos-generate;})
23+
(hexagon {
24+
name = "spawn-larva";
25+
help = "Spawns larva, the x86_64-linux iso bootstrapper.";
26+
command = ''
27+
echo "Boostrap image is building..."
28+
if path=$(nix build $PRJ_ROOT#nixosConfigurations._queen-o-larva.config.system.build.isoImage --print-out-paths);
29+
then
30+
echo "Boostrap image build finished."
31+
else
32+
echo "Boostrap image build failed."
33+
fi
34+
'';
35+
})
36+
];
37+
};
38+
}

comb/_queen/nixosConfigurations.nix

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
inputs,
3+
cell,
4+
}: let
5+
inherit (cell) nixosSuites;
6+
in {
7+
larva = {
8+
bee.system = "x86_64-linux";
9+
bee.pkgs = inputs.nixpkgs;
10+
imports = [nixosSuites.larva];
11+
};
12+
}

comb/_queen/nixosProfiles.nix

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
inputs,
3+
cell,
4+
}: let
5+
inherit (inputs) nixpkgs nixos-generators;
6+
lib = nixpkgs.lib // builtins;
7+
in {
8+
bootstrap = {
9+
config,
10+
options,
11+
pkgs,
12+
...
13+
}: {
14+
imports = [
15+
nixos-generators.nixosModules.install-iso
16+
];
17+
18+
nix = {
19+
# only part of ./modules/profiles/channels.nix since 22.11
20+
registry.nixpkgs.flake.outPath = builtins.path {
21+
name = "source";
22+
path = pkgs.path;
23+
};
24+
package = nixpkgs.nix;
25+
extraOptions = ''
26+
experimental-features = nix-command flakes recursive-nix
27+
'';
28+
};
29+
30+
networking.domain = "local";
31+
32+
# Provide networkmanager for easy wireless configuration.
33+
networking.networkmanager.enable = true;
34+
networking.networkmanager.wifi.backend = "iwd";
35+
networking.wireless.enable = lib.mkForce false;
36+
networking.wireless.iwd.enable = true;
37+
services.getty.helpLine =
38+
''
39+
The "nixos" and "root" accounts have empty passwords.
40+
41+
An ssh daemon is running. You then must set a password
42+
for either "root" or "nixos" with `passwd` or add an ssh key
43+
to /home/nixos/.ssh/authorized_keys be able to login.
44+
''
45+
+ lib.optionalString config.services.xserver.enable ''
46+
47+
Type `sudo systemctl start display-manager' to
48+
start the graphical user interface.
49+
'';
50+
51+
isoImage = {
52+
isoBaseName = "bootstrap-hive-from-queen";
53+
contents = [
54+
{
55+
source = inputs.self;
56+
target = "/hive/";
57+
}
58+
];
59+
};
60+
61+
systemd.network = {
62+
# https://www.freedesktop.org/software/systemd/man/systemd.network.html
63+
networks."boostrap-link-local" = {
64+
matchConfig = {
65+
Name = "en* wl* ww*";
66+
};
67+
networkConfig = {
68+
Description = "Link-local host bootstrap network";
69+
MulticastDNS = true;
70+
LinkLocalAddressing = "ipv6";
71+
DHCP = "yes";
72+
};
73+
address = [
74+
# fall back well-known link-local for situations where MulticastDNS is not available
75+
"fe80::47" # 47: n=14 i=9 x=24; n+i+x
76+
];
77+
extraConfig = ''
78+
# Unique, yet stable. Based off the MAC address.
79+
IPv6LinkLocalAddressGenerationMode = "eui64"
80+
'';
81+
};
82+
};
83+
};
84+
}

comb/_queen/nixosSuites.nix

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
inputs,
3+
cell,
4+
}: let
5+
inherit (cell) nixosProfiles;
6+
in {
7+
larva = {
8+
imports = [
9+
nixosProfiles.bootstrap
10+
];
11+
};
12+
}

0 commit comments

Comments
 (0)