perSystem.lib.haskellData
Makes a derivation containing a Haskell Cabal package with data modules (using Cabal data stanzas)
Type: function that evaluates to a(n) (attribute set) (read only)
Default:
<function, args: {cabalDataPatterns, cabalPackageName, cabalPackageVersion?, srcs}>
Example:
''
```haskell
haskellData {
srcs = [ ./. ];
cabalDataPatterns = [ "**/*.json" ];
cabalPackageName = "golden-json-data";
};
```
''
Declared by:
perSystem.lib.haskellFlake
TODO(jaredponn): write down documentation here
Type: function that evaluates to a(n) (attribute set) (read only)
Default:
<function>
Example:
''
TODO(jaredponn): write down an example here
''
Declared by:
perSystem.lib.haskellPlutusFlake
TODO(jaredponn): write down documentation here
Type: function that evaluates to a(n) (attribute set) (read only)
Default:
<function>
Example:
''
TODO(jaredponn): write down an example here
''
Declared by:
perSystem.lib.purescriptFlake
TODO(jaredponn): write down documentation here
Type: function that evaluates to a(n) (attribute set) (read only)
Default:
<function>
Example:
''
TODO(jaredponn): write down an example here
''
Declared by:
perSystem.lib.rustFlake
Creates a flake for a Rust project.
Arguments:
src
: Source folder (unfiltered)extraSourceFilters
(optional): Extra filters to add non-rust related files to the derivationcrane
(optional): Crane version to be usedcrateName
: Name of the projectversion
: Major version of the projectrustChannel
(default=stable): Rust profile (stable, nightly, etc.)rustVersion
(default=latest): Rust versionnativeBuildInputs
(optional): Additional native build inputsbuildInputs
(optional): Additional build inputsextraSources
(optional): Extra sources, allowing to use other rustFlake components to be used as dependenciesextraSourcesDir
(default=.extras): Folder to store extra source librariesdata
(optional): Data dependenciesdataDir
(default=data): Folder to store the data dependenciesdevShellHook
(optional): Shell script executed after entering the dev shelldevShellTools
(optional): Packages made available in the dev shelltestTools
(optional): Packages made available in checks and the dev shellcargoNextestExtraArgs
(optional): Extra cargo nextest argumentsdoInstallCargoArtifacts
(optional): Controls whether cargo’s target directory should be copied as an outputtarget
(default=pkgs.stdenv.hostPlatform.config): Rust compilation targetextraRustcFlags
(optional): Extra rustc flagsextraCargoArgs
(optional): Extra cargo argumentsextraEnvVars
(optional): Extra environment variablesgenerateDocs
(default=true): Generate Rustdoc
Returns:
Returns an attribute set of the form
{
devShells."dev-${name}-rust" = derivation { ... };
packages."${name}-rust" = derivation { ... };
packages."${name}-rust-src" = derivation { ... };
packages."${name}-rust-build-env" = derivation { ... };
packages."${name}-rust-doc" = derivation { ... };
checks."${name}-rust-test" = derivation { ... };
checks."${name}-rust-clippy" = derivation { ... };
}
where
packages."${name}-rust"
contains the binary executable of the project.packages."${name}-rust-src"
contains the source folder, to be used as a dependency of other application in extraSourcespackages."${name}-rust-build-env"
contains the source folder, to be used as a standalone library (not is extraSources)packages."${name}-rust-doc"
contains the API references documentchecks."${name}-rust-test"
runs tests using cargo nextestchecks."${name}-rust-clippy"
runs clippy
Type: function that evaluates to a(n) (attribute set) (read only)
Default:
<function, args: {buildInputs?, cargoNextestExtraArgs?, crane?, crateName, data?, dataDir?, devShellHook?, devShellTools?, doInstallCargoArtifacts?, extraCargoArgs?, extraEnvVars?, extraRustcFlags?, extraSourceFilters?, extraSources?, extraSourcesDir?, generateDocs?, nativeBuildInputs?, rustChannel?, rustProfile?, rustVersion?, src, target?, testTools?, version?}>
Example:
''
{ ... }: {
perSystem = { config, ... }:
let
rustFlake = config.lib.rustFlake
{
src = ./.;
crateName = "rust-flake-project";
devShellHook = config.settings.shell.hook;
};
in
{
inherit (rustFlake) packages checks devShells;
};
}
''
Declared by:
perSystem.lib.typescriptFlake
Creates a flake for a TypeScript project.
Returns an attribute set of the form
{
devShells."${name}-typescript" = derivation { ... };
packages."${name}-typescript" = derivation { ... };
packages."${name}-typescript-exe" = derivation { ... };
packages."${name}-typescript-lib" = derivation { ... };
packages."${name}-typescript-tgz" = derivation { ... };
packages."${name}-typescript-node2nix" = derivation { ... };
checks."${name}-typescript-test" = derivation { ... };
}
where
-
packages."${name}-typescript"
contains the project with anode_modules/
provided by Nix (in theconfigurePhase
), and itsbuildPhase
runsnpm run "$npmBuildScript"
(wherenpmBuildScript
isbuild
by default). Indeed, one can overlay the entire derivation (which contains all its dependencies) to postprocess their project as they see fit. For example, one may want to generate documentation instead of building the project, by running:packages."${name}-typescript".overrideAttrs (_self: _super: { npmBuildScript = "docs"; installPhase = '' mv ./docs "$out" ''; });
where we assume that the
package.json
containsscripts.docs = <some-script>
which produces documentation in the./docs
folder. -
devShells."${name}-typescript"
provides a developer shell with the environment variableNODE_PATH
as the path to thenode_modules/
produced by Nix, and the command${name}-npm-extra-dependencies
which copies the transitive closure ofnpmExtraDependencies
to the folder./.extra-dependencies
.Moreover, the
shellHook
will:- create a symbolic link named
node_modules
pointing to$NODE_PATH
; and - execute
${name}-npm-extra-dependencies
.
As such, one should enter the development shell in the folder that the project exists in, so
npm
may use the provided dependencies from nix. - create a symbolic link named
-
packages."${name}-typescript-exe"
ispackages."${name}-typescript"
except runsnpm install --global --prefix="$out"
for theinstallPhase
and copies some of the symbolic links so that the output makes sense. -
packages."${name}-typescript-tgz"
ispackages."${name}-typescript"
except runsnpm pack
after thebuildPhase
to create a tarball of the project in the directory$out/tarballs/
. -
packages."${name}-typescript-lib"
ispackages."${name}-typescript-tgz"
except that it unpacks the tarball to$out/lib/node_modules/<package-name>
-
packages."${name}-typescript-test"
ispackages."${name}-typescript"
except it runsnpm test
after thebuildPhase
succeeding only ifnpm test
succeeds.
Type: function that evaluates to a(n) (attribute set) (read only)
Default:
<function, args: {data?, dataDir?, devShellHook?, devShellTools?, name, nodejs?, npmBuildScript?, npmExtraDependencies?, src, testTools?}>
Example:
"TODO(jaredponn)"
Declared by: