Skip to content

Commit

Permalink
nix: Update all inputs (#564)
Browse files Browse the repository at this point in the history
  • Loading branch information
srid authored Dec 24, 2024
2 parents d165ad1 + e4d7a29 commit 55c1161
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 62 deletions.
2 changes: 1 addition & 1 deletion emanote/emanote.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: emanote
version: 1.3.18.0
version: 1.3.18.1
license: AGPL-3.0-only
copyright: 2022 Sridhar Ratnakumar
maintainer: [email protected]
Expand Down
42 changes: 21 additions & 21 deletions flake.lock

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

5 changes: 5 additions & 0 deletions nix/modules/flake-parts/extra/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
imports = [
./small-closure.nix
];
}
63 changes: 63 additions & 0 deletions nix/modules/flake-parts/extra/small-closure.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# To make sure that Emanote's closure size is small.
{ root, inputs, ... }:
let
allowedSystems = [
"x86_64-linux"

# Disabling on macOS due to upstream bug:
# - https://github.com/NixOS/nixpkgs/issues/318013
# - https://github.com/NixOS/nixpkgs/pull/304352
# - Related: https://github.com/NixOS/nix/pull/10877
# "aarch64-darwin"
];
in
{
perSystem = { pkgs, lib, config, system, ... }: lib.mkIf (lib.elem system allowedSystems) {
haskellProjects.default = {
settings = {
emanote = { name, pkgs, self, super, ... }: {
separateBinOutput = false; # removeReferencesTo.nix doesn't work otherwise
justStaticExecutables = true;
removeReferencesTo = [
self.ghc
self.pandoc
self.pandoc-types
self.warp
];
};
};
};

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 'first(.[])'.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
'';
};
};
};

flake.om.ci.default.emanote = {
dir = ".";
steps.custom = {
closure-size = {
type = "app";
name = "check-closure-size";
systems = allowedSystems;
};
};
};
}
27 changes: 0 additions & 27 deletions nix/modules/flake-parts/haskell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@
emanote = { name, pkgs, self, super, ... }: {
check = false;
extraBuildDepends = [ pkgs.stork ];
separateBinOutput = false; # removeReferencesTo.nix doesn't work otherwise
justStaticExecutables = true;
removeReferencesTo = [
self.pandoc
self.pandoc-types
self.warp
];
custom = pkg: pkg.overrideAttrs (lib.addMetaAttrs {
# https://github.com/NixOS/cabal2nix/issues/608
longDescription = ''
Expand All @@ -68,25 +61,5 @@

packages.default = config.packages.emanote;
apps.default = config.apps.emanote;
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
'';
};
};
};
}
13 changes: 0 additions & 13 deletions nix/modules/flake-parts/toplevel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,5 @@
description = "A simple flake.nix template for emanote notebooks";
path = builtins.path { path = inputs.emanote-template; filter = path: _: baseNameOf path == "flake.nix"; };
};
om = {
ci.default = {
emanote = {
dir = ".";
steps.custom = {
closure-size = {
type = "app";
name = "check-closure-size";
};
};
};
};
};
};
}

0 comments on commit 55c1161

Please sign in to comment.