-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: namespace arg, inputs for packages and overlays, get lib from r…
…oot, add checks
- Loading branch information
1 parent
d6b7669
commit b2e6364
Showing
13 changed files
with
112 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
core-inputs, | ||
user-inputs, | ||
snowfall-lib, | ||
snowfall-config, | ||
}: let | ||
inherit (core-inputs.flake-utils-plus.lib) filterPackages; | ||
inherit (core-inputs.nixpkgs.lib) assertMsg foldl mapAttrs callPackageWith; | ||
|
||
user-checks-root = snowfall-lib.fs.get-snowfall-file "checks"; | ||
in { | ||
check = { | ||
## Create flake output packages. | ||
## Example Usage: | ||
## ```nix | ||
## create-checks { inherit channels; src = ./my-checks; overrides = { inherit another-check; }; alias = { default = "another-check"; }; } | ||
## ``` | ||
## Result: | ||
## ```nix | ||
## { another-check = ...; my-check = ...; default = ...; } | ||
## ``` | ||
#@ Attrs -> Attrs | ||
create-checks = { | ||
channels, | ||
src ? user-checks-root, | ||
pkgs ? channels.nixpkgs, | ||
overrides ? {}, | ||
alias ? {}, | ||
}: let | ||
user-checks = snowfall-lib.fs.get-default-nix-files-recursive src; | ||
create-check-metadata = check: let | ||
extra-inputs = | ||
pkgs | ||
// { | ||
inherit channels; | ||
lib = snowfall-lib.internal.system-lib; | ||
inputs = snowfall-lib.flake.without-src user-inputs; | ||
namespace = snowfall-config.namespace; | ||
}; | ||
in { | ||
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory check); | ||
drv = callPackageWith extra-inputs check {}; | ||
}; | ||
checks-metadata = builtins.map create-check-metadata user-checks; | ||
merge-checks = checks: metadata: | ||
checks | ||
// { | ||
${metadata.name} = metadata.drv; | ||
}; | ||
checks-without-aliases = foldl merge-checks {} checks-metadata; | ||
aliased-checks = mapAttrs (name: value: checks-without-aliases.${value}) alias; | ||
checks = checks-without-aliases // aliased-checks // overrides; | ||
in | ||
filterPackages pkgs.system checks; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,14 +37,17 @@ in { | |
templates | ||
// { | ||
${metadata.name} = | ||
(builtins.trace "name: ${metadata.name}") | ||
(builtins.trace "path: ${metadata.path}") | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jakehamilton
Author
Member
|
||
(overrides.${metadata.name} or {}) | ||
// { | ||
inherit (metadata) path; | ||
}; | ||
}; | ||
templates-without-aliases = foldl merge-templates {} templates-metadata; | ||
aliased-templates = mapAttrs (name: value: templates-without-aliases.${value}) alias; | ||
templates = templates-without-aliases // aliased-templates // overrides; | ||
unused-overrides = builtins.removeAttrs overrides (builtins.map (metadata: metadata.name) templates-metadata); | ||
templates = templates-without-aliases // aliased-templates // unused-overrides; | ||
in | ||
templates; | ||
}; | ||
|
Should these be here? This prints out trace messages during
nix flake show
andnix flake check
.