fix: Flake | use nixfmt=classic to format nix files

This commit is contained in:
2025-02-17 19:24:25 +05:00
parent 234e52f051
commit 7eab398f6d
41 changed files with 189 additions and 370 deletions

View File

@@ -1,10 +1,4 @@
{
inputs,
pkgs,
lib,
config,
...
}:
{ inputs, pkgs, lib, config, ... }:
{
imports = lib.flatten [
@@ -26,7 +20,8 @@
# ========= Disk Layout =========
#
inputs.disko.nixosModules.disko
(lib.custom.relativeToRoot "hosts/common/disks/rihla.nix") {
(lib.custom.relativeToRoot "hosts/common/disks/rihla.nix")
{
_module.args = {
device = "/dev/nvme0n1";
withSwap = true;
@@ -38,9 +33,7 @@
#
# ========= Required Configs =========
#
(map lib.custom.relativeToRoot [
"hosts/common/core"
])
(map lib.custom.relativeToRoot [ "hosts/common/core" ])
#
# ========= Optional Configs =========
@@ -59,15 +52,16 @@
#
# ========= Optional Services =========
#
(map (s: lib.custom.relativeToRoot "hosts/common/optional/services/${s}.nix") [
"audio"
"bluetooth"
"firmware"
"greetd"
"openssh"
"printing"
"smart-card"
])
(map
(s: lib.custom.relativeToRoot "hosts/common/optional/services/${s}.nix") [
"audio"
"bluetooth"
"firmware"
"greetd"
"openssh"
"printing"
"smart-card"
])
];
#
@@ -91,30 +85,31 @@
efi.canTouchEfiVariables = true;
};
initrd.postResumeCommands = lib.mkIf config.hostSpec.impermanance (lib.mkAfter ''
mkdir /btrfs_tmp
mount /dev/crypt_vg/root /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
fi
initrd.postResumeCommands = lib.mkIf config.hostSpec.impermanance
(lib.mkAfter ''
mkdir /btrfs_tmp
mount /dev/crypt_vg/root /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
fi
delete_subvolume_recursively() {
IFS=$'\n'
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
delete_subvolume_recursively "/btrfs_tmp/$i"
done
btrfs subvolume delete "$1"
}
delete_subvolume_recursively() {
IFS=$'\n'
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
delete_subvolume_recursively "/btrfs_tmp/$i"
done
btrfs subvolume delete "$1"
}
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
delete_subvolume_recursively "$i"
done
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
delete_subvolume_recursively "$i"
done
btrfs subvolume create /btrfs_tmp/root
umount /btrfs_tmp
'');
btrfs subvolume create /btrfs_tmp/root
umount /btrfs_tmp
'');
lanzaboote = {
enable = config.hostSpec.secureBoot;
@@ -124,9 +119,7 @@
security.rtkit.enable = true;
environment.systemPackages = with pkgs; [
pciutils
];
environment.systemPackages = with pkgs; [ pciutils ];
system.stateVersion = "25.05";
}

View File

@@ -1,14 +1,8 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
pkgs,
config,
lib,
modulesPath,
...
}: {
imports = [(modulesPath + "/installer/scan/not-detected.nix")];
{ pkgs, config, lib, modulesPath, ... }: {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot = {
initrd = {
@@ -21,11 +15,11 @@
"usb_storage"
"sd_mod"
];
kernelModules = [];
kernelModules = [ ];
};
kernelModules = ["kvm-amd"];
extraModulePackages = [];
kernelModules = [ "kvm-amd" ];
extraModulePackages = [ ];
};
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
@@ -38,10 +32,11 @@
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware = {
cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
graphics = {
enable = true;
extraPackages = with pkgs; [amdvlk];
extraPackages = with pkgs; [ amdvlk ];
};
};
}