From 245fe5bee8c5f49db08b1bb868ac74dcaed2cb96 Mon Sep 17 00:00:00 2001 From: iFargle Date: Fri, 22 Sep 2023 19:45:23 +0900 Subject: [PATCH] test --- flake.nix | 4 ++-- nixos/common/modules/boot.nix | 14 +++++------ nixos/common/modules/plymouth.nix | 7 ++++++ .../{disks-btrfs.nix => disks-ext4.nix} | 24 +++---------------- nixos/hosts/nixos-vm-02/disks.nix | 24 ++++++++++++++++--- 5 files changed, 39 insertions(+), 34 deletions(-) create mode 100644 nixos/common/modules/plymouth.nix rename nixos/hosts/nixos-vm-02/{disks-btrfs.nix => disks-ext4.nix} (52%) diff --git a/flake.nix b/flake.nix index bf112b7c..05ec6f46 100644 --- a/flake.nix +++ b/flake.nix @@ -14,14 +14,14 @@ nur.url = "github:nix-community/NUR"; # sops-nix - Secret Management with SOPS using GPG Keys sops-nix.url = "github:Mic92/sops-nix"; - # doom-emacs - The Doom Emacs distribution + # doom-emacs - The Doom Emacs distribution` doom-emacs.url = "github:nix-community/nix-doom-emacs"; # nixos-hardware - Hardware Configurations nixos-hardware.url = "github:NixOS/nixos-hardware/master"; # nixos-generators - Automated Image / ISO Creation nixos-generators.url = "github:nix-community/nixos-generators"; nixos-generators.inputs.nixpkgs.follows = "nixpkgs"; - # disko - Automated Disk Partitioning + # disko - Declarative Disk Partitioning disko.url = "github:nix-community/disko"; disko.inputs.nixpkgs.follows = "nixpkgs"; }; diff --git a/nixos/common/modules/boot.nix b/nixos/common/modules/boot.nix index 3b1332cd..44d52d58 100644 --- a/nixos/common/modules/boot.nix +++ b/nixos/common/modules/boot.nix @@ -1,14 +1,12 @@ -{ config, pkgs, ... }: { +{ config, pkgs, desktop, ... }: { + + # IF we're booting into a GUI, load in pretty things + imports = [ ] ++ lib.optional (builtins.isString desktop) ./plymouth.nix; + # Bootloader boot.loader.efi.canTouchEfiVariables = true; boot.loader.systemd-boot.enable = true; boot.tmp.cleanOnBoot = true; boot.initrd.systemd.enable = true; boot.kernelParams = ["quiet"]; - - # Plymouth splash screen - boot.plymouth.enable = true; - # https://github.com/adi1090x/plymouth-themes - boot.plymouth.theme = "red_loader"; - boot.plymouth.themePackages = [ pkgs.adi1090x-plymouth-themes ]; - } \ No newline at end of file +} \ No newline at end of file diff --git a/nixos/common/modules/plymouth.nix b/nixos/common/modules/plymouth.nix new file mode 100644 index 00000000..b88b3240 --- /dev/null +++ b/nixos/common/modules/plymouth.nix @@ -0,0 +1,7 @@ +{ pkgs, config, ... }: { + # Plymouth splash screen + boot.plymouth.enable = true; + # https://github.com/adi1090x/plymouth-themes + boot.plymouth.theme = "red_loader"; + boot.plymouth.themePackages = [ pkgs.adi1090x-plymouth-themes ]; +} \ No newline at end of file diff --git a/nixos/hosts/nixos-vm-02/disks-btrfs.nix b/nixos/hosts/nixos-vm-02/disks-ext4.nix similarity index 52% rename from nixos/hosts/nixos-vm-02/disks-btrfs.nix rename to nixos/hosts/nixos-vm-02/disks-ext4.nix index b1c9c102..929e7bdc 100644 --- a/nixos/hosts/nixos-vm-02/disks-btrfs.nix +++ b/nixos/hosts/nixos-vm-02/disks-ext4.nix @@ -1,8 +1,6 @@ { boot.loader.grub.device = "/dev/sda"; boot.initrd.luks.devices."sda2".device = "/dev/sda2"; - services.btrfs.autoScrub.enable = true; - services.btrfs.autoScrub.interval = "weekly"; disko.devices.disk.sda = { device = "/dev/sda"; @@ -29,27 +27,11 @@ end = "100%"; content = { type = "luks"; - name = "LUKS-ROOT"; - extraOpenArgs = [ "--allow-discards" ]; - settings.keyFile = "/tmp/secret.key"; + name = "ROOT"; content = { type = "filesystem"; - format = "btrfs"; - # extraArgs = [ "-f" ]; - subvolumes = { - "/root" = { - mountpoint = "/"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; # root - "/home" = { - mountpoint = "/home"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; # home - "/nix" = { - mountpoint = "/nix"; - mountOptions = [ "compress=zstd" "noatime" ]; - }; # nix - }; # subvolumes + format = "ext4"; + mountpoint = "/"; }; # content.content }; # content } # partition 2 diff --git a/nixos/hosts/nixos-vm-02/disks.nix b/nixos/hosts/nixos-vm-02/disks.nix index 929e7bdc..b1c9c102 100644 --- a/nixos/hosts/nixos-vm-02/disks.nix +++ b/nixos/hosts/nixos-vm-02/disks.nix @@ -1,6 +1,8 @@ { boot.loader.grub.device = "/dev/sda"; boot.initrd.luks.devices."sda2".device = "/dev/sda2"; + services.btrfs.autoScrub.enable = true; + services.btrfs.autoScrub.interval = "weekly"; disko.devices.disk.sda = { device = "/dev/sda"; @@ -27,11 +29,27 @@ end = "100%"; content = { type = "luks"; - name = "ROOT"; + name = "LUKS-ROOT"; + extraOpenArgs = [ "--allow-discards" ]; + settings.keyFile = "/tmp/secret.key"; content = { type = "filesystem"; - format = "ext4"; - mountpoint = "/"; + format = "btrfs"; + # extraArgs = [ "-f" ]; + subvolumes = { + "/root" = { + mountpoint = "/"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # root + "/home" = { + mountpoint = "/home"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # home + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # nix + }; # subvolumes }; # content.content }; # content } # partition 2