Skip to content

Commit

Permalink
update flake schema
Browse files Browse the repository at this point in the history
  • Loading branch information
jm8 committed Feb 11, 2024
1 parent 49d85b6 commit 9c951bf
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 70 deletions.
104 changes: 85 additions & 19 deletions src/schema/flakeSchema.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,73 @@
{
type = "object";
properties = {
inputs = {};
inputs = {
additionalProperties = {
type = "object";
properties = {
flake = {type = "boolean";};
type = {
enum = [
"path"
"git"
"mercurial"
"tarball"
"file"
"github"
"gitlab"
"sourcehut"
"indirect"
];
};
url = {
type = "string";
description = "An attrset specifying the dependencies of the flake.";
};
dir = {
type = "string";
description = ''
The subdirectory of the flake in which `flake.nix` is
located. This parameter enables having multiple flakes in a
repository or tarball. The default is the root directory of the
flake.
'';
};
narHash = {
type = "string";
description = ''
The hash of the NAR serialisation (in SRI format) of the
contents of the flake. This is useful for flake types such as
tarballs that lack a unique content identifier such as a Git commit
hash.
'';
};
rev = {
type = "string";
description = ''
A Git or Mercurial commit hash.
'';
};
ref = {
type = "string";
description = ''
A Git or Mercurial branch or tag name.
'';
};
owner = {
type = "string";
description = ''
The owner of the repository.
'';
};
repo = {
type = "string";
description = ''
The name of the repository.
'';
};
};
};
};
outputs = {};
};
}
Expand Down Expand Up @@ -31,11 +97,11 @@
# };
# url = mkOption {
# type = types.str;
# description = mdDoc "An attrset specifying the dependencies of the flake.";
# description = "An attrset specifying the dependencies of the flake.";
# };
# dir = mkOption {
# type = types.str;
# description = mdDoc ''
# description = ''
# The subdirectory of the flake in which `flake.nix` is
# located. This parameter enables having multiple flakes in a
# repository or tarball. The default is the root directory of the
Expand All @@ -44,7 +110,7 @@
# };
# narHash = mkOption {
# type = types.str;
# description = mdDoc ''
# description = ''
# The hash of the NAR serialisation (in SRI format) of the
# contents of the flake. This is useful for flake types such as
# tarballs that lack a unique content identifier such as a Git commit
Expand All @@ -53,31 +119,31 @@
# };
# rev = mkOption {
# type = types.str;
# description = mdDoc ''
# description = ''
# A Git or Mercurial commit hash.
# '';
# };
# ref = mkOption {
# type = types.str;
# description = mdDoc ''
# description = ''
# A Git or Mercurial branch or tag name.
# '';
# };
# owner = mkOption {
# type = types.str;
# description = mdDoc ''
# description = ''
# The owner of the repository.
# '';
# };
# repo = mkOption {
# type = types.str;
# description = mdDoc ''
# description = ''
# The name of the repository.
# '';
# };
# };
# }));
# description = mdDoc ''
# description = ''
# Specifies the dependencies of a flake, as an
# attrset mapping input names to flake references.
# '';
Expand All @@ -87,11 +153,11 @@
# options = {
# checks = mkOption {
# type = systemTo (attrsOfWithDefault types.package);
# description = mdDoc "Executed by `nix flake check`";
# description = "Executed by `nix flake check`";
# };
# packages = mkOption {
# type = systemTo (attrsOfWithDefault types.package);
# description = mdDoc "Executed by `nix build .#<name>`";
# description = "Executed by `nix build .#<name>`";
# };
# apps = mkOption {
# type = systemTo (attrsOfWithDefault (types.submodule {
Expand All @@ -104,35 +170,35 @@
# };
# };
# }));
# description = mdDoc "Executed by `nix run .#<name>``";
# description = "Executed by `nix run .#<name>``";
# };
# formatter = mkOption {
# type = systemTo types.package;
# description = mdDoc "Formatter (alejandra, nixfmt or nixpkgs-fmt)`";
# description = "Formatter (alejandra, nixfmt or nixpkgs-fmt)`";
# };
# legacyPackages = mkOption {
# type = systemTo (types.attrsOf types.package);
# description = mdDoc "Used for nixpkgs packages, also accessible via `nix build .#<name>`";
# description = "Used for nixpkgs packages, also accessible via `nix build .#<name>`";
# };
# overlays = mkOption {
# type = attrsOfWithDefault types.raw;
# description = mdDoc "Overlays, consumed by other flakes";
# description = "Overlays, consumed by other flakes";
# };
# nixosModules = mkOption {
# type = attrsOfWithDefault types.raw;
# description = mdDoc "Nixos modules, consumed by other flakes";
# description = "Nixos modules, consumed by other flakes";
# };
# nixosConfigurations = mkOption {
# type = types.attrsOf types.raw;
# description = mdDoc "Used with `nixos-rebuild --flake .#<hostname>`";
# description = "Used with `nixos-rebuild --flake .#<hostname>`";
# };
# devShells = mkOption {
# type = systemTo (attrsOfWithDefault types.package);
# description = mdDoc "Used by `nix develop .#<name>`";
# description = "Used by `nix develop .#<name>`";
# };
# hydraJobs = mkOption {
# type = types.attrsOf (systemTo types.package);
# description = mdDoc "Hydra build jobs";
# description = "Hydra build jobs";
# };
# templates = mkOption {
# type = attrsOfWithDefault (types.submodule {
Expand Down
3 changes: 3 additions & 0 deletions tests/completion_flake_input.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ import ./lib/maketest.nix {
"type"
"url"
];
ftype = {
schema = import ../src/schema/flakeSchema.nix;
};
}
101 changes: 50 additions & 51 deletions tests/completion_nixos_module_root.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,56 @@ import ./lib/maketest.nix {
'';
path = "/etc/configuration.nix";
expected = [
"appstream"
"assertions"
"boot"
"console"
"containers"
"docker-containers"
"documentation"
"dysnomia"
"ec2"
"environment"
"fileSystems"
"fonts"
"gtk"
"hardware"
"i18n"
"ids"
"jobs"
"krb5"
"lib"
"location"
"meta"
"nesting"
"networking"
"nix"
"nixops"
"nixpkgs"
"oci"
"openstack"
"passthru"
"power"
"powerManagement"
"programs"
"qt"
"qt5"
"security"
"services"
"snapraid"
"sound"
"specialisation"
"stubby"
"swapDevices"
"system"
"systemd"
"time"
"users"
"virtualisation"
"warnings"
"xdg"
"zramSwap"
]
;
"appstream"
"assertions"
"boot"
"console"
"containers"
"docker-containers"
"documentation"
"dysnomia"
"ec2"
"environment"
"fileSystems"
"fonts"
"gtk"
"hardware"
"i18n"
"ids"
"jobs"
"krb5"
"lib"
"location"
"meta"
"nesting"
"networking"
"nix"
"nixops"
"nixpkgs"
"oci"
"openstack"
"passthru"
"power"
"powerManagement"
"programs"
"qt"
"qt5"
"security"
"services"
"snapraid"
"sound"
"specialisation"
"stubby"
"swapDevices"
"system"
"systemd"
"time"
"users"
"virtualisation"
"warnings"
"xdg"
"zramSwap"
];
ftype = {
schema = import ../src/schema/nixosModuleSchema.nix;
};
Expand Down

0 comments on commit 9c951bf

Please sign in to comment.