Skip to content

Commit a531b56

Browse files
authored
Merge pull request #69 from input-output-hk/next-2025-05-27
Next 2025 05 27
2 parents 1bc7649 + 6031cf5 commit a531b56

21 files changed

+1554
-1341
lines changed

flake.lock

Lines changed: 127 additions & 887 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 57 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,91 @@
22
description = "Cardano Parts: nix flake parts for cardano clusters";
33

44
inputs = {
5-
auth-keys-hub.url = "github:input-output-hk/auth-keys-hub";
6-
auth-keys-hub.inputs.nixpkgs.follows = "nixpkgs";
7-
colmena.inputs.nixpkgs.follows = "nixpkgs";
8-
colmena.url = "github:zhaofengli/colmena";
5+
auth-keys-hub = {
6+
url = "github:input-output-hk/auth-keys-hub";
7+
inputs = {
8+
nixpkgs.follows = "nixpkgs";
9+
flake-parts.follows = "flake-parts";
10+
treefmt-nix.follows = "treefmt-nix";
11+
};
12+
};
13+
14+
colmena = {
15+
url = "github:zhaofengli/colmena";
16+
inputs.nixpkgs.follows = "nixpkgs";
17+
};
18+
919
flake-parts.url = "github:hercules-ci/flake-parts";
10-
inputs-check.url = "github:input-output-hk/inputs-check";
20+
21+
inputs-check = {
22+
url = "github:input-output-hk/inputs-check";
23+
inputs = {
24+
nixpkgs.follows = "nixpkgs";
25+
flake-parts.follows = "flake-parts";
26+
};
27+
};
28+
1129
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
12-
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
13-
nix.url = "github:nixos/nix/2.25-maintenance";
30+
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
31+
nix.url = "github:nixos/nix/2.29-maintenance";
32+
1433
opentofu-registry = {
1534
url = "github:opentofu/registry";
1635
flake = false;
1736
};
18-
sops-nix.url = "github:Mic92/sops-nix";
19-
terranix.url = "github:terranix/terranix";
20-
treefmt-nix.url = "github:numtide/treefmt-nix";
21-
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
37+
38+
sops-nix = {
39+
url = "github:Mic92/sops-nix";
40+
inputs.nixpkgs.follows = "nixpkgs";
41+
};
42+
43+
terranix = {
44+
url = "github:terranix/terranix";
45+
inputs = {
46+
nixpkgs.follows = "nixpkgs";
47+
flake-parts.follows = "flake-parts";
48+
};
49+
};
50+
51+
treefmt-nix = {
52+
url = "github:numtide/treefmt-nix";
53+
inputs.nixpkgs.follows = "nixpkgs";
54+
};
2255

2356
# Process compose related
2457
process-compose-flake.url = "github:Platonic-systems/process-compose-flake";
2558
services-flake.url = "github:juspay/services-flake";
2659

2760
# Cardano related inputs
2861
capkgs.url = "github:input-output-hk/capkgs";
29-
empty-flake.url = "github:input-output-hk/empty-flake";
30-
haskell-nix.url = "github:input-output-hk/haskell.nix";
3162
iohk-nix.url = "github:input-output-hk/iohk-nix";
3263
iohk-nix-ng.url = "github:input-output-hk/iohk-nix";
3364

34-
# For tmp local testing pins
35-
blockperf.url = "github:johnalotoski/blockperf/preview-network";
65+
# Blockperf fork until PRs merged upstream
66+
blockperf = {
67+
url = "github:johnalotoski/blockperf/preview-network";
68+
inputs = {
69+
# Requires nixpkgs specific pinning for locked python versioning
70+
# nixpkgs.follows = "nixpkgs";
71+
flake-parts.follows = "flake-parts";
72+
};
73+
};
3674
# blockperf.url = "path:/home/jlotoski/work/johnalotoski/blockperf-wt/preview-network";
75+
76+
# For tmp local testing pins
3777
# cardano-faucet.url = "github:input-output-hk/cardano-faucet/jl/node-9.2";
3878
# cardano-faucet.url = "path:/home/jlotoski/work/iohk/cardano-faucet-wt/jl/node-9.2";
3979

4080
# Cardano-db-sync schema input pins, which must match the
4181
# versioning of the release and pre-release (-ng) dbsync
4282
# definitions found in flakeModule/pkgs.nix.
4383
cardano-db-sync-schema = {
44-
url = "github:IntersectMBO/cardano-db-sync/13.6.0.4";
84+
url = "github:IntersectMBO/cardano-db-sync/13.6.0.5";
4585
flake = false;
4686
};
4787

4888
cardano-db-sync-schema-ng = {
49-
url = "github:IntersectMBO/cardano-db-sync/13.6.0.4";
89+
url = "github:IntersectMBO/cardano-db-sync/13.6.0.5";
5090
flake = false;
5191
};
5292

@@ -95,9 +135,6 @@
95135
url = "github:cardano-foundation/cardano-wallet/v2025-03-31";
96136
flake = false;
97137
};
98-
99-
# Reduce stackage.nix source download deps
100-
haskell-nix.inputs.stackage.follows = "empty-flake";
101138
};
102139

