mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-14 11:47:31 +00:00
Merge pull request #226 from hercules-ci/nixpkgs-lib
flake-update: Get the nixpkgs/lib subtree only
This commit is contained in:
commit
e5d10a24b6
1 changed files with 30 additions and 0 deletions
|
@ -11,6 +11,36 @@
|
|||
enable = true;
|
||||
autoMergeMethod = "merge";
|
||||
when.dayOfMonth = 1;
|
||||
flakes = {
|
||||
"." = { };
|
||||
"dev" = { };
|
||||
};
|
||||
effect.settings = {
|
||||
# Only fetch the `lib` subtree.
|
||||
# NOTE: Users don't have to do this. They are recommended to use follows
|
||||
# and just use the `nixpkgs` they're already fetching anyway.
|
||||
# It doesn't have to be `lib/` only!
|
||||
git.update.script = lib.mkBefore ''
|
||||
echo 'Fetching nixpkgs-lib tree'
|
||||
branch="nixos-unstable"
|
||||
mkdir ~/nixpkgs
|
||||
git -C ~/nixpkgs init
|
||||
git -C ~/nixpkgs remote add origin https://github.com/NixOS/nixpkgs.git
|
||||
git -C ~/nixpkgs fetch origin --filter=blob:none --depth=1 "$branch"
|
||||
commit="$(git -C ~/nixpkgs rev-parse FETCH_HEAD)"
|
||||
tree="$(git -C ~/nixpkgs rev-parse FETCH_HEAD:lib)"
|
||||
|
||||
echo 'Adjusting nixpkgs-lib.url'
|
||||
sed -i flake.nix -e \
|
||||
's^ nixpkgs-lib\.url = ".*^ nixpkgs-lib\.url = "https://github.com/NixOS/nixpkgs/archive/'$tree'.tar.gz"; # '$commit' /lib from '$branch'^'
|
||||
git diff
|
||||
grep -F "$tree" flake.nix >/dev/null || {
|
||||
echo 'failed to write new tree to flake.nix'
|
||||
exit 1
|
||||
}
|
||||
git commit flake.nix -m 'flake.nix: Update nixpkgs-lib tree'
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
perSystem = { config, pkgs, ... }: {
|
||||
|
|
Loading…
Reference in a new issue