git.delta.rocks / jrsonnet / refs/commits / 6899c702106b

difftreelog

fix(readme) make basic example compilable

Petr Portnov2024-11-11parent: #05eadde.patch.diff
in: trunk

1 file changed

modifiedREADME.adocdiffbeforeafterboth
30 inputs.nixpkgs.follows = "nixpkgs";30 inputs.nixpkgs.follows = "nixpkgs";
31 };31 };
32 };32 };
33 outputs = inputs: flake-parts.lib.mkFlake { inherit inputs; } {33 outputs = inputs @ {
34 nixpkgs,
35 flake-parts,
36 lanzaboote,
37 ...
38 }:
39 flake-parts.lib.mkFlake {inherit inputs;} {
34 imports = [inputs.fleet.flakeModules.default];40 imports = [inputs.fleet.flakeModules.default];
3541
36 perSystem = {pkgs, system, ...}: {42 perSystem = {
43 pkgs,
44 system,
45 ...
46 }: {
37 _module.args.pkgs = import nixpkgs { inherit system; };47 _module.args.pkgs = import nixpkgs {inherit system;};
3848
39 formatter = pkgs.alejandra;49 formatter = pkgs.alejandra;
40 devShells.default = pkgs.mkShell {50 devShells.default = pkgs.mkShell {
41 packages = [51 packages = [inputs.fleet.packages.${system}.fleet];
42 inputs.fleet.packages.${system}.fleet
43 ];52 };
44 };53 };
45 };
4654
47 # Single flake may contain multiple fleet configurations, default one is called... `default`55 # Single flake may contain multiple fleet configurations, default one is called... `default`
48 fleetConfigurations.default = {56 fleetConfigurations.default = {
49 # nixpkgs used to build the systems57 # nixpkgs used to build the systems
50 nixpkgs.buildUsing = nixpkgs;58 nixpkgs.buildUsing = nixpkgs;
51
52 # nixos option section of fleet config declares module, which is used for all configured nixos hosts.
53 nixos.imports = [
54 lanzaboote.nixosModules.lanzaboote
55 {
56 # Make `nix shell nixpkgs#thing` use the same nixpkgs, as used to build the system.
57 nix.registry.nixpkgs = {
58 from = { id = "nixpkgs"; type = "indirect"; };
59 flake = nixpkgs;
60 exact = false;
61 };
62 }
63 ];
6459
65 # Those modules are used to configure all the machines in cluster at the same time, good example of global modules60 # nixos option section of fleet config declares module, which is used for all configured nixos hosts.
66 # Is I.e wiring up the mesh VPN, or deploying kubernetes, or other things.
67 #
68 # Modules use the same semantics as standard nixos module system, they are just configuring all the hosts at once.
69 imports = [
70 ./wireguard
71 # Multi-instancible modules example
72 (import ./kubernetes {hosts = ["a" "b"];})
73 (import ./kubernetes {hosts = ["c" "d"];})
74 ];
75
76 # Hosts attribute (may also be defined/extended using modules attribute) configures hosts...
77 hosts.controlplane-1 = {
78 # Every host has some system, for which the system configuration needs to be built
79 system = "x86_64-linux";
80 # And nixos modules
81 nixos.imports = [61 nixos.imports = [
82 ./controlplane-1/hardware-configuration.nix62 lanzaboote.nixosModules.lanzaboote
83 ./controlplane-1/configuration.nix
84 # Configuration may also be specified inline, as in any nixos config.
85 {63 {
86 services.ray = {64 # Make `nix shell nixpkgs#thing` use the same nixpkgs, as used to build the system.
65 nix.registry.nixpkgs = {
66 from = {
67 id = "nixpkgs";
68 type = "indirect";
69 };
87 gpus = 4;70 flake = nixpkgs;
88 cpus = 128;71 exact = false;
89 };72 };
90 }73 }
91 ];74 ];
75
76 # Those modules are used to configure all the machines in cluster at the same time, good example of global modules
77 # Is I.e wiring up the mesh VPN, or deploying kubernetes, or other things.
78 #
79 # Modules use the same semantics as standard nixos module system, they are just configuring all the hosts at once.
80 imports = [
81 ./wireguard
82 # Multi-instancible modules example
83 (import ./kubernetes {hosts = ["a" "b"];})
84 (import ./kubernetes {hosts = ["c" "d"];})
85 ];
86
87 # Hosts attribute (may also be defined/extended using modules attribute) configures hosts...
88 hosts.controlplane-1 = {
89 # Every host has some system, for which the system configuration needs to be built
90 system = "x86_64-linux";
91 # And nixos modules
92 nixos.imports = [
93 ./controlplane-1/hardware-configuration.nix
94 ./controlplane-1/configuration.nix
95 # Configuration may also be specified inline, as in any nixos config.
96 {
97 services.ray = {
98 gpus = 4;
99 cpus = 128;
100 };
101 }
102 ];
103 };
92 };104 };
93 };105 };
94 };
95}106}
96----107----
97108