move all expressions to nix/; include modularized home-manager config
This commit is contained in:
parent
d76a7f963b
commit
13bd5e9000
65 changed files with 1726 additions and 511 deletions
63
nix/os/modules/encryptedDisk.nix
Normal file
63
nix/os/modules/encryptedDisk.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
{ lib
|
||||
, config
|
||||
, ... }:
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.hardware.encryptedDisk;
|
||||
|
||||
volumeGroup = cfg.diskId;
|
||||
bootGrubDevice = lib.concatStrings [ "/dev/disk/by-id/" cfg.diskId ];
|
||||
bootFsDevice = lib.concatStrings [ "/dev/disk/by-partlabel/" cfg.diskId "-part2" ];
|
||||
bootLuksDevice = lib.concatStrings [ "/dev/disk/by-partlabel/" cfg.diskId "-part3" ];
|
||||
rootFsDevice = lib.concatStrings [ "/dev/" volumeGroup "/root" ];
|
||||
swapFsDevice = lib.concatStrings [ "/dev/" volumeGroup "/swap" ];
|
||||
|
||||
in {
|
||||
options.hardware.encryptedDisk = {
|
||||
enable = mkEnableOption "Enable encrypted filesystem layout";
|
||||
diskId = mkOption {
|
||||
type = types.string;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
fileSystems."/boot" = {
|
||||
device = bootFsDevice;
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
fileSystems."/" = {
|
||||
device = rootFsDevice;
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=nixos" ];
|
||||
};
|
||||
|
||||
fileSystems."/home" = {
|
||||
device = rootFsDevice;
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=home" ];
|
||||
};
|
||||
|
||||
swapDevices = [ { device = swapFsDevice; } ];
|
||||
|
||||
boot.loader.grub = {
|
||||
device = bootGrubDevice;
|
||||
enableCryptodisk = true;
|
||||
};
|
||||
|
||||
boot.initrd.luks.devices = [
|
||||
{
|
||||
name =
|
||||
let
|
||||
splitstring = builtins.split "/" bootLuksDevice;
|
||||
lastelem = (builtins.length splitstring)-1;
|
||||
in
|
||||
builtins.elemAt splitstring lastelem;
|
||||
device = bootLuksDevice;
|
||||
preLVM = true;
|
||||
allowDiscards = true;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
26
nix/os/modules/natrouter.nix
Normal file
26
nix/os/modules/natrouter.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ lib
|
||||
, config
|
||||
, ... }:
|
||||
with lib;
|
||||
|
||||
{
|
||||
# TODO
|
||||
# Provide a NAT/DHCP Router
|
||||
#
|
||||
# networking.nat.enable = true;
|
||||
# networking.nat.internalInterfaces = [ "enp0s20f0u4u1u3" ];
|
||||
# networking.nat.externalInterface = "wlp1s0";
|
||||
# networking.interfaces."enp0s20f0u4u1u3".ipv4.addresses = [
|
||||
# { address = "10.254.253.254"; prefixLength = 24; }
|
||||
# ];
|
||||
# services.dnsmasq = {
|
||||
# enable = true;
|
||||
# servers = [ "8.8.8.8" "8.8.4.4" ];
|
||||
# extraConfig = ''
|
||||
# domain=lan
|
||||
# interface=enp0s20f0u4u1u3
|
||||
# bind-interfaces
|
||||
# dhcp-range=10.254.253.100,10.254.253.199,1h
|
||||
# '';
|
||||
# };
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue