modules: Format with nixfmt-rfc-style

This commit is contained in:
Donovan Glover 2024-08-03 14:40:07 -04:00
parent 1d0296c209
commit a32f73a388
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
5 changed files with 172 additions and 106 deletions

View File

@ -1,4 +1,9 @@
{ config, nix-config, lib, ... }:
{
config,
nix-config,
lib,
...
}:
let
inherit (lib) mkIf;
@ -46,16 +51,16 @@ let
};
in
{
systemd.tmpfiles.rules = [
"d /run/user/1000 0700 ${username} users -"
];
systemd.tmpfiles.rules = [ "d /run/user/1000 0700 ${username} users -" ];
containers = mkIf enableContainers {
wine = template // {
hostAddress = "192.168.100.34";
localAddress = "192.168.100.49";
config = { ... }: {
config =
{ ... }:
{
imports = [
../containers
../containers/wine.nix

View File

@ -1,24 +1,52 @@
{ nix-config, pkgs, config, lib, ... }:
{
nix-config,
pkgs,
config,
lib,
...
}:
let
inherit (lib) mkEnableOption mkIf mkMerge mkOption;
inherit (lib.types) float int;
inherit (config.modules.system) username;
inherit (config.lib.stylix.colors.withHashtag) base00;
inherit (cfg) bloat gnome plasma container opacity fontSize graphical;
inherit (nix-config.packages.${pkgs.system}) aleo-fonts;
inherit (pkgs) phinger-cursors noto-fonts-cjk-sans maple-mono noto-fonts-emoji stdenvNoCC imagemagick;
inherit (builtins) attrValues;
inherit (lib)
mkEnableOption
mkIf
mkMerge
mkOption
;
inherit (cfg)
bloat
gnome
plasma
container
opacity
fontSize
graphical
;
inherit (pkgs)
phinger-cursors
noto-fonts-cjk-sans
maple-mono
noto-fonts-emoji
stdenvNoCC
imagemagick
;
stylix-background = stdenvNoCC.mkDerivation {
pname = "stylix-background";
version = base00;
dontUnpack = true;
nativeBuildInputs = [
imagemagick
];
nativeBuildInputs = [ imagemagick ];
postInstall = ''
mkdir -p $out
@ -62,9 +90,7 @@ in
thunar = {
enable = true;
plugins = attrValues {
inherit (pkgs.xfce) thunar-volman;
};
plugins = with pkgs.xfce; [ thunar-volman ];
};
};
@ -91,7 +117,7 @@ in
xserver = mkIf (!container || graphical) {
enable = true;
excludePackages = [ pkgs.xterm ];
excludePackages = with pkgs; [ xterm ];
};
pipewire = {
@ -164,19 +190,19 @@ in
})
];
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"vagrant"
];
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "vagrant" ];
fonts = {
enableDefaultPackages = false;
packages = [
packages =
[
noto-fonts-cjk-sans
noto-fonts-emoji
maple-mono
aleo-fonts
] ++ (with pkgs; [
]
++ (with pkgs; [
noto-fonts
noto-fonts-cjk-serif
font-awesome
@ -187,9 +213,20 @@ in
fontconfig = {
defaultFonts = {
serif = [ "Noto Serif CJK JP" "Noto Serif" ];
sansSerif = [ "Noto Sans CJK JP" "Noto Sans" ];
monospace = [ "Noto Sans Mono CJK JP" "Noto Sans Mono" ];
serif = [
"Noto Serif CJK JP"
"Noto Serif"
];
sansSerif = [
"Noto Sans CJK JP"
"Noto Sans"
];
monospace = [
"Noto Sans Mono CJK JP"
"Noto Sans Mono"
];
};
allowBitmaps = false;
@ -244,13 +281,8 @@ in
};
specialisation = {
gnome = mkIf gnome {
configuration.imports = [ ../specializations/gnome.nix ];
};
plasma = mkIf plasma {
configuration.imports = [ ../specializations/plasma.nix ];
};
gnome = mkIf gnome { configuration.imports = [ ../specializations/gnome.nix ]; };
plasma = mkIf plasma { configuration.imports = [ ../specializations/plasma.nix ]; };
};
};
}

View File

@ -1,12 +1,29 @@
{ pkgs, config, lib, ... }:
{
pkgs,
config,
lib,
...
}:
let
inherit (lib) mkEnableOption mkIf getExe singleton;
inherit (pkgs) piper interception-tools;
inherit (pkgs.interception-tools-plugins) dual-function-keys;
inherit (cfg) mouseSettings lidIgnore keyboardBinds bluetooth;
inherit (builtins) toJSON;
inherit (lib)
mkEnableOption
mkIf
getExe
singleton
;
inherit (cfg)
mouseSettings
lidIgnore
keyboardBinds
bluetooth
;
dualFunctionKeysConfig = "dual-function-keys.yaml";
cfg = config.modules.hardware;
@ -36,7 +53,8 @@ in
plugins = [ dual-function-keys ];
udevmonConfig = toJSON (singleton {
JOB = /* bash */ ''
JOB = # bash
''
${interception-tools}/bin/intercept -g $DEVNODE |
${getExe dual-function-keys} -c /etc/${dualFunctionKeysConfig} |
${interception-tools}/bin/uinput -d $DEVNODE
@ -44,7 +62,10 @@ in
DEVICE = {
EVENTS = {
EV_KEY = [ "KEY_CAPSLOCK" "KEY_ESC" ];
EV_KEY = [
"KEY_CAPSLOCK"
"KEY_ESC"
];
};
};
});

View File

@ -54,8 +54,6 @@ in
rmlint
jpegoptim
pass
;
inherit (pkgs)
sudachi-rs
tango
npm-check-updates
@ -103,10 +101,6 @@ in
nix-search-cli
nix-tree
;
inherit (pkgs)
nodejs
deno
;
inherit (pkgs)
rustc
rustfmt
@ -114,8 +108,8 @@ in
cargo-tarpaulin
bacon
clippy
;
inherit (pkgs)
nodejs
deno
tectonic
;
})

View File

@ -1,17 +1,38 @@
{ nix-config, pkgs, lib, config, ... }:
{
nix-config,
pkgs,
lib,
config,
...
}:
let
inherit (lib) mkOption mkEnableOption mkIf singleton;
inherit (lib.types) nullOr str listOf;
inherit (cfg) username iHaveLotsOfRam hashedPassword mullvad allowSRB2Port allowDevPort noRoot postgres;
inherit (builtins) attrValues;
inherit (lib)
mkOption
mkEnableOption
mkIf
singleton
;
inherit (cfg)
username
iHaveLotsOfRam
hashedPassword
mullvad
allowSRB2Port
allowDevPort
noRoot
postgres
;
cfg = config.modules.system;
in
{
imports = attrValues {
inherit (nix-config.inputs.home-manager.nixosModules) home-manager;
};
imports = with nix-config.inputs.home-manager.nixosModules; [
home-manager
];
options.modules.system = {
username = mkOption {
@ -36,7 +57,12 @@ in
supportedLocales = mkOption {
type = listOf str;
default = [ "ja_JP.UTF-8/UTF-8" "en_US.UTF-8/UTF-8" "fr_FR.UTF-8/UTF-8" ];
default = [
"ja_JP.UTF-8/UTF-8"
"en_US.UTF-8/UTF-8"
"fr_FR.UTF-8/UTF-8"
];
};
stateVersion = mkOption {
@ -59,10 +85,7 @@ in
config = {
boot = {
tmp =
if iHaveLotsOfRam
then { useTmpfs = true; }
else { cleanOnBoot = true; };
tmp = if iHaveLotsOfRam then { useTmpfs = true; } else { cleanOnBoot = true; };
binfmt.emulatedSystems = [ "aarch64-linux" ];
@ -77,9 +100,7 @@ in
efi.canTouchEfiVariables = true;
};
blacklistedKernelModules = [
"floppy"
];
blacklistedKernelModules = [ "floppy" ];
};
systemd = {
@ -91,11 +112,15 @@ in
package = pkgs.nixVersions.nix_2_22;
settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
warn-dirty = false;
allow-import-from-derivation = false;
experimental-features = [
"nix-command"
"flakes"
];
trusted-users = [
"root"
"@wheel"
@ -130,10 +155,12 @@ in
isNormalUser = true;
uid = 1000;
password = mkIf (hashedPassword == null && !noRoot) username;
extraGroups =
if noRoot
then [ ]
else [
if noRoot then
[ ]
else
[
"wheel"
"networkmanager"
"dialout"
@ -221,13 +248,8 @@ in
};
firewall = {
allowedUDPPorts = mkIf allowSRB2Port [
5029
];
allowedTCPPorts = mkIf allowDevPort [
3000
];
allowedUDPPorts = mkIf allowSRB2Port [ 5029 ];
allowedTCPPorts = mkIf allowDevPort [ 3000 ];
};
};
@ -242,22 +264,14 @@ in
postgresql = mkIf postgres {
enable = true;
ensureUsers = singleton {
name = username;
};
ensureUsers = singleton { name = username; };
ensureDatabases = [ username ];
};
};
environment = {
systemPackages = with pkgs; [
(pass.withExtensions (ext: with ext; [ pass-otp ]))
];
systemPackages = with pkgs; [ (pass.withExtensions (ext: with ext; [ pass-otp ])) ];
defaultPackages = [ ];
gnome.excludePackages = with pkgs; [ gnome-tour ];
};