Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

flake.nix: add top level documented lib output #19

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 45 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,51 @@
};
};

lib = {
inherit (import ./lib/nuenv.nix)
mkNushellDerivation
mkNushellScript;
};
lib =
let internalLib = import ./lib/nuenv.nix;
in {
/*
mkNushellDerivation creates a nushell derivation builder

Type:
[package] -> [string] -> package

Example:
let nushellBuilder = mkNuShellDerivation
pkgs.nushell
pkgs.stdenv.hostPlatform.system;
*/
mkNushellDerivation =
# nushell package to use for derivation build environment
nushellPkg:
# system as a string
system:
internalLib.mkNushellDerivation nushellPkg system;

/*
mkNushellScript creates a nushell script builder

Type:
[string] -> [string] -> package

Example:
let mkNushellScript = mkNushellScript
pkgs.nushell
pkgs.writeTextFile;
let outScript = mkNushellScript
"repair-infra.nu"
''
print -e "(ansi red)fixing infrastructure(ansi reset)"
print "dont_crash_anymore=true" | save -a server_config.toml
'';
*/
mkNushellScript =
# nushell package to use for script shebang/execution
nushellPkg:
# function to use for writing out script (example: pkgs.writeTextFile)
writeTextFile:
internalLib.mkNushellScript nushellPkg writeTextFile;
};

devShells = forAllSystems ({ pkgs, system }: {
default = pkgs.mkShell {
Expand Down