Skip to content

Commit

Permalink
Add git-lfs dependency (purescript#651)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashoneyman authored Aug 9, 2023
1 parent 8bf23d3 commit 282a4f0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
5 changes: 3 additions & 2 deletions app/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
dhall,
dhall-json,
git,
git-lfs,
licensee,
coreutils,
gzip,
Expand Down Expand Up @@ -73,7 +74,7 @@ in {
'';
postFixup = ''
wrapProgram $out/bin/${name} \
--set PATH ${lib.makeBinPath [compilers purs-versions dhall dhall-json licensee git coreutils gzip gnutar]} \
--set PATH ${lib.makeBinPath [compilers purs-versions dhall dhall-json licensee git git-lfs coreutils gzip gnutar]} \
'';
};

Expand Down Expand Up @@ -106,7 +107,7 @@ in {
'';
postFixup = ''
wrapProgram $out/bin/${name} \
--set PATH ${lib.makeBinPath [compilers purs-versions dhall dhall-json licensee git coreutils gzip gnutar]} \
--set PATH ${lib.makeBinPath [compilers purs-versions dhall dhall-json licensee git git-lfs coreutils gzip gnutar]} \
'';
};
}
9 changes: 8 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@

DHALL_TYPES = ./types;

# We disable git-lfs files explicitly, as this is intended for large files
# (typically >4GB), and source packgaes really ought not be shipping large
# files — just source code.
GIT_LFS_SKIP_SMUDGE = 1;

registryOverlay = final: prev: rec {
nodejs = prev.nodejs_20;

Expand Down Expand Up @@ -210,7 +215,7 @@
# A full set of environment variables, each set to their default values
# according to the env.example file, or to the values explicitly set below
# (e.g. DHALL_PRELUDE and DHALL_TYPES).
defaultEnv = parseEnv ./.env.example // {inherit DHALL_PRELUDE DHALL_TYPES;};
defaultEnv = parseEnv ./.env.example // {inherit DHALL_PRELUDE DHALL_TYPES GIT_LFS_SKIP_SMUDGE;};

# Parse a .env file, skipping empty lines and comments, into Nix attrset
parseEnv = path: let
Expand Down Expand Up @@ -662,6 +667,7 @@

devShells = {
default = pkgs.mkShell {
inherit GIT_LFS_SKIP_SMUDGE;
name = "registry-dev";
packages = with pkgs; [
# All stable PureScript compilers
Expand All @@ -678,6 +684,7 @@
nixFlakes
nixfmt
git
git-lfs
bash
nodejs
jq
Expand Down
10 changes: 8 additions & 2 deletions nix/module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ in {
};

envVars = lib.mkOption {
type = lib.types.attrsOf (lib.types.either lib.types.str lib.types.path);
type = lib.types.attrsOf (lib.types.either lib.types.str (lib.types.either lib.types.int lib.types.path));
default = {};
description = "Environment variables to set for the registry server";
};
Expand Down Expand Up @@ -79,7 +79,13 @@ in {
systemd.services = let
# Print an attrset of env vars { ENV_VAR = "value"; } as a newline-delimited
# string of "ENV_VAR=value" lines, then write the text to the Nix store.
defaultEnvFile = pkgs.writeText ".env" (pkgs.lib.concatStringsSep "\n" (pkgs.lib.mapAttrsToList (name: value: "${name}=${value}") cfg.envVars));
defaultEnvFile =
pkgs.writeText ".env"
(pkgs.lib.concatStringsSep "\n" (pkgs.lib.mapAttrsToList (name: value:
if (builtins.typeOf value == "int")
then "${name}=${toString value}"
else "${name}=${value}")
cfg.envVars));
in {
server = {
description = "registry server";
Expand Down
9 changes: 5 additions & 4 deletions scripts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
dhall-json,
licensee,
git,
git-lfs,
coreutils,
gzip,
gnutar,
Expand All @@ -23,8 +24,8 @@
stdenv.mkDerivation rec {
inherit name;
src = ./src;
nativeBuildInputs = [ esbuild makeWrapper ];
buildInputs = [ nodejs ];
nativeBuildInputs = [esbuild makeWrapper];
buildInputs = [nodejs];
entrypoint = writeText "entrypoint.js" ''
import { main } from "./output/Registry.Scripts.${module}";
main();
Expand All @@ -49,9 +50,9 @@
'';
postFixup = ''
wrapProgram $out/bin/${name} \
--set PATH ${lib.makeBinPath [ compilers purs-versions dhall dhall-json licensee git coreutils gzip gnutar ]}
--set PATH ${lib.makeBinPath [compilers purs-versions dhall dhall-json licensee git git-lfs coreutils gzip gnutar]}
'';
};
};
in {
legacy-importer = build-script "registry-legacy-importer" "LegacyImporter";
package-deleter = build-script "registry-package-deleter" "PackageDeleter";
Expand Down

0 comments on commit 282a4f0

Please sign in to comment.