feat: add inputs to callPackage
This commit is contained in:
parent
2bc7d5fab3
commit
07d478036c
4 changed files with 38 additions and 6 deletions
31
README.md
31
README.md
|
|
@ -38,7 +38,7 @@ cd config
|
||||||
2. Create a new flake with one of the templates from [@snowfallorg/templates](https://github.com/snowfallorg/templates).
|
2. Create a new flake with one of the templates from [@snowfallorg/templates](https://github.com/snowfallorg/templates).
|
||||||
|
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
|-----------|---------------------------------------------------|
|
| --------- | ------------------------------------------------- |
|
||||||
| `system` | A NixOS system and modules ready to modify. |
|
| `system` | A NixOS system and modules ready to modify. |
|
||||||
| `package` | A Nix Flake that exports packages and an overlay. |
|
| `package` | A Nix Flake that exports packages and an overlay. |
|
||||||
| `module` | A Nix Flake that exports NixOS modules. |
|
| `module` | A Nix Flake that exports NixOS modules. |
|
||||||
|
|
@ -114,7 +114,7 @@ inputs.snowfall-lib.mkFlake {
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
See [`lib.mkFlake`](#lib.mkflake) for information on how to configure your flake's outputs.
|
See [`lib.mkFlake`](#libmkflake) for information on how to configure your flake's outputs.
|
||||||
|
|
||||||
## `lib`
|
## `lib`
|
||||||
|
|
||||||
|
|
@ -150,7 +150,7 @@ Snowfall Lib has opinions about how a flake's files are laid out. This lets
|
||||||
the structure that `lib` expects to find at the root of your flake.
|
the structure that `lib` expects to find at the root of your flake.
|
||||||
|
|
||||||
```
|
```
|
||||||
flake-root/
|
flake-root/
|
||||||
│
|
│
|
||||||
│ Your Nix flake.
|
│ Your Nix flake.
|
||||||
├─ flake.nix
|
├─ flake.nix
|
||||||
|
|
@ -161,7 +161,7 @@ flake-root/
|
||||||
│ │ A Nix function called with `inputs`, `snowfall-inputs`, and `lib`.
|
│ │ A Nix function called with `inputs`, `snowfall-inputs`, and `lib`.
|
||||||
│ │ The function should return an attribute set to merge with `lib`.
|
│ │ The function should return an attribute set to merge with `lib`.
|
||||||
│ ├─ default.nix
|
│ ├─ default.nix
|
||||||
│ │
|
│ │
|
||||||
│ │ Any (nestable) directory name.
|
│ │ Any (nestable) directory name.
|
||||||
│ └─ **/
|
│ └─ **/
|
||||||
│ │
|
│ │
|
||||||
|
|
@ -701,8 +701,11 @@ Result:
|
||||||
File system utilities.
|
File system utilities.
|
||||||
|
|
||||||
#### `lib.snowfall.fs.is-file-kind`
|
#### `lib.snowfall.fs.is-file-kind`
|
||||||
|
|
||||||
#### `lib.snowfall.fs.is-symlink-kind`
|
#### `lib.snowfall.fs.is-symlink-kind`
|
||||||
|
|
||||||
#### `lib.snowfall.fs.is-directory-kind`
|
#### `lib.snowfall.fs.is-directory-kind`
|
||||||
|
|
||||||
#### `lib.snowfall.fs.is-unknown-kind`
|
#### `lib.snowfall.fs.is-unknown-kind`
|
||||||
|
|
||||||
Matchers for file kinds. These are often used with `readDir`.
|
Matchers for file kinds. These are often used with `readDir`.
|
||||||
|
|
@ -1066,6 +1069,24 @@ Result:
|
||||||
false
|
false
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### `lib.snowfall.system.is-virtual`
|
||||||
|
|
||||||
|
Check whether a named system is virtual.
|
||||||
|
|
||||||
|
Type: `String -> Bool`
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
is-linux "x86_64-iso"
|
||||||
|
```
|
||||||
|
|
||||||
|
Result:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
true
|
||||||
|
```
|
||||||
|
|
||||||
#### `lib.snowfall.system.get-virtual-system-type`
|
#### `lib.snowfall.system.get-virtual-system-type`
|
||||||
|
|
||||||
Get the virtual system type of a system target.
|
Get the virtual system type of a system target.
|
||||||
|
|
@ -1175,7 +1196,7 @@ Result:
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `lib.snowfall.system.create-systems`
|
#### `lib.snowfall.system.create-systems`
|
||||||
|
|
||||||
Create all available systems.
|
Create all available systems.
|
||||||
|
|
||||||
Type: `Attrs -> Attrs`
|
Type: `Attrs -> Attrs`
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ in
|
||||||
drv = pkgs.callPackage package {
|
drv = pkgs.callPackage package {
|
||||||
inherit channels;
|
inherit channels;
|
||||||
lib = snowfall-lib.internal.system-lib;
|
lib = snowfall-lib.internal.system-lib;
|
||||||
|
inputs = snowfall-lib.flake.without-src user-inputs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
packages-metadata = builtins.map create-package-metadata user-packages;
|
packages-metadata = builtins.map create-package-metadata user-packages;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,9 @@ in
|
||||||
{
|
{
|
||||||
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory shell);
|
name = builtins.unsafeDiscardStringContext (snowfall-lib.path.get-parent-directory shell);
|
||||||
drv = channels.nixpkgs.callPackage shell {
|
drv = channels.nixpkgs.callPackage shell {
|
||||||
|
inherit channels;
|
||||||
lib = snowfall-lib.internal.system-lib;
|
lib = snowfall-lib.internal.system-lib;
|
||||||
|
inputs = snowfall-lib.flake.without-src user-inputs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
shells-metadata = builtins.map create-shell-metadata user-shells;
|
shells-metadata = builtins.map create-shell-metadata user-shells;
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,13 @@ in
|
||||||
# result: false
|
# result: false
|
||||||
is-linux = hasInfix "linux";
|
is-linux = hasInfix "linux";
|
||||||
|
|
||||||
|
# Check whether a named system is virtual.
|
||||||
|
# Type: String -> Bool
|
||||||
|
# Usage: is-virtual "x86_64-iso"
|
||||||
|
# result: true
|
||||||
|
is-virtual = target:
|
||||||
|
(get-virtual-system-type target) != "";
|
||||||
|
|
||||||
# Get the virtual system type of a system target.
|
# Get the virtual system type of a system target.
|
||||||
# Type: String -> String
|
# Type: String -> String
|
||||||
# Usage: get-virtual-system-type "x86_64-iso"
|
# Usage: get-virtual-system-type "x86_64-iso"
|
||||||
|
|
@ -161,8 +168,9 @@ in
|
||||||
modules = [ path ] ++ modules;
|
modules = [ path ] ++ modules;
|
||||||
|
|
||||||
specialArgs = specialArgs // {
|
specialArgs = specialArgs // {
|
||||||
inherit system name systems lib;
|
inherit target system name systems lib;
|
||||||
|
|
||||||
|
virtual = (get-virtual-system-type target) != "";
|
||||||
inputs = snowfall-lib.flake.without-src user-inputs;
|
inputs = snowfall-lib.flake.without-src user-inputs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue