File tree Expand file tree Collapse file tree 5 files changed +37
-12
lines changed Expand file tree Collapse file tree 5 files changed +37
-12
lines changed Original file line number Diff line number Diff line change 31
31
./modules/apps.nix
32
32
# Sets the overlays.default flake output
33
33
./modules/overlay.nix
34
+ # Sets the flake.nixosModules flake output
35
+ ./modules/nixosModules.nix
34
36
] ;
35
37
} ;
36
38
Original file line number Diff line number Diff line change @@ -140,9 +140,18 @@ nix-std: {
140
140
}
141
141
// buildGoModuleArgs ) ;
142
142
in {
143
+ # A helper for building rust cosmwasm smart contracts. Does some best practices like using binaryren wasm-opt
144
+ # to optimize the bytecode, and runs cosmwasm-check to validate.
143
145
inherit buildCosmwasmContract ;
146
+
147
+ # A wrapper around [buildGoModule](https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/go/module.nix)
148
+ # that is specialized to packaging cosmos-sdk based go projects
149
+ #
150
+ # for more information see: https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/go.section.md
144
151
mkCosmosGoApp = buildApp ;
145
152
153
+ # A helper function for patching cosmos-sdk binaries that use wasmd, so that the binary artifact references
154
+ # a nix store path, and not a local relative path
146
155
wasmdPreFixupPhase = libwasmvm : binName :
147
156
if pkgs . stdenv . hostPlatform . isLinux
148
157
then ''
156
165
''
157
166
else null ;
158
167
168
+ # A helper that produces an executable for generating a gomod2nix.toml file (which
169
+ # captures a go module's dependencies and their hash in a toml file)
159
170
mkGenerator = name : srcDir :
160
171
pkgs . writeShellApplication {
161
172
inherit name ;
168
179
gomod2nix --outdir "$CURDIR"
169
180
'' ;
170
181
} ;
182
+
171
183
# `hermesModuleConfigToml { modules }).config.hermes.toml`
172
184
# will be a string to put into [config.toml](https://hermes.informal.systems/documentation/configuration/configure-hermes.html)
173
185
hermesModuleConfigToml = { modules } :
Original file line number Diff line number Diff line change 1
1
{
2
2
inputs ,
3
- hermes ,
3
+ pkgs ,
4
4
...
5
- } : let
6
- std = inputs . nix-std ;
7
- in {
5
+ } : {
8
6
flake . nixosModules = {
9
- hermes = import ../../nixosModules/hermes/default.nix { inherit nix-std hermes ; } ;
7
+ hermes = import ../../nixosModules/hermes/default.nix {
8
+ inherit ( inputs ) nix-std ;
9
+ inherit ( pkgs ) hermes ;
10
+ } ;
10
11
} ;
11
12
}
Original file line number Diff line number Diff line change
1
+ # This module might be slightly confusing, since nixos modules are isntantiated via a "fixed point"
2
+ # which is effectively a loop that accumulates attributes.
3
+ #
4
+ # because of this "fixed point" and lazyness we are able to set the "options"
5
+ # attribute, which declares the schema for the module and is required at the
6
+ # beginning of the loop, and the "config" attribute which is a serialization of
7
+ # the accumulated configuration into a toml file and intuitively happens at the
8
+ # end of the loop
9
+ #
10
+ # TL;DR:
11
+ # - 'options' represents the schema for the hermes configuration module
12
+ # - 'config.toml' represents the a final serialization of the actual configuration into a toml file
13
+ # - for more information on nixos modules see https://nix.dev/tutorials/module-system/module-system.html
1
14
{
2
15
lib ,
3
16
nix-std ,
@@ -9,10 +22,6 @@ with lib; {
9
22
toml = mkOption { type = types . unique { message = "only one toml output" ; } types . str ; } ;
10
23
} ;
11
24
config = {
12
- toml = let
13
- # remove `null` from toml render
14
- sanitizedCfg = filterAttrsRecursive ( _ : v : v != null ) cfg . config ;
15
- in
16
- nix-std . lib . serde . toTOML sanitizedCfg ;
25
+ toml = nix-std . lib . serde . toTOML cfg . config ;
17
26
} ;
18
27
}
You can’t perform that action at this time.
0 commit comments