forked from fediversity/fediversity
Compare commits
No commits in common. "6eb27c06e2480535103acde1df6be4566a37747e" and "26d39b7b937c5bcc30243243a9a6ea21eeac0452" have entirely different histories.
6eb27c06e2
...
26d39b7b93
3 changed files with 8 additions and 47 deletions
|
|
@ -1,38 +1,5 @@
|
||||||
/**
|
/**
|
||||||
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, ... }:
|
{ config, lib, ... }:
|
||||||
let
|
let
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{
|
{
|
||||||
nixosConfiguration,
|
nixpkgs,
|
||||||
hostKeys ? { },
|
hostKeys ? { },
|
||||||
nixpkgs ? (import ../npins).nixpkgs,
|
nixosConfiguration,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
@ -44,7 +44,7 @@ let
|
||||||
imports = [ "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" ];
|
imports = [ "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" ];
|
||||||
nixpkgs.hostPlatform = "x86_64-linux";
|
nixpkgs.hostPlatform = "x86_64-linux";
|
||||||
services.getty.autologinUser = lib.mkForce "root";
|
services.getty.autologinUser = lib.mkForce "root";
|
||||||
programs.bash.loginShellInit = lib.getExe bootstrap;
|
programs.bash.loginShellInit = nixpkgs.lib.getExe bootstrap;
|
||||||
|
|
||||||
isoImage = {
|
isoImage = {
|
||||||
compressImage = false;
|
compressImage = false;
|
||||||
|
|
@ -55,10 +55,4 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
(import "${nixpkgs}/nixos/lib/eval-config.nix" {
|
(nixpkgs.lib.nixosSystem { modules = [ installer ]; }).config.system.build.isoImage
|
||||||
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
|
|
||||||
|
|
|
||||||
|
|
@ -223,9 +223,9 @@ build_iso () {
|
||||||
nix build \
|
nix build \
|
||||||
--impure --expr "
|
--impure --expr "
|
||||||
let flake = builtins.getFlake (builtins.toString ./.); in
|
let flake = builtins.getFlake (builtins.toString ./.); in
|
||||||
import ./infra/makeInstallerIso.nix {
|
import ./makeInstallerIso.nix {
|
||||||
nixosConfiguration = flake.nixosConfigurations.$vm_name;
|
nixosConfiguration = flake.nixosConfigurations.$vm_name;
|
||||||
# FIXME pass nixpkgs from npins
|
nixpkgs = flake.inputs.nixpkgs;
|
||||||
$nix_host_keys
|
$nix_host_keys
|
||||||
}
|
}
|
||||||
" \
|
" \
|
||||||
|
|
@ -239,7 +239,7 @@ Check the Nix logs and fix things. Possibly there just is no NixOS configuration
|
||||||
"$vm_name"
|
"$vm_name"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -sf "$(ls "$tmpdir/installer-$vm_name"/iso/nixos-*.iso)" "$tmpdir/installer-$vm_name.iso"
|
ln -sf "$tmpdir/installer-$vm_name/iso/installer.iso" "$tmpdir/installer-$vm_name.iso"
|
||||||
|
|
||||||
printf 'done building ISO for VM %s.\n' "$vm_name"
|
printf 'done building ISO for VM %s.\n' "$vm_name"
|
||||||
release_lock build
|
release_lock build
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue