mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-14 11:47:31 +00:00
Merge pull request #4 from hercules-ci/more-attrs
Add darwinModules, nixosModules, overlay
This commit is contained in:
commit
0d9aec2b72
5 changed files with 93 additions and 0 deletions
|
@ -2,9 +2,12 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./modules/checks.nix
|
./modules/checks.nix
|
||||||
|
./modules/darwinModules.nix
|
||||||
./modules/devShell.nix
|
./modules/devShell.nix
|
||||||
./modules/flake.nix
|
./modules/flake.nix
|
||||||
./modules/legacyPackages.nix
|
./modules/legacyPackages.nix
|
||||||
|
./modules/nixosModules.nix
|
||||||
|
./modules/overlay.nix
|
||||||
./modules/packages.nix
|
./modules/packages.nix
|
||||||
./modules/perSystem.nix
|
./modules/perSystem.nix
|
||||||
];
|
];
|
||||||
|
|
27
modules/darwinModules.nix
Normal file
27
modules/darwinModules.nix
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{ config, self, lib, flake-modules-core-lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
filterAttrs
|
||||||
|
mapAttrs
|
||||||
|
mkOption
|
||||||
|
optionalAttrs
|
||||||
|
types
|
||||||
|
;
|
||||||
|
inherit (flake-modules-core-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 modules.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -36,6 +36,10 @@ in
|
||||||
options = {
|
options = {
|
||||||
devShell = mkOption {
|
devShell = mkOption {
|
||||||
type = types.package;
|
type = types.package;
|
||||||
|
# We don't have a way to unset devShell in the flake without computing
|
||||||
|
# the root of each allSystems module, so to improve laziness, the best
|
||||||
|
# choice seems to be to require a devShell and give the opportunity
|
||||||
|
# to unset it manually.
|
||||||
default = throw "The default devShell was not configured for system ${system}. Please set it, or if you don't want to use the devShell attribute, set flake.devShell = lib.mkForce {};";
|
default = throw "The default devShell was not configured for system ${system}. Please set it, or if you don't want to use the devShell attribute, set flake.devShell = lib.mkForce {};";
|
||||||
description = ''
|
description = ''
|
||||||
A derivation that nix develop bases its environment on.
|
A derivation that nix develop bases its environment on.
|
||||||
|
|
27
modules/nixosModules.nix
Normal file
27
modules/nixosModules.nix
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{ config, self, lib, flake-modules-core-lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
filterAttrs
|
||||||
|
mapAttrs
|
||||||
|
mkOption
|
||||||
|
optionalAttrs
|
||||||
|
types
|
||||||
|
;
|
||||||
|
inherit (flake-modules-core-lib)
|
||||||
|
mkSubmoduleOptions
|
||||||
|
;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
flake = mkSubmoduleOptions {
|
||||||
|
nixosModules = mkOption {
|
||||||
|
type = types.lazyAttrsOf types.unspecified;
|
||||||
|
default = { };
|
||||||
|
apply = mapAttrs (k: v: { _file = "${toString self.outPath}/flake.nix#nixosModules.${k}"; imports = [ v ]; });
|
||||||
|
description = ''
|
||||||
|
NixOS modules.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
32
modules/overlay.nix
Normal file
32
modules/overlay.nix
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
{ config, lib, flake-modules-core-lib, ... }:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkOption
|
||||||
|
types
|
||||||
|
;
|
||||||
|
inherit (flake-modules-core-lib)
|
||||||
|
mkSubmoduleOptions
|
||||||
|
;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
flake = mkSubmoduleOptions {
|
||||||
|
overlay = mkOption {
|
||||||
|
# uniq should be ordered: https://github.com/NixOS/nixpkgs/issues/147052
|
||||||
|
# also update description when done
|
||||||
|
type = types.uniq (types.functionTo (types.functionTo (types.lazyAttrsOf types.unspecified)));
|
||||||
|
# This eta expansion exists for the sole purpose of making nix flake check happy.
|
||||||
|
apply = f: final: prev: f final prev;
|
||||||
|
default = _: _: { };
|
||||||
|
defaultText = lib.literalExpression or lib.literalExample ''final: prev: {}'';
|
||||||
|
description = ''
|
||||||
|
An overlay.
|
||||||
|
|
||||||
|
Note that this option's type is not mergeable. While overlays can be
|
||||||
|
composed, the order of composition is significant, but the module
|
||||||
|
system does not guarantee deterministic definition ordering.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue