git: add basic support for LFS
Fixes #542
(cherry picked from commit 1cdb8abf30
)
This commit is contained in:
parent
fdb81a7ea0
commit
ee7631fbe3
|
@ -133,6 +133,20 @@ in
|
|||
'';
|
||||
description = "List of configuration files to include.";
|
||||
};
|
||||
|
||||
lfs = {
|
||||
enable = mkEnableOption "Git Large File Storage";
|
||||
|
||||
skipSmudge = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Skip automatic downloading of objects on clone or pull.
|
||||
This requires a manual <command>git lfs pull</command>
|
||||
every time a new commit is checked out on your repository.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -204,6 +218,25 @@ in
|
|||
'')
|
||||
cfg.includes);
|
||||
})
|
||||
|
||||
(mkIf cfg.lfs.enable {
|
||||
home.packages = [ pkgs.git-lfs ];
|
||||
|
||||
programs.git.iniContent."filter \"lfs\"" =
|
||||
let
|
||||
skipArg = optional cfg.lfs.skipSmudge "--skip";
|
||||
in
|
||||
{
|
||||
clean = "git-lfs clean -- %f";
|
||||
process = concatStringsSep " " (
|
||||
[ "git-lfs" "filter-process" ] ++ skipArg
|
||||
);
|
||||
required = true;
|
||||
smudge = concatStringsSep " " (
|
||||
[ "git-lfs" "smudge" ] ++ skipArg ++ [ "--" "%f" ]
|
||||
);
|
||||
};
|
||||
})
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,12 @@ boolean=true
|
|||
integer=38
|
||||
name=value
|
||||
|
||||
[filter "lfs"]
|
||||
clean=git-lfs clean -- %f
|
||||
process=git-lfs filter-process
|
||||
required=true
|
||||
smudge=git-lfs smudge -- %f
|
||||
|
||||
[gpg]
|
||||
program=path-to-gpg
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ with lib;
|
|||
};
|
||||
userEmail = "user@example.org";
|
||||
userName = "John Doe";
|
||||
lfs.enable = true;
|
||||
}
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue