-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(units/std/blockTypes): add jupyenv support
- Loading branch information
Showing
16 changed files
with
141 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,8 @@ in | |
"homeModules" | ||
"darwinModules" | ||
"darwinProfiles" | ||
"units" | ||
"units/*" | ||
".*." | ||
]; | ||
}; | ||
|
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
super.flakeOutputs |
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,28 @@ | ||
{ | ||
root, | ||
lib, | ||
super, | ||
}: | ||
load: | ||
let | ||
inherit | ||
(root.errors.requiredInputs load.inputs.inputs "omnibus.pops.jupyenv" [ | ||
"jupyenv" | ||
"nixpkgs" | ||
]) | ||
nixpkgs | ||
jupyenv | ||
; | ||
inherit (jupyenv.lib.${nixpkgs.system}) mkJupyterlabNew mkJupyterlabEval; | ||
|
||
setJupyenvModule = | ||
module: mkJupyterlabEval { imports = lib.flatten [ module ]; }; | ||
in | ||
(super.nixosProfiles.addLoadExtender { | ||
load = { | ||
inputs = { | ||
inherit setJupyenvModule mkJupyterlabNew mkJupyterlabEval; | ||
}; | ||
}; | ||
}).addLoadExtender | ||
{ inherit load; } |
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,10 @@ | ||
let | ||
inherit (root.errors.requiredInputs inputs "omnibus.pops.self" [ "std" ]) std; | ||
in | ||
super.load { | ||
loader = with haumea; [ (matchers.nix loaders.scoped) ]; | ||
src = projectDir + "/units/std"; | ||
inputs.inputs = { | ||
inherit std; | ||
}; | ||
} |
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
omnibus, | ||
eachSystem, | ||
projectDir, | ||
flops, | ||
}: | ||
let | ||
filterConfigs = | ||
|
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
omnibus, | ||
eachSystem, | ||
projectDir, | ||
flops, | ||
}: | ||
let | ||
filterConfigs = | ||
|
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ inputs, root }: | ||
/* Use the Runnables Blocktype for targets that you want to | ||
make accessible with a 'run' action on the TUI. | ||
*/ | ||
let | ||
inherit (inputs.std) actions; | ||
inherit (root) mkCommand; | ||
in | ||
name: { | ||
inherit name; | ||
type = "jupyenv"; | ||
actions = | ||
{ | ||
currentSystem, | ||
fragment, | ||
fragmentRelPath, | ||
target, | ||
inputs, | ||
}: | ||
[ | ||
(actions.build currentSystem target.config.build) | ||
(actions.run currentSystem target.config.build) | ||
(mkCommand currentSystem "quarto" "pass any command to quarto" [ ] | ||
'' | ||
(cd "$PRJ_ROOT" && ${target.config.quartoEnv}/bin/quarto "$@") | ||
'' | ||
{ } | ||
) | ||
]; | ||
} |
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,52 @@ | ||
{ inputs }: | ||
currentSystem: name: description: deps: command: args: | ||
let | ||
inherit (inputs.std.inputs) nixpkgs; | ||
inherit (nixpkgs.legacyPackages.${currentSystem}) pkgs; | ||
inherit (pkgs) | ||
lib | ||
stdenv | ||
haskell | ||
shellcheck | ||
runtimeShell | ||
; | ||
inherit (pkgs.haskell.lib.compose) justStaticExecutables; | ||
in | ||
args | ||
// { | ||
inherit name description; | ||
command = pkgs.writeTextFile { | ||
inherit name; | ||
executable = true; | ||
checkPhase = '' | ||
runHook preCheck | ||
${stdenv.shellDryRun} "$target" | ||
# use shellcheck which does not include docs | ||
# pandoc takes long to build and documentation isn't needed for in nixpkgs usage | ||
${lib.getExe (justStaticExecutables shellcheck.unwrapped)} "$target" | ||
runHook postCheck | ||
''; | ||
text = | ||
'' | ||
#!${runtimeShell} | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
if test -z "$PRJ_ROOT"; then | ||
echo "All Standard Block Type Actions require an environment that fulfills the PRJ Base Directiory Specification" | ||
echo "see: https://github.com/numtide/prj-spec" | ||
echo "Tip: To achieve that, you can enter a Standard direnv environment or run the action via the Standard CLI/TUI" | ||
exit 1 | ||
fi | ||
# Action Code follows ... | ||
'' | ||
+ lib.optionalString (deps != [ ]) '' | ||
# Be optionally reproducible due to potential overhead to load some | ||
# quaasi-ubiquitous dependencies that are already generally available | ||
export PATH="${lib.makeBinPath deps}:$PATH" | ||
'' | ||
+ command; | ||
}; | ||
} |