1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2024-12-14 11:47:31 +00:00

Merge pull request #80 from hercules-ci/darwin-cleanup

Darwin cleanup
This commit is contained in:
Robert Hensing 2022-12-07 20:33:16 +01:00 committed by GitHub
commit 8d0e2444ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 73 additions and 28 deletions

View file

@ -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

View file

@ -3,7 +3,6 @@
imports = [
./modules/apps.nix
./modules/checks.nix
./modules/darwinModules.nix
./modules/devShells.nix
./modules/flake.nix
./modules/formatter.nix

View file

@ -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
View 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";
}

View file

@ -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.
'';
};
};
};
}