mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
feat: lazy devshell eval
This commit is contained in:
parent
4904a8dfd7
commit
a50966a8ea
4 changed files with 28 additions and 8 deletions
|
|
@ -7,6 +7,10 @@ NF_HOST=${NF_HOST-tewi}
|
|||
NIXOS_TOPLEVEL=network.nodes.$NF_HOST.system.build.toplevel
|
||||
NF_ADDR=${NF_ADDR-${NF_HOST}.local}
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
set -- ""
|
||||
fi
|
||||
|
||||
if [[ $1 = tarball ]]; then
|
||||
shift
|
||||
set -- build "$@"
|
||||
12
devShell.nix
12
devShell.nix
|
|
@ -1,11 +1,7 @@
|
|||
{ inputs, system }:
|
||||
let
|
||||
meta = import ./meta.nix { inherit inputs system; };
|
||||
config = meta;
|
||||
inherit (meta) pkgs;
|
||||
inherit (pkgs) lib;
|
||||
inherit (lib.options) optional;
|
||||
inherit (lib.attrsets) attrValues;
|
||||
nf-actions = pkgs.writeShellScriptBin "nf-actions" ''
|
||||
NF_CONFIG_FILES=($NF_CONFIG_ROOT/ci/{nodes,flake-cron}.nix)
|
||||
for f in "''${NF_CONFIG_FILES[@]}"; do
|
||||
|
|
@ -14,13 +10,13 @@ let
|
|||
done
|
||||
'';
|
||||
nf-actions-test = pkgs.writeShellScriptBin "nf-actions-test" ''
|
||||
nix run --argstr config "$NF_CONFIG_ROOT/ci/nodes.nix" -f '${inputs.ci}' job.tewi.test
|
||||
exec nix run --argstr config "$NF_CONFIG_ROOT/ci/nodes.nix" -f '${inputs.ci}' job.tewi.test
|
||||
'';
|
||||
nf-update = pkgs.writeShellScriptBin "nf-update" ''
|
||||
nix flake update
|
||||
exec nix flake update "$@"
|
||||
'';
|
||||
nf-deploy = pkgs.writeShellScriptBin "nf-deploy" ''
|
||||
exec /usr/bin/env bash ${./nixos/deploy.sh} "$@"
|
||||
exec nix run ''${FLAKE_OPTS-} ''$NF_CONFIG_ROOT#nf-deploy -- "$@"
|
||||
'';
|
||||
in
|
||||
pkgs.mkShell {
|
||||
|
|
@ -33,7 +29,7 @@ pkgs.mkShell {
|
|||
nf-deploy
|
||||
];
|
||||
shellHook = ''
|
||||
export NIX_BIN_DIR=${pkgs.nix}/bin
|
||||
export NIX_BIN_DIR=$(dirname $(readlink -f $(type -P nix)))
|
||||
export HOME_UID=$(id -u)
|
||||
export HOME_USER=$(id -un)
|
||||
export CI_PLATFORM="impure"
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
(system: rec {
|
||||
devShells.default = import ./devShell.nix {inherit system inputs;};
|
||||
legacyPackages = import ./meta.nix {inherit system inputs;};
|
||||
inherit (legacyPackages.outputs) packages;
|
||||
});
|
||||
in
|
||||
providedSystems
|
||||
|
|
|
|||
19
modules/meta/packages.nix
Normal file
19
modules/meta/packages.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) attrsOf package;
|
||||
in {
|
||||
options.outputs.packages = mkOption {
|
||||
type = attrsOf package;
|
||||
default = { };
|
||||
};
|
||||
|
||||
config.outputs.packages = {
|
||||
nf-deploy = pkgs.writeShellScriptBin "nf-deploy" ''
|
||||
exec ${pkgs.runtimeShell} ${../../ci/deploy.sh} "$@"
|
||||
'';
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue