Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix: Update all inputs #564

Merged
merged 4 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: srid@srid.ca
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";
};
};
};
};
};
};
}