103140
outputs = inputs: let

flake/nixosModules/profile-aws-ec2-ephemeral.nix

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ flake: {
6060
...
6161
}: let
6262
inherit (builtins) head;
63-
inherit (lib) any getExe hasInfix hasPrefix mkForce mkIf mkOption splitString;
63+
inherit (lib) any getExe hasInfix hasPrefix mkForce mkIf mkOption removePrefix splitString;
6464
inherit (lib.types) bool enum listOf str;
6565
inherit (config.aws.instance) instance_type;
6666

@@ -76,6 +76,15 @@ flake: {
7676
key = ./profile-aws-ec2-ephemeral.nix;
7777

7878
options.services.aws.ec2.ephemeral = {
79+
enableMountOnCreation = mkOption {
80+
type = bool;
81+
default = true;
82+
description = ''
83+
Whether to ensure the ephemeral volume is mounted automatically after
84+
it becomes available.
85+
'';
86+
};
87+
7988
enablePostMountService = mkOption {
8089
type = bool;
8190
default = true;
@@ -86,18 +95,28 @@ flake: {
8695

8796
fsOpts = mkOption {
8897
type = listOf str;
89-
default = [
90-
# An example file system performance tuning option for XFS
91-
"logbsize=256k"
92-
];
98+
default =
99+
if cfg.fsType == "ext2"
100+
then [
101+
# An example file system performance tuning option for ext2
102+
"noacl"
103+
"noatime"
104+
"nodiratime"
105+
]
106+
else if cfg.fsType == "xfs"
107+
then [
108+
# An example file system performance tuning option for XFS
109+
"logbsize=256k"
110+
]
111+
else [];
93112
description = ''
94113
File system tuning options used during mounting.
95114
'';
96115
};
97116

98117
fsType = mkOption {
99-
type = enum ["xfs"];
100-
default = "xfs";
118+
type = enum ["ext2" "xfs"];
119+
default = "ext2";
101120
description = ''
102121
The file system to use for ephemeral storage.
103122
@@ -107,7 +126,7 @@ flake: {
107126
ephemeral block device(s) at which point auto-format and relabelling
108127
will occur.
109128
110-
NOTE: Changing to a file system other than xfs will require
129+
NOTE: Changing to a file system other than ext2 or xfs will require
111130
extending the nixos module code to support the new filesystem(s).
112131
'';
113132
};
@@ -239,7 +258,7 @@ flake: {
239258
ExecStart = getExe (pkgs.writeShellApplication {
240259
name = cfg.serviceName;
241260

242-
runtimeInputs = with pkgs; [fd jq kmod mdadm util-linux xfsprogs];
261+
runtimeInputs = with pkgs; [e2fsprogs fd jq kmod mdadm util-linux xfsprogs];
243262
text = ''
244263
set -euo pipefail
245264
@@ -291,7 +310,7 @@ flake: {
291310
if [ "$NUM_BD" -eq "1" ]; then
292311
if [ "$EMPTY" = "true" ]; then
293312
set -x
294-
mkfs -t xfs -L "$LABEL" "''${INSTANCE_BD[@]}"
313+
mkfs -t ${cfg.fsType} -L "$LABEL" "''${INSTANCE_BD[@]}"
295314
fi
296315
ln -svf "''${INSTANCE_BD[@]}" "$SYM_TGT"
297316
set +x
@@ -301,7 +320,7 @@ flake: {
301320
set -x
302321
mdadm --create "$RAID_DEV" --raid-devices="$NUM_BD" --level=0 "''${INSTANCE_BD[@]}"
303322
mdadm --detail --scan | tee "$RAID_CFG"
304-
mkfs -t xfs -L "$LABEL" "$RAID_DEV"
323+
mkfs -t ${cfg.fsType} -L "$LABEL" "$RAID_DEV"
305324
ln -svf "$RAID_DEV" "$SYM_TGT"
306325
set +x
307326
else
@@ -335,6 +354,35 @@ flake: {
335354
});
336355
};
337356
};
357+
358+
"${cfg.serviceName}-mount-on-creation" = mkIf cfg.enableMountOnCreation {
359+
wantedBy = ["multi-user.target"];
360+
serviceConfig = {
361+
Type = "oneshot";
362+
ExecStart = getExe (pkgs.writeShellApplication {
363+
name = "${cfg.serviceName}-mount-on-creation";
364+
text = ''
365+
set -euo pipefail
366+
367+
while true; do
368+
echo "Sleeping 10 seconds until mount on created attempt..."
369+
sleep 10
370+
# shellcheck disable=SC2010
371+
if ls -1 / | grep -q ${removePrefix "/" cfg.mountPoint}; then
372+
echo "Found: ${cfg.mountPoint}"
373+
374+
# Trigger the systemd auto-mount service
375+
ls ${cfg.mountPoint}
376+
377+
touch ${cfg.mountPoint}/.mounted
378+
379+
break
380+
fi
381+
done
382+
'';
383+
});
384+
};
385+
};
338386
};
339387
};
340388
};

flake/nixosModules/profile-basic.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,12 @@
144144
# disabled as a precaution.
145145
optimise.automatic = false;
146146

147-
gc.automatic = true;
147+
gc = {
148+
automatic = true;
149+
150+
# Minimize security vulnerability positive scan results by flushing old closures
151+
options = "--delete-older-than 30d";
152+
};
148153

149154
settings = {
150155
auto-optimise-store = true;

flake/nixosModules/profile-cardano-metadata.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,12 @@ flake: {
526526
listenAddress = "127.0.0.1";
527527
port = cfg.varnishExporterPort;
528528
group = "varnish";
529+
530+
# Required until https://github.com/nixos/nixpkgs/issues/400003 is fixed.
531+
instance =
532+
if versionOlder config.services.varnish.package.version "7"
533+
then "/var/run/varnish/${config.networking.hostName}"
534+
else "/var/run/varnishd";
529535
};
530536
};
531537
};

flake/nixosModules/profile-cardano-parts.nix

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,41 @@ flake @ {moduleWithSystem, ...}: {
352352
config = {
353353
# The hosts file is case-insensitive, so switch from camelCase attr name to kebab-case
354354
networking.hosts = mkIf (gfModules ? ips) (let
355-
allIps = head gfModules.ips.imports;
355+
# Prior to "github:hercules-ci/flake-parts/dc3b467eac0fe1436e897d01c35dabe63b4749ea"
356+
# made on Sept 12th, 2024, the expression:
357+
#
358+
# head gfModules.ips.imports
359+
#
360+
# yielded an attrSet with attrName as machine name and
361+
# attrValue as attrSet of ip type to ip value. We'll refer to this
362+
# attrSet as ipInfo for simplicity below.
363+
#
364+
# After this commit, the same expression instead returns:
365+
#
366+
# {
367+
# imports = [
368+
# {
369+
# _file = "$NIX_STORE_PATH, via option flake.nixosModules.ips";
370+
# imports = [
371+
# ipInfo
372+
# ];
373+
# }
374+
# ]
375+
# }
376+
#
377+
# The same info can be extracted with:
378+
#
379+
# head (head (head gfModules.ips.imports).imports).imports
380+
#
381+
# but this is getting rather ugly, so let's use a recursive function
382+
# instead.
383+
allIps = let
384+
flattenImports = m:
385+
if m ? imports && isList m.imports
386+
then flattenImports (head m.imports)
387+
else m;
388+
in
389+
flattenImports gfModules.ips;
356390

357391
hostsList =
358392
# See hostsList type and description above

flake/nixosModules/profile-cardano-smash.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,12 @@ flake: {
613613
listenAddress = "127.0.0.1";
614614
port = cfg.varnishExporterPort;
615615
group = "varnish";
616+
617+
# Required until https://github.com/nixos/nixpkgs/issues/400003 is fixed.
618+
instance =
619+
if versionOlder config.services.varnish.package.version "7"
620+
then "/var/run/varnish/${config.networking.hostName}"
621+
else "/var/run/varnishd";
616622
};
617623
};
618624
};

flake/nixosModules/profile-cardano-webserver.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,12 @@ flake: {
386386
listenAddress = "127.0.0.1";
387387
port = cfg.varnishExporterPort;
388388
group = "varnish";
389+
390+
# Required until https://github.com/nixos/nixpkgs/issues/400003 is fixed.
391+
instance =
392+
if versionOlder config.services.varnish.package.version "7"
393+
then "/var/run/varnish/${config.networking.hostName}"
394+
else "/var/run/varnishd";
389395
};
390396
};
391397
};

flake/nixosModules/profile-grafana-alloy.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ flake @ {moduleWithSystem, ...}: {
2929
}:
3030
with builtins;
3131
with lib; let
32-
inherit (lib.types) attrsOf bool enum listOf str;
32+
inherit (lib.types) attrsOf bool enum listOf str lines;
3333
inherit (config.cardano-parts.perNode.meta) cardanoDbSyncPrometheusExporterPort cardanoNodePrometheusExporterPort hostAddr;
3434
inherit (groupCfg) groupName groupFlake;
3535
inherit (groupCfg.meta) environmentName;
@@ -432,7 +432,7 @@ flake @ {moduleWithSystem, ...}: {
432432
};
433433

434434
extraAlloyConfig = mkOption {
435-
type = str;
435+
type = lines;
436436
default = "";
437437
description = ''
438438
Extra configuration appended to the /etc/alloy/config.alloy file prior to formatting.

0 commit comments

Comments
 (0)