nixos: add file-systems options
This commit is contained in:
parent
1bb05f7e57
commit
74ea4d0c12
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
x86_64 = {
|
x86_64 = {
|
||||||
imports = [
|
imports = [
|
||||||
|
./file-systems.nix
|
||||||
./genode-core.nix
|
./genode-core.nix
|
||||||
./genode-init.nix
|
./genode-init.nix
|
||||||
./gui
|
./gui
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
with lib; {
|
||||||
|
|
||||||
|
options.fileSystems = lib.mkOption {
|
||||||
|
type = types.attrsOf (types.submodule ({ name, config, ... }: {
|
||||||
|
options.block = {
|
||||||
|
|
||||||
|
device = lib.mkOption { type = types.int; };
|
||||||
|
|
||||||
|
driver = lib.mkOption { type = types.enum [ "ahci" ]; };
|
||||||
|
|
||||||
|
partition = lib.mkOption { type = types.ints.positive; };
|
||||||
|
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
|
||||||
|
assertions = [{
|
||||||
|
assertion = config.fileSystems."/".fsType == "ext2";
|
||||||
|
message = "The only supported fsType is EXT2";
|
||||||
|
}];
|
||||||
|
|
||||||
|
hardware.genode.ahci.enable =
|
||||||
|
any (fs: fs.block.driver == "ahci") (attrValues config.fileSystems);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -220,7 +220,9 @@ in {
|
||||||
, service = "Block"
|
, service = "Block"
|
||||||
, label = Init.LabelSelector.prefix "store_fs"
|
, label = Init.LabelSelector.prefix "store_fs"
|
||||||
, attributes = toMap
|
, attributes = toMap
|
||||||
{ partition = "1"
|
{ partition = "${
|
||||||
|
toString config.fileSystems."/".block.partition
|
||||||
|
}"
|
||||||
, writeable = "yes"
|
, writeable = "yes"
|
||||||
, TODO = "select by partition UUID"
|
, TODO = "select by partition UUID"
|
||||||
}
|
}
|
||||||
|
@ -233,17 +235,18 @@ in {
|
||||||
{ }) // {
|
{ }) // {
|
||||||
store_fs.configFile = let
|
store_fs.configFile = let
|
||||||
|
|
||||||
storeVfsConfig = let
|
storeVfsConfig =
|
||||||
rumpExt2 = ''
|
if config.genode.boot.storeBackend == "tarball" then ''
|
||||||
VFS.vfs [ VFS.leafAttrs "rump" (toMap { fs = "ext2fs", ram="12M" }) ]
|
|
||||||
'';
|
|
||||||
in {
|
|
||||||
ahci = rumpExt2;
|
|
||||||
tarball = ''
|
|
||||||
VFS.vfs [ VFS.leafAttrs "tar" (toMap { name = "${config.system.build.tarball.fileName}.tar" }) ]
|
VFS.vfs [ VFS.leafAttrs "tar" (toMap { name = "${config.system.build.tarball.fileName}.tar" }) ]
|
||||||
'';
|
'' else
|
||||||
usb = rumpExt2;
|
let
|
||||||
}.${config.genode.boot.storeBackend};
|
rumpExt2 = ''
|
||||||
|
VFS.vfs [ VFS.leafAttrs "rump" (toMap { fs = "ext2fs", ram="12M" }) ]
|
||||||
|
'';
|
||||||
|
in {
|
||||||
|
ahci = rumpExt2;
|
||||||
|
usb = rumpExt2;
|
||||||
|
}.${config.fileSystems."/".block.driver};
|
||||||
|
|
||||||
storeResources = let
|
storeResources = let
|
||||||
rumpExt2 =
|
rumpExt2 =
|
||||||
|
|
|
@ -10,8 +10,6 @@ with lib;
|
||||||
config = let cfg = config.hardware.genode.ahci;
|
config = let cfg = config.hardware.genode.ahci;
|
||||||
in {
|
in {
|
||||||
|
|
||||||
hardware.genode.ahci.enable = config.genode.boot.storeBackend == "ahci";
|
|
||||||
|
|
||||||
hardware.genode.platform.policies = lib.optional cfg.enable
|
hardware.genode.platform.policies = lib.optional cfg.enable
|
||||||
(builtins.toFile ("ahci.platform-policy.dhall") ''
|
(builtins.toFile ("ahci.platform-policy.dhall") ''
|
||||||
let Genode = env:DHALL_GENODE
|
let Genode = env:DHALL_GENODE
|
||||||
|
@ -52,7 +50,9 @@ with lib;
|
||||||
[ Init.Config.Policy::{
|
[ Init.Config.Policy::{
|
||||||
, service = "Block"
|
, service = "Block"
|
||||||
, label = Init.LabelSelector.prefix "part_block"
|
, label = Init.LabelSelector.prefix "part_block"
|
||||||
, attributes = toMap { device = "0", writeable = "yes" }
|
, attributes = toMap { device = "${
|
||||||
|
toString config.fileSystems."/".block.device
|
||||||
|
}", writeable = "yes" }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
{
|
{
|
||||||
name = "ahci";
|
name = "ahci";
|
||||||
machine = { pkgs, ... }: {
|
machine = { pkgs, ... }: {
|
||||||
genode.boot.storeBackend = "ahci";
|
fileSystems."/".block = {
|
||||||
|
driver = "ahci";
|
||||||
|
device = 0;
|
||||||
|
partition = 1;
|
||||||
|
};
|
||||||
genode.init.children.hello = {
|
genode.init.children.hello = {
|
||||||
inputs = [ pkgs.hello pkgs.genodePackages.vfs.lib ];
|
inputs = [ pkgs.hello pkgs.genodePackages.vfs.lib ];
|
||||||
configFile = pkgs.writeText "ahci-hello.child.dhall" ''
|
configFile = pkgs.writeText "ahci-hello.child.dhall" ''
|
||||||
|
|
|
@ -27,6 +27,7 @@ rec {
|
||||||
inherit system;
|
inherit system;
|
||||||
modules = configurations ++ extraConfigurations;
|
modules = configurations ++ extraConfigurations;
|
||||||
baseModules = (import "${modulesPath}/module-list.nix") ++ [
|
baseModules = (import "${modulesPath}/module-list.nix") ++ [
|
||||||
|
../../nixos-modules/file-systems.nix
|
||||||
../../nixos-modules/genode-core.nix
|
../../nixos-modules/genode-core.nix
|
||||||
../../nixos-modules/genode-init.nix
|
../../nixos-modules/genode-init.nix
|
||||||
../../nixos-modules/gui
|
../../nixos-modules/gui
|
||||||
|
|
Loading…
Reference in New Issue