diff --git a/flake.lock b/flake.lock
index cc0a181..df5f71d 100644
--- a/flake.lock
+++ b/flake.lock
@@ -158,11 +158,12 @@
},
"flake-schemas": {
"locked": {
- "narHash": "sha256-ifw8Td8kD08J8DxFbYjeIx5naHcDLz7s2IFP3X42I/U=",
- "rev": "c702cbb663d6d70bbb716584a2ee3aeb35017279",
- "revCount": 21,
+ "lastModified": 1697467827,
+ "narHash": "sha256-j8SR19V1SRysyJwpOBF4TLuAvAjF5t+gMiboN4gYQDU=",
+ "rev": "764932025c817d4e500a8d2a4d8c565563923d29",
+ "revCount": 29,
"type": "tarball",
- "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.1/018a4c59-80e1-708a-bb4d-854930c20f72/source.tar.gz"
+ "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.2/018b3da8-4cc3-7fbb-8ff7-1588413c53e2/source.tar.gz"
},
"original": {
"type": "tarball",
@@ -339,11 +340,11 @@
"nixpkgs-regression": "nixpkgs-regression_2"
},
"locked": {
- "lastModified": 1695206941,
- "narHash": "sha256-ggISAuGpTkKp6JXt1BbcLtLDYOPECWqrVnPVgQEFHYc=",
+ "lastModified": 1696259154,
+ "narHash": "sha256-WNmifcTsN9aG1ONkv+l2BC4sHZZxtNKy0keqBHXXQ7w=",
"owner": "NixOS",
"repo": "nix",
- "rev": "44fb1192185cdd03343da7faa08a1c605f773419",
+ "rev": "f5f4de6a550327b4b1a06123c2e450f1b92c73b6",
"type": "github"
},
"original": {
@@ -388,11 +389,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1696019113,
- "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=",
+ "lastModified": 1697723726,
+ "narHash": "sha256-SaTWPkI8a5xSHX/rrKzUe+/uVNy6zCGMXgoeMb7T9rg=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a",
+ "rev": "7c9cc5a6e5d38010801741ac830a3f8fd667a7a0",
"type": "github"
},
"original": {
diff --git a/overlays/overrides/default.nix b/overlays/overrides/default.nix
index 2434dff..0e329d7 100644
--- a/overlays/overrides/default.nix
+++ b/overlays/overrides/default.nix
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-{ hydra, nix, ... } @ inputs:
+{ hydra, nix, ... } @ _inputs:
final: prev:
let
# Avoid infinite recursion by renaming flakes
@@ -27,11 +27,26 @@ let
hydra_final = final // (hydra'.inputs.nix.overlays.default hydra_final prev);
# Get the relevant bits out of the provided overlays
inherit (hydra'.overlays.default hydra_final prev) hydra perlPackages;
- inherit (nix'.overlays.default final prev) lowdown-nix nix;
+ inherit (nix'.overlays.default final prev) lowdown-nix nix nixStable nixUnstable;
in
{
# Expose the extracted packages into the overlay
- inherit lowdown-nix nix perlPackages;
+ inherit lowdown-nix nix nixStable nixUnstable perlPackages;
+ nixVersions = with final; prev.nixVersions // {
+ schemas = nixSchemas;
+ };
hydra_unstable = hydra;
+
+ # Build a nix package that has flake schema support (see nix#8892)
+ nixSchemas = nix.overrideAttrs ({ patches ? [ ], ... }: {
+ patches = patches ++ [
+ (final.fetchpatch {
+ url = "https://github.com/NixOS/nix/pull/8892.diff";
+ hash = "sha256-NfBksfuW1RUWe3O9cyqdM+A4O9ZGvEWg8rfv+24BosA=";
+ excludes = [ "doc/manual/src/SUMMARY.md.in" "flake.nix" "flake.lock" ];
+ })
+ ];
+ doCheck = false; # Schema tests still require internet connection
+ });
}
diff --git a/schemas/apps/default.nix b/schemas/apps/default.nix
new file mode 100644
index 0000000..3ed0b78
--- /dev/null
+++ b/schemas/apps/default.nix
@@ -0,0 +1,31 @@
+# This file is part of Nix++.
+# Copyright (C) 2023 Leandro Emmanuel Reina Kiperman.
+#
+# Nix++ is free software: you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# Nix++ is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+{ ... } @ _inputs:
+{
+ version = 1;
+ doc = ''
+ The `apps` flake output is a set of executables that can be run using `nix run`.
+ '';
+ inventory = output: {
+ children = builtins.mapAttrs
+ (system: apps: {
+ forSystems = [ system ];
+ children = builtins.mapAttrs (_: _: { what = "flake app"; }) apps;
+ })
+ output
+ ;
+ };
+}
diff --git a/schemas/default.nix b/schemas/default.nix
index 65309a1..be5763f 100644
--- a/schemas/default.nix
+++ b/schemas/default.nix
@@ -17,13 +17,13 @@
(self.lib.import.asSchemas' {
path = ./.;
apply = _: schema: schema inputs;
- # TODO apps nixosModules packages templates
}) // {
inherit (flake-schemas.schemas)
devShells
checks
- hydraJobs
+ # hydraJobs # Reimplemented to avoid nesting into cross compiled jobs
nixosConfigurations
+ nixosModules
overlays
# packages # We have a superset that also allows for cross-compilation
schemas
diff --git a/schemas/hydraJobs/default.nix b/schemas/hydraJobs/default.nix
new file mode 100644
index 0000000..fc8be79
--- /dev/null
+++ b/schemas/hydraJobs/default.nix
@@ -0,0 +1,55 @@
+# This file is part of Nix++.
+# Copyright (C) 2023 Leandro Emmanuel Reina Kiperman.
+#
+# Nix++ is free software: you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# Nix++ is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+{ nixpkgs, ... } @ _inputs:
+{
+ version = 1;
+ doc = ''
+ The `hydraJobs` flake output defines derivations to be built by the Hydra
+ continuous integration system.
+ '';
+ inventory = output: {
+ children = builtins.mapAttrs
+ (_: category: {
+ children = builtins.mapAttrs
+ (name: jobset:
+ let
+ localSystem = builtins.head (nixpkgs.lib.splitString "." name);
+ crossSystem = nixpkgs.lib.removePrefix "${localSystem}." name;
+
+ in
+ {
+ forSystems = [ localSystem ];
+ children = builtins.mapAttrs
+ (_: job: {
+ what = "Hydra CI job (${
+ if localSystem == crossSystem then
+ "natively compiled on ${localSystem}"
+ else
+ "cross compiled on ${localSystem} for ${crossSystem}"
+ })";
+ derivation = job;
+ })
+ jobset
+ ;
+ }
+ )
+ category
+ ;
+ })
+ output
+ ;
+ };
+}
diff --git a/schemas/lib/default.nix b/schemas/lib/default.nix
index e72d506..db80f78 100644
--- a/schemas/lib/default.nix
+++ b/schemas/lib/default.nix
@@ -29,6 +29,9 @@ let
_apply = metadata: {
what = "Metadata for this flake";
} // recurse metadata [ "meta" ];
+ homepage._apply = _: {
+ what = "This flake's home page";
+ };
license._apply = _: {
what = "GPLv3+ license";
};
@@ -41,6 +44,7 @@ let
what = "Cross-compiled nixpkgs with overlays applied";
children = builtins.mapAttrs
(localSystem: crossPkgs: {
+ forSystems = [ localSystem ];
children = builtins.mapAttrs
(crossSystem: _: {
what = "nixpkgs (${
diff --git a/schemas/packages/default.nix b/schemas/packages/default.nix
new file mode 100644
index 0000000..1e06dc4
--- /dev/null
+++ b/schemas/packages/default.nix
@@ -0,0 +1,72 @@
+# This file is part of Nix++.
+# Copyright (C) 2023 Leandro Emmanuel Reina Kiperman.
+#
+# Nix++ is free software: you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# Nix++ is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+{ nixpkgs, self, ... } @ _inputs:
+{
+ version = 1;
+ doc = ''
+ The `packages` flake output is a collection of packages that can be installed
+ using `nix profile install`.
+ '';
+ inventory = output: {
+ children = builtins.mapAttrs
+ (localSystem: packages: {
+ forSystems = [ localSystem ];
+ children = (builtins.mapAttrs
+ (_: derivation: {
+ what = "Derivation for (natively compiled on ${localSystem})";
+ inherit derivation;
+ })
+ (nixpkgs.lib.filterAttrs
+ (name: _:
+ (builtins.all (system: name != system) self.lib.supportedSystems)
+ && (!nixpkgs.lib.hasPrefix "_" name)
+ )
+ packages
+ )
+ ) // (builtins.listToAttrs (builtins.map
+ (crossSystem: {
+ name = crossSystem;
+ value = {
+ children = builtins.mapAttrs
+ (_: derivation: {
+ what = "Derivation (${
+ if localSystem == crossSystem then
+ "natively compiled on ${localSystem}"
+ else
+ "cross compiled on ${localSystem} for ${crossSystem}"
+ })";
+ inherit derivation;
+ })
+ (nixpkgs.lib.filterAttrs
+ (name: _: !nixpkgs.lib.hasPrefix "_" name)
+ packages.${crossSystem}.passthru
+ )
+ ;
+ };
+ })
+ (builtins.filter
+ (name:
+ builtins.any (system: name == system)
+ self.lib.supportedSystems
+ )
+ (builtins.attrNames packages)
+ )
+ ));
+ })
+ output
+ ;
+ };
+}
diff --git a/schemas/templates/default.nix b/schemas/templates/default.nix
new file mode 100644
index 0000000..c1e81e2
--- /dev/null
+++ b/schemas/templates/default.nix
@@ -0,0 +1,29 @@
+# This file is part of Nix++.
+# Copyright (C) 2023 Leandro Emmanuel Reina Kiperman.
+#
+# Nix++ is free software: you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation, either version 3 of the License, or (at your option) any later
+# version.
+#
+# Nix++ is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+{ ... } @ _inputs:
+{
+ version = 1;
+ doc = ''
+ The `templates` flake output is used to provide ways to create new flakes using
+ `nix flake init`.
+ '';
+ inventory = output: {
+ children = builtins.mapAttrs
+ (_: _: { what = "flake template"; })
+ output
+ ;
+ };
+}
diff --git a/shells/default/default.nix b/shells/default/default.nix
index 5bed508..4415288 100644
--- a/shells/default/default.nix
+++ b/shells/default/default.nix
@@ -20,7 +20,7 @@
# Basics
({ lib, pkgs, ... }: {
name = "Nix++";
- packages = with pkgs; [ cacert coreutils nixVersions.unstable ];
+ packages = with pkgs; [ cacert coreutils nixVersions.schemas ];
enterShell = lib.mkBefore ''
EDITOR="''${EDITOR:-${npppkgs.vim-minimal}/bin/vim}" # Default to vim
export EDITOR