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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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