numtide / nixos-facter-modules

A series of NixOS modules to be used in conjunction with https://github.com/numtide/nixos-facter [maintainer=@brianmcgee]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nixos-facter-modules

Note

Status: alpha

A series of NixOS modules to be used in conjunction with NixOS Facter.

With a similar goal to NixOS Hardware, these modules are designed around fine-grained feature detection as opposed to system models. This is made possible by the hardware report provided by NixOS Facter.

By default, these modules enable or disable themselves based on detected hardware.

Getting started

To generate a hardware report run the following:

$ nix --extra-experimental-features "flakes nix-command" run github:numtide/nixos-facter > facter.json

Then use the generated facter.json with the NixOS module as follows:

NixOS with flakes

We are currently assuming that a the system uses disko, so we have not implemented fileSystems configuration. If you don't use disko, you have to currently specify that part of the configuration yourself or take it from nixos-generate-config.

# flake.nix
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
  };

  outputs =
    inputs@{ nixpkgs, ... }:
    {
      nixosConfigurations.basic = nixpkgs.lib.nixosSystem {

        modules = [
          inputs.nixos-facter-modules.nixosModules.facter
          { config.facter.reportPath = ./facter.json; }
          # If you want to test out nixos-facter, you can add these dummy
          # values to make the configuration valid. Note that this likely won't boot if
          # it doesn't match your own partitioning
          # {
          #   users.users.root.initialPassword = "fnord23";
          #   boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ];
          #   fileSystems."/".device = lib.mkDefault "/dev/sda";
          # }
          # ...
        ];
      };
    };
}

Non-flakes NixOS

# configuration.nix
{
  imports = [
    "${
      (builtins.fetchTarball { url = "https://github.com/numtide/nixos-facter-modules/"; })
    }/modules/nixos/facter.nix"
  ];

  config.facter.reportPath = ./facter.json;
}

About

A series of NixOS modules to be used in conjunction with https://github.com/numtide/nixos-facter [maintainer=@brianmcgee]

License:MIT License


Languages

Language:Nix 98.1%Language:Shell 1.9%