Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make formatting mandatory #53

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pkgs.mkShellNoCC {

facterMarkdown = mkMarkdown "facter" eval.options.facter.detected;
otherMarkdown = lib.mapAttrsToList mkMarkdown (
lib.filterAttrs (n: v: n != "detected") eval.options.facter
lib.filterAttrs (n: _v: n != "detected") eval.options.facter
);

optionsMarkdown = pkgs.symlinkJoin {
Expand Down
6 changes: 5 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@
}
);
formatter = eachSystem (
{ pkgs, ... }: pkgs.callPackage ./formatter.nix { inputs = publicInputs // privateInputs; }
{ pkgs, ... }:
(pkgs.callPackage ./formatter.nix { inputs = publicInputs // privateInputs; }).config.build.wrapper
);

checks = eachSystem (
{ pkgs, ... }:
{
formatting =
(pkgs.callPackage ./formatter.nix { inputs = publicInputs // privateInputs; }).config.build.check
publicInputs.self;
minimal-machine =
(pkgs.nixos [
publicInputs.self.nixosModules.facter
Expand Down
2 changes: 1 addition & 1 deletion formatter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
let
hasNixFmt = pkgs.lib.meta.availableOn pkgs.stdenv.buildPlatform pkgs.nixfmt-rfc-style.compiler;
in
inputs.treefmt-nix.lib.mkWrapper pkgs {
inputs.treefmt-nix.lib.evalModule pkgs {
projectRootFile = ".git/config";

programs = {
Expand Down
12 changes: 8 additions & 4 deletions modules/nixos/bluetooth.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{ lib, config, ... }:
{
options.facter.detected.bluetooth.enable = lib.mkEnableOption "Enable the Facter bluetooth module" // {
default = builtins.length (config.facter.report.hardware.bluetooth or []) > 0;
};
options.facter.detected.bluetooth.enable =
lib.mkEnableOption "Enable the Facter bluetooth module"
// {
default = builtins.length (config.facter.report.hardware.bluetooth or [ ]) > 0;
};

config.hardware.bluetooth.enable = lib.mkIf config.facter.detected.bluetooth.enable (lib.mkDefault true);
config.hardware.bluetooth.enable = lib.mkIf config.facter.detected.bluetooth.enable (
lib.mkDefault true
);
}
16 changes: 8 additions & 8 deletions modules/nixos/disk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ in
options.facter.detected.boot.disk.kernelModules = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = facterLib.stringSet (
facterLib.collectDrivers (
# A disk might be attached.
(report.hardware.firewire_controller or [ ])
# definitely important
++ (report.hardware.disk or [ ])
++ (report.hardware.storage_controller or [ ])
)
);
facterLib.collectDrivers (
# A disk might be attached.
(report.hardware.firewire_controller or [ ])
# definitely important
++ (report.hardware.disk or [ ])
++ (report.hardware.storage_controller or [ ])
)
);
description = ''
List of kernel modules that are needed to access the disk.
'';
Expand Down
6 changes: 5 additions & 1 deletion modules/nixos/facter.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
options.facter = with lib; {
report = mkOption {
type = types.raw;
default = if config.facter.reportPath == null then {} else builtins.fromJSON (builtins.readFile config.facter.reportPath);
default =
if config.facter.reportPath == null then
{ }
else
builtins.fromJSON (builtins.readFile config.facter.reportPath);
description = "An import for the reportPath.";
};

Expand Down
4 changes: 3 additions & 1 deletion modules/nixos/system.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
}:
{
nixpkgs = lib.mkIf (!options.nixpkgs.pkgs.isDefined) {
hostPlatform = lib.mkIf (config.facter.report.system or null != null) (lib.mkDefault config.facter.report.system);
hostPlatform = lib.mkIf (config.facter.report.system or null != null) (
lib.mkDefault config.facter.report.system
);
};
}
6 changes: 2 additions & 4 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
]
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:recommended"]
}