mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-14 11:47:31 +00:00
commit
8d0e2444ab
5 changed files with 73 additions and 28 deletions
|
@ -1,4 +1,12 @@
|
|||
|
||||
# 2022-12-07
|
||||
|
||||
- The `darwinModules` option has been removed. This was added in the early days
|
||||
without full consideration. The removal will have no effect on most flakes
|
||||
considering that the [`flake` option](https://flake.parts/options/flake-parts.html#opt-flake)
|
||||
allows any attribute to be set. This attribute and related attributes should
|
||||
be added to the nix-darwin project instead.
|
||||
|
||||
# 2022-10-11
|
||||
|
||||
- The `nixpkgs` input has been renamed to `nixpkgs-lib` to signify that the
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
imports = [
|
||||
./modules/apps.nix
|
||||
./modules/checks.nix
|
||||
./modules/darwinModules.nix
|
||||
./modules/devShells.nix
|
||||
./modules/flake.nix
|
||||
./modules/formatter.nix
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
};
|
||||
};
|
||||
|
||||
checks.eval-tests =
|
||||
let tests = import ./tests/eval-tests.nix;
|
||||
in tests.runTests pkgs.emptyFile // { internals = tests; };
|
||||
|
||||
};
|
||||
flake = {
|
||||
# for repl exploration / debug
|
||||
|
|
61
dev/tests/eval-tests.nix
Normal file
61
dev/tests/eval-tests.nix
Normal file
|
@ -0,0 +1,61 @@
|
|||
rec {
|
||||
f-p = builtins.getFlake (toString ../..);
|
||||
f-p-lib = f-p.lib;
|
||||
|
||||
inherit (f-p-lib) mkFlake;
|
||||
inherit (f-p.inputs.nixpkgs-lib) lib;
|
||||
|
||||
pkg = system: name: derivation {
|
||||
name = name;
|
||||
builder = "no-builder";
|
||||
system = system;
|
||||
};
|
||||
|
||||
empty = mkFlake
|
||||
{ self = { }; }
|
||||
{
|
||||
systems = [ ];
|
||||
};
|
||||
|
||||
example1 = mkFlake
|
||||
{ self = { }; }
|
||||
{
|
||||
systems = [ "a" "b" ];
|
||||
perSystem = { system, ... }: {
|
||||
packages.hello = pkg system "hello";
|
||||
};
|
||||
};
|
||||
|
||||
runTests = ok:
|
||||
|
||||
assert empty == {
|
||||
apps = { };
|
||||
checks = { };
|
||||
devShells = { };
|
||||
formatter = { };
|
||||
legacyPackages = { };
|
||||
nixosConfigurations = { };
|
||||
nixosModules = { };
|
||||
overlays = { };
|
||||
packages = { };
|
||||
};
|
||||
|
||||
assert example1 == {
|
||||
apps = { a = { }; b = { }; };
|
||||
checks = { a = { }; b = { }; };
|
||||
devShells = { a = { }; b = { }; };
|
||||
formatter = { };
|
||||
legacyPackages = { a = { }; b = { }; };
|
||||
nixosConfigurations = { };
|
||||
nixosModules = { };
|
||||
overlays = { };
|
||||
packages = {
|
||||
a = { hello = pkg "a" "hello"; };
|
||||
b = { hello = pkg "b" "hello"; };
|
||||
};
|
||||
};
|
||||
|
||||
ok;
|
||||
|
||||
result = runTests "ok";
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
{ config, self, lib, flake-parts-lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
filterAttrs
|
||||
mapAttrs
|
||||
mkOption
|
||||
optionalAttrs
|
||||
types
|
||||
;
|
||||
inherit (flake-parts-lib)
|
||||
mkSubmoduleOptions
|
||||
;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
flake = mkSubmoduleOptions {
|
||||
darwinModules = mkOption {
|
||||
type = types.lazyAttrsOf types.unspecified;
|
||||
default = { };
|
||||
apply = mapAttrs (k: v: { _file = "${toString self.outPath}/flake.nix#darwinModules.${k}"; imports = [ v ]; });
|
||||
description = ''
|
||||
[nix-darwin](https://daiderd.com/nix-darwin/) modules.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue