-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mkNixosConfig: add config builder abstraction
Signed-off-by: Paul Meyer <[email protected]>
- Loading branch information
1 parent
b154547
commit d90575a
Showing
9 changed files
with
68 additions
and
44 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
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,60 @@ | ||
# Copyright 2024 Edgeless Systems GmbH | ||
# SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
{ | ||
lib, | ||
nixos, | ||
pkgs, | ||
}: | ||
|
||
{ | ||
# If set, placeholder is written into the command line roothash parameter. | ||
# Used for building verity protected images. | ||
roothashPlaceholder ? "", | ||
|
||
... | ||
}@args: | ||
|
||
let | ||
# 'nixos' uses 'pkgs' from the point in time where nixpkgs function is evaluated. According | ||
# to the documentation, we should be able to overwrite 'pkgs' by setting nixpkgs.pkgs in | ||
# the config, but that doesn't seem to work. We use an overlay for now instead. | ||
# TODO(katexochen): Investigate why the config option doesn't work. | ||
outerPkgs = pkgs; | ||
|
||
readModulesDir = | ||
dir: | ||
lib.pipe (builtins.readDir dir) [ | ||
(lib.filterAttrs (_filename: type: type == "regular")) | ||
(lib.mapAttrsToList (filename: _type: "${dir}/${filename}")) | ||
]; | ||
|
||
args' = lib.removeAttrs args [ "roothashPlaceholder" ]; | ||
in | ||
|
||
(nixos ( | ||
{ modulesPath, ... }: | ||
|
||
{ | ||
imports = [ | ||
"${modulesPath}/image/repart.nix" | ||
"${modulesPath}/system/boot/uki.nix" | ||
] ++ readModulesDir ../../nixos; | ||
|
||
# TODO(katexochen): imporve, see comment above. | ||
nixpkgs.overlays = [ | ||
(_self: _super: { | ||
inherit (outerPkgs) | ||
azure-no-agent | ||
cloud-api-adaptor | ||
kernel-podvm-azure | ||
pause-bundle | ||
; | ||
inherit (outerPkgs.kata) kata-agent; | ||
}) | ||
]; | ||
|
||
boot.kernelParams = lib.optional (roothashPlaceholder != "") "roothash=${roothashPlaceholder}"; | ||
} | ||
// args' | ||
)) |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.