treewide: Format remaining files with nixfmt-rfc-style

This commit is contained in:
Donovan Glover 2024-08-03 14:42:39 -04:00
parent a32f73a388
commit 8ece3e2812
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
7 changed files with 199 additions and 140 deletions

113
flake.nix
View File

@ -26,14 +26,40 @@
}; };
}; };
outputs = { self, nixpkgs, mobile-nixos, ... } @ attrs: outputs =
{
self,
nixpkgs,
mobile-nixos,
...
}@attrs:
let let
inherit (nixpkgs.lib) nixosSystem; inherit (nixpkgs.lib) nixosSystem;
inherit (nixpkgs.legacyPackages) x86_64-linux aarch64-linux; inherit (nixpkgs.legacyPackages) x86_64-linux aarch64-linux;
inherit (builtins) attrNames listToAttrs map replaceStrings readDir;
flakeOutputs = [ "overlays" "nixosModules" "homeModules" "packages" "checks" ]; inherit (builtins)
flakeDirectories = [ "overlays" "modules" "home" "packages" "tests" ]; attrNames
listToAttrs
map
replaceStrings
readDir
;
flakeOutputs = [
"overlays"
"nixosModules"
"homeModules"
"packages"
"checks"
];
flakeDirectories = [
"overlays"
"modules"
"home"
"packages"
"tests"
];
in in
{ {
nixosConfigurations = nixosConfigurations =
@ -46,7 +72,10 @@
{ {
nixos = nixosSystem { nixos = nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = attrs // { nix-config = self; };
specialArgs = attrs // {
nix-config = self;
};
modules = [ modules = [
./hosts/laptop/configuration.nix ./hosts/laptop/configuration.nix
@ -56,12 +85,13 @@
mobile-nixos = nixosSystem { mobile-nixos = nixosSystem {
system = "aarch64-linux"; system = "aarch64-linux";
specialArgs = attrs // { nix-config = self; };
specialArgs = attrs // {
nix-config = self;
};
modules = phoneModules ++ [ modules = phoneModules ++ [
(import "${mobile-nixos}/lib/configuration.nix" { (import "${mobile-nixos}/lib/configuration.nix" { device = "pine64-pinephone"; })
device = "pine64-pinephone";
})
{ {
mobile.beautification = { mobile.beautification = {
@ -74,66 +104,61 @@
mobile-nixos-vm = nixosSystem { mobile-nixos-vm = nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = attrs // { nix-config = self; };
specialArgs = attrs // {
nix-config = self;
};
modules = phoneModules; modules = phoneModules;
}; };
}; };
formatter.x86_64-linux = x86_64-linux.nixpkgs-fmt; formatter.x86_64-linux = x86_64-linux.nixpkgs-fmt;
formatter.aarch64-linux = aarch64-linux.nixpkgs-fmt; formatter.aarch64-linux = aarch64-linux.nixpkgs-fmt;
} // }
(listToAttrs // (listToAttrs (
(map map (attributeName: {
(attributeName: {
name = attributeName; name = attributeName;
value = value =
let 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 = value =
if directory == "packages" if directory == "packages" then
then x86_64-linux.callPackage ./${directory}/${file} { } x86_64-linux.callPackage ./${directory}/${file} { }
else else if directory == "tests" then
if directory == "tests" import ./${directory}/${file} {
then
import ./${directory}/${file}
{
inherit self; inherit self;
pkgs = x86_64-linux; pkgs = x86_64-linux;
} }
else import ./${directory}/${file}; else
}) import ./${directory}/${file};
(attrNames (readDir ./${directory}))); }) (attrNames (readDir ./${directory}))
);
aarch64Packages = listToAttrs aarch64Packages = listToAttrs (
(map map (file: {
(file: {
name = replaceStrings [ ".nix" ] [ "" ] file; name = replaceStrings [ ".nix" ] [ "" ] file;
value = value =
if directory == "packages" if directory == "packages" then aarch64-linux.callPackage ./${directory}/${file} { } else null;
then aarch64-linux.callPackage ./${directory}/${file} { } }) (attrNames (readDir ./${directory}))
else null; );
})
(attrNames (readDir ./${directory})));
attributeSet = attributeSet =
if directory == "packages" if directory == "packages" then
then { {
x86_64-linux = attributeValue; x86_64-linux = attributeValue;
aarch64-linux = aarch64Packages; aarch64-linux = aarch64Packages;
} }
else if directory == "tests" then
{ x86_64-linux = attributeValue; }
else else
if directory == "tests" attributeValue;
then {
x86_64-linux = attributeValue;
}
else attributeValue;
in in
attributeSet; attributeSet;
}) }) flakeOutputs
flakeOutputs)); ));
} }

View File

