diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c6aefa6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# nix +result +result-* + +# pre-commit-hooks.nix +.pre-commit-config.yaml + +# dev/README.md +flake.lock diff --git a/README.md b/README.md index 65c3fe1..56a1795 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# Flake Modules Core +# Flake Parts _Core of a distributed framework for writing Nix Flakes._ -`flake-modules-core` provides the options that represent standard flake attributes and establishes a way of working with `system`. Opinionated features are provided by an ecosystem of modules that you can import. +`flake-parts` provides the options that represent standard flake attributes and establishes a way of working with `system`. Opinionated features are provided by an ecosystem of modules that you can import. # Why Modules? @@ -13,7 +13,7 @@ into modules that can be shared. It reduces the proliferation of custom Nix glue code, similar to what the module system has done for NixOS configurations. -Unlike NixOS, but following Flakes' spirit, `flake-modules-core` is not a +Unlike NixOS, but following Flakes' spirit, `flake-parts` is not a monorepo with the implied goal of absorbing all of open source, but rather a single module that other repositories can build upon, while ensuring a baseline level of compatibility: which core attribute make up a flake and @@ -24,21 +24,21 @@ how these are represented as module options. If your project does not have a flake yet: ```console -nix flake init -t github:hercules-ci/flake-modules-core +nix flake init -t github:hercules-ci/flake-parts ``` Otherwise, add the input, ``` - flake-modules-core.url = "github:hercules-ci/flake-modules-core"; - flake-modules-core.inputs.nixpkgs.follows = "nixpkgs"; + flake-parts.url = "github:hercules-ci/flake-parts"; + flake-parts.inputs.nixpkgs.follows = "nixpkgs"; ``` then slide `mkFlake` between your outputs function head and body, ``` - outputs = { self, flake-modules-core, ... }: - flake-modules-core.lib.mkFlake { inherit self; } { + outputs = { self, flake-parts, ... }: + flake-parts.lib.mkFlake { inherit self; } { flake = { # Put your original flake attributes here. } @@ -50,3 +50,7 @@ Now you can add the remaining module attributes like in the [the template](./tem # Example See [the template](./template/default/flake.nix). + +# Options Reference + +See [flake.parts](https://flake.parts/options.html) diff --git a/dev/README.md b/dev/README.md index bd7f521..b5001c5 100644 --- a/dev/README.md +++ b/dev/README.md @@ -2,5 +2,5 @@ # Separate `tools` flake Wouldn't recommend this pattern normally, but I'm trying to keep -deps low for `flake-modules-core` until we have split dev inputs +deps low for `flake-parts` until we have split dev inputs that don't carry over to dependent lock files. diff --git a/flake.nix b/flake.nix index f94577b..3fd3e80 100644 --- a/flake.nix +++ b/flake.nix @@ -11,13 +11,13 @@ default = { path = ./template/default; description = '' - A minimal flake using flake-modules-core. + A minimal flake using flake-parts. ''; }; multi-module = { path = ./template/multi-module; description = '' - A minimal flake using flake-modules-core. + A minimal flake using flake-parts. ''; }; }; diff --git a/lib.nix b/lib.nix index 23a35a1..bb693e5 100644 --- a/lib.nix +++ b/lib.nix @@ -26,7 +26,7 @@ let nestedTypes.elemType = elemType; }; - flake-modules-core-lib = { + flake-parts-lib = { evalFlakeModule = { self , specialArgs ? { } @@ -34,12 +34,12 @@ let module: lib.evalModules { - specialArgs = { inherit self flake-modules-core-lib; inherit (self) inputs; } // specialArgs; + specialArgs = { inherit self flake-parts-lib; inherit (self) inputs; } // specialArgs; modules = [ ./all-modules.nix module ]; }; mkFlake = args: module: - (flake-modules-core-lib.evalFlakeModule args module).config.flake; + (flake-parts-lib.evalFlakeModule args module).config.flake; # For extending options in an already declared submodule. # Workaround for https://github.com/NixOS/nixpkgs/issues/146882 @@ -61,10 +61,10 @@ let mkPerSystemOption = module: mkOption { - type = flake-modules-core-lib.mkPerSystemType module; + type = flake-parts-lib.mkPerSystemType module; }; }; in -flake-modules-core-lib +flake-parts-lib diff --git a/modules/apps.nix b/modules/apps.nix index 6d90a20..c932ddd 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -1,4 +1,4 @@ -{ config, lib, flake-modules-core-lib, ... }: +{ config, lib, flake-parts-lib, ... }: let inherit (lib) filterAttrs @@ -7,7 +7,7 @@ let optionalAttrs types ; - inherit (flake-modules-core-lib) + inherit (flake-parts-lib) mkSubmoduleOptions mkPerSystemOption ; diff --git a/modules/checks.nix b/modules/checks.nix index d20fc02..87338ae 100644 --- a/modules/checks.nix +++ b/modules/checks.nix @@ -1,4 +1,4 @@ -{ config, lib, flake-modules-core-lib, ... }: +{ config, lib, flake-parts-lib, ... }: let inherit (lib) filterAttrs @@ -7,7 +7,7 @@ let optionalAttrs types ; - inherit (flake-modules-core-lib) + inherit (flake-parts-lib) mkSubmoduleOptions mkPerSystemOption ; diff --git a/modules/darwinModules.nix b/modules/darwinModules.nix index fb3df5b..0e3b017 100644 --- a/modules/darwinModules.nix +++ b/modules/darwinModules.nix @@ -1,4 +1,4 @@ -{ config, self, lib, flake-modules-core-lib, ... }: +{ config, self, lib, flake-parts-lib, ... }: let inherit (lib) filterAttrs @@ -7,7 +7,7 @@ let optionalAttrs types ; - inherit (flake-modules-core-lib) + inherit (flake-parts-lib) mkSubmoduleOptions ; in diff --git a/modules/devShells.nix b/modules/devShells.nix index 6ca058f..94a1042 100644 --- a/modules/devShells.nix +++ b/modules/devShells.nix @@ -1,4 +1,4 @@ -{ config, lib, flake-modules-core-lib, ... }: +{ config, lib, flake-parts-lib, ... }: let inherit (lib) filterAttrs @@ -7,7 +7,7 @@ let optionalAttrs types ; - inherit (flake-modules-core-lib) + inherit (flake-parts-lib) mkSubmoduleOptions mkPerSystemOption ; diff --git a/modules/legacyPackages.nix b/modules/legacyPackages.nix index 5263cd4..197d147 100644 --- a/modules/legacyPackages.nix +++ b/modules/legacyPackages.nix @@ -1,4 +1,4 @@ -{ config, lib, flake-modules-core-lib, ... }: +{ config, lib, flake-parts-lib, ... }: let inherit (lib) filterAttrs @@ -7,7 +7,7 @@ let optionalAttrs types ; - inherit (flake-modules-core-lib) + inherit (flake-parts-lib) mkSubmoduleOptions mkPerSystemOption ; diff --git a/modules/nixosConfigurations.nix b/modules/nixosConfigurations.nix index 6dee1bb..f62e4b4 100644 --- a/modules/nixosConfigurations.nix +++ b/modules/nixosConfigurations.nix @@ -1,11 +1,11 @@ -{ config, lib, flake-modules-core-lib, ... }: +{ config, lib, flake-parts-lib, ... }: let inherit (lib) mkOption types literalExpression ; - inherit (flake-modules-core-lib) + inherit (flake-parts-lib) mkSubmoduleOptions ; in diff --git a/modules/nixosModules.nix b/modules/nixosModules.nix index e26d040..bbd1afd 100644 --- a/modules/nixosModules.nix +++ b/modules/nixosModules.nix @@ -1,4 +1,4 @@ -{ config, self, lib, flake-modules-core-lib, ... }: +{ config, self, lib, flake-parts-lib, ... }: let inherit (lib) filterAttrs @@ -7,7 +7,7 @@ let optionalAttrs types ; - inherit (flake-modules-core-lib) + inherit (flake-parts-lib) mkSubmoduleOptions ; in diff --git a/modules/nixpkgs.nix b/modules/nixpkgs.nix index 76eaf21..d3870fc 100644 --- a/modules/nixpkgs.nix +++ b/modules/nixpkgs.nix @@ -3,12 +3,12 @@ # # Provides a `pkgs` argument in `perSystem`. # -# Arguably, this shouldn't be in flake-modules-core, but in nixpkgs. +# Arguably, this shouldn't be in flake-parts, but in nixpkgs. # Nixpkgs could define its own module that does this, which would be # a more consistent UX, but for now this will do. # # The existence of this module does not mean that other flakes' logic -# will be accepted into flake-modules-core, because it's against the +# will be accepted into flake-parts, because it's against the # spirit of Flakes. # { @@ -17,7 +17,7 @@ config = { _module.args.pkgs = lib.mkOptionDefault ( builtins.seq - (inputs'.nixpkgs or (throw "flake-modules-core: The flake does not have a `nixpkgs` input. Please add it, or set `perSystem._module.args.pkgs` yourself.")) + (inputs'.nixpkgs or (throw "flake-parts: The flake does not have a `nixpkgs` input. Please add it, or set `perSystem._module.args.pkgs` yourself.")) inputs'.nixpkgs.legacyPackages ); }; diff --git a/modules/overlay.nix b/modules/overlay.nix index 88405ae..d132ac9 100644 --- a/modules/overlay.nix +++ b/modules/overlay.nix @@ -1,10 +1,10 @@ -{ config, lib, flake-modules-core-lib, ... }: +{ config, lib, flake-parts-lib, ... }: let inherit (lib) mkOption types ; - inherit (flake-modules-core-lib) + inherit (flake-parts-lib) mkSubmoduleOptions ; in diff --git a/modules/packages.nix b/modules/packages.nix index 9844d88..50be309 100644 --- a/modules/packages.nix +++ b/modules/packages.nix @@ -1,4 +1,4 @@ -{ config, lib, flake-modules-core-lib, ... }: +{ config, lib, flake-parts-lib, ... }: let inherit (lib) filterAttrs @@ -7,7 +7,7 @@ let optionalAttrs types ; - inherit (flake-modules-core-lib) + inherit (flake-parts-lib) mkSubmoduleOptions mkPerSystemOption ; diff --git a/modules/perSystem.nix b/modules/perSystem.nix index ab781a4..446adee 100644 --- a/modules/perSystem.nix +++ b/modules/perSystem.nix @@ -1,4 +1,4 @@ -{ config, lib, flake-modules-core-lib, self, ... }: +{ config, lib, flake-parts-lib, self, ... }: let inherit (lib) genAttrs @@ -6,7 +6,7 @@ let mkOption types ; - inherit (flake-modules-core-lib) + inherit (flake-parts-lib) mkPerSystemType ; diff --git a/site/flake-module.nix b/site/flake-module.nix index 3543cb4..4814b57 100644 --- a/site/flake-module.nix +++ b/site/flake-module.nix @@ -57,8 +57,8 @@ }; coreOptions = optionsDoc { title = "Core Options"; - sourceName = "flake-modules-core"; - baseUrl = "https://github.com/hercules-ci/flake-modules-core/blob/main"; + sourceName = "flake-parts"; + baseUrl = "https://github.com/hercules-ci/flake-parts/blob/main"; sourcePath = ../.; }; buildPhase = '' diff --git a/site/index.html b/site/index.html index 759f7be..2837db5 100644 --- a/site/index.html +++ b/site/index.html @@ -1,11 +1,11 @@
-flake-modules-core
flake-parts
Compose flakes with the (NixOS) module system. @@ -30,7 +30,7 @@
diff --git a/template/default/flake.nix b/template/default/flake.nix index c8ed7de..f0d6be7 100644 --- a/template/default/flake.nix +++ b/template/default/flake.nix @@ -2,13 +2,13 @@ description = "Description for the project"; inputs = { - flake-modules-core.url = "github:hercules-ci/flake-modules-core"; - flake-modules-core.inputs.nixpkgs.follows = "nixpkgs"; + flake-parts.url = "github:hercules-ci/flake-parts"; + flake-parts.inputs.nixpkgs.follows = "nixpkgs"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; - outputs = { self, flake-modules-core, ... }: - flake-modules-core.lib.mkFlake { inherit self; } { + outputs = { self, flake-parts, ... }: + flake-parts.lib.mkFlake { inherit self; } { imports = [ # To import a flake module # 1. Add foo to inputs diff --git a/template/multi-module/flake.nix b/template/multi-module/flake.nix index ed20313..2964b21 100644 --- a/template/multi-module/flake.nix +++ b/template/multi-module/flake.nix @@ -2,13 +2,13 @@ description = "Description for the project"; inputs = { - flake-modules-core.url = "github:hercules-ci/flake-modules-core"; - flake-modules-core.inputs.nixpkgs.follows = "nixpkgs"; + flake-parts.url = "github:hercules-ci/flake-parts"; + flake-parts.inputs.nixpkgs.follows = "nixpkgs"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; }; - outputs = { self, flake-modules-core, ... }: - flake-modules-core.lib.mkFlake { inherit self; } { + outputs = { self, flake-parts, ... }: + flake-parts.lib.mkFlake { inherit self; } { imports = [ ./hello/flake-module.nix ];