Compare commits

..

2 commits

Author SHA1 Message Date
6eb27c06e2
fix proxmox-provision.sh
Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
2025-09-18 19:11:58 +02:00
3fd61aea5b better document function.nix (#524)
Reviewed-on: Fediversity/Fediversity#524
2025-09-18 18:22:09 +02:00
3 changed files with 47 additions and 8 deletions

View file

@ -1,5 +1,38 @@
/**
Modular function type
Modular function type.
Compared to plain nix functions, adds input type-checks
at the cost of longer stack traces.
Usage:
```nix
{ lib, ... }:
{
options = {
my-function = lib.mkOption {
description = "My type-safe function invocation.";
type = lib.types.submodule PATH/TO/function.nix;
readOnly = true;
default = {
input-type = lib.types.int;
output-type = lib.types.int;
implementation = x: x + x;
};
};
};
config = {
my-function.apply "1"
};
}
```
A sample stack trace using this ends up like:
- `INVOKER.apply.<function body>``
- `function.nix`
- `INVOKER.wrapper.<function body>.output`
- `INVOKER.implementation.<function body>`
*/
{ config, lib, ... }:
let

View file

@ -5,9 +5,9 @@
*/
{
nixpkgs,
hostKeys ? { },
nixosConfiguration,
hostKeys ? { },
nixpkgs ? (import ../npins).nixpkgs,
}:
let
@ -44,7 +44,7 @@ let
imports = [ "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" ];
nixpkgs.hostPlatform = "x86_64-linux";
services.getty.autologinUser = lib.mkForce "root";
programs.bash.loginShellInit = nixpkgs.lib.getExe bootstrap;
programs.bash.loginShellInit = lib.getExe bootstrap;
isoImage = {
compressImage = false;
@ -55,4 +55,10 @@ let
};
};
in
(nixpkgs.lib.nixosSystem { modules = [ installer ]; }).config.system.build.isoImage
(import "${nixpkgs}/nixos/lib/eval-config.nix" {
modules = [ installer ];
# Allow system to be set modularly in nixpkgs.system.
# We set it to null, to remove the "legacy" entrypoint's
# non-hermetic default.
system = null;
}).config.system.build.isoImage

View file

@ -223,9 +223,9 @@ build_iso () {
nix build \
--impure --expr "
let flake = builtins.getFlake (builtins.toString ./.); in
import ./makeInstallerIso.nix {
import ./infra/makeInstallerIso.nix {
nixosConfiguration = flake.nixosConfigurations.$vm_name;
nixpkgs = flake.inputs.nixpkgs;
# FIXME pass nixpkgs from npins
$nix_host_keys
}
" \
@ -239,7 +239,7 @@ Check the Nix logs and fix things. Possibly there just is no NixOS configuration
"$vm_name"
fi
ln -sf "$tmpdir/installer-$vm_name/iso/installer.iso" "$tmpdir/installer-$vm_name.iso"
ln -sf "$(ls "$tmpdir/installer-$vm_name"/iso/nixos-*.iso)" "$tmpdir/installer-$vm_name.iso"
printf 'done building ISO for VM %s.\n' "$vm_name"
release_lock build