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

143
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: {
name = attributeName;
value =
let
directory = replaceStrings flakeOutputs flakeDirectories attributeName;
}
// (listToAttrs (
map (attributeName: {
name = attributeName;
value =
let
directory = replaceStrings flakeOutputs flakeDirectories attributeName;
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}
{
inherit self;
pkgs = x86_64-linux;
}
else import ./${directory}/${file};
})
(attrNames (readDir ./${directory})));
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} {
inherit self;
pkgs = x86_64-linux;
}
else
import ./${directory}/${file};
}) (attrNames (readDir ./${directory}))
);
aarch64Packages = listToAttrs
(map
(file: {
name = replaceStrings [ ".nix" ] [ "" ] file;
value =
if directory == "packages"
then aarch64-linux.callPackage ./${directory}/${file} { }
else null;
})
(attrNames (readDir ./${directory})));
aarch64Packages = listToAttrs (
map (file: {
name = replaceStrings [ ".nix" ] [ "" ] file;
value =
if directory == "packages" then aarch64-linux.callPackage ./${directory}/${file} { } else null;
}) (attrNames (readDir ./${directory}))
);
attributeSet =
if directory == "packages"
then {
attributeSet =
if directory == "packages" then
{
x86_64-linux = attributeValue;
aarch64-linux = aarch64Packages;
}
else
if directory == "tests"
then {
x86_64-linux = attributeValue;
}
else attributeValue;
in
attributeSet;
})
flakeOutputs));
else if directory == "tests" then
{ x86_64-linux = attributeValue; }
else
attributeValue;
in
attributeSet;
}) 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)
phinger-cursors
;
};
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,40 +106,35 @@ in
};
background = {
stylix.targets.gtk.extraCss = /* css */ ''
phosh-lockscreen {
background: ${bg}, url('file:///home/${username}/wall-lock.jpg');
}
stylix.targets.gtk.extraCss = # css
''
phosh-lockscreen {
background: ${bg}, url('file:///home/${username}/wall-lock.jpg');
}
phosh-app-grid {
background: ${bg}, url('file:///home/${username}/wall-grid.jpg');
}
phosh-app-grid {
background: ${bg}, url('file:///home/${username}/wall-grid.jpg');
}
phosh-top-panel {
background: ${bg}, url('file:///home/${username}/wall-panel.jpg');
}
phosh-top-panel {
background: ${bg}, url('file:///home/${username}/wall-panel.jpg');
}
phosh-home {
background: ${bg}, url('file:///home/${username}/wall-home.jpg');
}
phosh-home {
background: ${bg}, url('file:///home/${username}/wall-home.jpg');
}
phosh-lockscreen, phosh-app-grid, phosh-top-panel, phosh-home {
background-size: cover;
background-position: center;
}
'';
phosh-lockscreen, phosh-app-grid, phosh-top-panel, phosh-home {
background-size: cover;
background-position: center;
}
'';
};
};
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,50 +4,53 @@ in
(import ../lib/test.nix) {
name = "neovim";
nodes.machine = { nix-config, ... }: {
imports = attrValues {
inherit (nix-config.nixosModules) desktop system shell;
nodes.machine =
{ nix-config, ... }:
{
imports = attrValues {
inherit (nix-config.nixosModules) desktop system shell;
customConfig = {
modules.desktop.container = true;
customConfig = {
modules.desktop.container = true;
};
};
home-manager.sharedModules = with nix-config.homeModules; [
neovim
];
};
home-manager.sharedModules = attrValues {
inherit (nix-config.homeModules) neovim;
};
};
testScript = # python
''
machine.wait_for_unit("default.target")
testScript = /* python */ ''
machine.wait_for_unit("default.target")
machine.send_chars("user")
machine.sleep(1)
machine.send_key("ret")
machine.sleep(1)
machine.send_chars("user")
machine.sleep(1)
machine.send_key("ret")
machine.sleep(5)
machine.send_chars("user")
machine.sleep(1)
machine.send_key("ret")
machine.sleep(1)
machine.send_chars("user")
machine.sleep(1)
machine.send_key("ret")
machine.sleep(5)
machine.send_chars("nvim hello.txt")
machine.sleep(1)
machine.send_key("ret")
machine.sleep(20)
machine.send_chars("nvim hello.txt")
machine.sleep(1)
machine.send_key("ret")
machine.sleep(20)
machine.send_chars("i")
machine.sleep(2)
machine.send_chars("Hello world")
machine.sleep(2)
machine.send_key("esc")
machine.sleep(2)
machine.send_chars(":wq")
machine.sleep(2)
machine.send_key("ret")
machine.sleep(2)
machine.send_chars("i")
machine.sleep(2)
machine.send_chars("Hello world")
machine.sleep(2)
machine.send_key("esc")
machine.sleep(2)
machine.send_chars(":wq")
machine.sleep(2)
machine.send_key("ret")
machine.sleep(2)
text = machine.succeed("cat /home/user/hello.txt")
text = machine.succeed("cat /home/user/hello.txt")
assert "Hello world" in text
'';
assert "Hello world" in text
'';
}