├── .envrc ├── .github ├── settings.yml └── workflows │ └── gh-pages.yml ├── .gitignore ├── .mergify.yml ├── LICENSE ├── README.md ├── dev ├── private.narHash └── private │ ├── flake.lock │ └── flake.nix ├── devshell.nix ├── docs.nix ├── docs ├── content │ ├── assets │ │ └── images │ │ │ ├── hero.svg │ │ │ └── logo.png │ ├── contributing │ │ ├── code.md │ │ └── docs.md │ ├── getting-started │ │ ├── generate-report.md │ │ └── nixos-configuration.md │ ├── index.md │ ├── reference │ │ └── .gitignore │ └── stylesheets │ │ └── extra.css └── theme │ └── home.html ├── flake.lock ├── flake.nix ├── formatter.nix ├── hosts └── basic │ ├── config.nix │ ├── default.nix │ └── report.json ├── lib ├── default.nix ├── lib.nix ├── lib.tests.nix └── pci │ └── devices.nix ├── mkdocs.yml ├── modules └── nixos │ ├── bluetooth.nix │ ├── debug.nix │ ├── disk.nix │ ├── facter.nix │ ├── fingerprint │ ├── default.nix │ └── devices.json │ ├── firmware.nix │ ├── graphics │ ├── amd.nix │ └── default.nix │ ├── keyboard.nix │ ├── networking │ ├── broadcom.nix │ ├── default.nix │ ├── initrd.nix │ └── intel.nix │ ├── system.nix │ └── virtualisation.nix ├── private.narHash └── renovate.json /.envrc: -------------------------------------------------------------------------------- 1 | if ! has nix_direnv_version || ! nix_direnv_version 3.0.5; then 2 | source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.5/direnvrc" "sha256-RuwIS+QKFj/T9M2TFXScjBsLR6V3A17YVoEW/Q6AZ1w=" 3 | fi 4 | 5 | watch_file devshell.nix 6 | watch_file dev/private.narHash 7 | 8 | use flake 9 | 10 | # create a data directory for shared state with nixos vms 11 | PRJ_DATA_DIR="$(pwd)/.data" 12 | mkdir -p "$PRJ_DATA_DIR" 13 | export PRJ_DATA_DIR -------------------------------------------------------------------------------- /.github/settings.yml: -------------------------------------------------------------------------------- 1 | repository: 2 | # See https://developer.github.com/v3/repos/#edit for all available settings. 3 | 4 | # The name of the repository. Changing this will rename the repository 5 | name: nixos-facter-modules 6 | 7 | # A short description of the repository that will show up on GitHub 8 | description: A series of NixOS modules to be used in conjunction with https://github.com/numtide/nixos-facter 9 | 10 | # # A URL with more information about the repository 11 | # homepage: "https://tbd.com" 12 | 13 | # A comma-separated list of topics to set on the repository 14 | topics: "nix, nixos, buildbot-numtide" 15 | 16 | # Either `true` to make the repository private, or `false` to make it public. 17 | private: false 18 | 19 | # Either `true` to enable issues for this repository, `false` to disable them. 20 | has_issues: true 21 | 22 | # Either `true` to enable projects for this repository, or `false` to disable them. 23 | # If projects are disabled for the organization, passing `true` will cause an API error. 24 | has_projects: false 25 | 26 | # Either `true` to enable the wiki for this repository, `false` to disable it. 27 | has_wiki: false 28 | 29 | # Either `true` to enable downloads for this repository, `false` to disable them. 30 | has_downloads: false 31 | 32 | # Updates the default branch for this repository. 33 | default_branch: main 34 | 35 | # Either `true` to allow squash-merging pull requests, or `false` to prevent 36 | # squash-merging. 37 | allow_squash_merge: true 38 | 39 | # Either `true` to allow merging pull requests with a merge commit, or `false` 40 | # to prevent merging pull requests with merge commits. 41 | allow_merge_commit: true 42 | 43 | # Either `true` to allow rebase-merging pull requests, or `false` to prevent 44 | # rebase-merging. 45 | allow_rebase_merge: true 46 | 47 | # Either `true` to enable automatic deletion of branches on merge, or `false` to disable 48 | delete_branch_on_merge: true 49 | 50 | # Either `true` to enable automated security fixes, or `false` to disable 51 | # automated security fixes. 52 | enable_automated_security_fixes: true 53 | 54 | # Either `true` to enable vulnerability alerts, or `false` to disable 55 | # vulnerability alerts. 56 | enable_vulnerability_alerts: true 57 | 58 | # Labels: define labels for Issues and Pull Requests 59 | # 60 | labels: 61 | # NOTE: leave that up to the https://github.com/numtide/.github repo 62 | 63 | # Milestones: define milestones for Issues and Pull Requests 64 | milestones: 65 | # - title: Replicate nixos-generate-config.pl functionality 66 | # description: Provide enough information in the report to replicate nixos-generate-config functionality. 67 | # # The state of the milestone. Either `open` or `closed` 68 | # state: open 69 | 70 | # Collaborators: give specific users access to this repository. 71 | # See https://docs.github.com/en/rest/reference/repos#add-a-repository-collaborator for available options 72 | collaborators: 73 | - username: brianmcgee 74 | permission: admin 75 | - username: zimbatm 76 | permission: admin 77 | - username: mic92 78 | permission: admin 79 | - username: osslate 80 | permission: write 81 | 82 | # See https://docs.github.com/en/rest/reference/teams#add-or-update-team-repository-permissions for available options 83 | teams: 84 | - name: network 85 | # The permission to grant the team. Can be one of: 86 | # * `pull` - can pull, but not push to or administer this repository. 87 | # * `push` - can pull and push, but not administer this repository. 88 | # * `admin` - can pull, push and administer this repository. 89 | # * `maintain` - Recommended for project managers who need to manage the repository without access to sensitive or destructive actions. 90 | # * `triage` - Recommended for contributors who need to proactively manage issues and pull requests without write access. 91 | permission: maintain 92 | 93 | branches: 94 | - name: main 95 | # https://docs.github.com/en/rest/reference/repos#update-branch-protection 96 | # Branch Protection settings. Set to null to disable 97 | protection: 98 | # Required. Require at least one approving review on a pull request, before merging. Set to null to disable. 99 | required_pull_request_reviews: 100 | # # The number of approvals required. (1-6) 101 | required_approving_review_count: 1 102 | # # Dismiss approved reviews automatically when a new commit is pushed. 103 | dismiss_stale_reviews: true 104 | # # Blocks merge until code owners have reviewed. 105 | # require_code_owner_reviews: true 106 | # # Specify which users and teams can dismiss pull request reviews. Pass an empty dismissal_restrictions object to disable. User and team dismissal_restrictions are only available for organization-owned repositories. Omit this parameter for personal repositories. 107 | # dismissal_restrictions: 108 | # users: [] 109 | # teams: [] 110 | # Required. Require status checks to pass before merging. Set to null to disable 111 | required_status_checks: 112 | # Required. Require branches to be up to date before merging. 113 | strict: true 114 | # Required. The list of status checks to require in order to merge into this branch 115 | contexts: [] 116 | # Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable. 117 | enforce_admins: false 118 | # Disabled for mergify to work 119 | required_linear_history: false 120 | # Required. Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable. 121 | restrictions: 122 | apps: ["mergify"] 123 | users: [] 124 | teams: [] 125 | -------------------------------------------------------------------------------- /.github/workflows/gh-pages.yml: -------------------------------------------------------------------------------- 1 | name: Deploy docs 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | tags: 8 | - "v*" 9 | 10 | # Allows you to run this workflow manually from the Actions tab 11 | workflow_dispatch: 12 | 13 | jobs: 14 | deploy: 15 | runs-on: ubuntu-24.04 16 | permissions: 17 | contents: write 18 | concurrency: 19 | group: ${{ github.workflow }} 20 | steps: 21 | - uses: actions/checkout@v4 22 | with: 23 | fetch-depth: 0 24 | - uses: cachix/install-nix-action@V27 25 | with: 26 | extra_nix_config: | 27 | accept-flake-config = true 28 | experimental-features = nix-command flakes 29 | - name: Configure Git user 30 | run: | 31 | git config --local user.email "github-actions[bot]@users.noreply.github.com" 32 | git config --local user.name "github-actions[bot]" 33 | - name: Deploy main 34 | if: ${{ github.ref_name == 'main' }} 35 | run: | 36 | nix develop .#docs --command bash -c "mike deploy -p main" 37 | - name: Deploy version 38 | if: startsWith(github.ref, 'refs/tags/v') 39 | run: | 40 | REF_NAME=${{ github.ref_name }} 41 | MAJOR_MINOR=${REF_NAME%.*} 42 | # strip the leading v from the ref_name 43 | # update the latest alias 44 | nix develop .#docs --command bash -c "mike deploy -p -u ${MAJOR_MINOR} latest" 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | result* 3 | *.qcow2 4 | .data 5 | report.json 6 | site 7 | .direnv/ 8 | -------------------------------------------------------------------------------- /.mergify.yml: -------------------------------------------------------------------------------- 1 | queue_rules: 2 | - name: default 3 | queue_conditions: 4 | - base=main 5 | - label~=merge-queue|dependencies 6 | merge_conditions: 7 | - check-success=buildbot/nix-eval 8 | merge_method: rebase 9 | 10 | pull_request_rules: 11 | - name: refactored queue action rule 12 | conditions: [] 13 | actions: 14 | queue: 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Numtide & Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nixos-facter-modules 2 | 3 | A series of [NixOS modules] to be used in conjunction with [NixOS Facter]. 4 | 5 | With a similar goal to [NixOS Hardware], these modules are designed around _fine-grained_ feature detection as opposed to system models. 6 | This is made possible by the hardware report provided by [NixOS Facter]. 7 | 8 | By default, these modules enable or disable themselves based on detected hardware. 9 | 10 | For more information, see the [docs]. 11 | 12 | [NixOS modules]: https://wiki.nixos.org/wiki/NixOS_modules 13 | [NixOS Facter]: https://github.com/numtide/nixos-facter 14 | [NixOS Hardware]: https://github.com/NixOS/nixos-hardware 15 | [docs]: https://nix-community.github.io/nixos-facter-modules/ 16 | 17 | ## Getting started 18 | 19 | To generate a hardware report run the following: 20 | 21 | ```console 22 | $ nix --extra-experimental-features "flakes nix-command" run github:numtide/nixos-facter > facter.json 23 | ``` 24 | 25 | Then use the generated `facter.json` with the NixOS module as follows: 26 | 27 | ## NixOS with flakes 28 | 29 | We are currently assuming that a the system uses [disko](https://github.com/nix-community/disko), 30 | so we have not implemented `fileSystems` configuration. If you don't use disko, you have to currently specify 31 | that part of the configuration yourself or take it from `nixos-generate-config`. 32 | 33 | ```nix 34 | # flake.nix 35 | { 36 | inputs = { 37 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 38 | nixos-facter-modules.url = "github:numtide/nixos-facter-modules"; 39 | }; 40 | 41 | outputs = 42 | inputs@{ nixpkgs, ... }: 43 | { 44 | nixosConfigurations.basic = nixpkgs.lib.nixosSystem { 45 | 46 | modules = [ 47 | inputs.nixos-facter-modules.nixosModules.facter 48 | { config.facter.reportPath = ./facter.json; } 49 | # If you want to test out nixos-facter, you can add these dummy 50 | # values to make the configuration valid. Note that this likely won't boot if 51 | # it doesn't match your own partitioning 52 | # { 53 | # users.users.root.initialPassword = "fnord23"; 54 | # boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ]; 55 | # fileSystems."/".device = lib.mkDefault "/dev/sda"; 56 | # } 57 | # ... 58 | ## You also need to define your bootloader if you are not using grub 59 | #{ boot.loader.systemd-boot.enable = true; } 60 | ]; 61 | }; 62 | }; 63 | } 64 | ``` 65 | 66 | ## Non-flakes NixOS 67 | 68 | ```nix 69 | # configuration.nix 70 | { 71 | imports = [ 72 | "${ 73 | (builtins.fetchTarball { url = "https://github.com/numtide/nixos-facter-modules/"; }) 74 | }/modules/nixos/facter.nix" 75 | ]; 76 | 77 | config.facter.reportPath = ./facter.json; 78 | } 79 | ``` 80 | -------------------------------------------------------------------------------- /dev/private.narHash: -------------------------------------------------------------------------------- 1 | sha256-G+inkmoC3ZoH6ktEovZqQYbUcK0EMpBcAHFTVFbCw40= -------------------------------------------------------------------------------- /dev/private/flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "nixpkgs": { 4 | "locked": { 5 | "lastModified": 1725103162, 6 | "narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=", 7 | "owner": "NixOS", 8 | "repo": "nixpkgs", 9 | "rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b", 10 | "type": "github" 11 | }, 12 | "original": { 13 | "owner": "NixOS", 14 | "ref": "nixos-unstable", 15 | "repo": "nixpkgs", 16 | "type": "github" 17 | } 18 | }, 19 | "root": { 20 | "inputs": { 21 | "nixpkgs": "nixpkgs", 22 | "treefmt-nix": "treefmt-nix" 23 | } 24 | }, 25 | "treefmt-nix": { 26 | "inputs": { 27 | "nixpkgs": [ 28 | "nixpkgs" 29 | ] 30 | }, 31 | "locked": { 32 | "lastModified": 1725271838, 33 | "narHash": "sha256-VcqxWT0O/gMaeWTTjf1r4MOyG49NaNxW4GHTO3xuThE=", 34 | "owner": "numtide", 35 | "repo": "treefmt-nix", 36 | "rev": "9fb342d14b69aefdf46187f6bb80a4a0d97007cd", 37 | "type": "github" 38 | }, 39 | "original": { 40 | "owner": "numtide", 41 | "repo": "treefmt-nix", 42 | "type": "github" 43 | } 44 | } 45 | }, 46 | "root": "root", 47 | "version": 7 48 | } 49 | -------------------------------------------------------------------------------- /dev/private/flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "private inputs"; 3 | # Follow the same nixpkgs as the main flake 4 | inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 5 | 6 | inputs.treefmt-nix.url = "github:numtide/treefmt-nix"; 7 | inputs.treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; 8 | 9 | outputs = _: { }; 10 | } 11 | -------------------------------------------------------------------------------- /devshell.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | pkgs.mkShellNoCC { 3 | packages = [ 4 | pkgs.nix-unit 5 | (pkgs.writeScriptBin "update-dev-private-narHash" '' 6 | nix flake lock ./dev/private 7 | nix hash path ./dev/private | tr -d '\n' > ./dev/private.narHash 8 | '') 9 | ]; 10 | } 11 | -------------------------------------------------------------------------------- /docs.nix: -------------------------------------------------------------------------------- 1 | { 2 | pkgs, 3 | ... 4 | }: 5 | pkgs.mkShellNoCC { 6 | packages = 7 | let 8 | inherit (pkgs) lib; 9 | 10 | # Capture root so we can identify our store paths below 11 | root = toString ./.; 12 | 13 | snakeCase = with lib; replaceStrings upperChars (map (s: "_" + s) lowerChars); 14 | 15 | # Eval Facter module 16 | eval = lib.evalModules { 17 | modules = [ 18 | # Load the root module 19 | ./modules/nixos/facter.nix 20 | { 21 | # Disable checks so it doesn't complain about NixOS related options which aren't available 22 | config._module.check = false; 23 | # Use the basic vm's report 24 | config.facter.reportPath = ./hosts/basic/report.json; 25 | } 26 | ]; 27 | }; 28 | 29 | # Convert `/nix/store/...` store paths in the option declarations into a repository link. 30 | # NOTE: we point at the main branch, but for versioned docs this will be incorrect. 31 | # It's still a good starting point though. 32 | transformDeclaration = 33 | decl: 34 | let 35 | declStr = toString decl; 36 | subpath = lib.removePrefix "/" (lib.removePrefix root declStr); 37 | in 38 | assert lib.hasPrefix root declStr; 39 | { 40 | url = "https://github.com/numtide/nixos-facter-modules/blob/main/${subpath}"; 41 | name = subpath; 42 | }; 43 | 44 | # Convert options into options doc, transforming declaration paths to point to the github repository. 45 | nixosOptionsDoc = 46 | _name: options: 47 | pkgs.nixosOptionsDoc { 48 | inherit options; 49 | transformOptions = 50 | opt: 51 | opt 52 | // { 53 | declarations = map transformDeclaration opt.declarations; 54 | }; 55 | }; 56 | 57 | # Take an options attr set and produce a markdown file. 58 | mkMarkdown = 59 | name: options: 60 | let 61 | optionsDoc = nixosOptionsDoc name options; 62 | in 63 | pkgs.runCommand "${name}-markdown" { } '' 64 | mkdir $out 65 | cat ${optionsDoc.optionsCommonMark} > $out/${snakeCase name}.md 66 | ''; 67 | 68 | facterMarkdown = mkMarkdown "facter" eval.options.facter.detected; 69 | otherMarkdown = lib.mapAttrsToList mkMarkdown ( 70 | lib.filterAttrs (n: _v: n != "detected") eval.options.facter 71 | ); 72 | 73 | optionsMarkdown = pkgs.symlinkJoin { 74 | name = "facter-module-markdown"; 75 | paths = [ facterMarkdown ] ++ otherMarkdown; 76 | }; 77 | 78 | in 79 | [ 80 | (pkgs.writeScriptBin "mkdocs" '' 81 | # rsync in NixOS modules doc to avoid issues with symlinks being owned by root 82 | rsync -aL --chmod=u+rw --delete-before ${optionsMarkdown}/ ./docs/content/reference/nixos_modules 83 | 84 | # execute the underlying command 85 | ${pkgs.mkdocs}/bin/mkdocs "$@" 86 | '') 87 | ] 88 | ++ (with pkgs.python3Packages; [ 89 | mike 90 | mkdocs-material 91 | ]); 92 | } 93 | -------------------------------------------------------------------------------- /docs/content/assets/images/hero.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 9 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/content/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nix-community/nixos-facter-modules/58ad9691670d293a15221d4a78818e0088d2e086/docs/content/assets/images/logo.png -------------------------------------------------------------------------------- /docs/content/contributing/code.md: -------------------------------------------------------------------------------- 1 | # Code 2 | 3 | ## Pre-requisites 4 | 5 | You will need to have the following installed: 6 | 7 | - [Nix] 8 | - [Direnv] 9 | 10 | !!! important 11 | 12 | We use a [Flake]-based workflow. You can certainly develop for `nixos-facter` without Flakes and leverage 13 | much of what is listed below, but it is left up to the reader to determine how to make that work. 14 | 15 | ## Formatting 16 | 17 | We use [treefmt] and [treefmt-nix] to format the repository by running `nix fmt` from the root directory. 18 | 19 | ```nix title="nix/formatter.nix" 20 | --8<-- "formatter.nix" 21 | ``` 22 | 23 | ## Checks 24 | 25 | Running `nix flake check` will build all the devshells and Nix packages, as well as check the formatting with [treefmt] 26 | and any other [Flake checks](https://github.com/NixOS/nix/blob/master/src/nix/flake-check.md) that have been configured. 27 | 28 | ## Documentation 29 | 30 | When making changes, it is **important** to add or update any relevant sections in the documentation within the same 31 | pull request. 32 | 33 | For more information see the [next section](./docs.md). 34 | 35 | [Nix]: https://nixos.org 36 | [Flake]: https://wiki.nixos.org/wiki/Flakes 37 | [Nix derivation]: https://nix.dev/manual/nix/2.18/language/derivations 38 | [Direnv]: https://direnv.net 39 | [devshell]: https://nix.dev/tutorials/first-steps/declarative-shell.html 40 | [treefmt]: https://treefmt.com 41 | [treefmt-nix]: https://github.com/numtide/treefmt-nix 42 | -------------------------------------------------------------------------------- /docs/content/contributing/docs.md: -------------------------------------------------------------------------------- 1 | # Documentation 2 | 3 | There is a separate [devshell] called `docs` which is provided for working with the docs locally. 4 | 5 | It can be entered by running: `nix develop .#docs` 6 | 7 | ```nix title="nix/devshells/docs.nix" 8 | --8<-- "docs.nix" 9 | ``` 10 | 11 | The docs are based on [MkDocs] and the [MkDocs Material] theme. 12 | You will find its configuration and content in the following locations: 13 | 14 | - `mkdocs.yaml` 15 | - `./docs` 16 | 17 | ## Serve locally 18 | 19 | To serve the docs locally run `mkdocs serve` from the root of the repository: 20 | 21 | ```console 22 | ❯ mkdocs serve 23 | INFO - Building documentation... 24 | INFO - Cleaning site directory 25 | WARNING - The following pages exist in the docs directory, but are not included in the "nav" configuration: 26 | - index.md 27 | INFO - Documentation built in 0.26 seconds 28 | INFO - [16:22:36] Watching paths for changes: 'docs/content', 'mkdocs.yml' 29 | INFO - [16:22:36] Serving on http://127.0.0.1:8000/nixos-facter/ 30 | ``` 31 | 32 | ## Versioning & Publication 33 | 34 | Versioning of the docs is managed through [mike]. 35 | 36 | It is responsible for managing the structure of the `gh-pages` branch in the repository, which [Github Pages] is 37 | configured to serve from. 38 | 39 | !!! note 40 | 41 | More information about versioning with [MkDocs Material] and [mike] can be found [here](https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/). 42 | 43 | There is a github workflow, `.github/workflows/gh-pages.yml` which is responsible for publishing the docs. 44 | It does the following: 45 | 46 | - On merge to `main`, the docs version [main](https://numtide.github.io/nixos-facter/main/) is updated. 47 | - When a new tag is created of the form `v...` a docs version `v.` is created and the 48 | [latest](https://numtide.github.io/nixos-facter/latest) alias is updated to point to this. 49 | 50 | The idea is that users will land on the latest released version of the docs by default, with `main` being available if 51 | they wish to read about unreleased features and changes. 52 | 53 | To preview the versions locally you can use `mike serve` instead of `mkdocs serve`. 54 | 55 | !!! warning 56 | 57 | Be sure to have fetched the latest changes for the `gh-pages` branch first. 58 | This is especially important if you are using `mike` locally to make manual changes to the published site. 59 | 60 | [Nix]: https://nixos.org 61 | [Flake]: https://wiki.nixos.org/wiki/Flakes 62 | [Nix derivation]: https://nix.dev/manual/nix/2.18/language/derivations 63 | [Direnv]: https://direnv.net 64 | [devshell]: https://nix.dev/tutorials/first-steps/declarative-shell.html 65 | [MkDocs]: https://www.mkdocs.org/ 66 | [MkDocs Material]: https://squidfunk.github.io/mkdocs-material/ 67 | [Github Pages]: https://pages.github.com/ 68 | [mike]: https://github.com/jimporter/mike 69 | -------------------------------------------------------------------------------- /docs/content/getting-started/generate-report.md: -------------------------------------------------------------------------------- 1 | # Generate a report 2 | 3 | To generate a report, you will need to have [Nix] installed on the target machine. 4 | 5 | === "Flake" 6 | 7 | ```shell 8 | sudo nix run \ 9 | --option experimental-features "nix-command flakes" \ 10 | --option extra-substituters https://numtide.cachix.org \ 11 | --option extra-trusted-public-keys numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE= \ 12 | github:numtide/nixos-facter -- -o facter.json 13 | ``` 14 | 15 | !!! warning 16 | 17 | The latest report output from `main` may be incompatible. Run from [nixpkgs] to ensure a stable report output. 18 | 19 | === "Nixpkgs" 20 | 21 | ```shell 22 | sudo nix run nixpkgs#nixos-facter -- -o facter.json 23 | ``` 24 | 25 | This will scan your system and produce a JSON-based report in a file named `facter.json`: 26 | 27 | ```json title="facter.json" 28 | { 29 | "version": 2, // (1)! 30 | "system": "x86_64-linux", // (2)! 31 | "virtualisation": "none", // (3)! 32 | "hardware": { // (4)! 33 | "bios": { ... }, 34 | "bluetooth": [ ... ], 35 | "bridge": [ ... ], 36 | "chip_card": [ ... ] , 37 | "cpu": [ ... ], 38 | "disk": [ ... ], 39 | "graphics_card": [ ... ], 40 | "hub": [ ... ], 41 | "keyboard": [ ... ], 42 | "memory": [ ... ], 43 | "monitor": [ ... ], 44 | "mouse": [ ... ], 45 | "network_controller": [ ... ], 46 | "network_interface": [ ... ], 47 | "sound": [ ... ], 48 | "storage_controller": [ ... ], 49 | "system": [ ... ], 50 | "unknown": [ ... ], 51 | "usb_controller": [ ... ] 52 | }, 53 | "smbios": { // (5)! 54 | "bios": { ... }, 55 | "board": { ... }, 56 | "cache": [ ... ], 57 | "chassis": { ... }, 58 | "config": { ... }, 59 | "language": { ... }, 60 | "memory_array": [ ... ], 61 | "memory_array_mapped_address": [ ... ], 62 | "memory_device": [ ... ], 63 | "memory_device_mapped_address": [ ... ], 64 | "memory_error": [ ... ], 65 | "onboard": [ ... ], 66 | "port_connector": [ ... ], 67 | "processor": [ ... ], 68 | "slot": [ ... ], 69 | "system": { ... } 70 | } 71 | } 72 | ``` 73 | 74 | 1. Used to track major breaking changes in the report format. 75 | 2. Architecture of the target machine. 76 | 3. Indicates whether the report was generated inside a virtualised environment, and if so, what type. 77 | 4. All the various bits of hardware that could be detected. 78 | 5. [System Management BIOS] information if available. 79 | 80 | [Nix]: https://nixos.org 81 | [Numtide]: https://numtide.com 82 | [Numtide Binary Cache]: https://numtide.cachix.org 83 | [nixos-facter]: https://github.com/numtide/nixos-facter 84 | [nixpkgs]: https://github.com/nixos/nixpkgs 85 | [System Management BIOS]: https://wiki.osdev.org/System_Management_BIOS 86 | -------------------------------------------------------------------------------- /docs/content/getting-started/nixos-configuration.md: -------------------------------------------------------------------------------- 1 | # NixOS Configuration 2 | 3 | Taking the `facter.json` file generated in the [previous step](./generate-report.md), we can construct a 4 | [NixOS configuration]: 5 | 6 | === "Flake" 7 | 8 | ```nix title="flake.nix" 9 | { 10 | inputs = { 11 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 12 | nixos-facter-modules.url = "github:numtide/nixos-facter-modules"; 13 | }; 14 | 15 | outputs = 16 | inputs@{ nixpkgs, ... }: 17 | let 18 | inherit (nixpkgs) lib; 19 | in 20 | { 21 | nixosConfigurations.basic = lib.nixosSystem { 22 | modules = [ 23 | 24 | # enable the NixOS Facter module 25 | inputs.nixos-facter-modules.nixosModules.facter 26 | 27 | # configure the facter report 28 | { config.facter.reportPath = ./facter.json; } 29 | 30 | # Additional modules and configuration, for example: 31 | # 32 | # { 33 | # users.users.root.initialPassword = "fnord23"; 34 | # boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ]; 35 | # fileSystems."/".device = lib.mkDefault "/dev/sda"; 36 | # } 37 | # ... 38 | # Define your bootloader if you are not using grub 39 | # { boot.loader.systemd-boot.enable = true; } 40 | ]; 41 | }; 42 | }; 43 | } 44 | ``` 45 | 46 | === "Non-Flake" 47 | 48 | ```nix title="configuration.nix" 49 | { lib, ... }: 50 | { 51 | imports = [ 52 | "${ 53 | (builtins.fetchTarball { url = "https://github.com/numtide/nixos-facter-modules/"; }) 54 | }/modules/nixos/facter.nix" 55 | ]; 56 | 57 | # configure the facter report 58 | config.facter.reportPath = ./facter.json; 59 | 60 | # Additional modules and configuration, for example: 61 | # 62 | # config.users.users.root.initialPassword = "fnord23"; 63 | # config.boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ]; 64 | # config.fileSystems."/".device = lib.mkDefault "/dev/sda"; 65 | # 66 | # ... 67 | # Define your bootloader if you are not using grub 68 | # config.boot.loader.systemd-boot.enable = true; 69 | } 70 | ``` 71 | 72 | The NixOS Facter module will attempt to do the following: 73 | 74 | - Configure `nixpkgs.hostPlatform` based on the [detected architecture]. 75 | - Enable a variety of kernel modules and NixOS options related to VM and bare-metal environments based on the [detected virtualisation]. 76 | - Enable CPU microcode updates based on the [detected CPU(s)]. 77 | - Ensure a variety of kernel modules are made available at boot time based on the [detected (usb|firewire|storage) controllers and disks]. 78 | - Enable a variety of kernel modules based on the [detected Broadcom and Intel WiFi devices]. 79 | 80 | !!! info "Roadmap" 81 | 82 | We continue to add to and improve [nixos-facter-modules]. Our eventual goal is to replace much if not all of the 83 | functionality currently provided by [nixos-hardware] and [nixos-generate-config]. 84 | 85 | ## Introspection and debugging 86 | 87 | You might be asking yourself: 88 | 89 | > This is cool and all that, but how do I know what changes `nixos-facter` will be making to my system closure??? 90 | 91 | And you would be right to be concerned about just applying it without a way of understanding its impact. 92 | 93 | That is why we have added the following options for introspecting how `nixos-facter` is affecting a system closure. 94 | 95 | ### `nvd` 96 | 97 | You can output a [nvd diff] of the system closure with and without `nixos-facter` enabled by running 98 | `nix run .#nixosConfigurations..config.facter.debug.nvd`: 99 | 100 | ```shell 101 | ❯ nix run .#nixosConfigurations.basic.config.facter.debug.nvd 102 | <<< /nix/store/fqbia5p8hfnyzxipfjmzxn8v3b69mjvs-nixos-system-nixos-24.11.20240831.12228ff 103 | >>> /nix/store/ijkh9sq03y72pfrjvncrsrhwh7g6k8q0-nixos-system-nixos-24.11.20240831.12228ff 104 | Added packages: 105 | [A.] #01 X-Reload-Triggers-systemd-networkd 106 | [A.] #02 X-Restart-Triggers-systemd-networkd 107 | [A.] #03 X-Restart-Triggers-systemd-resolved 108 | [A.] #04 etc-systemd-networkd.conf 109 | [A.] #05 etc-systemd-resolved.conf 110 | [A.] #06 graphics-driver.conf 111 | [A.] #07 graphics-drivers 112 | [A.] #08 hwdata 0.385 113 | [A.] #09 libXfixes 6.0.1 114 | [A.] #10 libXxf86vm 1.1.5 115 | [A.] #11 libdrm 2.4.122 116 | [A.] #12 libpciaccess 0.18.1 117 | [A.] #13 libxshmfence 1.3.2 118 | [A.] #14 llvm 18.1.8-lib 119 | [A.] #15 lm-sensors 3.6.0 120 | [A.] #16 mesa 24.2.1, 24.2.1-drivers 121 | [A.] #17 unit 99-ethernet-default-dhcp.network, 99-wireless-client-dhcp.network 122 | [A.] #18 unit-systemd-network-wait-online-.service 123 | [A.] #19 unit-systemd-networkd-wait-online.service 124 | [A.] #20 unit-systemd-networkd.service 125 | [A.] #21 unit-systemd-networkd.socket 126 | [A.] #22 unit-systemd-resolved.service 127 | [A.] #23 vulkan-loader 1.3.283.0 128 | [A.] #24 wayland 1.23.0 129 | [A.] #25 xcb-util-keysyms 0.4.1 130 | Removed packages: 131 | [R.] #1 X-Restart-Triggers-resolvconf 132 | [R-] #2 dhcpcd 10.0.6 133 | [R.] #3 dhcpcd.conf 134 | [R-] #4 openresolv 3.13.2 135 | [R.] #5 unit-dhcpcd.service 136 | [R.] #6 unit-network-setup.service 137 | [R.] #7 unit-resolvconf.service 138 | [R.] #8 unit-script-network-setup-start 139 | Closure size: 562 -> 581 (55 paths added, 36 paths removed, delta +19, disk usage +700.6MiB). 140 | ``` 141 | 142 | !!! info "Arg pass through" 143 | 144 | Any additional arguments you provide to `nix run` after `--` will be passed through to the `nvd diff` command. 145 | For example `nix run .#nixosConfigurations.basic.config.facter.debug.nvd -- --help`. 146 | 147 | ### `nix-diff` 148 | 149 | You can output a [nix-diff] of the system closure with and without `nixos-facter` enabled by running 150 | `nix run .#nixosConfigurations..config.facter.debug.nix-diff`: 151 | 152 | ```shell 153 | ❯ nix run .#nixosConfigurations.basic.config.facter.debug.nix-diff 154 | - /nix/store/fqbia5p8hfnyzxipfjmzxn8v3b69mjvs-nixos-system-nixos-24.11.20240831.12228ff:{out} 155 | + /nix/store/ijkh9sq03y72pfrjvncrsrhwh7g6k8q0-nixos-system-nixos-24.11.20240831.12228ff:{out} 156 | • The input derivation named `boot.json` differs 157 | - /nix/store/zcmdy29f5di6rrfkkld3x773q1d7c1bv-boot.json.drv:{out} 158 | + /nix/store/j0wxsmw6fxgzd59pdcljkpq430jbk8jn-boot.json.drv:{out} 159 | • The input derivation named `initrd-linux-6.6.48` differs 160 | - /nix/store/3z3jgifv3rj5wrh4cx23gzc9hlrwrxwj-initrd-linux-6.6.48.drv:{out} 161 | + /nix/store/ds7pcp97k33p93z460b5vzrii02jjkcf-initrd-linux-6.6.48.drv:{out} 162 | • The input derivation named `initrd-nixos.conf` differs 163 | - /nix/store/y458hw08d5hv2bcf295fv9wvbsfvprrq-initrd-nixos.conf.drv:{out} 164 | + /nix/store/989v278ws16mnvlx6fwsa925vgx9a0ia-initrd-nixos.conf.drv:{out} 165 | • The environments do not match: 166 | text='' 167 | virtio_balloon 168 | virtio_console 169 | virtio_rng 170 | virtio_gpu 171 | bochs 172 | dm_mod 173 | '' 174 | • The input derivation named `linux-6.6.48-modules-shrunk` differs 175 | - /nix/store/dk2xshi6hr85wjyia60nizahl2rq31sz-linux-6.6.48-modules-shrunk.drv:{out} 176 | + /nix/store/xxk67p9wy7hxq33gd1mfz5dqcsm2mhsr-linux-6.6.48-modules-shrunk.drv:{out} 177 | • The environments do not match: 178 | rootModules='' 179 | virtio_net virtio_pci virtio_mmio virtio_blk 9p 9pnet_virtio uhci_hcd ata_piix floppy virtio_blk virtio_pci ext2 ext4 autofs tpm-tis tpm-crb efivarfs ahci sata_nv sata_via sata_sis sata_uli ata_piix pata_marvell nvme sd_mod sr_mod mmc_block uhci_hcd ehci_hcd ehci_pci ohci_hcd ohci_pci xhci_hcd xhci_pci usbhid hid_generic hid_lenovo hid_apple hid_roccat hid_logitech_hidpp hid_logitech_dj hid_microsoft hid_cherry hid_corsair pcips2 atkbd i8042 rtc_cmos virtio_balloon virtio_console virtio_rng virtio_gpu bochs dm_mod 180 | '' 181 | • Skipping environment comparison 182 | • Skipping environment comparison 183 | ... 184 | ... 185 | ... 186 | ``` 187 | 188 | !!! info "Arg pass through" 189 | 190 | Any additional arguments you provide to `nix run` after `--` will be passed through to the `nix-diff` command. 191 | For example `nix run .#nixosConfigurations.basic.config.facter.debug.nix-diff -- --help`. 192 | 193 | [NixOS configuration]: https://nixos.org/manual/nixos/stable/#sec-configuration-syntax 194 | [detected architecture]: https://github.com/numtide/nixos-facter-modules/blob/main/modules/nixos/system.nix 195 | [detected virtualisation]: https://github.com/numtide/nixos-facter-modules/blob/main/modules/nixos/virtualisation.nix 196 | [detected CPU(s)]: https://github.com/numtide/nixos-facter-modules/blob/main/modules/nixos/firmware.nix 197 | [detected (usb|firewire|storage) controllers and disks]: (https://github.com/numtide/nixos-facter-modules/blob/main/modules/nixos/boot.nix) 198 | [detected Broadcom and Intel WiFi devices]: https://github.com/numtide/nixos-facter-modules/blob/main/modules/nixos/networking 199 | [nixos-facter-modules]: https://github.com/numtide/nixos-facter-modules 200 | [nixos-hardware]: https://github.com/NixOS/nixos-hardware 201 | [nixos-generate-config]: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/installer/tools/nixos-generate-config.pl 202 | [nvd diff]: https://khumba.net/projects/nvd/ 203 | [nix-diff]: https://github.com/Gabriella439/nix-diff 204 | -------------------------------------------------------------------------------- /docs/content/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | template: home.html 3 | search: 4 | exclude: true 5 | --- 6 | 7 | # Home 8 | -------------------------------------------------------------------------------- /docs/content/reference/.gitignore: -------------------------------------------------------------------------------- 1 | nixos_modules -------------------------------------------------------------------------------- /docs/content/stylesheets/extra.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nix-community/nixos-facter-modules/58ad9691670d293a15221d4a78818e0088d2e086/docs/content/stylesheets/extra.css -------------------------------------------------------------------------------- /docs/theme/home.html: -------------------------------------------------------------------------------- 1 | {% extends "main.html" %} {% block header %} 2 | 3 | 4 | 5 | 12 | {% include "partials/logo.html" %} 13 | 14 | 15 | 16 | 17 | 18 | 19 | {{ config.site_name }} 20 | 21 | 22 | 23 | {% if page.meta and page.meta.title %} {{ 24 | page.meta.title }} {% else %} {{ page.title }} {% endif 25 | %} 26 | 27 | 28 | 29 | 30 | 31 | 32 | {% if config.theme.palette %} {% if not config.theme.palette is mapping 33 | %} {% include "partials/palette.html" %} {% endif %} {% endif %} 34 | 35 | 36 | {% if not config.theme.palette is mapping %} {% include 37 | "partials/javascripts/palette.html" %} {% endif %} 38 | 39 | 40 | {% if config.extra.alternate %} {% include "partials/alternate.html" %} 41 | {% endif %} 42 | 43 | 44 | {% if config.repo_url %} 45 | 46 | {% include "partials/source.html" %} 47 | 48 | {% endif %} 49 | 50 | 51 | {% endblock %} {% block hero %} 52 | 53 | 90 | 91 | 92 | 93 | 94 | NixOS Facter Modules 95 | {{ config.site_description }} 96 | 101 | Get started 102 | 103 | 108 | Contribute 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | {% endblock %} {% block tabs %}{% endblock %} {% block site_nav %}{% endblock %} 119 | {% block content %}{% endblock %} {% block footer %}{% endblock %} 120 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "root": {} 4 | }, 5 | "root": "root", 6 | "version": 7 7 | } 8 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "NixOS Facter Modules"; 3 | 4 | outputs = 5 | publicInputs: 6 | let 7 | loadPrivateFlake = 8 | path: 9 | let 10 | flakeHash = builtins.readFile "${toString path}.narHash"; 11 | flakePath = "path:${toString path}?narHash=${flakeHash}"; 12 | in 13 | builtins.getFlake (builtins.unsafeDiscardStringContext flakePath); 14 | 15 | privateFlake = loadPrivateFlake ./dev/private; 16 | 17 | privateInputs = privateFlake.inputs; 18 | 19 | systems = [ 20 | "aarch64-linux" 21 | "riscv64-linux" 22 | "x86_64-linux" 23 | ]; 24 | eachSystem = 25 | f: 26 | builtins.listToAttrs ( 27 | builtins.map (system: { 28 | name = system; 29 | value = f { 30 | pkgs = privateInputs.nixpkgs.legacyPackages.${system}; 31 | inherit system; 32 | }; 33 | }) systems 34 | ); 35 | in 36 | { 37 | lib = import ./lib { inherit (privateInputs.nixpkgs) lib; }; 38 | 39 | nixosConfigurations = { 40 | basic = 41 | (import ./hosts/basic { 42 | inputs = privateInputs; 43 | flake = publicInputs.self; 44 | }).value; 45 | }; 46 | nixosModules.facter = ./modules/nixos/facter.nix; 47 | } 48 | // 49 | # DevOutputs 50 | { 51 | devShells = eachSystem ( 52 | { pkgs, ... }: 53 | { 54 | default = pkgs.callPackage ./devshell.nix { inputs = publicInputs // privateInputs; }; 55 | docs = pkgs.callPackage ./docs.nix { inputs = publicInputs // privateInputs; }; 56 | } 57 | ); 58 | formatter = eachSystem ( 59 | { pkgs, ... }: 60 | (pkgs.callPackage ./formatter.nix { inputs = publicInputs // privateInputs; }).config.build.wrapper 61 | ); 62 | 63 | packages = eachSystem ( 64 | { pkgs, ... }: 65 | { 66 | fprint-supported-devices = pkgs.libfprint.overrideAttrs (old: { 67 | nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [ 68 | pkgs.jq 69 | pkgs.gawk 70 | ]; 71 | buildPhase = '' 72 | ninja libfprint/fprint-list-supported-devices 73 | ''; 74 | outputs = [ "out" ]; 75 | installPhase = '' 76 | ./libfprint/fprint-list-supported-devices | \ 77 | grep -o -E '(\b[0-9a-fA-F]{4}:[0-9a-fA-F]{4}\b)' | \ 78 | awk '{print toupper($0)}' | \ 79 | jq -R -s 'split("\n") | map(select(. != "")) | map({key: ., value: true}) | from_entries' > $out 80 | ''; 81 | # we cannot disable doInstallcheck because than we are missing nativeCheckInputs dependencies 82 | installCheckPhase = ""; 83 | }); 84 | update-fprint-devices = pkgs.writeScriptBin "update-fprint-devices" '' 85 | #!${pkgs.stdenv.shell} 86 | target=$(git rev-parse --show-toplevel)/modules/nixos/fingerprint/devices.json 87 | cat ${publicInputs.self.packages.${pkgs.system}.fprint-supported-devices} > "$target" 88 | nix fmt -- "$target" 89 | git add -- "$target" 90 | ''; 91 | } 92 | ); 93 | 94 | checks = eachSystem ( 95 | { pkgs, ... }: 96 | { 97 | formatting = 98 | (pkgs.callPackage ./formatter.nix { inputs = publicInputs // privateInputs; }).config.build.check 99 | publicInputs.self; 100 | minimal-machine = 101 | (pkgs.nixos [ 102 | publicInputs.self.nixosModules.facter 103 | ( 104 | { lib, config, ... }: 105 | { 106 | boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ]; 107 | fileSystems."/".device = lib.mkDefault "/dev/sda"; 108 | users.users.root.initialPassword = "fnord23"; 109 | system.stateVersion = config.system.nixos.version; 110 | nixpkgs.pkgs = pkgs; 111 | } 112 | ) 113 | ]).config.system.build.toplevel; 114 | lib-tests = pkgs.runCommandLocal "lib-tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } '' 115 | export HOME="$(realpath .)" 116 | export NIX_CONFIG=' 117 | extra-experimental-features = nix-command flakes 118 | flake-registry = "" 119 | ' 120 | 121 | nix-unit --expr '(import ${publicInputs.self}/lib { lib = import ${privateInputs.nixpkgs}/lib; }).tests' 122 | 123 | touch $out 124 | ''; 125 | } 126 | ); 127 | }; 128 | } 129 | -------------------------------------------------------------------------------- /formatter.nix: -------------------------------------------------------------------------------- 1 | { pkgs, inputs, ... }: 2 | let 3 | hasNixFmt = pkgs.lib.meta.availableOn pkgs.stdenv.buildPlatform pkgs.nixfmt-rfc-style.compiler; 4 | in 5 | inputs.treefmt-nix.lib.evalModule pkgs { 6 | projectRootFile = ".git/config"; 7 | 8 | programs = { 9 | nixfmt.enable = hasNixFmt; 10 | nixfmt.package = pkgs.nixfmt-rfc-style; 11 | 12 | deadnix.enable = true; 13 | prettier.enable = true; 14 | statix.enable = true; 15 | }; 16 | 17 | settings = { 18 | global.excludes = [ 19 | "LICENSE" 20 | "*.narHash" 21 | # unsupported extensions 22 | "*.{gif,png,svg,tape,mts,lock,mod,sum,toml,env,envrc,gitignore}" 23 | ]; 24 | 25 | formatter = { 26 | deadnix = { 27 | priority = 1; 28 | }; 29 | 30 | statix = { 31 | priority = 2; 32 | }; 33 | 34 | nixfmt = pkgs.lib.mkIf hasNixFmt { priority = 3; }; 35 | 36 | prettier = { 37 | options = [ 38 | "--tab-width" 39 | "4" 40 | ]; 41 | includes = [ "*.{css,html,js,json,jsx,md,mdx,scss,ts,yaml}" ]; 42 | }; 43 | }; 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /hosts/basic/config.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | { 3 | boot = { 4 | growPartition = true; 5 | kernelParams = [ "console=ttyS0" ]; 6 | loader = { 7 | timeout = 0; 8 | grub.device = "/dev/vda"; 9 | }; 10 | }; 11 | 12 | fileSystems."/" = { 13 | device = "/dev/vda"; 14 | autoResize = true; 15 | fsType = "ext4"; 16 | }; 17 | 18 | boot.tmp.cleanOnBoot = true; 19 | boot.initrd.systemd.enable = true; 20 | # Enable this to have a shell access in initrd 21 | boot.initrd.systemd.emergencyAccess = false; 22 | 23 | users.users.facter = { 24 | isNormalUser = true; 25 | extraGroups = [ "wheel" ]; 26 | }; 27 | services.getty.autologinUser = "facter"; 28 | security.sudo.wheelNeedsPassword = false; 29 | 30 | system.stateVersion = "24.05"; 31 | 32 | nix = { 33 | settings = { 34 | fallback = true; 35 | experimental-features = "nix-command flakes"; 36 | 37 | substituters = [ 38 | "https://nix-community.cachix.org" 39 | "https://numtide.cachix.org" 40 | ]; 41 | 42 | trusted-public-keys = [ 43 | "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" 44 | "numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE=" 45 | ]; 46 | }; 47 | registry = { 48 | nixpkgs.to = { 49 | type = "path"; 50 | inherit (pkgs) path; 51 | }; 52 | nixos-facter.to = { 53 | type = "github"; 54 | owner = "numtide"; 55 | repo = "nixos-facter"; 56 | }; 57 | }; 58 | }; 59 | 60 | virtualisation.vmVariant = { 61 | virtualisation = { 62 | graphics = false; 63 | cores = 2; 64 | diskSize = 1024 * 10; 65 | memorySize = 1024 * 2; 66 | sharedDirectories.facter = { 67 | source = "$PRJ_DATA_DIR"; 68 | target = "/mnt/shared"; 69 | }; 70 | }; 71 | }; 72 | } 73 | -------------------------------------------------------------------------------- /hosts/basic/default.nix: -------------------------------------------------------------------------------- 1 | { flake, inputs, ... }: 2 | { 3 | class = "nixos"; 4 | value = inputs.nixpkgs.lib.nixosSystem { 5 | modules = [ 6 | ./config.nix 7 | flake.nixosModules.facter 8 | { config.facter.reportPath = ./report.json; } 9 | ]; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /hosts/basic/report.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "system": "x86_64-linux", 4 | "virtualisation": "kvm", 5 | "hardware": { 6 | "bios": { 7 | "apm_info": { 8 | "supported": false, 9 | "enabled": false, 10 | "version": 0, 11 | "sub_version": 0, 12 | "bios_flags": 0 13 | }, 14 | "vbe_info": { 15 | "version": 0, 16 | "video_memory": 0 17 | }, 18 | "pnp": true, 19 | "pnp_id": 0, 20 | "lba_support": false, 21 | "low_memory_size": 654336, 22 | "smbios_version": 520 23 | }, 24 | "bridge": [ 25 | { 26 | "bus_type": { 27 | "name": "PCI", 28 | "value": 4 29 | }, 30 | "slot": 1, 31 | "base_class": { 32 | "name": "Bridge", 33 | "value": 6 34 | }, 35 | "sub_class": { 36 | "name": "ISA bridge", 37 | "value": 1 38 | }, 39 | "vendor": { 40 | "name": "Intel Corporation", 41 | "value": 32902 42 | }, 43 | "sub_vendor": { 44 | "value": 6900 45 | }, 46 | "device": { 47 | "value": 28672 48 | }, 49 | "sub_device": { 50 | "value": 4352 51 | }, 52 | "model": "Intel ISA bridge", 53 | "sysfs_id": "/devices/pci0000:00/0000:00:01.0", 54 | "sysfs_bus_id": "0000:00:01.0", 55 | "sysfs_iommu_group_id": 0, 56 | "detail": { 57 | "function": 0, 58 | "command": 259, 59 | "header_type": 0, 60 | "secondary_bus": 0, 61 | "irq": 0, 62 | "prog_if": 0 63 | }, 64 | "hotplug": "none", 65 | "hotplug_slot": 0, 66 | "is": {}, 67 | "module_alias": "pci:v00008086d00007000sv00001AF4sd00001100bc06sc01i00" 68 | }, 69 | { 70 | "bus_type": { 71 | "name": "PCI", 72 | "value": 4 73 | }, 74 | "slot": 0, 75 | "base_class": { 76 | "name": "Bridge", 77 | "value": 6 78 | }, 79 | "sub_class": { 80 | "name": "Host bridge", 81 | "value": 0 82 | }, 83 | "vendor": { 84 | "name": "Intel Corporation", 85 | "value": 32902 86 | }, 87 | "sub_vendor": { 88 | "value": 6900 89 | }, 90 | "device": { 91 | "value": 4663 92 | }, 93 | "sub_device": { 94 | "value": 4352 95 | }, 96 | "revision": { 97 | "value": 2 98 | }, 99 | "model": "Intel Host bridge", 100 | "sysfs_id": "/devices/pci0000:00/0000:00:00.0", 101 | "sysfs_bus_id": "0000:00:00.0", 102 | "sysfs_iommu_group_id": 0, 103 | "detail": { 104 | "function": 0, 105 | "command": 259, 106 | "header_type": 0, 107 | "secondary_bus": 0, 108 | "irq": 0, 109 | "prog_if": 0 110 | }, 111 | "hotplug": "none", 112 | "hotplug_slot": 0, 113 | "is": {}, 114 | "module_alias": "pci:v00008086d00001237sv00001AF4sd00001100bc06sc00i00" 115 | }, 116 | { 117 | "bus_type": { 118 | "name": "PCI", 119 | "value": 4 120 | }, 121 | "slot": 1, 122 | "base_class": { 123 | "name": "Bridge", 124 | "value": 6 125 | }, 126 | "sub_class": { 127 | "name": "Bridge", 128 | "value": 128 129 | }, 130 | "vendor": { 131 | "name": "Intel Corporation", 132 | "value": 32902 133 | }, 134 | "sub_vendor": { 135 | "value": 6900 136 | }, 137 | "device": { 138 | "value": 28947 139 | }, 140 | "sub_device": { 141 | "value": 4352 142 | }, 143 | "revision": { 144 | "value": 3 145 | }, 146 | "model": "Intel Bridge", 147 | "sysfs_id": "/devices/pci0000:00/0000:00:01.3", 148 | "sysfs_bus_id": "0000:00:01.3", 149 | "sysfs_iommu_group_id": 0, 150 | "resources": [ 151 | { 152 | "type": "irq", 153 | "base": 9, 154 | "triggered": 0, 155 | "enabled": true 156 | } 157 | ], 158 | "detail": { 159 | "function": 3, 160 | "command": 259, 161 | "header_type": 0, 162 | "secondary_bus": 0, 163 | "irq": 9, 164 | "prog_if": 0 165 | }, 166 | "hotplug": "none", 167 | "hotplug_slot": 0, 168 | "is": {}, 169 | "driver": "piix4_smbus", 170 | "driver_module": "i2c_piix4", 171 | "drivers": [ 172 | "piix4_smbus" 173 | ], 174 | "driver_modules": [ 175 | "i2c_piix4" 176 | ], 177 | "module_alias": "pci:v00008086d00007113sv00001AF4sd00001100bc06sc80i00" 178 | } 179 | ], 180 | "cdrom": [ 181 | { 182 | "bus_type": { 183 | "name": "SCSI", 184 | "value": 132 185 | }, 186 | "slot": 256, 187 | "base_class": { 188 | "name": "Mass Storage Device", 189 | "value": 262 190 | }, 191 | "sub_class": { 192 | "name": "CD-ROM", 193 | "value": 2 194 | }, 195 | "pci_interface": { 196 | "name": "DVD", 197 | "value": 3 198 | }, 199 | "vendor": { 200 | "name": "QEMU", 201 | "value": 0 202 | }, 203 | "device": { 204 | "name": "QEMU DVD-ROM", 205 | "value": 0 206 | }, 207 | "revision": { 208 | "name": "2.5+", 209 | "value": 0 210 | }, 211 | "model": "QEMU DVD-ROM", 212 | "attached_to": 14, 213 | "sysfs_id": "/class/block/sr0", 214 | "sysfs_bus_id": "1:0:0:0", 215 | "sysfs_device_link": "/devices/pci0000:00/0000:00:01.1/ata2/host1/target1:0:0/1:0:0:0", 216 | "sysfs_iommu_group_id": 0, 217 | "unix_device_name": "/dev/sr0", 218 | "unix_device_number": { 219 | "type": 98, 220 | "major": 11, 221 | "minor": 0, 222 | "range": 1 223 | }, 224 | "unix_device_names": [ 225 | "/dev/cdrom", 226 | "/dev/disk/by-diskseq/3", 227 | "/dev/disk/by-id/ata-QEMU_DVD-ROM_QM00003", 228 | "/dev/disk/by-path/pci-0000:00:01.1-ata-2", 229 | "/dev/disk/by-path/pci-0000:00:01.1-ata-2.0", 230 | "/dev/sr0" 231 | ], 232 | "unix_device_name_2": "/dev/sg0", 233 | "unix_device_number_2": { 234 | "type": 99, 235 | "major": 21, 236 | "minor": 0, 237 | "range": 1 238 | }, 239 | "hotplug": "none", 240 | "hotplug_slot": 0, 241 | "is": { 242 | "dvd": true, 243 | "mrw": true, 244 | "mrw_w": true 245 | }, 246 | "driver": "ata_piix", 247 | "driver_module": "ata_piix", 248 | "drivers": [ 249 | "ata_piix", 250 | "sr" 251 | ], 252 | "driver_modules": [ 253 | "ata_piix", 254 | "sr_mod" 255 | ] 256 | } 257 | ], 258 | "cpu": [ 259 | { 260 | "architecture": "x86_64", 261 | "vendor_name": "AuthenticAMD", 262 | "family": 25, 263 | "model": 33, 264 | "stepping": 0, 265 | "features": [ 266 | "fpu", 267 | "vme", 268 | "de", 269 | "pse", 270 | "tsc", 271 | "msr", 272 | "pae", 273 | "mce", 274 | "cx8", 275 | "apic", 276 | "sep", 277 | "mtrr", 278 | "pge", 279 | "mca", 280 | "cmov", 281 | "pat", 282 | "pse36", 283 | "clflush", 284 | "mmx", 285 | "fxsr", 286 | "sse", 287 | "sse2", 288 | "ht", 289 | "syscall", 290 | "nx", 291 | "mmxext", 292 | "fxsr_opt", 293 | "pdpe1gb", 294 | "rdtscp", 295 | "lm", 296 | "rep_good", 297 | "nopl", 298 | "cpuid", 299 | "extd_apicid", 300 | "tsc_known_freq", 301 | "pni", 302 | "pclmulqdq", 303 | "ssse3", 304 | "fma", 305 | "cx16", 306 | "sse4_1", 307 | "sse4_2", 308 | "x2apic", 309 | "movbe", 310 | "popcnt", 311 | "tsc_deadline_timer", 312 | "aes", 313 | "xsave", 314 | "avx", 315 | "f16c", 316 | "rdrand", 317 | "hypervisor", 318 | "lahf_lm", 319 | "cmp_legacy", 320 | "svm", 321 | "cr8_legacy", 322 | "abm", 323 | "sse4a", 324 | "misalignsse", 325 | "3dnowprefetch", 326 | "osvw", 327 | "perfctr_core", 328 | "ssbd", 329 | "ibrs", 330 | "ibpb", 331 | "stibp", 332 | "vmmcall", 333 | "fsgsbase", 334 | "tsc_adjust", 335 | "bmi1", 336 | "avx2", 337 | "smep", 338 | "bmi2", 339 | "erms", 340 | "invpcid", 341 | "rdseed", 342 | "adx", 343 | "smap", 344 | "clflushopt", 345 | "clwb", 346 | "sha_ni", 347 | "xsaveopt", 348 | "xsavec", 349 | "xgetbv1", 350 | "xsaves", 351 | "clzero", 352 | "xsaveerptr", 353 | "wbnoinvd", 354 | "arat", 355 | "npt", 356 | "lbrv", 357 | "nrip_save", 358 | "tsc_scale", 359 | "vmcb_clean", 360 | "pausefilter", 361 | "pfthreshold", 362 | "v_vmsave_vmload", 363 | "vgif", 364 | "umip", 365 | "pku", 366 | "ospke", 367 | "vaes", 368 | "vpclmulqdq", 369 | "rdpid", 370 | "fsrm", 371 | "arch_capabilities" 372 | ], 373 | "bugs": [ 374 | "sysret_ss_attrs", 375 | "spectre_v1", 376 | "spectre_v2", 377 | "spec_store_bypass", 378 | "srso" 379 | ], 380 | "bogo": 6799.99, 381 | "cache": 512, 382 | "units": 2, 383 | "physical_id": 0, 384 | "siblings": 2, 385 | "cores": 2, 386 | "fpu": true, 387 | "fpu_exception": true, 388 | "cpuid_level": 16, 389 | "write_protect": false, 390 | "tlb_size": 1024, 391 | "clflush_size": 64, 392 | "cache_alignment": 64, 393 | "address_sizes": { 394 | "physical": 48, 395 | "virtual": 48 396 | } 397 | } 398 | ], 399 | "disk": [ 400 | { 401 | "slot": 0, 402 | "base_class": { 403 | "name": "Mass Storage Device", 404 | "value": 262 405 | }, 406 | "sub_class": { 407 | "name": "Disk", 408 | "value": 0 409 | }, 410 | "model": "Disk", 411 | "sysfs_id": "/class/block/fd0", 412 | "sysfs_bus_id": "floppy.0", 413 | "sysfs_device_link": "/devices/platform/floppy.0", 414 | "sysfs_iommu_group_id": 0, 415 | "unix_device_name": "/dev/fd0", 416 | "unix_device_number": { 417 | "type": 98, 418 | "major": 2, 419 | "minor": 0, 420 | "range": 1 421 | }, 422 | "unix_device_names": [ 423 | "/dev/fd0" 424 | ], 425 | "resources": [ 426 | { 427 | "type": "size", 428 | "unit": "sectors", 429 | "value_1": 8, 430 | "value_2": 512 431 | } 432 | ], 433 | "hotplug": "none", 434 | "hotplug_slot": 0, 435 | "is": { 436 | "not_ready": true 437 | }, 438 | "driver": "floppy", 439 | "driver_module": "floppy", 440 | "drivers": [ 441 | "floppy" 442 | ], 443 | "driver_modules": [ 444 | "floppy" 445 | ] 446 | }, 447 | { 448 | "slot": 0, 449 | "base_class": { 450 | "name": "Mass Storage Device", 451 | "value": 262 452 | }, 453 | "sub_class": { 454 | "name": "Disk", 455 | "value": 0 456 | }, 457 | "model": "Disk", 458 | "attached_to": 21, 459 | "sysfs_id": "/class/block/vda", 460 | "sysfs_bus_id": "virtio6", 461 | "sysfs_device_link": "/devices/pci0000:00/0000:00:09.0/virtio6", 462 | "sysfs_iommu_group_id": 0, 463 | "unix_device_name": "/dev/vda", 464 | "unix_device_number": { 465 | "type": 98, 466 | "major": 253, 467 | "minor": 0, 468 | "range": 16 469 | }, 470 | "unix_device_names": [ 471 | "/dev/disk/by-diskseq/1", 472 | "/dev/disk/by-id/virtio-root", 473 | "/dev/disk/by-label/nixos", 474 | "/dev/disk/by-path/pci-0000:00:09.0", 475 | "/dev/disk/by-path/virtio-pci-0000:00:09.0", 476 | "/dev/disk/by-uuid/d907ce0d-0d9b-446f-8f2e-6b0bd67873f1", 477 | "/dev/vda" 478 | ], 479 | "resources": [ 480 | { 481 | "type": "disk_geo", 482 | "cylinders": 20805, 483 | "heads": 16, 484 | "sectors": 63, 485 | "size": 0, 486 | "geo_type": "logical" 487 | }, 488 | { 489 | "type": "size", 490 | "unit": "sectors", 491 | "value_1": 20971520, 492 | "value_2": 512 493 | } 494 | ], 495 | "hotplug": "none", 496 | "hotplug_slot": 0, 497 | "is": {}, 498 | "driver": "virtio-pci", 499 | "driver_module": "virtio_pci", 500 | "drivers": [ 501 | "virtio-pci", 502 | "virtio_blk" 503 | ], 504 | "driver_modules": [ 505 | "virtio_blk", 506 | "virtio_pci" 507 | ] 508 | } 509 | ], 510 | "graphics_card": [ 511 | { 512 | "bus_type": { 513 | "name": "PCI", 514 | "value": 4 515 | }, 516 | "slot": 2, 517 | "base_class": { 518 | "name": "Display controller", 519 | "value": 3 520 | }, 521 | "sub_class": { 522 | "name": "VGA compatible controller", 523 | "value": 0 524 | }, 525 | "pci_interface": { 526 | "name": "VGA", 527 | "value": 0 528 | }, 529 | "vendor": { 530 | "value": 4660 531 | }, 532 | "sub_vendor": { 533 | "value": 6900 534 | }, 535 | "device": { 536 | "value": 4369 537 | }, 538 | "sub_device": { 539 | "value": 4352 540 | }, 541 | "revision": { 542 | "value": 2 543 | }, 544 | "model": "VGA compatible controller", 545 | "sysfs_id": "/devices/pci0000:00/0000:00:02.0", 546 | "sysfs_bus_id": "0000:00:02.0", 547 | "sysfs_iommu_group_id": 0, 548 | "resources": [ 549 | { 550 | "type": "mem", 551 | "base": 4244635648, 552 | "range": 16777216, 553 | "enabled": true, 554 | "access": "read_only", 555 | "prefetch": "no" 556 | }, 557 | { 558 | "type": "mem", 559 | "base": 4273799168, 560 | "range": 4096, 561 | "enabled": true, 562 | "access": "read_write", 563 | "prefetch": "no" 564 | }, 565 | { 566 | "type": "mem", 567 | "base": 786432, 568 | "range": 131072, 569 | "enabled": false, 570 | "access": "read_write", 571 | "prefetch": "no" 572 | } 573 | ], 574 | "detail": { 575 | "function": 0, 576 | "command": 259, 577 | "header_type": 0, 578 | "secondary_bus": 0, 579 | "irq": 0, 580 | "prog_if": 0 581 | }, 582 | "hotplug": "none", 583 | "hotplug_slot": 0, 584 | "is": {}, 585 | "driver": "bochs-drm", 586 | "driver_module": "bochs", 587 | "drivers": [ 588 | "bochs-drm" 589 | ], 590 | "driver_modules": [ 591 | "bochs" 592 | ], 593 | "module_alias": "pci:v00001234d00001111sv00001AF4sd00001100bc03sc00i00" 594 | } 595 | ], 596 | "hub": [ 597 | { 598 | "bus_type": { 599 | "name": "USB", 600 | "value": 134 601 | }, 602 | "slot": 0, 603 | "base_class": { 604 | "name": "Hub", 605 | "value": 266 606 | }, 607 | "vendor": { 608 | "name": "Linux 6.6.48 uhci_hcd", 609 | "value": 7531 610 | }, 611 | "device": { 612 | "name": "UHCI Host Controller", 613 | "value": 1 614 | }, 615 | "revision": { 616 | "name": "6.06", 617 | "value": 0 618 | }, 619 | "model": "Linux 6.6.48 uhci_hcd UHCI Host Controller", 620 | "attached_to": 7, 621 | "sysfs_id": "/devices/pci0000:00/0000:00:01.2/usb1/1-0:1.0", 622 | "sysfs_bus_id": "1-0:1.0", 623 | "sysfs_iommu_group_id": 0, 624 | "resources": [ 625 | { 626 | "type": "baud", 627 | "speed": 12000000, 628 | "bits": 0, 629 | "stop_bits": 0, 630 | "parity": 0, 631 | "handshake": 0 632 | } 633 | ], 634 | "detail": { 635 | "bus": 0, 636 | "device_number": 0, 637 | "lev": 0, 638 | "parent": 0, 639 | "port": 0, 640 | "count": 0, 641 | "connections": 0, 642 | "used_connections": 0, 643 | "interface_descriptor": 0, 644 | "speed": 12000000, 645 | "manufacturer": "Linux 6.6.48 uhci_hcd", 646 | "product": "UHCI Host Controller", 647 | "device_class": "hub", 648 | "interface_class": "hub", 649 | "country": 0 650 | }, 651 | "hotplug": "usb", 652 | "hotplug_slot": 0, 653 | "is": {}, 654 | "driver": "hub", 655 | "drivers": [ 656 | "hub" 657 | ], 658 | "module_alias": "usb:v1D6Bp0001d0606dc09dsc00dp00ic09isc00ip00in00" 659 | } 660 | ], 661 | "memory": [ 662 | null 663 | ], 664 | "monitor": [ 665 | { 666 | "slot": 0, 667 | "base_class": { 668 | "name": "Monitor", 669 | "value": 256 670 | }, 671 | "sub_class": { 672 | "name": "LCD Monitor", 673 | "value": 2 674 | }, 675 | "vendor": { 676 | "value": 18708 677 | }, 678 | "device": { 679 | "name": "QEMU Monitor", 680 | "value": 4660 681 | }, 682 | "model": "QEMU Monitor", 683 | "attached_to": 17, 684 | "sysfs_iommu_group_id": 0, 685 | "resources": [ 686 | { 687 | "type": "monitor", 688 | "width": 1024, 689 | "height": 768, 690 | "vertical_frequency": 60, 691 | "interlaced": false 692 | }, 693 | { 694 | "type": "monitor", 695 | "width": 1280, 696 | "height": 800, 697 | "vertical_frequency": 60, 698 | "interlaced": false 699 | }, 700 | { 701 | "type": "monitor", 702 | "width": 1600, 703 | "height": 1200, 704 | "vertical_frequency": 60, 705 | "interlaced": false 706 | }, 707 | { 708 | "type": "monitor", 709 | "width": 1920, 710 | "height": 1080, 711 | "vertical_frequency": 60, 712 | "interlaced": false 713 | }, 714 | { 715 | "type": "monitor", 716 | "width": 2048, 717 | "height": 1152, 718 | "vertical_frequency": 60, 719 | "interlaced": false 720 | }, 721 | { 722 | "type": "monitor", 723 | "width": 640, 724 | "height": 480, 725 | "vertical_frequency": 60, 726 | "interlaced": false 727 | }, 728 | { 729 | "type": "monitor", 730 | "width": 800, 731 | "height": 600, 732 | "vertical_frequency": 60, 733 | "interlaced": false 734 | }, 735 | { 736 | "type": "size", 737 | "unit": "mm", 738 | "value_1": 325, 739 | "value_2": 203 740 | } 741 | ], 742 | "detail": { 743 | "manufacture_year": 2014, 744 | "manufacture_week": 42, 745 | "vertical_sync": { 746 | "min": 50, 747 | "max": 125 748 | }, 749 | "horizontal_sync": { 750 | "min": 30, 751 | "max": 160 752 | }, 753 | "horizontal_sync_timings": { 754 | "disp": 1280, 755 | "sync_start": 1600, 756 | "sync_end": 1638, 757 | "total": 1728 758 | }, 759 | "vertical_sync_timings": { 760 | "disp": 800, 761 | "sync_start": 804, 762 | "sync_end": 808, 763 | "total": 828 764 | }, 765 | "clock": 107300, 766 | "width": 1280, 767 | "height": 800, 768 | "width_millimetres": 325, 769 | "height_millimetres": 203, 770 | "horizontal_flag": 45, 771 | "vertical_flag": 45, 772 | "vendor": "", 773 | "name": "QEMU Monitor" 774 | }, 775 | "hotplug": "none", 776 | "hotplug_slot": 0, 777 | "is": {}, 778 | "driver_info": { 779 | "type": "display", 780 | "width": 2048, 781 | "height": 1152, 782 | "vertical_sync": { 783 | "min": 50, 784 | "max": 125 785 | }, 786 | "horizontal_sync": { 787 | "min": 30, 788 | "max": 160 789 | }, 790 | "bandwidth": 0, 791 | "horizontal_sync_timings": { 792 | "disp": 1280, 793 | "sync_start": 1600, 794 | "sync_end": 1638, 795 | "total": 1728 796 | }, 797 | "vertical_sync_timings": { 798 | "disp": 800, 799 | "sync_start": 804, 800 | "sync_end": 808, 801 | "total": 828 802 | }, 803 | "horizontal_flag": 45, 804 | "vertical_flag": 45 805 | } 806 | } 807 | ], 808 | "mouse": [ 809 | { 810 | "bus_type": { 811 | "name": "USB", 812 | "value": 134 813 | }, 814 | "slot": 0, 815 | "base_class": { 816 | "name": "Mouse", 817 | "value": 261 818 | }, 819 | "sub_class": { 820 | "name": "USB Mouse", 821 | "value": 3 822 | }, 823 | "vendor": { 824 | "name": "QEMU", 825 | "value": 1575 826 | }, 827 | "device": { 828 | "name": "QEMU USB Tablet", 829 | "value": 1 830 | }, 831 | "compat_vendor": "Unknown", 832 | "compat_device": "Generic USB Mouse", 833 | "model": "QEMU USB Tablet", 834 | "attached_to": 33, 835 | "sysfs_id": "/devices/pci0000:00/0000:00:01.2/usb1/1-1/1-1:1.0", 836 | "sysfs_bus_id": "1-1:1.0", 837 | "sysfs_iommu_group_id": 0, 838 | "unix_device_name": "/dev/input/mice", 839 | "unix_device_number": { 840 | "type": 99, 841 | "major": 13, 842 | "minor": 63, 843 | "range": 1 844 | }, 845 | "unix_device_names": [ 846 | "/dev/input/mice" 847 | ], 848 | "unix_device_name_2": "/dev/input/mouse0", 849 | "unix_device_number_2": { 850 | "type": 99, 851 | "major": 13, 852 | "minor": 32, 853 | "range": 1 854 | }, 855 | "resources": [ 856 | { 857 | "type": "baud", 858 | "speed": 12000000, 859 | "bits": 0, 860 | "stop_bits": 0, 861 | "parity": 0, 862 | "handshake": 0 863 | } 864 | ], 865 | "detail": { 866 | "bus": 0, 867 | "device_number": 0, 868 | "lev": 0, 869 | "parent": 0, 870 | "port": 0, 871 | "count": 0, 872 | "connections": 0, 873 | "used_connections": 0, 874 | "interface_descriptor": 0, 875 | "speed": 12000000, 876 | "manufacturer": "QEMU", 877 | "product": "QEMU USB Tablet", 878 | "interface_class": "hid", 879 | "country": 0 880 | }, 881 | "hotplug": "usb", 882 | "hotplug_slot": 0, 883 | "is": {}, 884 | "driver": "usbhid", 885 | "driver_module": "usbhid", 886 | "drivers": [ 887 | "usbhid" 888 | ], 889 | "driver_modules": [ 890 | "usbhid" 891 | ], 892 | "driver_info": { 893 | "type": "mouse", 894 | "db_entry_0": [ 895 | "explorerps/2", 896 | "exps2" 897 | ], 898 | "xf86": "explorerps/2", 899 | "gpm": "exps2", 900 | "buttons": -1, 901 | "wheels": -1 902 | }, 903 | "module_alias": "usb:v0627p0001d0000dc00dsc00dp00ic03isc00ip00in00" 904 | } 905 | ], 906 | "network_controller": [ 907 | { 908 | "bus_type": { 909 | "name": "Virtio", 910 | "value": 143 911 | }, 912 | "slot": 0, 913 | "base_class": { 914 | "name": "Network controller", 915 | "value": 2 916 | }, 917 | "sub_class": { 918 | "name": "Ethernet controller", 919 | "value": 0 920 | }, 921 | "vendor": "Virtio", 922 | "device": "Ethernet Card 0", 923 | "model": "Virtio Ethernet Card 0", 924 | "attached_to": 13, 925 | "sysfs_id": "/devices/pci0000:00/0000:00:03.0/virtio0", 926 | "sysfs_bus_id": "virtio0", 927 | "sysfs_iommu_group_id": 0, 928 | "unix_device_name": "eth0", 929 | "unix_device_names": [ 930 | "eth0" 931 | ], 932 | "resources": [ 933 | { 934 | "type": "hwaddr", 935 | "address": 53 936 | }, 937 | { 938 | "type": "phwaddr", 939 | "address": 53 940 | } 941 | ], 942 | "hotplug": "none", 943 | "hotplug_slot": 0, 944 | "is": {}, 945 | "driver": "virtio_net", 946 | "driver_module": "virtio_net", 947 | "drivers": [ 948 | "virtio_net" 949 | ], 950 | "driver_modules": [ 951 | "virtio_net" 952 | ], 953 | "module_alias": "virtio:d00000001v00001AF4" 954 | } 955 | ], 956 | "network_interface": [ 957 | { 958 | "slot": 0, 959 | "base_class": { 960 | "name": "Network Interface", 961 | "value": 263 962 | }, 963 | "sub_class": { 964 | "name": "Loopback", 965 | "value": 0 966 | }, 967 | "model": "Loopback network interface", 968 | "sysfs_id": "/class/net/lo", 969 | "sysfs_iommu_group_id": 0, 970 | "unix_device_name": "lo", 971 | "unix_device_names": [ 972 | "lo" 973 | ], 974 | "hotplug": "none", 975 | "hotplug_slot": 0, 976 | "is": {} 977 | }, 978 | { 979 | "slot": 0, 980 | "base_class": { 981 | "name": "Network Interface", 982 | "value": 263 983 | }, 984 | "sub_class": { 985 | "name": "Ethernet", 986 | "value": 1 987 | }, 988 | "model": "Ethernet network interface", 989 | "attached_to": 24, 990 | "sysfs_id": "/class/net/eth0", 991 | "sysfs_device_link": "/devices/pci0000:00/0000:00:03.0/virtio0", 992 | "sysfs_iommu_group_id": 0, 993 | "unix_device_name": "eth0", 994 | "unix_device_names": [ 995 | "eth0" 996 | ], 997 | "resources": [ 998 | { 999 | "type": "hwaddr", 1000 | "address": 53 1001 | }, 1002 | { 1003 | "type": "phwaddr", 1004 | "address": 53 1005 | } 1006 | ], 1007 | "hotplug": "none", 1008 | "hotplug_slot": 0, 1009 | "is": {}, 1010 | "driver": "virtio_net", 1011 | "driver_module": "virtio_net", 1012 | "drivers": [ 1013 | "virtio_net" 1014 | ], 1015 | "driver_modules": [ 1016 | "virtio_net" 1017 | ] 1018 | } 1019 | ], 1020 | "storage_controller": [ 1021 | { 1022 | "bus_type": { 1023 | "name": "PCI", 1024 | "value": 4 1025 | }, 1026 | "slot": 1, 1027 | "base_class": { 1028 | "name": "Mass storage controller", 1029 | "value": 1 1030 | }, 1031 | "sub_class": { 1032 | "name": "IDE interface", 1033 | "value": 1 1034 | }, 1035 | "pci_interface": { 1036 | "value": 128 1037 | }, 1038 | "vendor": { 1039 | "name": "Intel Corporation", 1040 | "value": 32902 1041 | }, 1042 | "sub_vendor": { 1043 | "value": 6900 1044 | }, 1045 | "device": { 1046 | "value": 28688 1047 | }, 1048 | "sub_device": { 1049 | "value": 4352 1050 | }, 1051 | "model": "Intel IDE interface", 1052 | "sysfs_id": "/devices/pci0000:00/0000:00:01.1", 1053 | "sysfs_bus_id": "0000:00:01.1", 1054 | "sysfs_iommu_group_id": 0, 1055 | "resources": [ 1056 | { 1057 | "type": "io", 1058 | "base": 1014, 1059 | "range": 1, 1060 | "enabled": true, 1061 | "access": "read_write" 1062 | }, 1063 | { 1064 | "type": "io", 1065 | "base": 368, 1066 | "range": 8, 1067 | "enabled": true, 1068 | "access": "read_write" 1069 | }, 1070 | { 1071 | "type": "io", 1072 | "base": 49536, 1073 | "range": 16, 1074 | "enabled": true, 1075 | "access": "read_write" 1076 | }, 1077 | { 1078 | "type": "io", 1079 | "base": 496, 1080 | "range": 8, 1081 | "enabled": true, 1082 | "access": "read_write" 1083 | }, 1084 | { 1085 | "type": "io", 1086 | "base": 886, 1087 | "range": 1, 1088 | "enabled": true, 1089 | "access": "read_write" 1090 | } 1091 | ], 1092 | "detail": { 1093 | "function": 1, 1094 | "command": 263, 1095 | "header_type": 0, 1096 | "secondary_bus": 0, 1097 | "irq": 0, 1098 | "prog_if": 128 1099 | }, 1100 | "hotplug": "none", 1101 | "hotplug_slot": 0, 1102 | "is": {}, 1103 | "driver": "ata_piix", 1104 | "driver_module": "ata_piix", 1105 | "drivers": [ 1106 | "ata_piix" 1107 | ], 1108 | "driver_modules": [ 1109 | "ata_piix" 1110 | ], 1111 | "module_alias": "pci:v00008086d00007010sv00001AF4sd00001100bc01sc01i80" 1112 | }, 1113 | { 1114 | "bus_type": { 1115 | "name": "Virtio", 1116 | "value": 143 1117 | }, 1118 | "slot": 0, 1119 | "base_class": { 1120 | "name": "Mass storage controller", 1121 | "value": 1 1122 | }, 1123 | "sub_class": { 1124 | "name": "Storage controller", 1125 | "value": 128 1126 | }, 1127 | "vendor": "Virtio", 1128 | "device": "Storage 0", 1129 | "model": "Virtio Storage 0", 1130 | "attached_to": 16, 1131 | "sysfs_id": "/devices/pci0000:00/0000:00:09.0/virtio6", 1132 | "sysfs_bus_id": "virtio6", 1133 | "sysfs_iommu_group_id": 0, 1134 | "hotplug": "none", 1135 | "hotplug_slot": 0, 1136 | "is": {}, 1137 | "driver": "virtio_blk", 1138 | "driver_module": "virtio_blk", 1139 | "drivers": [ 1140 | "virtio_blk" 1141 | ], 1142 | "driver_modules": [ 1143 | "virtio_blk" 1144 | ], 1145 | "module_alias": "virtio:d00000002v00001AF4" 1146 | } 1147 | ], 1148 | "system": { 1149 | "form_factor": "desktop" 1150 | }, 1151 | "unknown": [ 1152 | { 1153 | "bus_type": { 1154 | "name": "PCI", 1155 | "value": 4 1156 | }, 1157 | "slot": 8, 1158 | "base_class": { 1159 | "name": "Unclassified device", 1160 | "value": 0 1161 | }, 1162 | "sub_class": { 1163 | "value": 2 1164 | }, 1165 | "vendor": { 1166 | "value": 6900 1167 | }, 1168 | "sub_vendor": { 1169 | "value": 6900 1170 | }, 1171 | "device": { 1172 | "value": 4105 1173 | }, 1174 | "sub_device": { 1175 | "value": 9 1176 | }, 1177 | "model": "Unclassified device", 1178 | "sysfs_id": "/devices/pci0000:00/0000:00:08.0", 1179 | "sysfs_bus_id": "0000:00:08.0", 1180 | "sysfs_iommu_group_id": 0, 1181 | "resources": [ 1182 | { 1183 | "type": "io", 1184 | "base": 49504, 1185 | "range": 32, 1186 | "enabled": true, 1187 | "access": "read_write" 1188 | }, 1189 | { 1190 | "type": "irq", 1191 | "base": 11, 1192 | "triggered": 0, 1193 | "enabled": true 1194 | }, 1195 | { 1196 | "type": "mem", 1197 | "base": 4261494784, 1198 | "range": 16384, 1199 | "enabled": true, 1200 | "access": "read_only", 1201 | "prefetch": "no" 1202 | }, 1203 | { 1204 | "type": "mem", 1205 | "base": 4273823744, 1206 | "range": 4096, 1207 | "enabled": true, 1208 | "access": "read_write", 1209 | "prefetch": "no" 1210 | } 1211 | ], 1212 | "detail": { 1213 | "function": 0, 1214 | "command": 1287, 1215 | "header_type": 0, 1216 | "secondary_bus": 0, 1217 | "irq": 11, 1218 | "prog_if": 0 1219 | }, 1220 | "hotplug": "none", 1221 | "hotplug_slot": 0, 1222 | "is": {}, 1223 | "driver": "virtio-pci", 1224 | "driver_module": "virtio_pci", 1225 | "drivers": [ 1226 | "virtio-pci" 1227 | ], 1228 | "driver_modules": [ 1229 | "virtio_pci" 1230 | ], 1231 | "module_alias": "pci:v00001AF4d00001009sv00001AF4sd00000009bc00sc02i00" 1232 | }, 1233 | { 1234 | "bus_type": { 1235 | "name": "PCI", 1236 | "value": 4 1237 | }, 1238 | "slot": 4, 1239 | "base_class": { 1240 | "name": "Unclassified device", 1241 | "value": 0 1242 | }, 1243 | "sub_class": { 1244 | "value": 255 1245 | }, 1246 | "vendor": { 1247 | "value": 6900 1248 | }, 1249 | "sub_vendor": { 1250 | "value": 6900 1251 | }, 1252 | "device": { 1253 | "value": 4101 1254 | }, 1255 | "sub_device": { 1256 | "value": 4 1257 | }, 1258 | "model": "Unclassified device", 1259 | "sysfs_id": "/devices/pci0000:00/0000:00:04.0", 1260 | "sysfs_bus_id": "0000:00:04.0", 1261 | "sysfs_iommu_group_id": 0, 1262 | "resources": [ 1263 | { 1264 | "type": "io", 1265 | "base": 49408, 1266 | "range": 32, 1267 | "enabled": true, 1268 | "access": "read_write" 1269 | }, 1270 | { 1271 | "type": "irq", 1272 | "base": 11, 1273 | "triggered": 0, 1274 | "enabled": true 1275 | }, 1276 | { 1277 | "type": "mem", 1278 | "base": 4261429248, 1279 | "range": 16384, 1280 | "enabled": true, 1281 | "access": "read_only", 1282 | "prefetch": "no" 1283 | }, 1284 | { 1285 | "type": "mem", 1286 | "base": 4273807360, 1287 | "range": 4096, 1288 | "enabled": true, 1289 | "access": "read_write", 1290 | "prefetch": "no" 1291 | } 1292 | ], 1293 | "detail": { 1294 | "function": 0, 1295 | "command": 1287, 1296 | "header_type": 0, 1297 | "secondary_bus": 0, 1298 | "irq": 11, 1299 | "prog_if": 0 1300 | }, 1301 | "hotplug": "none", 1302 | "hotplug_slot": 0, 1303 | "is": {}, 1304 | "driver": "virtio-pci", 1305 | "driver_module": "virtio_pci", 1306 | "drivers": [ 1307 | "virtio-pci" 1308 | ], 1309 | "driver_modules": [ 1310 | "virtio_pci" 1311 | ], 1312 | "module_alias": "pci:v00001AF4d00001005sv00001AF4sd00000004bc00scFFi00" 1313 | }, 1314 | { 1315 | "bus_type": { 1316 | "name": "PCI", 1317 | "value": 4 1318 | }, 1319 | "slot": 7, 1320 | "base_class": { 1321 | "name": "Unclassified device", 1322 | "value": 0 1323 | }, 1324 | "sub_class": { 1325 | "value": 2 1326 | }, 1327 | "vendor": { 1328 | "value": 6900 1329 | }, 1330 | "sub_vendor": { 1331 | "value": 6900 1332 | }, 1333 | "device": { 1334 | "value": 4105 1335 | }, 1336 | "sub_device": { 1337 | "value": 9 1338 | }, 1339 | "model": "Unclassified device", 1340 | "sysfs_id": "/devices/pci0000:00/0000:00:07.0", 1341 | "sysfs_bus_id": "0000:00:07.0", 1342 | "sysfs_iommu_group_id": 0, 1343 | "resources": [ 1344 | { 1345 | "type": "io", 1346 | "base": 49472, 1347 | "range": 32, 1348 | "enabled": true, 1349 | "access": "read_write" 1350 | }, 1351 | { 1352 | "type": "irq", 1353 | "base": 10, 1354 | "triggered": 0, 1355 | "enabled": true 1356 | }, 1357 | { 1358 | "type": "mem", 1359 | "base": 4261478400, 1360 | "range": 16384, 1361 | "enabled": true, 1362 | "access": "read_only", 1363 | "prefetch": "no" 1364 | }, 1365 | { 1366 | "type": "mem", 1367 | "base": 4273819648, 1368 | "range": 4096, 1369 | "enabled": true, 1370 | "access": "read_write", 1371 | "prefetch": "no" 1372 | } 1373 | ], 1374 | "detail": { 1375 | "function": 0, 1376 | "command": 1287, 1377 | "header_type": 0, 1378 | "secondary_bus": 0, 1379 | "irq": 10, 1380 | "prog_if": 0 1381 | }, 1382 | "hotplug": "none", 1383 | "hotplug_slot": 0, 1384 | "is": {}, 1385 | "driver": "virtio-pci", 1386 | "driver_module": "virtio_pci", 1387 | "drivers": [ 1388 | "virtio-pci" 1389 | ], 1390 | "driver_modules": [ 1391 | "virtio_pci" 1392 | ], 1393 | "module_alias": "pci:v00001AF4d00001009sv00001AF4sd00000009bc00sc02i00" 1394 | }, 1395 | { 1396 | "bus_type": { 1397 | "name": "PCI", 1398 | "value": 4 1399 | }, 1400 | "slot": 3, 1401 | "base_class": { 1402 | "name": "Network controller", 1403 | "value": 2 1404 | }, 1405 | "sub_class": { 1406 | "name": "Ethernet controller", 1407 | "value": 0 1408 | }, 1409 | "vendor": { 1410 | "value": 6900 1411 | }, 1412 | "sub_vendor": { 1413 | "value": 6900 1414 | }, 1415 | "device": { 1416 | "value": 4096 1417 | }, 1418 | "sub_device": { 1419 | "value": 1 1420 | }, 1421 | "model": "Ethernet controller", 1422 | "sysfs_id": "/devices/pci0000:00/0000:00:03.0", 1423 | "sysfs_bus_id": "0000:00:03.0", 1424 | "sysfs_iommu_group_id": 0, 1425 | "resources": [ 1426 | { 1427 | "type": "io", 1428 | "base": 49376, 1429 | "range": 32, 1430 | "enabled": true, 1431 | "access": "read_write" 1432 | }, 1433 | { 1434 | "type": "irq", 1435 | "base": 10, 1436 | "triggered": 0, 1437 | "enabled": true 1438 | }, 1439 | { 1440 | "type": "mem", 1441 | "base": 4261412864, 1442 | "range": 16384, 1443 | "enabled": true, 1444 | "access": "read_only", 1445 | "prefetch": "no" 1446 | }, 1447 | { 1448 | "type": "mem", 1449 | "base": 4273471488, 1450 | "range": 262144, 1451 | "enabled": false, 1452 | "access": "read_only", 1453 | "prefetch": "no" 1454 | }, 1455 | { 1456 | "type": "mem", 1457 | "base": 4273803264, 1458 | "range": 4096, 1459 | "enabled": true, 1460 | "access": "read_write", 1461 | "prefetch": "no" 1462 | } 1463 | ], 1464 | "detail": { 1465 | "function": 0, 1466 | "command": 1287, 1467 | "header_type": 0, 1468 | "secondary_bus": 0, 1469 | "irq": 10, 1470 | "prog_if": 0 1471 | }, 1472 | "hotplug": "none", 1473 | "hotplug_slot": 0, 1474 | "is": {}, 1475 | "driver": "virtio-pci", 1476 | "driver_module": "virtio_pci", 1477 | "drivers": [ 1478 | "virtio-pci" 1479 | ], 1480 | "driver_modules": [ 1481 | "virtio_pci" 1482 | ], 1483 | "module_alias": "pci:v00001AF4d00001000sv00001AF4sd00000001bc02sc00i00" 1484 | }, 1485 | { 1486 | "bus_type": { 1487 | "name": "PCI", 1488 | "value": 4 1489 | }, 1490 | "slot": 6, 1491 | "base_class": { 1492 | "name": "Unclassified device", 1493 | "value": 0 1494 | }, 1495 | "sub_class": { 1496 | "value": 2 1497 | }, 1498 | "vendor": { 1499 | "value": 6900 1500 | }, 1501 | "sub_vendor": { 1502 | "value": 6900 1503 | }, 1504 | "device": { 1505 | "value": 4105 1506 | }, 1507 | "sub_device": { 1508 | "value": 9 1509 | }, 1510 | "model": "Unclassified device", 1511 | "sysfs_id": "/devices/pci0000:00/0000:00:06.0", 1512 | "sysfs_bus_id": "0000:00:06.0", 1513 | "sysfs_iommu_group_id": 0, 1514 | "resources": [ 1515 | { 1516 | "type": "io", 1517 | "base": 49280, 1518 | "range": 64, 1519 | "enabled": true, 1520 | "access": "read_write" 1521 | }, 1522 | { 1523 | "type": "irq", 1524 | "base": 11, 1525 | "triggered": 0, 1526 | "enabled": true 1527 | }, 1528 | { 1529 | "type": "mem", 1530 | "base": 4261462016, 1531 | "range": 16384, 1532 | "enabled": true, 1533 | "access": "read_only", 1534 | "prefetch": "no" 1535 | }, 1536 | { 1537 | "type": "mem", 1538 | "base": 4273815552, 1539 | "range": 4096, 1540 | "enabled": true, 1541 | "access": "read_write", 1542 | "prefetch": "no" 1543 | } 1544 | ], 1545 | "detail": { 1546 | "function": 0, 1547 | "command": 1287, 1548 | "header_type": 0, 1549 | "secondary_bus": 0, 1550 | "irq": 11, 1551 | "prog_if": 0 1552 | }, 1553 | "hotplug": "none", 1554 | "hotplug_slot": 0, 1555 | "is": {}, 1556 | "driver": "virtio-pci", 1557 | "driver_module": "virtio_pci", 1558 | "drivers": [ 1559 | "virtio-pci" 1560 | ], 1561 | "driver_modules": [ 1562 | "virtio_pci" 1563 | ], 1564 | "module_alias": "pci:v00001AF4d00001009sv00001AF4sd00000009bc00sc02i00" 1565 | }, 1566 | { 1567 | "bus_type": { 1568 | "name": "PCI", 1569 | "value": 4 1570 | }, 1571 | "slot": 9, 1572 | "base_class": { 1573 | "name": "Mass storage controller", 1574 | "value": 1 1575 | }, 1576 | "sub_class": { 1577 | "name": "SCSI storage controller", 1578 | "value": 0 1579 | }, 1580 | "vendor": { 1581 | "value": 6900 1582 | }, 1583 | "sub_vendor": { 1584 | "value": 6900 1585 | }, 1586 | "device": { 1587 | "value": 4097 1588 | }, 1589 | "sub_device": { 1590 | "value": 2 1591 | }, 1592 | "model": "SCSI storage controller", 1593 | "sysfs_id": "/devices/pci0000:00/0000:00:09.0", 1594 | "sysfs_bus_id": "0000:00:09.0", 1595 | "sysfs_iommu_group_id": 0, 1596 | "resources": [ 1597 | { 1598 | "type": "io", 1599 | "base": 49152, 1600 | "range": 128, 1601 | "enabled": true, 1602 | "access": "read_write" 1603 | }, 1604 | { 1605 | "type": "irq", 1606 | "base": 10, 1607 | "triggered": 0, 1608 | "enabled": true 1609 | }, 1610 | { 1611 | "type": "mem", 1612 | "base": 4261511168, 1613 | "range": 16384, 1614 | "enabled": true, 1615 | "access": "read_only", 1616 | "prefetch": "no" 1617 | }, 1618 | { 1619 | "type": "mem", 1620 | "base": 4273827840, 1621 | "range": 4096, 1622 | "enabled": true, 1623 | "access": "read_write", 1624 | "prefetch": "no" 1625 | } 1626 | ], 1627 | "detail": { 1628 | "function": 0, 1629 | "command": 1287, 1630 | "header_type": 0, 1631 | "secondary_bus": 0, 1632 | "irq": 10, 1633 | "prog_if": 0 1634 | }, 1635 | "hotplug": "none", 1636 | "hotplug_slot": 0, 1637 | "is": {}, 1638 | "driver": "virtio-pci", 1639 | "driver_module": "virtio_pci", 1640 | "drivers": [ 1641 | "virtio-pci" 1642 | ], 1643 | "driver_modules": [ 1644 | "virtio_pci" 1645 | ], 1646 | "module_alias": "pci:v00001AF4d00001001sv00001AF4sd00000002bc01sc00i00" 1647 | }, 1648 | { 1649 | "bus_type": { 1650 | "name": "PCI", 1651 | "value": 4 1652 | }, 1653 | "slot": 5, 1654 | "base_class": { 1655 | "name": "Unclassified device", 1656 | "value": 0 1657 | }, 1658 | "sub_class": { 1659 | "value": 2 1660 | }, 1661 | "vendor": { 1662 | "value": 6900 1663 | }, 1664 | "sub_vendor": { 1665 | "value": 6900 1666 | }, 1667 | "device": { 1668 | "value": 4105 1669 | }, 1670 | "sub_device": { 1671 | "value": 9 1672 | }, 1673 | "model": "Unclassified device", 1674 | "sysfs_id": "/devices/pci0000:00/0000:00:05.0", 1675 | "sysfs_bus_id": "0000:00:05.0", 1676 | "sysfs_iommu_group_id": 0, 1677 | "resources": [ 1678 | { 1679 | "type": "io", 1680 | "base": 49440, 1681 | "range": 32, 1682 | "enabled": true, 1683 | "access": "read_write" 1684 | }, 1685 | { 1686 | "type": "irq", 1687 | "base": 10, 1688 | "triggered": 0, 1689 | "enabled": true 1690 | }, 1691 | { 1692 | "type": "mem", 1693 | "base": 4261445632, 1694 | "range": 16384, 1695 | "enabled": true, 1696 | "access": "read_only", 1697 | "prefetch": "no" 1698 | }, 1699 | { 1700 | "type": "mem", 1701 | "base": 4273811456, 1702 | "range": 4096, 1703 | "enabled": true, 1704 | "access": "read_write", 1705 | "prefetch": "no" 1706 | } 1707 | ], 1708 | "detail": { 1709 | "function": 0, 1710 | "command": 1287, 1711 | "header_type": 0, 1712 | "secondary_bus": 0, 1713 | "irq": 10, 1714 | "prog_if": 0 1715 | }, 1716 | "hotplug": "none", 1717 | "hotplug_slot": 0, 1718 | "is": {}, 1719 | "driver": "virtio-pci", 1720 | "driver_module": "virtio_pci", 1721 | "drivers": [ 1722 | "virtio-pci" 1723 | ], 1724 | "driver_modules": [ 1725 | "virtio_pci" 1726 | ], 1727 | "module_alias": "pci:v00001AF4d00001009sv00001AF4sd00000009bc00sc02i00" 1728 | }, 1729 | { 1730 | "bus_type": { 1731 | "name": "PCI", 1732 | "value": 4 1733 | }, 1734 | "slot": 10, 1735 | "base_class": { 1736 | "name": "Input device controller", 1737 | "value": 9 1738 | }, 1739 | "sub_class": { 1740 | "name": "Keyboard controller", 1741 | "value": 0 1742 | }, 1743 | "vendor": { 1744 | "value": 6900 1745 | }, 1746 | "sub_vendor": { 1747 | "value": 6900 1748 | }, 1749 | "device": { 1750 | "value": 4178 1751 | }, 1752 | "sub_device": { 1753 | "value": 4352 1754 | }, 1755 | "revision": { 1756 | "value": 1 1757 | }, 1758 | "model": "Keyboard controller", 1759 | "sysfs_id": "/devices/pci0000:00/0000:00:0a.0", 1760 | "sysfs_bus_id": "0000:00:0a.0", 1761 | "sysfs_iommu_group_id": 0, 1762 | "resources": [ 1763 | { 1764 | "type": "irq", 1765 | "base": 11, 1766 | "triggered": 0, 1767 | "enabled": true 1768 | }, 1769 | { 1770 | "type": "mem", 1771 | "base": 4261527552, 1772 | "range": 16384, 1773 | "enabled": true, 1774 | "access": "read_only", 1775 | "prefetch": "no" 1776 | }, 1777 | { 1778 | "type": "mem", 1779 | "base": 4273831936, 1780 | "range": 4096, 1781 | "enabled": true, 1782 | "access": "read_write", 1783 | "prefetch": "no" 1784 | } 1785 | ], 1786 | "detail": { 1787 | "function": 0, 1788 | "command": 1287, 1789 | "header_type": 0, 1790 | "secondary_bus": 0, 1791 | "irq": 11, 1792 | "prog_if": 0 1793 | }, 1794 | "hotplug": "none", 1795 | "hotplug_slot": 0, 1796 | "is": {}, 1797 | "driver": "virtio-pci", 1798 | "driver_module": "virtio_pci", 1799 | "drivers": [ 1800 | "virtio-pci" 1801 | ], 1802 | "driver_modules": [ 1803 | "virtio_pci" 1804 | ], 1805 | "module_alias": "pci:v00001AF4d00001052sv00001AF4sd00001100bc09sc00i00" 1806 | }, 1807 | { 1808 | "slot": 0, 1809 | "base_class": { 1810 | "name": "Unclassified device", 1811 | "value": 0 1812 | }, 1813 | "sub_class": { 1814 | "name": "Unclassified device", 1815 | "value": 0 1816 | }, 1817 | "vendor": "Virtio", 1818 | "device": "", 1819 | "model": "Virtio Unclassified device", 1820 | "attached_to": 9, 1821 | "sysfs_id": "/devices/pci0000:00/0000:00:04.0/virtio1", 1822 | "sysfs_bus_id": "virtio1", 1823 | "sysfs_iommu_group_id": 0, 1824 | "hotplug": "none", 1825 | "hotplug_slot": 0, 1826 | "is": {}, 1827 | "driver": "virtio_rng", 1828 | "driver_module": "virtio_rng", 1829 | "drivers": [ 1830 | "virtio_rng" 1831 | ], 1832 | "driver_modules": [ 1833 | "virtio_rng" 1834 | ], 1835 | "module_alias": "virtio:d00000004v00001AF4" 1836 | }, 1837 | { 1838 | "slot": 0, 1839 | "base_class": { 1840 | "name": "Unclassified device", 1841 | "value": 0 1842 | }, 1843 | "sub_class": { 1844 | "name": "Unclassified device", 1845 | "value": 0 1846 | }, 1847 | "vendor": "Virtio", 1848 | "device": "", 1849 | "model": "Virtio Unclassified device", 1850 | "attached_to": 10, 1851 | "sysfs_id": "/devices/pci0000:00/0000:00:07.0/virtio4", 1852 | "sysfs_bus_id": "virtio4", 1853 | "sysfs_iommu_group_id": 0, 1854 | "hotplug": "none", 1855 | "hotplug_slot": 0, 1856 | "is": {}, 1857 | "driver": "9pnet_virtio", 1858 | "driver_module": "9pnet_virtio", 1859 | "drivers": [ 1860 | "9pnet_virtio" 1861 | ], 1862 | "driver_modules": [ 1863 | "9pnet_virtio" 1864 | ], 1865 | "module_alias": "virtio:d00000009v00001AF4" 1866 | }, 1867 | { 1868 | "slot": 0, 1869 | "base_class": { 1870 | "name": "Unclassified device", 1871 | "value": 0 1872 | }, 1873 | "sub_class": { 1874 | "name": "Unclassified device", 1875 | "value": 0 1876 | }, 1877 | "vendor": "Virtio", 1878 | "device": "", 1879 | "model": "Virtio Unclassified device", 1880 | "attached_to": 18, 1881 | "sysfs_id": "/devices/pci0000:00/0000:00:05.0/virtio2", 1882 | "sysfs_bus_id": "virtio2", 1883 | "sysfs_iommu_group_id": 0, 1884 | "hotplug": "none", 1885 | "hotplug_slot": 0, 1886 | "is": {}, 1887 | "driver": "9pnet_virtio", 1888 | "driver_module": "9pnet_virtio", 1889 | "drivers": [ 1890 | "9pnet_virtio" 1891 | ], 1892 | "driver_modules": [ 1893 | "9pnet_virtio" 1894 | ], 1895 | "module_alias": "virtio:d00000009v00001AF4" 1896 | }, 1897 | { 1898 | "slot": 0, 1899 | "base_class": { 1900 | "name": "Unclassified device", 1901 | "value": 0 1902 | }, 1903 | "sub_class": { 1904 | "name": "Unclassified device", 1905 | "value": 0 1906 | }, 1907 | "vendor": "Virtio", 1908 | "device": "", 1909 | "model": "Virtio Unclassified device", 1910 | "attached_to": 19, 1911 | "sysfs_id": "/devices/pci0000:00/0000:00:0a.0/virtio7", 1912 | "sysfs_bus_id": "virtio7", 1913 | "sysfs_iommu_group_id": 0, 1914 | "unix_device_name": "/dev/input/event3", 1915 | "unix_device_number": { 1916 | "type": 99, 1917 | "major": 13, 1918 | "minor": 67, 1919 | "range": 1 1920 | }, 1921 | "unix_device_names": [ 1922 | "/dev/input/by-path/pci-0000:00:0a.0-event-kbd", 1923 | "/dev/input/event3" 1924 | ], 1925 | "hotplug": "none", 1926 | "hotplug_slot": 0, 1927 | "is": {}, 1928 | "driver": "virtio_input", 1929 | "driver_module": "virtio_input", 1930 | "drivers": [ 1931 | "virtio_input" 1932 | ], 1933 | "driver_modules": [ 1934 | "virtio_input" 1935 | ], 1936 | "module_alias": "virtio:d00000012v00001AF4" 1937 | }, 1938 | { 1939 | "slot": 0, 1940 | "base_class": { 1941 | "name": "Unclassified device", 1942 | "value": 0 1943 | }, 1944 | "sub_class": { 1945 | "name": "Unclassified device", 1946 | "value": 0 1947 | }, 1948 | "vendor": "Virtio", 1949 | "device": "", 1950 | "model": "Virtio Unclassified device", 1951 | "attached_to": 6, 1952 | "sysfs_id": "/devices/pci0000:00/0000:00:08.0/virtio5", 1953 | "sysfs_bus_id": "virtio5", 1954 | "sysfs_iommu_group_id": 0, 1955 | "hotplug": "none", 1956 | "hotplug_slot": 0, 1957 | "is": {}, 1958 | "driver": "9pnet_virtio", 1959 | "driver_module": "9pnet_virtio", 1960 | "drivers": [ 1961 | "9pnet_virtio" 1962 | ], 1963 | "driver_modules": [ 1964 | "9pnet_virtio" 1965 | ], 1966 | "module_alias": "virtio:d00000009v00001AF4" 1967 | }, 1968 | { 1969 | "slot": 0, 1970 | "base_class": { 1971 | "name": "Unclassified device", 1972 | "value": 0 1973 | }, 1974 | "sub_class": { 1975 | "name": "Unclassified device", 1976 | "value": 0 1977 | }, 1978 | "vendor": "Virtio", 1979 | "device": "", 1980 | "model": "Virtio Unclassified device", 1981 | "attached_to": 15, 1982 | "sysfs_id": "/devices/pci0000:00/0000:00:06.0/virtio3", 1983 | "sysfs_bus_id": "virtio3", 1984 | "sysfs_iommu_group_id": 0, 1985 | "hotplug": "none", 1986 | "hotplug_slot": 0, 1987 | "is": {}, 1988 | "driver": "9pnet_virtio", 1989 | "driver_module": "9pnet_virtio", 1990 | "drivers": [ 1991 | "9pnet_virtio" 1992 | ], 1993 | "driver_modules": [ 1994 | "9pnet_virtio" 1995 | ], 1996 | "module_alias": "virtio:d00000009v00001AF4" 1997 | }, 1998 | { 1999 | "slot": 0, 2000 | "base_class": { 2001 | "name": "Communication controller", 2002 | "value": 7 2003 | }, 2004 | "sub_class": { 2005 | "name": "Serial controller", 2006 | "value": 0 2007 | }, 2008 | "pci_interface": { 2009 | "name": "16550", 2010 | "value": 2 2011 | }, 2012 | "device": { 2013 | "name": "16550A", 2014 | "value": 0 2015 | }, 2016 | "model": "16550A", 2017 | "sysfs_iommu_group_id": 0, 2018 | "unix_device_name": "/dev/ttyS0", 2019 | "unix_device_names": [ 2020 | "/dev/ttyS0" 2021 | ], 2022 | "resources": [ 2023 | { 2024 | "type": "io", 2025 | "base": 1016, 2026 | "range": 0, 2027 | "enabled": true, 2028 | "access": "read_write" 2029 | }, 2030 | { 2031 | "type": "irq", 2032 | "base": 4, 2033 | "triggered": 0, 2034 | "enabled": true 2035 | } 2036 | ], 2037 | "hotplug": "none", 2038 | "hotplug_slot": 0, 2039 | "is": {} 2040 | } 2041 | ], 2042 | "usb_controller": [ 2043 | { 2044 | "bus_type": { 2045 | "name": "PCI", 2046 | "value": 4 2047 | }, 2048 | "slot": 1, 2049 | "base_class": { 2050 | "name": "Serial bus controller", 2051 | "value": 12 2052 | }, 2053 | "sub_class": { 2054 | "name": "USB Controller", 2055 | "value": 3 2056 | }, 2057 | "pci_interface": { 2058 | "name": "UHCI", 2059 | "value": 0 2060 | }, 2061 | "vendor": { 2062 | "name": "Intel Corporation", 2063 | "value": 32902 2064 | }, 2065 | "sub_vendor": { 2066 | "value": 6900 2067 | }, 2068 | "device": { 2069 | "value": 28704 2070 | }, 2071 | "sub_device": { 2072 | "value": 4352 2073 | }, 2074 | "revision": { 2075 | "value": 1 2076 | }, 2077 | "model": "Intel USB Controller", 2078 | "sysfs_id": "/devices/pci0000:00/0000:00:01.2", 2079 | "sysfs_bus_id": "0000:00:01.2", 2080 | "sysfs_iommu_group_id": 0, 2081 | "resources": [ 2082 | { 2083 | "type": "io", 2084 | "base": 49344, 2085 | "range": 32, 2086 | "enabled": true, 2087 | "access": "read_write" 2088 | }, 2089 | { 2090 | "type": "irq", 2091 | "base": 11, 2092 | "triggered": 0, 2093 | "enabled": true 2094 | } 2095 | ], 2096 | "detail": { 2097 | "function": 2, 2098 | "command": 263, 2099 | "header_type": 0, 2100 | "secondary_bus": 0, 2101 | "irq": 11, 2102 | "prog_if": 0 2103 | }, 2104 | "hotplug": "none", 2105 | "hotplug_slot": 0, 2106 | "is": {}, 2107 | "driver": "uhci_hcd", 2108 | "driver_module": "uhci_hcd", 2109 | "drivers": [ 2110 | "uhci_hcd" 2111 | ], 2112 | "driver_modules": [ 2113 | "uhci_hcd" 2114 | ], 2115 | "driver_info": { 2116 | "type": "module", 2117 | "db_entry_0": [ 2118 | "uhci-hcd" 2119 | ], 2120 | "active": true, 2121 | "modprobe": true, 2122 | "names": [ 2123 | "uhci-hcd" 2124 | ], 2125 | "module_args": [ 2126 | "" 2127 | ], 2128 | "conf": "" 2129 | }, 2130 | "module_alias": "pci:v00008086d00007020sv00001AF4sd00001100bc0Csc03i00" 2131 | } 2132 | ] 2133 | }, 2134 | "smbios": { 2135 | "bios": { 2136 | "handle": 0, 2137 | "vendor": "SeaBIOS", 2138 | "version": "rel-1.16.3-0-ga6ed6b701f0a-prebuilt.qemu.org", 2139 | "date": "04/01/2014", 2140 | "features": null, 2141 | "start_address": "0xe8000", 2142 | "rom_size": 65536 2143 | }, 2144 | "chassis": { 2145 | "handle": 768, 2146 | "manufacturer": "QEMU", 2147 | "version": "pc-i440fx-9.0", 2148 | "chassis_type": { 2149 | "name": "Other", 2150 | "value": 1 2151 | }, 2152 | "lock_present": false, 2153 | "bootup_state": { 2154 | "name": "Safe", 2155 | "value": 3 2156 | }, 2157 | "power_state": { 2158 | "name": "Safe", 2159 | "value": 3 2160 | }, 2161 | "thermal_state": { 2162 | "name": "Safe", 2163 | "value": 3 2164 | }, 2165 | "security_state": { 2166 | "name": "Unknown", 2167 | "value": 2 2168 | }, 2169 | "oem": "0x0" 2170 | }, 2171 | "memory_array": [ 2172 | { 2173 | "handle": 4096, 2174 | "location": { 2175 | "name": "Other", 2176 | "value": 1 2177 | }, 2178 | "usage": { 2179 | "name": "System memory", 2180 | "value": 3 2181 | }, 2182 | "ecc": { 2183 | "name": "Multi-bit", 2184 | "value": 6 2185 | }, 2186 | "max_size": 2097152, 2187 | "error_handle": 65534, 2188 | "slots": 1 2189 | } 2190 | ], 2191 | "memory_array_mapped_address": [ 2192 | { 2193 | "handle": 4864, 2194 | "array_handle": 4096, 2195 | "start_address": 0, 2196 | "end_address": 2147483648, 2197 | "part_width": 1 2198 | } 2199 | ], 2200 | "memory_device": [ 2201 | { 2202 | "handle": 4352, 2203 | "location": "DIMM 0", 2204 | "bank_location": "", 2205 | "manufacturer": "QEMU", 2206 | "part_number": "", 2207 | "array_handle": 4096, 2208 | "error_handle": 65534, 2209 | "width": 0, 2210 | "ecc_bits": 0, 2211 | "size": 2097152, 2212 | "form_factor": { 2213 | "name": "DIMM", 2214 | "value": 9 2215 | }, 2216 | "set": 0, 2217 | "memory_type": { 2218 | "name": "RAM", 2219 | "value": 7 2220 | }, 2221 | "memory_type_details": [ 2222 | "Other" 2223 | ], 2224 | "speed": 0 2225 | } 2226 | ], 2227 | "processor": [ 2228 | { 2229 | "handle": 1024, 2230 | "socket": "CPU 0", 2231 | "socket_type": { 2232 | "name": "Other", 2233 | "value": 1 2234 | }, 2235 | "socket_populated": true, 2236 | "manufacturer": "QEMU", 2237 | "version": "pc-i440fx-9.0", 2238 | "part": "", 2239 | "processor_type": { 2240 | "name": "CPU", 2241 | "value": 3 2242 | }, 2243 | "processor_family": { 2244 | "name": "Other", 2245 | "value": 254 2246 | }, 2247 | "processor_status": { 2248 | "name": "Enabled", 2249 | "value": 1 2250 | }, 2251 | "clock_ext": 0, 2252 | "clock_max": 2000, 2253 | "cache_handle_l1": 0, 2254 | "cache_handle_l2": 0, 2255 | "cache_handle_l3": 0 2256 | } 2257 | ], 2258 | "system": { 2259 | "handle": 256, 2260 | "manufacturer": "QEMU", 2261 | "product": "Standard PC (i440FX + PIIX, 1996)", 2262 | "version": "pc-i440fx-9.0", 2263 | "wake_up": { 2264 | "name": "Power Switch", 2265 | "value": 6 2266 | } 2267 | } 2268 | } 2269 | } -------------------------------------------------------------------------------- /lib/default.nix: -------------------------------------------------------------------------------- 1 | { lib }: 2 | let 3 | facterLib = import ./lib.nix lib; 4 | in 5 | facterLib // { tests = import ./lib.tests.nix facterLib; } 6 | -------------------------------------------------------------------------------- /lib/lib.nix: -------------------------------------------------------------------------------- 1 | lib: 2 | let 3 | 4 | inherit (lib) assertMsg; 5 | 6 | hasCpu = 7 | name: 8 | { 9 | hardware ? { }, 10 | ... 11 | }: 12 | let 13 | cpus = hardware.cpu or [ ]; 14 | in 15 | assert assertMsg (hardware != { }) "no hardware entries found in the report"; 16 | assert assertMsg (cpus != [ ]) "no cpu entries found in the report"; 17 | builtins.any ( 18 | { 19 | vendor_name ? null, 20 | ... 21 | }: 22 | assert assertMsg (vendor_name != null) "detail.vendor_name not found in cpu entry"; 23 | vendor_name == name 24 | ) cpus; 25 | 26 | collectDrivers = list: lib.foldl' (lst: value: lst ++ value.driver_modules or [ ]) [ ] list; 27 | stringSet = list: builtins.attrNames (builtins.groupBy lib.id list); 28 | in 29 | { 30 | inherit hasCpu collectDrivers stringSet; 31 | hasAmdCpu = hasCpu "AuthenticAMD"; 32 | hasIntelCpu = hasCpu "GenuineIntel"; 33 | } 34 | -------------------------------------------------------------------------------- /lib/lib.tests.nix: -------------------------------------------------------------------------------- 1 | facterLib: with facterLib; { 2 | hasCpu = { 3 | testErrorWithoutHardwareSection = { 4 | expr = (hasCpu "foo") { }; 5 | expectedError.msg = "no hardware entries found in the report"; 6 | }; 7 | testErrorWithoutCpuSection = { 8 | expr = (hasCpu "foo") { hardware.cpu = [ ]; }; 9 | expectedError.msg = "no cpu entries found in the report"; 10 | }; 11 | testErrorWithoutVendorName = { 12 | expr = (hasCpu "foo") { hardware.cpu = [ { } ]; }; 13 | expectedError.msg = "detail.vendor_name not found in cpu entry"; 14 | }; 15 | testMatch = { 16 | expr = map (hasCpu "CoolProcessor") [ 17 | { hardware.cpu = [ { vendor_name = "foo"; } ]; } 18 | { hardware.cpu = [ { vendor_name = "CoolProcessor"; } ]; } 19 | ]; 20 | expected = [ 21 | false 22 | true 23 | ]; 24 | }; 25 | }; 26 | 27 | testHasAmdCpu = { 28 | expr = map hasAmdCpu [ 29 | { hardware.cpu = [ { vendor_name = "foo"; } ]; } 30 | { hardware.cpu = [ { vendor_name = "AuthenticAMD"; } ]; } 31 | ]; 32 | expected = [ 33 | false 34 | true 35 | ]; 36 | }; 37 | 38 | testHasIntelCpu = { 39 | expr = map hasIntelCpu [ 40 | { hardware.cpu = [ { vendor_name = "foo"; } ]; } 41 | { hardware.cpu = [ { vendor_name = "GenuineIntel"; } ]; } 42 | ]; 43 | expected = [ 44 | false 45 | true 46 | ]; 47 | }; 48 | } 49 | -------------------------------------------------------------------------------- /lib/pci/devices.nix: -------------------------------------------------------------------------------- 1 | { 2 | virtio_scsi = { 3 | vendorId = 6900; # 0x1af4 4 | deviceIds = [ 5 | 4100 # 0x1004 6 | 4168 # 0x1048 7 | ]; 8 | }; 9 | 10 | broadcom_sta = { 11 | vendorId = 5348; # 0x14e4 12 | deviceIds = [ 13 | 17169 # 0x4311 14 | 17170 # 0x4312 15 | 17171 # 0x4313 16 | 17173 # 0x4315 17 | 17191 # 0x4327 18 | 17192 # 0x4328 19 | 17193 # 0x4329 20 | 17194 # 0x432a 21 | 17195 # 0x432b 22 | 17196 # 0x432c 23 | 17197 # 0x432d 24 | 17235 # 0x4353 25 | 17239 # 0x4357 26 | 17240 # 0x4358 27 | 17241 # 0x4359 28 | 17201 # 0x4331 29 | 17312 # 0x43a0 30 | 17329 # 0x43b1 31 | ]; 32 | }; 33 | broadcom_full_mac = { 34 | vendorId = 5348; # 0x14e4 35 | deviceIds = [ 36 | 17315 # 0x43a3 37 | 17375 # 0x43df 38 | 17388 # 0x43ec 39 | 17363 # 0x43d3 40 | 17369 # 0x43d9 41 | 17385 # 0x43e9 42 | 17338 # 0x43ba 43 | 17339 # 0x43bb 44 | 17340 # 0x43bc 45 | 43602 # 0xaa52 46 | 17354 # 0x43ca 47 | 17355 # 0x43cb 48 | 17356 # 0x43cc 49 | 17347 # 0x43c3 50 | 17348 # 0x43c4 51 | 17349 # 0x43c5 52 | ]; 53 | }; 54 | intel_2200BG = { 55 | vendorId = 32902; # 0x8086 56 | deviceIds = [ 57 | 4163 # 0x1043 58 | 4175 # 0x104f 59 | 16928 # 0x4220 60 | 16929 # 0x4221 61 | 16931 # 0x4223 62 | 16932 # 0x4224 63 | ]; 64 | }; 65 | intel_3945ABG = { 66 | vendorId = 32902; # 0x8086 67 | deviceIds = [ 68 | 16937 # 0x4229 69 | 16938 # 0x4230 70 | 16930 # 0x4222 71 | 16935 # 0x4227 72 | ]; 73 | }; 74 | } 75 | -------------------------------------------------------------------------------- /mkdocs.yml: -------------------------------------------------------------------------------- 1 | # Project info 2 | site_name: NixOS Facter Modules 3 | site_url: https://numtide.github.io/nixos-facter-modules 4 | site_description: >- 5 | NixOS Modules for use with NixOS Facter 6 | 7 | # Repository 8 | repo_name: numtide/nixos-facter-modules 9 | repo_url: https://github.com/numtide/nixos-facter-modules 10 | 11 | # Copyright 12 | copyright: >- 13 | Content on this site is licensed under a Creative Commons 14 | Attribution-ShareAlike 4.0 International license. 15 | 16 | validation: 17 | omitted_files: warn 18 | absolute_links: warn 19 | unrecognized_links: warn 20 | 21 | # Configuration 22 | 23 | docs_dir: docs/content 24 | 25 | nav: 26 | 27 | theme: 28 | name: material 29 | custom_dir: docs/theme 30 | 31 | logo: assets/images/logo.png 32 | favicon: assets/images/logo.png 33 | 34 | features: 35 | - content.code.annotate 36 | - content.code.copy 37 | - navigation.footer 38 | - navigation.indexes 39 | - navigation.path 40 | - navigation.sections 41 | - navigation.tabs 42 | - navigation.tracking 43 | - search.highlight 44 | - search.share 45 | - search.suggest 46 | 47 | font: 48 | text: Inter 49 | mono: Noto Sans Mono 50 | palette: 51 | # Palette toggle for automatic mode 52 | - media: "(prefers-color-scheme)" 53 | toggle: 54 | icon: material/brightness-auto 55 | name: Switch to light mode 56 | 57 | # Palette toggle for light mode 58 | - media: "(prefers-color-scheme: light)" 59 | scheme: default 60 | toggle: 61 | icon: material/brightness-7 62 | name: Switch to dark mode 63 | 64 | # Palette toggle for dark mode 65 | - media: "(prefers-color-scheme: dark)" 66 | scheme: slate 67 | toggle: 68 | icon: material/brightness-4 69 | name: Switch to system preference 70 | 71 | extra: 72 | version: 73 | provider: mike 74 | social: 75 | - icon: fontawesome/brands/github 76 | link: https://github.com/numtide 77 | - icon: fontawesome/brands/x-twitter 78 | link: https://x.com/numtide 79 | - icon: fontawesome/brands/mastodon 80 | link: https://fosstodon.org/@numtide 81 | 82 | extra_css: 83 | - stylesheets/extra.css 84 | 85 | markdown_extensions: 86 | - tables 87 | - admonition 88 | - attr_list 89 | - footnotes 90 | - md_in_html 91 | - def_list 92 | - meta 93 | - pymdownx.emoji: 94 | emoji_index: !!python/name:material.extensions.emoji.twemoji 95 | emoji_generator: !!python/name:material.extensions.emoji.to_svg 96 | - pymdownx.tasklist: 97 | custom_checkbox: true 98 | - pymdownx.superfences 99 | - pymdownx.tabbed: 100 | alternate_style: true 101 | - pymdownx.details 102 | - pymdownx.highlight: 103 | use_pygments: true 104 | linenums: true 105 | anchor_linenums: true 106 | - pymdownx.inlinehilite 107 | - pymdownx.snippets 108 | - pymdownx.keys 109 | 110 | plugins: 111 | - search 112 | - mike 113 | -------------------------------------------------------------------------------- /modules/nixos/bluetooth.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | { 3 | options.facter.detected.bluetooth.enable = 4 | lib.mkEnableOption "Enable the Facter bluetooth module" 5 | // { 6 | default = builtins.length (config.facter.report.hardware.bluetooth or [ ]) > 0; 7 | defaultText = "hardware dependent"; 8 | }; 9 | 10 | config.hardware.bluetooth.enable = lib.mkIf config.facter.detected.bluetooth.enable ( 11 | lib.mkDefault true 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /modules/nixos/debug.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | config, 5 | extendModules, 6 | ... 7 | }: 8 | { 9 | 10 | options = { 11 | 12 | system.build = { 13 | noFacter = lib.mkOption { 14 | type = lib.types.unspecified; 15 | description = "A version of the system closure with facter disabled"; 16 | }; 17 | }; 18 | 19 | facter.debug = { 20 | nvd = lib.mkOption { 21 | type = lib.types.package; 22 | description = '' 23 | A shell application which will produce an nvd diff of the system closure with and without facter enabled. 24 | ''; 25 | }; 26 | nix-diff = lib.mkOption { 27 | type = lib.types.package; 28 | description = '' 29 | A shell application which will produce a nix-diff of the system closure with and without facter enabled. 30 | ''; 31 | }; 32 | }; 33 | 34 | }; 35 | 36 | config.system.build = { 37 | noFacter = extendModules { 38 | modules = [ 39 | { 40 | # we 'disable' facter by overriding the report and setting it to empty with one caveat: hostPlatform 41 | config.facter.report = lib.mkForce { 42 | system = config.nixpkgs.hostPlatform; 43 | }; 44 | } 45 | ]; 46 | }; 47 | }; 48 | 49 | config.facter.debug = { 50 | 51 | nvd = pkgs.writeShellApplication { 52 | name = "facter-diff"; 53 | runtimeInputs = [ pkgs.nvd ]; 54 | text = '' 55 | nvd diff \ 56 | ${config.system.build.noFacter.config.system.build.toplevel} \ 57 | ${config.system.build.toplevel} \ 58 | "$@" 59 | ''; 60 | }; 61 | 62 | nix-diff = pkgs.writeShellApplication { 63 | name = "facter-diff"; 64 | runtimeInputs = [ pkgs.nix-diff ]; 65 | text = '' 66 | nix-diff \ 67 | ${config.system.build.noFacter.config.system.build.toplevel} \ 68 | ${config.system.build.toplevel} \ 69 | "$@" 70 | ''; 71 | }; 72 | 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /modules/nixos/disk.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | let 3 | facterLib = import ../../lib/lib.nix lib; 4 | 5 | inherit (config.facter) report; 6 | in 7 | { 8 | options.facter.detected.boot.disk.kernelModules = lib.mkOption { 9 | type = lib.types.listOf lib.types.str; 10 | default = facterLib.stringSet ( 11 | facterLib.collectDrivers ( 12 | # A disk might be attached. 13 | (report.hardware.firewire_controller or [ ]) 14 | # definitely important 15 | ++ (report.hardware.disk or [ ]) 16 | ++ (report.hardware.storage_controller or [ ]) 17 | ) 18 | ); 19 | defaultText = "hardware dependent"; 20 | description = '' 21 | List of kernel modules that are needed to access the disk. 22 | ''; 23 | }; 24 | 25 | config = { 26 | boot.initrd.availableKernelModules = config.facter.detected.boot.disk.kernelModules; 27 | }; 28 | } 29 | -------------------------------------------------------------------------------- /modules/nixos/facter.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | config, 4 | ... 5 | }: 6 | { 7 | imports = [ 8 | ./bluetooth.nix 9 | ./disk.nix 10 | ./debug.nix 11 | ./fingerprint 12 | ./firmware.nix 13 | ./graphics 14 | ./keyboard.nix 15 | ./networking 16 | ./system.nix 17 | ./virtualisation.nix 18 | ]; 19 | 20 | options.facter = with lib; { 21 | report = mkOption { 22 | type = types.raw; 23 | default = 24 | if config.facter.reportPath == null then 25 | { } 26 | else 27 | builtins.fromJSON (builtins.readFile config.facter.reportPath); 28 | defaultText = "A JSON import from config.facter.reportPath (if not null), {} otherwise."; 29 | description = "An import for the reportPath."; 30 | }; 31 | 32 | reportPath = mkOption { 33 | type = types.nullOr types.path; 34 | default = null; 35 | description = "Path to a report generated by nixos-facter."; 36 | }; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /modules/nixos/fingerprint/default.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | let 3 | devices = builtins.fromJSON (builtins.readFile ./devices.json); 4 | default = { 5 | value = 0; 6 | }; 7 | 8 | toZeroPaddedHex = 9 | n: 10 | let 11 | hex = lib.toHexString n; 12 | len = builtins.stringLength hex; 13 | in 14 | if len == 1 then 15 | "000${hex}" 16 | else if len == 2 then 17 | "00${hex}" 18 | else if len == 3 then 19 | "0${hex}" 20 | else 21 | hex; 22 | 23 | isSupported = lib.any ( 24 | { 25 | vendor ? default, 26 | device ? default, 27 | bus_type ? { 28 | name = ""; 29 | }, 30 | ... 31 | }: 32 | bus_type.name == "USB" 33 | && devices ? "${toZeroPaddedHex vendor.value}:${toZeroPaddedHex device.value}" 34 | ); 35 | in 36 | { 37 | options.facter.detected.fingerprint.enable = lib.mkEnableOption "Fingerprint devices" // { 38 | default = 39 | isSupported (config.facter.report.hardware.unknown or [ ]) 40 | || isSupported (config.facter.report.hardware.fingerprint or [ ]) 41 | || isSupported (config.facter.report.hardware.usb or [ ]); 42 | defaultText = "hardware dependent"; 43 | }; 44 | 45 | config.services.fprintd.enable = lib.mkIf config.facter.detected.fingerprint.enable ( 46 | lib.mkDefault true 47 | ); 48 | } 49 | -------------------------------------------------------------------------------- /modules/nixos/fingerprint/devices.json: -------------------------------------------------------------------------------- 1 | { 2 | "045E:00BB": true, 3 | "045E:00BC": true, 4 | "045E:00BD": true, 5 | "045E:00CA": true, 6 | "0483:2015": true, 7 | "0483:2016": true, 8 | "0483:2017": true, 9 | "04F3:0903": true, 10 | "04F3:0907": true, 11 | "04F3:0C01": true, 12 | "04F3:0C02": true, 13 | "04F3:0C03": true, 14 | "04F3:0C04": true, 15 | "04F3:0C05": true, 16 | "04F3:0C06": true, 17 | "04F3:0C07": true, 18 | "04F3:0C08": true, 19 | "04F3:0C09": true, 20 | "04F3:0C0A": true, 21 | "04F3:0C0B": true, 22 | "04F3:0C0C": true, 23 | "04F3:0C0D": true, 24 | "04F3:0C0E": true, 25 | "04F3:0C0F": true, 26 | "04F3:0C10": true, 27 | "04F3:0C11": true, 28 | "04F3:0C12": true, 29 | "04F3:0C13": true, 30 | "04F3:0C14": true, 31 | "04F3:0C15": true, 32 | "04F3:0C16": true, 33 | "04F3:0C17": true, 34 | "04F3:0C18": true, 35 | "04F3:0C19": true, 36 | "04F3:0C1A": true, 37 | "04F3:0C1B": true, 38 | "04F3:0C1C": true, 39 | "04F3:0C1D": true, 40 | "04F3:0C1E": true, 41 | "04F3:0C1F": true, 42 | "04F3:0C20": true, 43 | "04F3:0C21": true, 44 | "04F3:0C22": true, 45 | "04F3:0C23": true, 46 | "04F3:0C24": true, 47 | "04F3:0C25": true, 48 | "04F3:0C26": true, 49 | "04F3:0C27": true, 50 | "04F3:0C28": true, 51 | "04F3:0C29": true, 52 | "04F3:0C2A": true, 53 | "04F3:0C2B": true, 54 | "04F3:0C2C": true, 55 | "04F3:0C2D": true, 56 | "04F3:0C2E": true, 57 | "04F3:0C2F": true, 58 | "04F3:0C30": true, 59 | "04F3:0C31": true, 60 | "04F3:0C32": true, 61 | "04F3:0C33": true, 62 | "04F3:0C3D": true, 63 | "04F3:0C42": true, 64 | "04F3:0C4B": true, 65 | "04F3:0C4D": true, 66 | "04F3:0C4F": true, 67 | "04F3:0C58": true, 68 | "04F3:0C63": true, 69 | "04F3:0C6E": true, 70 | "04F3:0C7D": true, 71 | "04F3:0C7E": true, 72 | "04F3:0C82": true, 73 | "04F3:0C88": true, 74 | "04F3:0C8C": true, 75 | "04F3:0C8D": true, 76 | "04F3:0C99": true, 77 | "05BA:0007": true, 78 | "05BA:0008": true, 79 | "05BA:000A": true, 80 | "061A:0110": true, 81 | "06CB:00BD": true, 82 | "06CB:00C2": true, 83 | "06CB:00DF": true, 84 | "06CB:00F0": true, 85 | "06CB:00F9": true, 86 | "06CB:00FC": true, 87 | "06CB:0100": true, 88 | "06CB:0103": true, 89 | "06CB:0104": true, 90 | "06CB:0123": true, 91 | "06CB:0126": true, 92 | "06CB:0129": true, 93 | "06CB:015F": true, 94 | "06CB:0168": true, 95 | "08FF:1600": true, 96 | "08FF:1660": true, 97 | "08FF:1680": true, 98 | "08FF:1681": true, 99 | "08FF:1682": true, 100 | "08FF:1683": true, 101 | "08FF:1684": true, 102 | "08FF:1685": true, 103 | "08FF:1686": true, 104 | "08FF:1687": true, 105 | "08FF:1688": true, 106 | "08FF:1689": true, 107 | "08FF:168A": true, 108 | "08FF:168B": true, 109 | "08FF:168C": true, 110 | "08FF:168D": true, 111 | "08FF:168E": true, 112 | "08FF:168F": true, 113 | "08FF:2500": true, 114 | "08FF:2550": true, 115 | "08FF:2580": true, 116 | "08FF:2660": true, 117 | "08FF:2680": true, 118 | "08FF:2681": true, 119 | "08FF:2682": true, 120 | "08FF:2683": true, 121 | "08FF:2684": true, 122 | "08FF:2685": true, 123 | "08FF:2686": true, 124 | "08FF:2687": true, 125 | "08FF:2688": true, 126 | "08FF:2689": true, 127 | "08FF:268A": true, 128 | "08FF:268B": true, 129 | "08FF:268C": true, 130 | "08FF:268D": true, 131 | "08FF:268E": true, 132 | "08FF:268F": true, 133 | "08FF:2691": true, 134 | "08FF:2810": true, 135 | "08FF:5501": true, 136 | "08FF:5731": true, 137 | "10A5:A305": true, 138 | "10A5:D205": true, 139 | "10A5:D805": true, 140 | "10A5:DA04": true, 141 | "10A5:FFE0": true, 142 | "138A:0001": true, 143 | "138A:0005": true, 144 | "138A:0008": true, 145 | "138A:0010": true, 146 | "138A:0011": true, 147 | "138A:0015": true, 148 | "138A:0017": true, 149 | "138A:0018": true, 150 | "138A:0050": true, 151 | "138A:0091": true, 152 | "147E:1000": true, 153 | "147E:1001": true, 154 | "147E:2016": true, 155 | "147E:2020": true, 156 | "147E:3001": true, 157 | "1C7A:0570": true, 158 | "1C7A:0571": true, 159 | "1C7A:0603": true, 160 | "27C6:5840": true, 161 | "27C6:6014": true, 162 | "27C6:6092": true, 163 | "27C6:6094": true, 164 | "27C6:609C": true, 165 | "27C6:60A2": true, 166 | "27C6:60A4": true, 167 | "27C6:60BC": true, 168 | "27C6:6304": true, 169 | "27C6:631C": true, 170 | "27C6:633C": true, 171 | "27C6:634C": true, 172 | "27C6:6384": true, 173 | "27C6:639C": true, 174 | "27C6:63AC": true, 175 | "27C6:63BC": true, 176 | "27C6:63CC": true, 177 | "27C6:6496": true, 178 | "27C6:6584": true, 179 | "27C6:658C": true, 180 | "27C6:6592": true, 181 | "27C6:6594": true, 182 | "27C6:659A": true, 183 | "27C6:659C": true, 184 | "27C6:6A94": true, 185 | "298D:1010": true, 186 | "04F3:241F": true, 187 | "04F3:3057": true, 188 | "04F3:3087": true, 189 | "04F3:309F": true, 190 | "04F3:30B2": true, 191 | "04F3:30C6": true, 192 | "04F3:3148": true, 193 | "04F3:3134": true 194 | } 195 | -------------------------------------------------------------------------------- /modules/nixos/firmware.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | let 3 | facterLib = import ../../lib/lib.nix lib; 4 | 5 | inherit (config.facter) report; 6 | isBaremetal = config.facter.detected.virtualisation.none.enable; 7 | hasAmdCpu = facterLib.hasAmdCpu report; 8 | hasIntelCpu = facterLib.hasIntelCpu report; 9 | in 10 | { 11 | imports = [ ./virtualisation.nix ]; 12 | config = lib.mkIf isBaremetal { 13 | # none (e.g. bare-metal) 14 | # provide firmware for devices that might not have been detected by nixos-facter 15 | hardware.enableRedistributableFirmware = lib.mkDefault true; 16 | 17 | # update microcode 18 | hardware.cpu.amd.updateMicrocode = lib.mkIf hasAmdCpu ( 19 | lib.mkDefault config.hardware.enableRedistributableFirmware 20 | ); 21 | hardware.cpu.intel.updateMicrocode = lib.mkIf hasIntelCpu ( 22 | lib.mkDefault config.hardware.enableRedistributableFirmware 23 | ); 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /modules/nixos/graphics/amd.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | let 3 | facterLib = import ../../../lib/lib.nix lib; 4 | cfg = config.facter.detected.graphics.amd; 5 | in 6 | { 7 | options.facter.detected.graphics = { 8 | amd.enable = lib.mkEnableOption "Enable the AMD Graphics module" // { 9 | default = builtins.elem "amdgpu" ( 10 | facterLib.collectDrivers (config.facter.report.hardware.graphics_card or [ ]) 11 | ); 12 | defaultText = "hardware dependent"; 13 | }; 14 | }; 15 | config = lib.mkIf cfg.enable { 16 | services.xserver.videoDrivers = [ "modesettings" ]; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /modules/nixos/graphics/default.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | let 3 | facterLib = import ../../../lib/lib.nix lib; 4 | cfg = config.facter.detected.graphics; 5 | in 6 | { 7 | imports = [ 8 | ./amd.nix 9 | ]; 10 | options.facter.detected = { 11 | graphics.enable = lib.mkEnableOption "Enable the Graphics module" // { 12 | default = builtins.length (config.facter.report.hardware.monitor or [ ]) > 0; 13 | defaultText = "hardware dependent"; 14 | }; 15 | boot.graphics.kernelModules = lib.mkOption { 16 | type = lib.types.listOf lib.types.str; 17 | # We currently don't auto import nouveau, in case the user might want to use the proprietary nvidia driver, 18 | # We might want to change this in future, if we have a better idea, how to handle this. 19 | default = lib.remove "nouveau" ( 20 | facterLib.stringSet (facterLib.collectDrivers (config.facter.report.hardware.graphics_card or [ ])) 21 | ); 22 | defaultText = "hardware dependent"; 23 | description = '' 24 | List of kernel modules to load at boot for the graphics card. 25 | ''; 26 | }; 27 | }; 28 | 29 | config = lib.mkIf cfg.enable ( 30 | { 31 | boot.initrd.kernelModules = config.facter.detected.boot.graphics.kernelModules; 32 | } 33 | // ( 34 | if lib.versionOlder lib.version "24.11pre" then 35 | { hardware.opengl.enable = lib.mkDefault true; } 36 | else 37 | { hardware.graphics.enable = lib.mkDefault true; } 38 | ) 39 | ); 40 | } 41 | -------------------------------------------------------------------------------- /modules/nixos/keyboard.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | let 3 | facterLib = import ../../lib/lib.nix lib; 4 | 5 | inherit (config.facter) report; 6 | in 7 | { 8 | options.facter.detected.boot.keyboard.kernelModules = lib.mkOption { 9 | type = lib.types.listOf lib.types.str; 10 | default = facterLib.stringSet (facterLib.collectDrivers (report.hardware.usb_controller or [ ])); 11 | defaultText = "hardware dependent"; 12 | example = [ "usbhid" ]; 13 | description = '' 14 | List of kernel modules to include in the initrd to support the keyboard. 15 | ''; 16 | }; 17 | 18 | config = { 19 | boot.initrd.availableKernelModules = config.facter.detected.boot.keyboard.kernelModules; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /modules/nixos/networking/broadcom.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | let 3 | inherit (config.facter) report; 4 | cfg = config.facter.detected.networking.broadcom; 5 | in 6 | { 7 | options.facter.detected.networking.broadcom = with lib; { 8 | full_mac.enable = mkEnableOption "Enable the Facter Broadcom Full MAC module" // { 9 | 10 | default = lib.any ( 11 | { 12 | vendor ? { }, 13 | device ? { }, 14 | ... 15 | }: 16 | # vendor (0x14e4) Broadcom Inc. and subsidiaries 17 | (vendor.value or 0) == 5348 18 | && (lib.elem (device.value or 0) [ 19 | 17315 # 0x43a3 20 | 17375 # 0x43df 21 | 17388 # 0x43ec 22 | 17363 # 0x43d3 23 | 17369 # 0x43d9 24 | 17385 # 0x43e9 25 | 17338 # 0x43ba 26 | 17339 # 0x43bb 27 | 17340 # 0x43bc 28 | 43602 # 0xaa52 29 | 17354 # 0x43ca 30 | 17355 # 0x43cb 31 | 17356 # 0x43cc 32 | 17347 # 0x43c3 33 | 17348 # 0x43c4 34 | 17349 # 0x43c5 35 | ]) 36 | ) (report.hardware.network_controller or [ ]); 37 | 38 | defaultText = "hardware dependent"; 39 | }; 40 | sta.enable = mkEnableOption "Enable the Facter Broadcom STA module" // { 41 | 42 | default = lib.any ( 43 | { 44 | vendor ? { }, 45 | device ? { }, 46 | ... 47 | }: 48 | # vendor (0x14e4) Broadcom Inc. and subsidiaries 49 | (vendor.value or 0) == 5348 50 | && (lib.elem (device.value or 0) [ 51 | 17169 # 0x4311 52 | 17170 # 0x4312 53 | 17171 # 0x4313 54 | 17173 # 0x4315 55 | 17191 # 0x4327 56 | 17192 # 0x4328 57 | 17193 # 0x4329 58 | 17194 # 0x432a 59 | 17195 # 0x432b 60 | 17196 # 0x432c 61 | 17197 # 0x432d 62 | 17235 # 0x4353 63 | 17239 # 0x4357 64 | 17240 # 0x4358 65 | 17241 # 0x4359 66 | 17201 # 0x4331 67 | 17312 # 0x43a0 68 | 17329 # 0x43b1 69 | ]) 70 | ) (report.hardware.network_controller or [ ]); 71 | 72 | defaultText = "hardware dependent"; 73 | }; 74 | }; 75 | 76 | config = { 77 | hardware.enableRedistributableFirmware = lib.mkIf cfg.full_mac.enable (lib.mkDefault true); 78 | 79 | boot = lib.mkIf cfg.sta.enable { 80 | kernelModules = [ "wl" ]; 81 | extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ]; 82 | }; 83 | }; 84 | 85 | } 86 | -------------------------------------------------------------------------------- /modules/nixos/networking/default.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: 2 | { 3 | imports = [ 4 | ./broadcom.nix 5 | ./initrd.nix 6 | ./intel.nix 7 | ]; 8 | 9 | options.facter.detected.dhcp.enable = lib.mkEnableOption "Facter dhcp module" // { 10 | default = builtins.length config.facter.report.hardware.network_interface or [ ] > 0; 11 | defaultText = "hardware dependent"; 12 | }; 13 | config = lib.mkIf config.facter.detected.dhcp.enable { 14 | networking.useDHCP = lib.mkDefault true; 15 | networking.useNetworkd = lib.mkDefault true; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /modules/nixos/networking/initrd.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | let 3 | facterLib = import ../../../lib/lib.nix lib; 4 | 5 | inherit (config.facter) report; 6 | in 7 | { 8 | options.facter.detected.boot.initrd.networking.kernelModules = lib.mkOption { 9 | type = lib.types.listOf lib.types.str; 10 | default = facterLib.stringSet ( 11 | facterLib.collectDrivers (report.hardware.network_controller or [ ]) 12 | ); 13 | defaultText = "hardware dependent"; 14 | description = '' 15 | List of kernel modules to include in the initrd to support networking. 16 | ''; 17 | }; 18 | 19 | config = lib.mkIf config.boot.initrd.network.enable { 20 | boot.initrd.kernelModules = config.facter.detected.boot.initrd.networking.kernelModules; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /modules/nixos/networking/intel.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: 2 | let 3 | inherit (config.facter) report; 4 | cfg = config.facter.detected.networking.intel; 5 | in 6 | { 7 | options.facter.detected.networking.intel = with lib; { 8 | _2200BG.enable = mkEnableOption "Enable the Facter Intel 2200BG module" // { 9 | 10 | default = lib.any ( 11 | { 12 | vendor ? { }, 13 | device ? { }, 14 | ... 15 | }: 16 | # vendor (0x8086) Intel Corp. 17 | (vendor.value or 0) == 32902 18 | && (lib.elem (device.value or 0) [ 19 | 4163 # 0x1043 20 | 4175 # 0x104f 21 | 16928 # 0x4220 22 | 16929 # 0x4221 23 | 16931 # 0x4223 24 | 16932 # 0x4224 25 | ]) 26 | ) (report.hardware.network_controller or [ ]); 27 | 28 | defaultText = "hardware dependent"; 29 | }; 30 | _3945ABG.enable = mkEnableOption "Enable the Facter Intel 3945ABG module" // { 31 | 32 | default = lib.any ( 33 | { 34 | vendor ? { }, 35 | device ? { }, 36 | ... 37 | }: 38 | # vendor (0x8086) Intel Corp. 39 | (vendor.value or 0) == 32902 40 | && (lib.elem (device.value or 0) [ 41 | 16937 # 0x4229 42 | 16938 # 0x4230 43 | 16930 # 0x4222 44 | 16935 # 0x4227 45 | ]) 46 | ) (report.hardware.network_controller or [ ]); 47 | 48 | defaultText = "hardware dependent"; 49 | }; 50 | }; 51 | 52 | config = { 53 | networking.enableIntel2200BGFirmware = lib.mkIf cfg._2200BG.enable (lib.mkDefault true); 54 | hardware.enableRedistributableFirmware = lib.mkIf cfg._3945ABG.enable (lib.mkDefault true); 55 | }; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /modules/nixos/system.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | options, 4 | lib, 5 | ... 6 | }: 7 | { 8 | nixpkgs = lib.mkIf (!options.nixpkgs.pkgs.isDefined) { 9 | hostPlatform = lib.mkIf (config.facter.report.system or null != null) ( 10 | lib.mkDefault config.facter.report.system 11 | ); 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /modules/nixos/virtualisation.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | config, 4 | options, 5 | ... 6 | }: 7 | let 8 | inherit (config.facter) report; 9 | cfg = config.facter.detected.virtualisation; 10 | in 11 | { 12 | options.facter.detected.virtualisation = { 13 | virtio_scsi.enable = lib.mkEnableOption "Enable the Facter Virtualisation Virtio SCSI module" // { 14 | default = lib.any ( 15 | { vendor, device, ... }: 16 | # vendor (0x1af4) Red Hat, Inc. 17 | (vendor.value or 0) == 6900 18 | && 19 | # device (0x1004, 0x1048) Virtio SCSI 20 | (lib.elem (device.value or 0) [ 21 | 4100 22 | 4168 23 | ]) 24 | ) (report.hardware.scsi or [ ]); 25 | defaultText = "hardware dependent"; 26 | }; 27 | oracle.enable = lib.mkEnableOption "Enable the Facter Virtualisation Oracle module" // { 28 | default = report.virtualisation or null == "oracle"; 29 | defaultText = "environment dependent"; 30 | }; 31 | parallels.enable = lib.mkEnableOption "Enable the Facter Virtualisation Parallels module" // { 32 | default = report.virtualisation or null == "parallels"; 33 | defaultText = "environment dependent"; 34 | }; 35 | qemu.enable = lib.mkEnableOption "Enable the Facter Virtualisation Qemu module" // { 36 | default = builtins.elem (report.virtualisation or null) [ 37 | "qemu" 38 | "kvm" 39 | "bochs" 40 | ]; 41 | defaultText = "environment dependent"; 42 | }; 43 | hyperv.enable = lib.mkEnableOption "Enable the Facter Virtualisation Hyper-V module" // { 44 | default = report.virtualisation or null == "microsoft"; 45 | defaultText = "environment dependent"; 46 | }; 47 | # no virtualisation detected 48 | none.enable = lib.mkEnableOption "Enable the Facter Virtualisation None module" // { 49 | default = report.virtualisation or null == "none"; 50 | defaultText = "environment dependent"; 51 | }; 52 | }; 53 | 54 | config = { 55 | 56 | # KVM support 57 | boot.kernelModules = 58 | let 59 | hasCPUFeature = 60 | feature: lib.any ({ features, ... }: lib.elem feature features) (report.hardware.cpu or [ ]); 61 | in 62 | lib.mkMerge [ 63 | (lib.mkIf (hasCPUFeature "vmx") [ "kvm-intel" ]) 64 | (lib.mkIf (hasCPUFeature "svm") [ "kvm-amd" ]) 65 | ]; 66 | 67 | # virtio & qemu 68 | boot.initrd = { 69 | kernelModules = lib.optionals cfg.qemu.enable [ 70 | "virtio_balloon" 71 | "virtio_console" 72 | "virtio_rng" 73 | "virtio_gpu" 74 | ]; 75 | 76 | availableKernelModules = lib.mkMerge [ 77 | (lib.mkIf cfg.qemu.enable [ 78 | "virtio_net" 79 | "virtio_pci" 80 | "virtio_mmio" 81 | "virtio_blk" 82 | "9p" 83 | "9pnet_virtio" 84 | ]) 85 | (lib.mkIf cfg.virtio_scsi.enable [ 86 | "virtio_scsi" 87 | ]) 88 | ]; 89 | }; 90 | 91 | virtualisation = { 92 | # oracle 93 | virtualbox.guest.enable = lib.mkIf cfg.oracle.enable (lib.mkDefault true); 94 | # hyper-v 95 | hypervGuest.enable = lib.mkIf cfg.hyperv.enable (lib.mkDefault true); 96 | }; 97 | 98 | # parallels 99 | hardware.parallels.enable = lib.mkIf cfg.parallels.enable (lib.mkDefault true); 100 | nixpkgs.config = lib.mkIf (!options.nixpkgs.pkgs.isDefined && cfg.parallels.enable) { 101 | allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "prl-tools" ]; 102 | }; 103 | }; 104 | } 105 | -------------------------------------------------------------------------------- /private.narHash: -------------------------------------------------------------------------------- 1 | sha256-6tFlF8x+M46Ub7IiBb/DsPoThzsyFvbnYF+0iq8mUvo= -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "extends": ["config:recommended"] 4 | } 5 | --------------------------------------------------------------------------------
{{ config.site_description }}