From 75b442acb64bac70294681ae6d318a470afeac3c Mon Sep 17 00:00:00 2001 From: ene Date: Sat, 4 Feb 2023 11:54:55 +0100 Subject: Feat: Made more configuration host independent --- system/boot/boot.nix | 28 +++++++++++ system/boot/boot_pictures/gnu.png | Bin 0 -> 327518 bytes system/boot/boot_pictures/gnulin_emb_1.png | Bin 0 -> 207444 bytes system/boot/boot_pictures/gnulin_emb_2.png | Bin 0 -> 208347 bytes system/filesystemLayouts/filesystemLayouts.nix | 62 +++++++++++++++++++++++++ system/system.nix | 6 ++- 6 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 system/boot/boot.nix create mode 100755 system/boot/boot_pictures/gnu.png create mode 100755 system/boot/boot_pictures/gnulin_emb_1.png create mode 100755 system/boot/boot_pictures/gnulin_emb_2.png create mode 100644 system/filesystemLayouts/filesystemLayouts.nix (limited to 'system') diff --git a/system/boot/boot.nix b/system/boot/boot.nix new file mode 100644 index 00000000..629e63ae --- /dev/null +++ b/system/boot/boot.nix @@ -0,0 +1,28 @@ +{ + config, + pkgs, + ... +}: { + boot = { + initrd = { + compressor = "lz4"; + compressorArgs = ["-9"]; + }; + + kernelPackages = pkgs.linuxPackages_latest; + loader = { + grub = { + enable = true; + version = 2; + theme = pkgs.nixos-grub2-theme; + splashImage = ./boot_pictures/gnu.png; + efiSupport = true; + device = "nodev"; # only for efi + }; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot"; + }; + }; + }; +} diff --git a/system/boot/boot_pictures/gnu.png b/system/boot/boot_pictures/gnu.png new file mode 100755 index 00000000..d07dee3e Binary files /dev/null and b/system/boot/boot_pictures/gnu.png differ diff --git a/system/boot/boot_pictures/gnulin_emb_1.png b/system/boot/boot_pictures/gnulin_emb_1.png new file mode 100755 index 00000000..483f2681 Binary files /dev/null and b/system/boot/boot_pictures/gnulin_emb_1.png differ diff --git a/system/boot/boot_pictures/gnulin_emb_2.png b/system/boot/boot_pictures/gnulin_emb_2.png new file mode 100755 index 00000000..48cd6ad7 Binary files /dev/null and b/system/boot/boot_pictures/gnulin_emb_2.png differ diff --git a/system/filesystemLayouts/filesystemLayouts.nix b/system/filesystemLayouts/filesystemLayouts.nix new file mode 100644 index 00000000..2f7c8fc2 --- /dev/null +++ b/system/filesystemLayouts/filesystemLayouts.nix @@ -0,0 +1,62 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.system.filesystemLayout; +in { + options = { + cfg.enable = mkEnableOption (mdDoc "filesysetemLayout"); + cfg.mainDisk = mkOption { + type = lib.types.path; + example = literalExpression "/dev/disk/by-uuid/0442cb6d-f13a-4635-b487-fa76189774c5"; + description = lib.mdDoc "Path to the main disk"; + }; + cfg.efiDisk = mkOption { + type = lib.types.path; + example = literalExpression "/dev/disk/by-uuid/5143-6136"; + description = lib.mdDoc "Path to the main disk"; + }; + }; + + config = mkif cfg.enabled { + fileSystems = { + "/" = { + device = "none"; + fsType = "tmpfs"; + options = ["defaults" "size=2G" "mode=755"]; + }; + "/nix" = { + device = cfg.mainDisk; + fsType = "btrfs"; + options = ["subvol=@nix" "compress-force=zstd:9"]; + }; + "/boot" = { + device = cfg.efiDisk; + fsType = "vfat"; + }; + + "/srv/home" = { + device = cfg.mainDisk; + fsType = "btrfs"; + options = ["subvol=@home" "compress-force=zstd:9"]; + }; + "/srv/nixos-config" = { + device = cfg.mainDisk; + fsType = "btrfs"; + options = ["subvol=@nixos-config" "compress-force=zstd:9"]; + }; + + "/etc/nixos" = { + device = "/srv/nix-config"; + options = ["bind"]; + }; + "/home" = { + device = "/srv/home"; + options = ["bind"]; + }; + }; + swapDevices = []; + }; +} diff --git a/system/system.nix b/system/system.nix index 3a034742..17e78968 100644 --- a/system/system.nix +++ b/system/system.nix @@ -1,8 +1,10 @@ {config, ...}: { imports = [ + ./boot/boot.nix + ./filesystemLayouts/filesystemLayouts.nix ./locale/locale.nix - ./users/users.nix - ./sound/sound.nix ./packages/packages.nix + ./sound/sound.nix + ./users/users.nix ]; } -- cgit 1.4.1