@ -1,13 +1,22 @@
{ config, lib, modulesPath, ... }: {
config,
lib,
modulesPath,
...
}:
{ {
imports = [ imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
(modulesPath + "/installer/scan/not-detected.nix")
];
boot = { boot = {
initrd = { initrd = {
availableKernelModules = [ "nvme" "xhci_pci" "usb_storage" "sd_mod" ]; availableKernelModules = [
"nvme"
"xhci_pci"
"usb_storage"
"sd_mod"
];
kernelModules = [ ]; kernelModules = [ ];
}; };

View File

@ -1,4 +1,10 @@
{ self, pkgs, config, lib, ... }: {
self,
pkgs,
config,
lib,
...
}:
let let
inherit (lib) mkIf mkForce; inherit (lib) mkIf mkForce;
@ -7,17 +13,19 @@ let
inherit (builtins) attrValues; inherit (builtins) attrValues;
getColorCh = colorName: channel: config.lib.stylix.colors."${colorName}-rgb-${channel}"; getColorCh = colorName: channel: config.lib.stylix.colors."${colorName}-rgb-${channel}";
rgba = color: transparency: ''rgba(${getColorCh color "r"}, ${getColorCh color "g"}, ${getColorCh color "b"}, ${transparency})'';
rgba =
color: transparency:
''rgba(${getColorCh color "r"}, ${getColorCh color "g"}, ${getColorCh color "b"}, ${transparency})'';
bg = ''linear-gradient(${rgba "base00" "0.7"}, ${rgba "base00" "0.7"})''; bg = ''linear-gradient(${rgba "base00" "0.7"}, ${rgba "base00" "0.7"})'';
in in
{ {
imports = attrValues self.nixosModules; imports = attrValues self.nixosModules;
nixpkgs.overlays = attrValues { nixpkgs.overlays = with self.overlays; [
inherit (self.overlays)
phinger-cursors phinger-cursors
; ];
};
home-manager.sharedModules = attrValues { home-manager.sharedModules = attrValues {
inherit (self.homeModules) inherit (self.homeModules)
@ -73,8 +81,15 @@ in
"org/gnome/desktop/input-sources" = { "org/gnome/desktop/input-sources" = {
sources = [ sources = [
(mkTuple [ "xkb" "us" ]) (mkTuple [
(mkTuple [ "xkb" "jp+kana" ]) "xkb"
"us"
])
(mkTuple [
"xkb"
"jp+kana"
])
]; ];
}; };
@ -91,7 +106,8 @@ in
}; };
background = { background = {
stylix.targets.gtk.extraCss = /* css */ '' stylix.targets.gtk.extraCss = # css
''
phosh-lockscreen { phosh-lockscreen {
background: ${bg}, url('file:///home/${username}/wall-lock.jpg'); background: ${bg}, url('file:///home/${username}/wall-lock.jpg');
} }
@ -117,14 +133,8 @@ in
}; };
environment.systemPackages = attrValues { environment.systemPackages = attrValues {
inherit (self.packages.${pkgs.system}) inherit (self.packages.${pkgs.system}) webp-thumbnailer pinephone-toolkit;
webp-thumbnailer inherit (pkgs.gnome) gnome-contacts;
pinephone-toolkit
;
inherit (pkgs.gnome)
gnome-contacts
;
inherit (pkgs) inherit (pkgs)
chatty chatty
@ -158,7 +168,6 @@ in
thunar.enable = mkForce false; thunar.enable = mkForce false;
}; };
networking = { networking = {
wireless.enable = false; wireless.enable = false;
wireguard.enable = true; wireguard.enable = true;

View File

@ -1,4 +1,7 @@
test: { self, pkgs }: test:
{ self, pkgs }:
let let
inherit (pkgs.lib) mkDefault; inherit (pkgs.lib) mkDefault;

View File

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
inherit (config.modules.system) username; inherit (config.modules.system) username;

View File

@ -1,4 +1,9 @@
{ pkgs, lib, config, ... }: {
pkgs,
lib,
config,
...
}:
let let
inherit (config.modules.system) username; inherit (config.modules.system) username;

View File

@ -4,7 +4,9 @@ in
(import ../lib/test.nix) { (import ../lib/test.nix) {
name = "neovim"; name = "neovim";
nodes.machine = { nix-config, ... }: { nodes.machine =
{ nix-config, ... }:
{
imports = attrValues { imports = attrValues {
inherit (nix-config.nixosModules) desktop system shell; inherit (nix-config.nixosModules) desktop system shell;
@ -13,12 +15,13 @@ in
}; };
}; };
home-manager.sharedModules = attrValues { home-manager.sharedModules = with nix-config.homeModules; [
inherit (nix-config.homeModules) neovim; neovim
}; ];
}; };
testScript = /* python */ '' testScript = # python
''
machine.wait_for_unit("default.target") machine.wait_for_unit("default.target")
machine.send_chars("user") machine.send_chars("user")