create custom module system
This commit is contained in:
parent
74bcda2c80
commit
e19e738b04
8 changed files with 86 additions and 19 deletions
10
modules/agenix.nix
Normal file
10
modules/agenix.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ config, ... }: {
|
||||
age = {
|
||||
identityPaths = [ "/root/age_ed25519" ];
|
||||
|
||||
secrets = {
|
||||
"host_ed25519".file = config.custom.ssh.hostKey;
|
||||
"user_ed25519".file = config.custom.ssh.userKey;
|
||||
};
|
||||
};
|
||||
}
|
50
modules/custom.nix
Normal file
50
modules/custom.nix
Normal file
|
@ -0,0 +1,50 @@
|
|||
{ lib, config, ... }: {
|
||||
options = {
|
||||
custom = {
|
||||
dataDisk.enable = lib.mkOption {
|
||||
default = false;
|
||||
type = lib.types.bool;
|
||||
description = ''
|
||||
Whether to automatically mount /dev/sda1 on /mnt/data
|
||||
'';
|
||||
};
|
||||
|
||||
ssh = {
|
||||
hostCert = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
SSH host certificate
|
||||
'';
|
||||
};
|
||||
|
||||
userCert = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = ''
|
||||
SSH user certificate
|
||||
'';
|
||||
};
|
||||
|
||||
hostKey = lib.mkOption {
|
||||
default = ../secrets/${config.networking.hostName}_host_ed25519.age;
|
||||
type = lib.types.path;
|
||||
description = ''
|
||||
SSH host key
|
||||
'';
|
||||
};
|
||||
|
||||
userKey = lib.mkOption {
|
||||
default = ../secrets/${config.networking.hostName}_user_ed25519.age;
|
||||
type = lib.types.path;
|
||||
description = ''
|
||||
SSH user key
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
fileSystems."/dev/data" =
|
||||
lib.mkIf config.custom.dataDisk.enable { device = "/dev/sda1"; };
|
||||
};
|
||||
}
|
34
modules/disk-config.nix
Normal file
34
modules/disk-config.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
disko.devices = {
|
||||
disk = {
|
||||
vdb = {
|
||||
device = "/dev/nvme0n1";
|
||||
type = "disk";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
type = "EF00";
|
||||
size = "500M";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
};
|
||||
};
|
||||
root = {
|
||||
end = "-4G";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "btrfs";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
swap = { size = "100%"; };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Reference in a new issue