From 0e61263fadead77a7ffbcd1eeedf64ac60049a80 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 2 Sep 2024 18:09:29 -0400 Subject: [PATCH] nix: Show app descriptions --- flake.lock | 30 ++++++++++++------------------ flake.nix | 35 +++++++++++++++++++---------------- nix/flake-module.nix | 6 ++++-- 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/flake.lock b/flake.lock index 5b96c1946..a1a22a233 100644 --- a/flake.lock +++ b/flake.lock @@ -223,11 +223,11 @@ "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { - "lastModified": 1712014858, - "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "lastModified": 1725234343, + "narHash": "sha256-+ebgonl3NbiKD2UD0x4BszCZQ6sTfL4xioaM49o5B3Y=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "rev": "567b938d64d4b4112ee253b9274472dc3a346eb6", "type": "github" }, "original": { @@ -283,11 +283,11 @@ }, "haskell-flake_2": { "locked": { - "lastModified": 1712823089, - "narHash": "sha256-AGkk2WK/E9mLcoEdfegZ1aYNh6HtOdPuEx4O+r44u3I=", + "lastModified": 1725314890, + "narHash": "sha256-jjVrhLOlPjQiZ/8pe+g6Xc5sa563WXnNZDwGXVl4PXQ=", "owner": "srid", "repo": "haskell-flake", - "rev": "92e393141a123c9695bc15dbe1ca0a1b7fef142b", + "rev": "ed94388c2e622f28cb45108a4e73c9d2b2a796da", "type": "github" }, "original": { @@ -381,20 +381,14 @@ }, "nixpkgs-lib_2": { "locked": { - "dir": "lib", - "lastModified": 1711703276, - "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", - "type": "github" + "lastModified": 1725233747, + "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" }, "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" } }, "nixpkgs_2": { diff --git a/flake.nix b/flake.nix index 3c7295979..edffda368 100644 --- a/flake.nix +++ b/flake.nix @@ -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 = { diff --git a/nix/flake-module.nix b/nix/flake-module.nix index 2fcb0999e..1d360b0f2 100644 --- a/nix/flake-module.nix +++ b/nix/flake-module.nix @@ -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