2024-09-12 14:43:39 +00:00
|
|
|
{ config, lib, inputs, self, withSystem, ... }:
|
2022-05-13 08:10:42 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
imports = [
|
2022-05-17 08:18:59 +00:00
|
|
|
inputs.pre-commit-hooks-nix.flakeModule
|
2022-11-12 15:30:20 +00:00
|
|
|
inputs.hercules-ci-effects.flakeModule # herculesCI attr
|
2022-05-13 08:10:42 +00:00
|
|
|
];
|
|
|
|
systems = [ "x86_64-linux" "aarch64-darwin" ];
|
2022-12-22 11:59:35 +00:00
|
|
|
|
|
|
|
hercules-ci.flake-update = {
|
|
|
|
enable = true;
|
|
|
|
autoMergeMethod = "merge";
|
|
|
|
when.dayOfMonth = 1;
|
2024-05-02 08:57:55 +00:00
|
|
|
flakes = {
|
|
|
|
"." = { };
|
|
|
|
"dev" = { };
|
|
|
|
};
|
2024-04-26 21:45:32 +00:00
|
|
|
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'
|
|
|
|
'';
|
|
|
|
};
|
2022-12-22 11:59:35 +00:00
|
|
|
};
|
|
|
|
|
2023-05-29 17:52:03 +00:00
|
|
|
perSystem = { config, pkgs, ... }: {
|
2022-05-17 08:18:59 +00:00
|
|
|
|
2022-05-13 08:10:42 +00:00
|
|
|
devShells.default = pkgs.mkShell {
|
2022-05-17 08:18:59 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkgs.nixpkgs-fmt
|
|
|
|
pkgs.pre-commit
|
2022-11-13 11:25:22 +00:00
|
|
|
pkgs.hci
|
2022-05-17 08:18:59 +00:00
|
|
|
];
|
|
|
|
shellHook = ''
|
|
|
|
${config.pre-commit.installationScript}
|
|
|
|
'';
|
2022-05-13 08:10:42 +00:00
|
|
|
};
|
2022-05-18 09:03:42 +00:00
|
|
|
|
2022-05-17 08:18:59 +00:00
|
|
|
pre-commit = {
|
|
|
|
inherit pkgs; # should make this default to the one it can get via follows
|
|
|
|
settings = {
|
2022-05-17 08:28:03 +00:00
|
|
|
hooks.nixpkgs-fmt.enable = true;
|
2022-05-17 08:18:59 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-11-27 16:06:43 +00:00
|
|
|
checks.eval-tests =
|
2024-09-12 14:43:39 +00:00
|
|
|
let tests = import ./tests/eval-tests.nix { flake-parts = self; };
|
2022-11-27 16:06:43 +00:00
|
|
|
in tests.runTests pkgs.emptyFile // { internals = tests; };
|
|
|
|
|
2022-05-13 08:10:42 +00:00
|
|
|
};
|
2022-11-11 07:00:22 +00:00
|
|
|
flake = {
|
2022-05-13 08:10:42 +00:00
|
|
|
# for repl exploration / debug
|
|
|
|
config.config = config;
|
|
|
|
options.mySystem = lib.mkOption { default = config.allSystems.${builtins.currentSystem}; };
|
2023-05-29 17:52:03 +00:00
|
|
|
config.effects = withSystem "x86_64-linux" ({ pkgs, hci-effects, ... }: {
|
2022-11-13 11:19:55 +00:00
|
|
|
tests = {
|
|
|
|
template = pkgs.callPackage ./tests/template.nix { inherit hci-effects; };
|
|
|
|
};
|
|
|
|
});
|
2022-05-13 08:10:42 +00:00
|
|
|
};
|
|
|
|
}
|