forked from DGNum/liminix
partial btrfs support
doesn't actually know how to make the filesystem, just kernel config and accept it as a valid option
This commit is contained in:
parent
243295aab8
commit
3c941b4ce2
3 changed files with 41 additions and 0 deletions
|
@ -43,8 +43,11 @@ in rec {
|
||||||
../modules/bridge
|
../modules/bridge
|
||||||
../modules/ntp
|
../modules/ntp
|
||||||
../modules/ssh
|
../modules/ssh
|
||||||
|
../modules/outputs/btrfs.nix
|
||||||
|
|
||||||
];
|
];
|
||||||
hostname = "rotuer";
|
hostname = "rotuer";
|
||||||
|
rootfsType = "btrfs";
|
||||||
|
|
||||||
services.hostap = svc.hostapd.build {
|
services.hostap = svc.hostapd.build {
|
||||||
interface = config.hardware.networkInterfaces.wlan;
|
interface = config.hardware.networkInterfaces.wlan;
|
||||||
|
|
|
@ -40,6 +40,7 @@ in {
|
||||||
rootfsType = mkOption {
|
rootfsType = mkOption {
|
||||||
default = "squashfs";
|
default = "squashfs";
|
||||||
type = types.enum [
|
type = types.enum [
|
||||||
|
"btrfs"
|
||||||
"ext4"
|
"ext4"
|
||||||
"jffs2"
|
"jffs2"
|
||||||
"squashfs"
|
"squashfs"
|
||||||
|
|
37
modules/outputs/btrfs.nix
Normal file
37
modules/outputs/btrfs.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
config
|
||||||
|
, pkgs
|
||||||
|
, lib
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib) mkIf mkOption types;
|
||||||
|
o = config.system.outputs;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./initramfs.nix
|
||||||
|
];
|
||||||
|
config = mkIf (config.rootfsType == "btrfs") {
|
||||||
|
kernel.config = {
|
||||||
|
BTRFS_FS = "y";
|
||||||
|
};
|
||||||
|
boot.initramfs.enable = true;
|
||||||
|
system.outputs = {
|
||||||
|
rootfs =
|
||||||
|
let
|
||||||
|
inherit (pkgs.pkgsBuildBuild) runCommand e2fsprogs;
|
||||||
|
in runCommand "mkfs.btrfs" {
|
||||||
|
depsBuildBuild = [ e2fsprogs ];
|
||||||
|
} ''
|
||||||
|
tree=${o.bootablerootdir}
|
||||||
|
size=$(du -s --apparent-size --block-size 1024 $tree |cut -f1)
|
||||||
|
# add 25% for filesystem overhead
|
||||||
|
size=$(( 5 * $size / 4))
|
||||||
|
dd if=/dev/zero of=$out bs=1024 count=$size
|
||||||
|
echo "not implemented" ; exit 1
|
||||||
|
# mke2fs -t ext4 -j -d $tree $out
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue