Skip to content

Commit

Permalink
nix: Show app descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Sep 2, 2024
1 parent a864dc8 commit 0e61263
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 36 deletions.
30 changes: 12 additions & 18 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 19 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -156,22 +156,25 @@
];
});

apps.check-closure-size.program = pkgs.writeShellApplication {
name = "emanote-check-closure-size";
runtimeInputs = [ pkgs.jq pkgs.bc pkgs.nix ];
meta.description = "Check that emanote's nix closure size remains reasonably small";
text = ''
MAX_CLOSURE_SIZE=$(echo "600 * 1000000" | bc)
CLOSURE_SIZE=$(nix path-info --json -S .#default | jq '.[0]'.closureSize)
echo "Emanote closure size: $CLOSURE_SIZE"
echo " Max closure size: $MAX_CLOSURE_SIZE"
if [ "$CLOSURE_SIZE" -gt "$MAX_CLOSURE_SIZE" ]; then
echo "ERROR: Emanote's nix closure size has increased"
exit 3
else
echo "OK: Emanote's nix closure size is within limits"
fi
'';
apps.check-closure-size = rec {
inherit (program) meta;
program = pkgs.writeShellApplication {
name = "emanote-check-closure-size";
runtimeInputs = [ pkgs.jq pkgs.bc pkgs.nix ];
meta.description = "Check that emanote's nix closure size remains reasonably small";
text = ''
MAX_CLOSURE_SIZE=$(echo "600 * 1000000" | bc)
CLOSURE_SIZE=$(nix path-info --json -S .#default | jq '.[0]'.closureSize)
echo "Emanote closure size: $CLOSURE_SIZE"
echo " Max closure size: $MAX_CLOSURE_SIZE"
if [ "$CLOSURE_SIZE" -gt "$MAX_CLOSURE_SIZE" ]; then
echo "ERROR: Emanote's nix closure size has increased"
exit 3
else
echo "OK: Emanote's nix closure size is within limits"
fi
'';
};
};

emanote = {
Expand Down
6 changes: 4 additions & 2 deletions nix/flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ in
sites =
lib.mapAttrs
(name: cfg: {
app = {
app = rec {
type = "app";

inherit (program) meta;

# '' is required for escaping ${} in nix
program = pkgs.writeShellApplication {
name = "emanote-with-layers-${name}";
meta.description = "Live server for Emanote site ${name} (arbitrary arguments accepted)";
meta.description = "Live server for Emanote site ${name}";
runtimeInputs = [ config.emanote.package ];
text =
let
Expand Down

0 comments on commit 0e61263

Please sign in to comment.