Skip to content

Commit

Permalink
Add comments to NixpkgsProblem struct sub-types
Browse files Browse the repository at this point in the history
  • Loading branch information
willbush committed Mar 26, 2024
1 parent bcc472d commit 591be8e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/nixpkgs_problem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub enum NixpkgsProblem {
TopLevelPackage(TopLevelPackageError),
}

/// A file structure error involving a shard (e.g. `fo` is the shard in the path `pkgs/by-name/fo/foo/package.nix`)
#[derive(Clone)]
pub struct ShardError {
pub shard_name: String,
Expand All @@ -33,6 +34,7 @@ pub enum ShardErrorKind {
CaseSensitiveDuplicate { first: OsString, second: OsString },
}

/// A file structure error involving the package name and/or path.
#[derive(Clone)]
pub struct PackageError {
pub relative_package_dir: RelativePathBuf,
Expand All @@ -54,6 +56,8 @@ pub enum PackageErrorKind {
PackageNixDir,
}

/// An error related to checks involving by-name attributes. For example, attribute `foo` in
/// `pkgs/by-name/fo/foo/package.nix`.
#[derive(Clone)]
pub struct ByNameError {
pub attribute_name: String,
Expand All @@ -68,6 +72,8 @@ pub enum ByNameErrorKind {
CannotDetermineAttributeLocation,
}

/// An error related to packages in `pkgs/by-name` that are manually overridden, e.g. in
/// all-packages.nix
#[derive(Clone)]
pub struct ByNameOverrideError {
pub package_name: String,
Expand All @@ -90,6 +96,8 @@ pub enum ByNameOverrideErrorKind {
NonPath,
}

/// An error that results from checks that verify a specific path does not reference outside the
/// package directory.
#[derive(Clone)]
pub struct PathError {
pub relative_package_dir: RelativePathBuf,
Expand All @@ -103,6 +111,8 @@ pub enum PathErrorKind {
UnresolvableSymlink { io_error: String },
}

/// An error that results from checks that verify a nix file that contains a path expression does
/// not reference outside the package.
#[derive(Clone)]
pub struct NixFileError {
pub relative_package_dir: RelativePathBuf,
Expand All @@ -120,7 +130,8 @@ pub enum NixFileErrorKind {
UnresolvablePathReference { io_error: String },
}

/// An error related to the introduction/move of a top-level package not using `pkgs/by-name`, but it should
/// An error related to the introduction/move of a top-level package not using `pkgs/by-name`, but
/// it should.
#[derive(Clone)]
pub struct TopLevelPackageError {
pub package_name: String,
Expand Down

0 comments on commit 591be8e

Please sign in to comment.