chore: Format with nixpkgs-fmt

Note that we will continue to use nixpkgs-fmt for the time being here
since nixfmt-rfc-style breaks string syntax highlighting and comments
like `/* this */` get turned into `# this`.

The conversion from lisp-like formatting to something else in flake.nix
is a bit unfortunate, but I'd rather have a singular style for the
entire code base to make things easier.
This commit is contained in:
Donovan Glover 2024-04-05 11:26:22 -04:00
parent 01acf8197d
commit 22e31ff60b
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
9 changed files with 103 additions and 95 deletions

View File

@ -21,7 +21,8 @@
}; };
}; };
outputs = { self, nixpkgs, home-manager, stylix, ... } @ attrs: let outputs = { self, nixpkgs, home-manager, stylix, ... } @ attrs:
let
inherit (nixpkgs.lib) nixosSystem; inherit (nixpkgs.lib) nixosSystem;
inherit (nixpkgs.legacyPackages.x86_64-linux) nixpkgs-fmt callPackage; inherit (nixpkgs.legacyPackages.x86_64-linux) nixpkgs-fmt callPackage;
inherit (builtins) attrValues attrNames listToAttrs map replaceStrings readDir; inherit (builtins) attrValues attrNames listToAttrs map replaceStrings readDir;
@ -34,7 +35,8 @@
flakeOutputs = [ "overlays" "nixosModules" "homeManagerModules" "packages" ]; flakeOutputs = [ "overlays" "nixosModules" "homeManagerModules" "packages" ];
flakeDirectories = [ "overlays" "modules" "home" "packages" ]; flakeDirectories = [ "overlays" "modules" "home" "packages" ];
packageDirectory = "packages"; packageDirectory = "packages";
in { in
{
formatter.x86_64-linux = nixpkgs-fmt; formatter.x86_64-linux = nixpkgs-fmt;
nixosConfigurations = { nixosConfigurations = {
@ -87,15 +89,19 @@
(map (map
(attributeName: { (attributeName: {
name = attributeName; name = attributeName;
value = let value =
let
directory = replaceStrings flakeOutputs flakeDirectories attributeName; directory = replaceStrings flakeOutputs flakeDirectories attributeName;
attributeValue = (listToAttrs attributeValue = (listToAttrs
(map (map
(file: { (file: {
name = replaceStrings [ ".nix" ] [ "" ] file; name = replaceStrings [ ".nix" ] [ "" ] file;
value = if directory == packageDirectory then callPackage ./${directory}/${file} { } else import ./${directory}/${file}; }) value = if directory == packageDirectory then callPackage ./${directory}/${file} { } else import ./${directory}/${file};
})
(attrNames (readDir ./${directory})))); (attrNames (readDir ./${directory}))));
attributeSet = if directory == packageDirectory then { x86_64-linux = attributeValue; } else attributeValue; attributeSet = if directory == packageDirectory then { x86_64-linux = attributeValue; } else attributeValue;
in (attributeSet); }) in
(attributeSet);
})
(flakeOutputs))); (flakeOutputs)));
} }

View File

@ -1,8 +1,8 @@
{ config, lib, pkgs, modulesPath, ... }: { config, lib, modulesPath, ... }:
{ {
imports = imports = [
[ (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ]; boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ];
@ -10,15 +10,15 @@
boot.kernelModules = [ "kvm-amd" ]; boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-label/nixos"; device = "/dev/disk/by-label/nixos";
fsType = "btrfs"; fsType = "btrfs";
}; };
boot.initrd.luks.devices."root".device = "/dev/disk/by-label/nixos-luks"; boot.initrd.luks.devices."root".device = "/dev/disk/by-label/nixos-luks";
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-label/boot"; device = "/dev/disk/by-label/boot";
fsType = "vfat"; fsType = "vfat";
}; };

View File

@ -45,7 +45,8 @@ in
config = { config = {
boot = { boot = {
tmp = if iHaveLotsOfRam tmp =
if iHaveLotsOfRam
then { useTmpfs = true; } then { useTmpfs = true; }
else { cleanOnBoot = true; }; else { cleanOnBoot = true; };

View File

@ -1,9 +1,8 @@
{ { lib
lib, , stdenv
stdenv, , hyprland
hyprland, , fetchFromGitHub
fetchFromGitHub, , fetchpatch
fetchpatch,
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {

View File

@ -1,7 +1,8 @@
# TODO: Write test to ensure that Hyprland starts with basic config # TODO: Write test to ensure that Hyprland starts with basic config
let let
inherit (builtins) attrValues; inherit (builtins) attrValues;
in (import ./lib.nix) { in
(import ./lib.nix) {
name = "hyprland"; name = "hyprland";
nodes.machine = { self, pkgs, ... }: { nodes.machine = { self, pkgs, ... }: {

View File

@ -1,7 +1,8 @@
# TODO: Ensure that neovim config works without errors on startup # TODO: Ensure that neovim config works without errors on startup
let let
inherit (builtins) attrValues; inherit (builtins) attrValues;
in (import ./lib.nix) { in
(import ./lib.nix) {
name = "neovim"; name = "neovim";
nodes.machine = { self, pkgs, ... }: { nodes.machine = { self, pkgs, ... }: {