From 9519a44070dfb6d6b0e24f86b66f87afb4f972cd Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 1 Nov 2025 02:44:24 +0800 Subject: [PATCH 01/21] fix(nix): include sd image module by default --- ops/nix/manifest/manifest.nix | 3 +++ ops/nix/manifest/modules/nixos/sd-image.nix | 14 ++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/ops/nix/manifest/manifest.nix b/ops/nix/manifest/manifest.nix index b04e3df7..cc57b964 100644 --- a/ops/nix/manifest/manifest.nix +++ b/ops/nix/manifest/manifest.nix @@ -9,6 +9,9 @@ in addSSL = true; }; nodes.nixos = { + nephalem = { + arch = "x86_64"; + }; veil = { arch = "aarch64"; createImage = true; diff --git a/ops/nix/manifest/modules/nixos/sd-image.nix b/ops/nix/manifest/modules/nixos/sd-image.nix index 474c1dc9..c5d603f1 100644 --- a/ops/nix/manifest/modules/nixos/sd-image.nix +++ b/ops/nix/manifest/modules/nixos/sd-image.nix @@ -1,16 +1,10 @@ -{ inputs, lib, ... }: -let - inherit (lib.modules) mkIf; - inherit (lib.lists) optional; -in +{ inputs, ... }: { flake.modules.nixos.default = { hostName, hostConfig, ... }: { - imports = optional hostConfig.createImage "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-${hostConfig.arch}.nix"; - config = mkIf hostConfig.createImage { - image.fileName = "nixos-25-11-${hostConfig.arch}-${hostName}.img"; - sdImage.compressImage = false; - }; + imports = [ "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-${hostConfig.arch}.nix" ]; + image.fileName = "nixos-25-11-${hostConfig.arch}-${hostName}.img"; + sdImage.compressImage = false; }; } From 3023350627d5076cb7696493da55516bec6727af Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 1 Nov 2025 16:12:44 +0800 Subject: [PATCH 02/21] RESET! --- docs/README.md | 34 +++++++++++++++------ docs/runbook.md | 9 ++++++ ops/nix/manifest/modules/nixos/sd-image.nix | 8 +++++ 3 files changed, 41 insertions(+), 10 deletions(-) diff --git a/docs/README.md b/docs/README.md index fec5c7b2..2de0afc5 100644 --- a/docs/README.md +++ b/docs/README.md @@ -3,24 +3,38 @@ `nodes.nixos.veil` has nginx with https setup and the `rrv.sh` website. `manifest` has externals and proxies skeleton impl set up. -## directory structure +## what this is -- `docs/` should contain: - - README.md -> instructions and information - - runbook.md -> commands and procedures -- `ops/` should contain IaC: - - `nix/` contains Nix code that is consumed by `flake.nix` in the root directory - - `sops/` contains sops encrypted secrets with age +a sort of exploration of the dendritic method. i like the dendritic method for how it turns writing a nix flake into an act of letting the system grow organically by writing a custom flake-parts module for every problem you encounter. i pay homage to this by adding a cheeky requirement to the dendritic method rules, that i think is thematically very appropriate for real-life dendritic systems - the flake must be able to self-replicate. run `nix flake init --template github:rrvsh/cathedral#pkg_shell` to see it :) + +the manifest declares all nodes, for now only nixos, and the manifest utilities will parse this "request", and automatically pick and choose modules that when put together, makes these nixosConfigurations. however, the beauty of using flake-parts is the abstraction layer of being able to have **separate** nodes have modules or options set that are dependent on **each other**, which allows us to do things like: + + - declare: this manifest provides a reverse proxy. + - specify: this reverse proxy will run from machine a. + - declare: machine b needs a reverse proxy to make a webapp public. + +and then, the configurations will include all that is needed to make that happen. + +the end state of this is essentially to provide the backend to easily automating writing/generating nix code. the syntax of the manifest options are deliberately simple, as the main issue of generating nixos configurations now are, to me, the complexity of "merging" nixos modules. so, we kind of "merge" those modules first before we present a simpler set of options to the user. + +### RULES + +- every file must be ATOMIC -> HARD REQUIREMENT! ## dev setup -with `direnv`, run `direnv allow` and all dependencies will be in your shell. +with `direnv`, run `direnv allow` and all dependencies will be in your shell. otherwise, install nix and run `nix develop` after cloning the repository. + +warning: the logic is in an unfinished state. you cannot yet import any flake-parts module i have written here and put it into your own config, or for most of my modules as a general rule (too much dependence on each other). feel free to steal any of the logic for yourself though :) run: - `just nice` to format and lint - `just check` to test -## architecture +## acknowledgements -`ops/nix/manifest/manifest.nix` describes the overview of the IaC. the rest construct the system configs. +- [ornicar](https://github.com/ornicar/dotfiles), for being my inspiration to start using Nix, open source, and being a full fledged software engineer +- [NixOS & Flakes Book](https://nixos-and-flakes.thiscute.world/) for teaching me how to use NixOS, flakes, and home-manager: the best damn tutorial on the internet I've seen yet +- [NotAShelf](https://github.com/notashelf/nyx) for introducing me to the idea of monorepos and custom logic (read: over-engineering) for Nix flakes +- [drupol/infra](https://not-a-number.io/2025/refactoring-my-infrastructure-as-code-configurations/) for introducing the dendritic pattern to me, and [mightyiam](https://discourse.nixos.org/t/pattern-every-file-is-a-flake-parts-module/61271) for pioneering it. diff --git a/docs/runbook.md b/docs/runbook.md index b4b3bc74..0099665e 100644 --- a/docs/runbook.md +++ b/docs/runbook.md @@ -1 +1,10 @@ ssh-to-age -private-key -i ~/.ssh/id_ed25519 > ~/.config/sops/age/keys.txt + +rg --no-binary --hidden --null -l '' \ + | tr '\0' '\n' \ + | grep -vE '^\.git/' \ + | grep -vE '/(\.direnv|result|tmp|node_modules)/' \ + | while read -l f + echo "\n==== $f ====\n" + cat "$f" + end | pbcopy diff --git a/ops/nix/manifest/modules/nixos/sd-image.nix b/ops/nix/manifest/modules/nixos/sd-image.nix index c5d603f1..f3a5f588 100644 --- a/ops/nix/manifest/modules/nixos/sd-image.nix +++ b/ops/nix/manifest/modules/nixos/sd-image.nix @@ -6,5 +6,13 @@ imports = [ "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-${hostConfig.arch}.nix" ]; image.fileName = "nixos-25-11-${hostConfig.arch}-${hostName}.img"; sdImage.compressImage = false; + + users.users.rafiq = { + extraGroups = [ "wheel" ]; + isNormalUser = true; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq" + ]; + }; }; } From b5cbaefac1f84cd4161cc0860556f50a64118a18 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 1 Nov 2025 16:43:13 +0800 Subject: [PATCH 03/21] docs(README.md): rebase --- docs/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/README.md b/docs/README.md index 2de0afc5..ce66fdc3 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,7 +1,6 @@ ## current state -`nodes.nixos.veil` has nginx with https setup and the `rrv.sh` website. -`manifest` has externals and proxies skeleton impl set up. + ## what this is @@ -19,7 +18,8 @@ the end state of this is essentially to provide the backend to easily automating ### RULES -- every file must be ATOMIC -> HARD REQUIREMENT! +- every file must be ATOMIC -> HARD REQUIREMENT! includes all types of files +- lists should be sorted if possible ## dev setup From 157d7573dd92152c72ad6915b9a3db00aecc9e82 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 1 Nov 2025 16:44:21 +0800 Subject: [PATCH 04/21] build(nix): init new file structure --- ops/nix/manifest/manifest.nix | 3 +++ .../manifest/modules/{nixos => }/default.nix | 0 .../modules/{nixos => externals}/nginx.nix | 0 .../modules/{nixos => nodes}/sd-image.nix | 0 ops/nix/manifest/modules/options/sops.nix | 18 ++++++++++++++++++ .../modules/{nixos => }/proxies/rrv-sh.nix | 0 ops/nix/templates/_pkg-shell/.gitignore | 1 + 7 files changed, 22 insertions(+) rename ops/nix/manifest/modules/{nixos => }/default.nix (100%) rename ops/nix/manifest/modules/{nixos => externals}/nginx.nix (100%) rename ops/nix/manifest/modules/{nixos => nodes}/sd-image.nix (100%) create mode 100644 ops/nix/manifest/modules/options/sops.nix rename ops/nix/manifest/modules/{nixos => }/proxies/rrv-sh.nix (100%) create mode 100644 ops/nix/templates/_pkg-shell/.gitignore diff --git a/ops/nix/manifest/manifest.nix b/ops/nix/manifest/manifest.nix index cc57b964..c2ea9e75 100644 --- a/ops/nix/manifest/manifest.nix +++ b/ops/nix/manifest/manifest.nix @@ -4,6 +4,9 @@ let in { flake.manifest = { + options = { + sops.enable = true; + }; externals.nginx = { node = "veil"; addSSL = true; diff --git a/ops/nix/manifest/modules/nixos/default.nix b/ops/nix/manifest/modules/default.nix similarity index 100% rename from ops/nix/manifest/modules/nixos/default.nix rename to ops/nix/manifest/modules/default.nix diff --git a/ops/nix/manifest/modules/nixos/nginx.nix b/ops/nix/manifest/modules/externals/nginx.nix similarity index 100% rename from ops/nix/manifest/modules/nixos/nginx.nix rename to ops/nix/manifest/modules/externals/nginx.nix diff --git a/ops/nix/manifest/modules/nixos/sd-image.nix b/ops/nix/manifest/modules/nodes/sd-image.nix similarity index 100% rename from ops/nix/manifest/modules/nixos/sd-image.nix rename to ops/nix/manifest/modules/nodes/sd-image.nix diff --git a/ops/nix/manifest/modules/options/sops.nix b/ops/nix/manifest/modules/options/sops.nix new file mode 100644 index 00000000..c13aa7a7 --- /dev/null +++ b/ops/nix/manifest/modules/options/sops.nix @@ -0,0 +1,18 @@ +# provide sops to the whole flake +{ + config, + lib, + ... +}: +let + cfg = config.flake; + inherit (lib.options) mkEnableOption; +in +{ + options.flake.manifest.options.sops.enable = mkEnableOption ""; + config.flake = { + modules.nixos.sops-common = { + needs = [ cfg.modules.nixos.users ]; + }; + }; +} diff --git a/ops/nix/manifest/modules/nixos/proxies/rrv-sh.nix b/ops/nix/manifest/modules/proxies/rrv-sh.nix similarity index 100% rename from ops/nix/manifest/modules/nixos/proxies/rrv-sh.nix rename to ops/nix/manifest/modules/proxies/rrv-sh.nix diff --git a/ops/nix/templates/_pkg-shell/.gitignore b/ops/nix/templates/_pkg-shell/.gitignore new file mode 100644 index 00000000..92b27930 --- /dev/null +++ b/ops/nix/templates/_pkg-shell/.gitignore @@ -0,0 +1 @@ +.direnv From 882167c211bd5d3204c39baea9182bfa3314bd0c Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 1 Nov 2025 17:35:28 +0800 Subject: [PATCH 05/21] build(nix): init new sops module --- ops/nix/manifest/manifest.nix | 1 + ops/nix/manifest/modules/default.nix | 14 ++------ ops/nix/manifest/modules/helpers/admin.nix | 15 ++++++++ ops/nix/manifest/modules/nodes/sd-image.nix | 8 ----- ops/nix/manifest/modules/options/sops.nix | 18 ---------- .../manifest/modules/options/sops/common.nix | 35 +++++++++++++++++++ ops/nix/manifest/modules/users/options.nix | 12 +++++++ 7 files changed, 65 insertions(+), 38 deletions(-) create mode 100644 ops/nix/manifest/modules/helpers/admin.nix delete mode 100644 ops/nix/manifest/modules/options/sops.nix create mode 100644 ops/nix/manifest/modules/options/sops/common.nix create mode 100644 ops/nix/manifest/modules/users/options.nix diff --git a/ops/nix/manifest/manifest.nix b/ops/nix/manifest/manifest.nix index c2ea9e75..5f460efd 100644 --- a/ops/nix/manifest/manifest.nix +++ b/ops/nix/manifest/manifest.nix @@ -4,6 +4,7 @@ let in { flake.manifest = { + users.rafiq.primary = true; options = { sops.enable = true; }; diff --git a/ops/nix/manifest/modules/default.nix b/ops/nix/manifest/modules/default.nix index 1eb23077..d376584b 100644 --- a/ops/nix/manifest/modules/default.nix +++ b/ops/nix/manifest/modules/default.nix @@ -1,4 +1,4 @@ -{ config, inputs, ... }: +{ config, ... }: let inherit (config.flake.paths) secrets; in @@ -11,7 +11,6 @@ in ... }: { - imports = [ inputs.sops-nix.nixosModules.sops ]; networking.hostName = hostName; nix.settings = { experimental-features = [ @@ -33,16 +32,7 @@ in enable = true; }; }; - sops = { - age.sshKeyPaths = [ "/home/rafiq/.ssh/id_ed25519" ]; - secrets = { - "keys/tailscale".sopsFile = secrets + /keys.yaml; - "rafiq/hashedPassword" = { - neededForUsers = true; - sopsFile = secrets + /users.yaml; - }; - }; - }; + sops.secrets."keys/tailscale".sopsFile = secrets + /keys.yaml; system.stateVersion = "25.11"; users = { groups.users.gid = 100; diff --git a/ops/nix/manifest/modules/helpers/admin.nix b/ops/nix/manifest/modules/helpers/admin.nix new file mode 100644 index 00000000..166b98c5 --- /dev/null +++ b/ops/nix/manifest/modules/helpers/admin.nix @@ -0,0 +1,15 @@ +{ lib, config, ... }: +let + cfg = config.flake; + inherit (builtins) attrNames; + inherit (lib.types) str; + inherit (lib.options) mkOption; + inherit (lib.attrsets) filterAttrs; + inherit (lib.lists) elemAt; +in +{ + options.flake.manifest.helpers.admin.username = mkOption { type = str; }; + config.flake.manifest.helpers.admin.username = elemAt (attrNames ( + filterAttrs (_: value: value.primary or false) cfg.manifest.users + )) 0; +} diff --git a/ops/nix/manifest/modules/nodes/sd-image.nix b/ops/nix/manifest/modules/nodes/sd-image.nix index f3a5f588..c5d603f1 100644 --- a/ops/nix/manifest/modules/nodes/sd-image.nix +++ b/ops/nix/manifest/modules/nodes/sd-image.nix @@ -6,13 +6,5 @@ imports = [ "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-${hostConfig.arch}.nix" ]; image.fileName = "nixos-25-11-${hostConfig.arch}-${hostName}.img"; sdImage.compressImage = false; - - users.users.rafiq = { - extraGroups = [ "wheel" ]; - isNormalUser = true; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq" - ]; - }; }; } diff --git a/ops/nix/manifest/modules/options/sops.nix b/ops/nix/manifest/modules/options/sops.nix deleted file mode 100644 index c13aa7a7..00000000 --- a/ops/nix/manifest/modules/options/sops.nix +++ /dev/null @@ -1,18 +0,0 @@ -# provide sops to the whole flake -{ - config, - lib, - ... -}: -let - cfg = config.flake; - inherit (lib.options) mkEnableOption; -in -{ - options.flake.manifest.options.sops.enable = mkEnableOption ""; - config.flake = { - modules.nixos.sops-common = { - needs = [ cfg.modules.nixos.users ]; - }; - }; -} diff --git a/ops/nix/manifest/modules/options/sops/common.nix b/ops/nix/manifest/modules/options/sops/common.nix new file mode 100644 index 00000000..5134da1d --- /dev/null +++ b/ops/nix/manifest/modules/options/sops/common.nix @@ -0,0 +1,35 @@ +# provide sops to the whole flake +{ + inputs, + config, + lib, + ... +}: +let + cfg = config.flake; + inherit (cfg.paths) secrets; + inherit (cfg.manifest.helpers) admin; + inherit (lib.attrsets) mapAttrs'; + inherit (lib.options) mkEnableOption; + inherit (lib.modules) mkIf; +in +{ + options.flake.manifest.options.sops.enable = mkEnableOption ""; + config.flake.modules.nixos.default = mkIf cfg.manifest.options.sops.enable ( + { config, ... }: + let + inherit (config.users) defaultUserHome; + in + { + imports = [ inputs.sops-nix.nixosModules.sops ]; + sops.age.sshKeyPaths = [ "${defaultUserHome}/${admin.username}/.ssh/id_ed25519" ]; + sops.secrets = mapAttrs' (name: _value: { + name = "${name}/hashedPassword"; + value = { + neededForUsers = true; + sopsFile = secrets + /users.yaml; + }; + }) cfg.manifest.users; + } + ); +} diff --git a/ops/nix/manifest/modules/users/options.nix b/ops/nix/manifest/modules/users/options.nix new file mode 100644 index 00000000..b8b58bac --- /dev/null +++ b/ops/nix/manifest/modules/users/options.nix @@ -0,0 +1,12 @@ +{ lib, ... }: +let + inherit (lib.types) attrsOf submodule; + inherit (lib.options) mkOption mkEnableOption; +in +{ + options.flake.manifest.users = mkOption { + type = attrsOf (submodule { + options.primary = mkEnableOption ""; + }); + }; +} From 535af86353737cb01952fbcacf1cd476c26a56ea Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 1 Nov 2025 18:04:51 +0800 Subject: [PATCH 06/21] refactor(nix): atomicise nginx --- ops/nix/manifest/manifest.nix | 13 ++-- ops/nix/manifest/modules/externals/nginx.nix | 67 ------------------- .../manifest/modules/externals/nginx/ssl.nix | 37 ++++++++++ .../modules/externals/nginx/virtual-hosts.nix | 50 ++++++++++++++ ops/nix/manifest/modules/helpers/admin.nix | 7 +- ops/nix/manifest/modules/users/options.nix | 3 +- ops/nix/manifest/utils/options.nix | 12 +--- 7 files changed, 105 insertions(+), 84 deletions(-) delete mode 100644 ops/nix/manifest/modules/externals/nginx.nix create mode 100644 ops/nix/manifest/modules/externals/nginx/ssl.nix create mode 100644 ops/nix/manifest/modules/externals/nginx/virtual-hosts.nix diff --git a/ops/nix/manifest/manifest.nix b/ops/nix/manifest/manifest.nix index 5f460efd..77e41f8e 100644 --- a/ops/nix/manifest/manifest.nix +++ b/ops/nix/manifest/manifest.nix @@ -4,13 +4,18 @@ let in { flake.manifest = { - users.rafiq.primary = true; - options = { - sops.enable = true; + users.rafiq = { + primary = true; + email = "rafiq@rrv.sh"; }; + options.sops.enable = true; externals.nginx = { node = "veil"; - addSSL = true; + ssl = { + enable = true; + dnsProvider = "cloudflare"; + certs."rrv.sh".extraDomainNames = [ "*.rrv.sh" ]; + }; }; nodes.nixos = { nephalem = { diff --git a/ops/nix/manifest/modules/externals/nginx.nix b/ops/nix/manifest/modules/externals/nginx.nix deleted file mode 100644 index a8232842..00000000 --- a/ops/nix/manifest/modules/externals/nginx.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ lib, config, ... }: -let - cfg = config.flake; - inherit (builtins) - toString - map - concatLists - listToAttrs - ; - inherit (lib.attrsets) mapAttrsToList; - inherit (lib.modules) mkMerge mkIf; - inherit (lib.trivial) pipe; - inherit (cfg.paths) secrets; - mkVHostConfig = - manifest: - pipe manifest.nodes.nixos [ - # enrich each proxy attrset with the node name - (mapAttrsToList (nodeName: nodeConfig: map (x: x // { node = nodeName; }) nodeConfig.proxies)) - # combine all proxy attrsets in the manifest - concatLists - # construct virtual host config for proxies - (map (proxy: { - name = proxy.domain; - value = { - inherit (manifest.externals.nginx) addSSL; - useACMEHost = if manifest.externals.nginx.addSSL then proxy.domain else null; - acmeRoot = null; # needed for DNS validation - locations."/".proxyPass = "http://${ - if (proxy.node == manifest.externals.nginx.node) then "localhost" else proxy.node - }:${toString proxy.port}"; - }; - })) - listToAttrs - ]; -in -{ - flake.modules.nixos.default = - { - hostName, - manifest, - config, - ... - }: - mkIf (hostName == manifest.externals.nginx.node) (mkMerge [ - { - networking.firewall.allowedTCPPorts = [ - 80 # HTTP - 443 # HTTPS - ]; - services.nginx.enable = true; - services.nginx.virtualHosts = mkVHostConfig manifest; - } - (mkIf manifest.externals.nginx.addSSL { - users.users.nginx.extraGroups = [ "acme" ]; - sops.secrets."keys/cloudflare".sopsFile = secrets + /keys.yaml; - security.acme = { - acceptTerms = true; - defaults = { - email = "rafiq@rrv.sh"; - dnsProvider = "cloudflare"; - credentialFiles."CLOUDFLARE_DNS_API_TOKEN_FILE" = config.sops.secrets."keys/cloudflare".path; - }; - certs."rrv.sh".extraDomainNames = [ "*.rrv.sh" ]; - }; - }) - ]); -} diff --git a/ops/nix/manifest/modules/externals/nginx/ssl.nix b/ops/nix/manifest/modules/externals/nginx/ssl.nix new file mode 100644 index 00000000..984b4d52 --- /dev/null +++ b/ops/nix/manifest/modules/externals/nginx/ssl.nix @@ -0,0 +1,37 @@ +{ lib, config, ... }: +let + cfg = config.flake; + modCfg = config.flake.manifest.externals.nginx; + inherit (cfg.manifest.helpers) admin; + inherit (cfg.paths) secrets; + inherit (lib.modules) mkMerge mkIf; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.types) raw str; +in +{ + options.flake.manifest.externals.nginx.ssl = { + enable = mkEnableOption ""; + dnsProvider = mkOption { type = str; }; + certs = mkOption { type = raw; }; + }; + config.flake.modules.nixos.default = + { hostName, config, ... }: + mkIf (hostName == modCfg.node) (mkMerge [ + (mkIf modCfg.ssl.enable { + users.users.nginx.extraGroups = [ "acme" ]; + security.acme = { + acceptTerms = true; + defaults = { + inherit (admin) email; + inherit (modCfg.ssl) dnsProvider; + }; + inherit (modCfg.ssl) certs; + }; + }) + (mkIf (modCfg.ssl.dnsProvider == "cloudflare" && cfg.manifest.options.sops.enable) { + sops.secrets."keys/cloudflare".sopsFile = secrets + /keys.yaml; + security.acme.defaults.credentialFiles."CLOUDFLARE_DNS_API_TOKEN_FILE" = + config.sops.secrets."keys/cloudflare".path; + }) + ]); +} diff --git a/ops/nix/manifest/modules/externals/nginx/virtual-hosts.nix b/ops/nix/manifest/modules/externals/nginx/virtual-hosts.nix new file mode 100644 index 00000000..b4203682 --- /dev/null +++ b/ops/nix/manifest/modules/externals/nginx/virtual-hosts.nix @@ -0,0 +1,50 @@ +{ lib, config, ... }: +let + cfg = config.flake; + modCfg = config.flake.manifest.externals.nginx; + inherit (builtins) + toString + map + concatLists + listToAttrs + attrNames + ; + inherit (lib.attrsets) mapAttrsToList; + inherit (lib.modules) mkIf; + inherit (lib.options) mkOption; + inherit (lib.trivial) pipe; + inherit (lib.types) enum; +in +{ + options.flake.manifest.externals.nginx.node = mkOption { + type = enum (attrNames cfg.manifest.nodes.nixos); + }; + config.flake.modules.nixos.default = + { hostName, ... }: + mkIf (hostName == modCfg.node) { + networking.firewall.allowedTCPPorts = [ + 80 # HTTP + 443 # HTTPS + ]; + services.nginx.enable = true; + services.nginx.virtualHosts = pipe cfg.manifest.nodes.nixos [ + # enrich each proxy attrset with the node name + (mapAttrsToList (nodeName: nodeConfig: map (x: x // { node = nodeName; }) nodeConfig.proxies)) + # combine all proxy attrsets in the manifest + concatLists + # construct virtual host config for proxies + (map (proxy: { + name = proxy.domain; + value = { + addSSL = modCfg.ssl.enable; + useACMEHost = if modCfg.ssl.enable then proxy.domain else null; + acmeRoot = null; # needed for DNS validation + locations."/".proxyPass = "http://${ + if (proxy.node == modCfg.node) then "localhost" else proxy.node + }:${toString proxy.port}"; + }; + })) + listToAttrs + ]; + }; +} diff --git a/ops/nix/manifest/modules/helpers/admin.nix b/ops/nix/manifest/modules/helpers/admin.nix index 166b98c5..e48cdec9 100644 --- a/ops/nix/manifest/modules/helpers/admin.nix +++ b/ops/nix/manifest/modules/helpers/admin.nix @@ -1,15 +1,20 @@ { lib, config, ... }: let cfg = config.flake; - inherit (builtins) attrNames; + inherit (builtins) attrNames attrValues; inherit (lib.types) str; inherit (lib.options) mkOption; inherit (lib.attrsets) filterAttrs; inherit (lib.lists) elemAt; + manifestAdmin = elemAt (attrValues ( + filterAttrs (_: value: value.primary or false) cfg.manifest.users + )) 0; in { options.flake.manifest.helpers.admin.username = mkOption { type = str; }; + options.flake.manifest.helpers.admin.email = mkOption { type = str; }; config.flake.manifest.helpers.admin.username = elemAt (attrNames ( filterAttrs (_: value: value.primary or false) cfg.manifest.users )) 0; + config.flake.manifest.helpers.admin.email = manifestAdmin.email; } diff --git a/ops/nix/manifest/modules/users/options.nix b/ops/nix/manifest/modules/users/options.nix index b8b58bac..ae405708 100644 --- a/ops/nix/manifest/modules/users/options.nix +++ b/ops/nix/manifest/modules/users/options.nix @@ -1,12 +1,13 @@ { lib, ... }: let - inherit (lib.types) attrsOf submodule; + inherit (lib.types) str attrsOf submodule; inherit (lib.options) mkOption mkEnableOption; in { options.flake.manifest.users = mkOption { type = attrsOf (submodule { options.primary = mkEnableOption ""; + options.email = mkOption { type = str; }; }); }; } diff --git a/ops/nix/manifest/utils/options.nix b/ops/nix/manifest/utils/options.nix index 6b23bc31..e56dac19 100644 --- a/ops/nix/manifest/utils/options.nix +++ b/ops/nix/manifest/utils/options.nix @@ -2,8 +2,7 @@ let cfg = config.flake; inherit (cfg.paths) root; - inherit (builtins) attrNames; - inherit (lib.options) mkOption mkEnableOption; + inherit (lib.options) mkOption; inherit (lib.types) deferredModule attrsOf @@ -11,7 +10,6 @@ let str bool path - enum listOf port ; @@ -19,14 +17,6 @@ in { options.flake = { manifest = { - externals.nginx = mkOption { - type = submodule { - options = { - node = mkOption { type = enum (attrNames cfg.manifest.nodes.nixos); }; - addSSL = mkEnableOption ""; - }; - }; - }; nodes.nixos = mkOption { type = attrsOf (submodule { options = { From cdc97c06056fe9d5684ab5de4e2b23c320e7bd2e Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 1 Nov 2025 18:34:05 +0800 Subject: [PATCH 07/21] refactor(nix): atomicise createImage --- .../manifest/modules/nodes/createImage.nix | 27 +++++++++++++++++++ ops/nix/manifest/modules/nodes/sd-image.nix | 10 ------- ops/nix/manifest/utils/config.nix | 4 --- 3 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 ops/nix/manifest/modules/nodes/createImage.nix delete mode 100644 ops/nix/manifest/modules/nodes/sd-image.nix diff --git a/ops/nix/manifest/modules/nodes/createImage.nix b/ops/nix/manifest/modules/nodes/createImage.nix new file mode 100644 index 00000000..80bee2a0 --- /dev/null +++ b/ops/nix/manifest/modules/nodes/createImage.nix @@ -0,0 +1,27 @@ +{ + inputs, + lib, + config, + ... +}: +let + cfg = config.flake; + inherit (cfg) manifest; + inherit (builtins) mapAttrs; + inherit (lib.modules) mkIf; + inherit (lib.attrsets) filterAttrs; +in +{ + flake.images = (mapAttrs (name: _: cfg.nixosConfigurations.${name}.config.system.build.sdImage)) ( + filterAttrs (_: value: value.createImage) manifest.nodes.nixos + ); + flake.modules.nixos.default = + { hostName, hostConfig, ... }: + { + imports = [ "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-${hostConfig.arch}.nix" ]; + config = mkIf hostConfig.createImage { + image.fileName = "nixos-25-11-${hostConfig.arch}-${hostName}.img"; + sdImage.compressImage = false; + }; + }; +} diff --git a/ops/nix/manifest/modules/nodes/sd-image.nix b/ops/nix/manifest/modules/nodes/sd-image.nix deleted file mode 100644 index c5d603f1..00000000 --- a/ops/nix/manifest/modules/nodes/sd-image.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ inputs, ... }: -{ - flake.modules.nixos.default = - { hostName, hostConfig, ... }: - { - imports = [ "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-${hostConfig.arch}.nix" ]; - image.fileName = "nixos-25-11-${hostConfig.arch}-${hostName}.img"; - sdImage.compressImage = false; - }; -} diff --git a/ops/nix/manifest/utils/config.nix b/ops/nix/manifest/utils/config.nix index 052221b4..434913a6 100644 --- a/ops/nix/manifest/utils/config.nix +++ b/ops/nix/manifest/utils/config.nix @@ -9,7 +9,6 @@ let inherit (cfg) manifest; inherit (builtins) mapAttrs; inherit (lib) nixosSystem; - inherit (lib.attrsets) filterAttrs; in { imports = [ inputs.flake-parts.flakeModules.modules ]; @@ -25,8 +24,5 @@ in modules = [ cfg.modules.nixos.default ] ++ value.modules; } ) manifest.nodes.nixos; - images = (mapAttrs (name: _: cfg.nixosConfigurations.${name}.config.system.build.sdImage)) ( - filterAttrs (_: value: value.createImage) manifest.nodes.nixos - ); }; } From fec8238c7298cdafce463314119e031ec6628d6d Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 1 Nov 2025 18:47:15 +0800 Subject: [PATCH 08/21] refactor(nix): nother one --- .gitignore | 6 ---- .../pkg-shell}/.envrc | 0 .../pkg-shell}/.gitignore | 0 .../pkg-shell}/Justfile | 0 .../pkg-shell}/flake.nix | 0 .../pkg-shell}/nix/package.nix | 0 .../pkg-shell}/nix/shell.nix | 0 .../modules => }/externals/nginx/ssl.nix | 0 .../externals/nginx/virtual-hosts.nix | 0 .../{manifest/modules => }/helpers/admin.nix | 0 ops/nix/{manifest => }/manifest.nix | 31 ++++++++++++++++--- .../{manifest/modules => nodes}/default.nix | 0 .../nodes => nodes/nixos}/createImage.nix | 0 .../modules => nodes}/proxies/rrv-sh.nix | 0 .../sops/common.nix => options/sops.nix} | 0 ops/nix/shell.nix | 19 ------------ ops/nix/templates/pkg-shell.nix | 6 ---- .../{manifest/modules => }/users/options.nix | 0 ops/nix/{manifest => }/utils/config.nix | 0 ops/nix/{manifest => }/utils/options.nix | 0 20 files changed, 26 insertions(+), 36 deletions(-) rename ops/nix/{templates/_pkg-shell => _templates/pkg-shell}/.envrc (100%) rename ops/nix/{templates/_pkg-shell => _templates/pkg-shell}/.gitignore (100%) rename ops/nix/{templates/_pkg-shell => _templates/pkg-shell}/Justfile (100%) rename ops/nix/{templates/_pkg-shell => _templates/pkg-shell}/flake.nix (100%) rename ops/nix/{templates/_pkg-shell => _templates/pkg-shell}/nix/package.nix (100%) rename ops/nix/{templates/_pkg-shell => _templates/pkg-shell}/nix/shell.nix (100%) rename ops/nix/{manifest/modules => }/externals/nginx/ssl.nix (100%) rename ops/nix/{manifest/modules => }/externals/nginx/virtual-hosts.nix (100%) rename ops/nix/{manifest/modules => }/helpers/admin.nix (100%) rename ops/nix/{manifest => }/manifest.nix (61%) rename ops/nix/{manifest/modules => nodes}/default.nix (100%) rename ops/nix/{manifest/modules/nodes => nodes/nixos}/createImage.nix (100%) rename ops/nix/{manifest/modules => nodes}/proxies/rrv-sh.nix (100%) rename ops/nix/{manifest/modules/options/sops/common.nix => options/sops.nix} (100%) delete mode 100644 ops/nix/shell.nix delete mode 100644 ops/nix/templates/pkg-shell.nix rename ops/nix/{manifest/modules => }/users/options.nix (100%) rename ops/nix/{manifest => }/utils/config.nix (100%) rename ops/nix/{manifest => }/utils/options.nix (100%) diff --git a/.gitignore b/.gitignore index 8196f7da..079e9744 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,3 @@ tmp - -# Nix - result - -# Direnv - .direnv diff --git a/ops/nix/templates/_pkg-shell/.envrc b/ops/nix/_templates/pkg-shell/.envrc similarity index 100% rename from ops/nix/templates/_pkg-shell/.envrc rename to ops/nix/_templates/pkg-shell/.envrc diff --git a/ops/nix/templates/_pkg-shell/.gitignore b/ops/nix/_templates/pkg-shell/.gitignore similarity index 100% rename from ops/nix/templates/_pkg-shell/.gitignore rename to ops/nix/_templates/pkg-shell/.gitignore diff --git a/ops/nix/templates/_pkg-shell/Justfile b/ops/nix/_templates/pkg-shell/Justfile similarity index 100% rename from ops/nix/templates/_pkg-shell/Justfile rename to ops/nix/_templates/pkg-shell/Justfile diff --git a/ops/nix/templates/_pkg-shell/flake.nix b/ops/nix/_templates/pkg-shell/flake.nix similarity index 100% rename from ops/nix/templates/_pkg-shell/flake.nix rename to ops/nix/_templates/pkg-shell/flake.nix diff --git a/ops/nix/templates/_pkg-shell/nix/package.nix b/ops/nix/_templates/pkg-shell/nix/package.nix similarity index 100% rename from ops/nix/templates/_pkg-shell/nix/package.nix rename to ops/nix/_templates/pkg-shell/nix/package.nix diff --git a/ops/nix/templates/_pkg-shell/nix/shell.nix b/ops/nix/_templates/pkg-shell/nix/shell.nix similarity index 100% rename from ops/nix/templates/_pkg-shell/nix/shell.nix rename to ops/nix/_templates/pkg-shell/nix/shell.nix diff --git a/ops/nix/manifest/modules/externals/nginx/ssl.nix b/ops/nix/externals/nginx/ssl.nix similarity index 100% rename from ops/nix/manifest/modules/externals/nginx/ssl.nix rename to ops/nix/externals/nginx/ssl.nix diff --git a/ops/nix/manifest/modules/externals/nginx/virtual-hosts.nix b/ops/nix/externals/nginx/virtual-hosts.nix similarity index 100% rename from ops/nix/manifest/modules/externals/nginx/virtual-hosts.nix rename to ops/nix/externals/nginx/virtual-hosts.nix diff --git a/ops/nix/manifest/modules/helpers/admin.nix b/ops/nix/helpers/admin.nix similarity index 100% rename from ops/nix/manifest/modules/helpers/admin.nix rename to ops/nix/helpers/admin.nix diff --git a/ops/nix/manifest/manifest.nix b/ops/nix/manifest.nix similarity index 61% rename from ops/nix/manifest/manifest.nix rename to ops/nix/manifest.nix index 77e41f8e..b37fcb40 100644 --- a/ops/nix/manifest/manifest.nix +++ b/ops/nix/manifest.nix @@ -4,11 +4,6 @@ let in { flake.manifest = { - users.rafiq = { - primary = true; - email = "rafiq@rrv.sh"; - }; - options.sops.enable = true; externals.nginx = { node = "veil"; ssl = { @@ -33,5 +28,31 @@ in ]; }; }; + options.sops.enable = true; + users.rafiq = { + primary = true; + email = "rafiq@rrv.sh"; + }; + }; + flake.templates.pkg-shell = { + path = ./_templates/pkg-shell; + description = "premade package and shell for all systems with flake parts"; }; + perSystem = + { pkgs, ... }: + { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + deadnix + gh + git + just + nh + nixfmt-tree + sops + statix + zizmor + ]; + }; + }; } diff --git a/ops/nix/manifest/modules/default.nix b/ops/nix/nodes/default.nix similarity index 100% rename from ops/nix/manifest/modules/default.nix rename to ops/nix/nodes/default.nix diff --git a/ops/nix/manifest/modules/nodes/createImage.nix b/ops/nix/nodes/nixos/createImage.nix similarity index 100% rename from ops/nix/manifest/modules/nodes/createImage.nix rename to ops/nix/nodes/nixos/createImage.nix diff --git a/ops/nix/manifest/modules/proxies/rrv-sh.nix b/ops/nix/nodes/proxies/rrv-sh.nix similarity index 100% rename from ops/nix/manifest/modules/proxies/rrv-sh.nix rename to ops/nix/nodes/proxies/rrv-sh.nix diff --git a/ops/nix/manifest/modules/options/sops/common.nix b/ops/nix/options/sops.nix similarity index 100% rename from ops/nix/manifest/modules/options/sops/common.nix rename to ops/nix/options/sops.nix diff --git a/ops/nix/shell.nix b/ops/nix/shell.nix deleted file mode 100644 index 36274ef0..00000000 --- a/ops/nix/shell.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ - perSystem = - { pkgs, ... }: - { - devShells.default = pkgs.mkShell { - buildInputs = with pkgs; [ - deadnix - gh - git - just - nh - nixfmt-tree - sops - statix - zizmor - ]; - }; - }; -} diff --git a/ops/nix/templates/pkg-shell.nix b/ops/nix/templates/pkg-shell.nix deleted file mode 100644 index f1b6c7c7..00000000 --- a/ops/nix/templates/pkg-shell.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - flake.templates.pkg-shell = { - path = ./_pkg-shell; - description = "premade package and shell for all systems with flake parts"; - }; -} diff --git a/ops/nix/manifest/modules/users/options.nix b/ops/nix/users/options.nix similarity index 100% rename from ops/nix/manifest/modules/users/options.nix rename to ops/nix/users/options.nix diff --git a/ops/nix/manifest/utils/config.nix b/ops/nix/utils/config.nix similarity index 100% rename from ops/nix/manifest/utils/config.nix rename to ops/nix/utils/config.nix diff --git a/ops/nix/manifest/utils/options.nix b/ops/nix/utils/options.nix similarity index 100% rename from ops/nix/manifest/utils/options.nix rename to ops/nix/utils/options.nix From 7232ff3c1ba04653d53b2895998191eeb7485615 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sat, 1 Nov 2025 18:55:30 +0800 Subject: [PATCH 09/21] refactor(nix): nother one --- .github/workflows/check.yaml | 26 +++++++++++++++++++++ .github/workflows/ensure_docs.yaml | 27 ++++++++++++++++++++++ .github/workflows/{test.yaml => lint.yaml} | 17 ++------------ ops/nix/{ => _templates}/.gitignore | 0 4 files changed, 55 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/check.yaml create mode 100644 .github/workflows/ensure_docs.yaml rename .github/workflows/{test.yaml => lint.yaml} (60%) rename ops/nix/{ => _templates}/.gitignore (100%) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml new file mode 100644 index 00000000..4cfb6aa7 --- /dev/null +++ b/.github/workflows/check.yaml @@ -0,0 +1,26 @@ +name: Run checks and tests + +on: + pull_request: + types: [opened, synchronize] + +jobs: + check: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + persist-credentials: false + + - name: Install Nix + uses: cachix/install-nix-action@d64e0553100205688c0fb2fa16edb0fc8663c590 + with: + extra_nix_config: | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + + - name: Evaluate flake outputs + run: nix flake check --all-systems diff --git a/.github/workflows/ensure_docs.yaml b/.github/workflows/ensure_docs.yaml new file mode 100644 index 00000000..947e9abc --- /dev/null +++ b/.github/workflows/ensure_docs.yaml @@ -0,0 +1,27 @@ +name: Check for changes to docs + +on: + pull_request: + types: [opened, synchronize] + +jobs: + ensure_docs: + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + persist-credentials: false + + - name: Get all changed docs files + id: changed-markdown-files + uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47 + with: + files: docs/** + + - name: Fail if no change to docs + if: steps.changed-markdown-files.outputs.any_changed == 'false' + run: exit 1 diff --git a/.github/workflows/test.yaml b/.github/workflows/lint.yaml similarity index 60% rename from .github/workflows/test.yaml rename to .github/workflows/lint.yaml index 84bd253b..7dc84082 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/lint.yaml @@ -1,11 +1,11 @@ -name: Run tests +name: Lint on: pull_request: types: [opened, synchronize] jobs: - test: + lint: runs-on: ubuntu-latest permissions: contents: read @@ -22,22 +22,9 @@ jobs: extra_nix_config: | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - - name: Evaluate flake outputs - run: nix flake check --all-systems - - name: Run linting and formatting checks run: | nix develop -c statix check nix develop -c deadnix nix develop -c treefmt --ci nix develop -c zizmor . - - - name: Get all changed docs files - id: changed-markdown-files - uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47 - with: - files: docs/** - - - name: Fail if no change to docs - if: steps.changed-markdown-files.outputs.any_changed == 'false' - run: exit 1 diff --git a/ops/nix/.gitignore b/ops/nix/_templates/.gitignore similarity index 100% rename from ops/nix/.gitignore rename to ops/nix/_templates/.gitignore From 80352ac7637a5f58afb187b3fd847f266df016ec Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sun, 2 Nov 2025 19:14:21 +0800 Subject: [PATCH 10/21] refactor users bracnh --- ops/nix/externals/nginx/ssl.nix | 4 +-- ops/nix/helpers/admin.nix | 20 ------------ ops/nix/{utils => helpers}/config.nix | 0 ops/nix/{utils => helpers}/options.nix | 0 ops/nix/manifest.nix | 11 ++++--- ops/nix/nodes/default.nix | 13 -------- ops/nix/options/sops.nix | 35 -------------------- ops/nix/users/admin.nix | 24 ++++++++++++++ ops/nix/users/options.nix | 13 -------- ops/nix/users/sops.nix | 45 ++++++++++++++++++++++++++ ops/nix/users/users.nix | 36 +++++++++++++++++++++ 11 files changed, 114 insertions(+), 87 deletions(-) delete mode 100644 ops/nix/helpers/admin.nix rename ops/nix/{utils => helpers}/config.nix (100%) rename ops/nix/{utils => helpers}/options.nix (100%) delete mode 100644 ops/nix/options/sops.nix create mode 100644 ops/nix/users/admin.nix delete mode 100644 ops/nix/users/options.nix create mode 100644 ops/nix/users/sops.nix create mode 100644 ops/nix/users/users.nix diff --git a/ops/nix/externals/nginx/ssl.nix b/ops/nix/externals/nginx/ssl.nix index 984b4d52..404c2eea 100644 --- a/ops/nix/externals/nginx/ssl.nix +++ b/ops/nix/externals/nginx/ssl.nix @@ -2,7 +2,7 @@ let cfg = config.flake; modCfg = config.flake.manifest.externals.nginx; - inherit (cfg.manifest.helpers) admin; + inherit (cfg.manifest.users) admin; inherit (cfg.paths) secrets; inherit (lib.modules) mkMerge mkIf; inherit (lib.options) mkOption mkEnableOption; @@ -28,7 +28,7 @@ in inherit (modCfg.ssl) certs; }; }) - (mkIf (modCfg.ssl.dnsProvider == "cloudflare" && cfg.manifest.options.sops.enable) { + (mkIf (modCfg.ssl.dnsProvider == "cloudflare" && cfg.manifest.users.sops.enable) { sops.secrets."keys/cloudflare".sopsFile = secrets + /keys.yaml; security.acme.defaults.credentialFiles."CLOUDFLARE_DNS_API_TOKEN_FILE" = config.sops.secrets."keys/cloudflare".path; diff --git a/ops/nix/helpers/admin.nix b/ops/nix/helpers/admin.nix deleted file mode 100644 index e48cdec9..00000000 --- a/ops/nix/helpers/admin.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ lib, config, ... }: -let - cfg = config.flake; - inherit (builtins) attrNames attrValues; - inherit (lib.types) str; - inherit (lib.options) mkOption; - inherit (lib.attrsets) filterAttrs; - inherit (lib.lists) elemAt; - manifestAdmin = elemAt (attrValues ( - filterAttrs (_: value: value.primary or false) cfg.manifest.users - )) 0; -in -{ - options.flake.manifest.helpers.admin.username = mkOption { type = str; }; - options.flake.manifest.helpers.admin.email = mkOption { type = str; }; - config.flake.manifest.helpers.admin.username = elemAt (attrNames ( - filterAttrs (_: value: value.primary or false) cfg.manifest.users - )) 0; - config.flake.manifest.helpers.admin.email = manifestAdmin.email; -} diff --git a/ops/nix/utils/config.nix b/ops/nix/helpers/config.nix similarity index 100% rename from ops/nix/utils/config.nix rename to ops/nix/helpers/config.nix diff --git a/ops/nix/utils/options.nix b/ops/nix/helpers/options.nix similarity index 100% rename from ops/nix/utils/options.nix rename to ops/nix/helpers/options.nix diff --git a/ops/nix/manifest.nix b/ops/nix/manifest.nix index b37fcb40..081e2527 100644 --- a/ops/nix/manifest.nix +++ b/ops/nix/manifest.nix @@ -28,10 +28,13 @@ in ]; }; }; - options.sops.enable = true; - users.rafiq = { - primary = true; - email = "rafiq@rrv.sh"; + users = { + sops.enable = true; + users.rafiq = { + primary = true; + email = "rafiq@rrv.sh"; + pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq"; + }; }; }; flake.templates.pkg-shell = { diff --git a/ops/nix/nodes/default.nix b/ops/nix/nodes/default.nix index d376584b..c7c48073 100644 --- a/ops/nix/nodes/default.nix +++ b/ops/nix/nodes/default.nix @@ -24,7 +24,6 @@ in trusted-substituters = [ "https://nix-community.cachix.org" ]; }; nixpkgs.hostPlatform.system = "${hostConfig.arch}-linux"; - security.sudo.wheelNeedsPassword = false; services = { openssh.enable = true; tailscale = { @@ -34,17 +33,5 @@ in }; sops.secrets."keys/tailscale".sopsFile = secrets + /keys.yaml; system.stateVersion = "25.11"; - users = { - groups.users.gid = 100; - mutableUsers = false; - users.rafiq = { - extraGroups = [ "wheel" ]; - hashedPasswordFile = config.sops.secrets."rafiq/hashedPassword".path; - isNormalUser = true; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq" - ]; - }; - }; }; } diff --git a/ops/nix/options/sops.nix b/ops/nix/options/sops.nix deleted file mode 100644 index 5134da1d..00000000 --- a/ops/nix/options/sops.nix +++ /dev/null @@ -1,35 +0,0 @@ -# provide sops to the whole flake -{ - inputs, - config, - lib, - ... -}: -let - cfg = config.flake; - inherit (cfg.paths) secrets; - inherit (cfg.manifest.helpers) admin; - inherit (lib.attrsets) mapAttrs'; - inherit (lib.options) mkEnableOption; - inherit (lib.modules) mkIf; -in -{ - options.flake.manifest.options.sops.enable = mkEnableOption ""; - config.flake.modules.nixos.default = mkIf cfg.manifest.options.sops.enable ( - { config, ... }: - let - inherit (config.users) defaultUserHome; - in - { - imports = [ inputs.sops-nix.nixosModules.sops ]; - sops.age.sshKeyPaths = [ "${defaultUserHome}/${admin.username}/.ssh/id_ed25519" ]; - sops.secrets = mapAttrs' (name: _value: { - name = "${name}/hashedPassword"; - value = { - neededForUsers = true; - sopsFile = secrets + /users.yaml; - }; - }) cfg.manifest.users; - } - ); -} diff --git a/ops/nix/users/admin.nix b/ops/nix/users/admin.nix new file mode 100644 index 00000000..40975ab0 --- /dev/null +++ b/ops/nix/users/admin.nix @@ -0,0 +1,24 @@ +{ lib, config, ... }: +let + cfg = config.flake; + inherit (builtins) attrNames attrValues; + inherit (lib.types) str; + inherit (lib.options) mkOption; + inherit (lib.attrsets) filterAttrs; + inherit (lib.lists) elemAt; + manifestAdmin = elemAt (attrValues ( + filterAttrs (_: value: value.primary or false) cfg.manifest.users.users + )) 0; +in +{ + options.flake.manifest.users = { + admin.username = mkOption { type = str; }; + admin.email = mkOption { type = str; }; + }; + config.flake.manifest.users = { + admin.username = elemAt (attrNames ( + filterAttrs (_: value: value.primary or false) cfg.manifest.users.users + )) 0; + admin.email = manifestAdmin.email; + }; +} diff --git a/ops/nix/users/options.nix b/ops/nix/users/options.nix deleted file mode 100644 index ae405708..00000000 --- a/ops/nix/users/options.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ lib, ... }: -let - inherit (lib.types) str attrsOf submodule; - inherit (lib.options) mkOption mkEnableOption; -in -{ - options.flake.manifest.users = mkOption { - type = attrsOf (submodule { - options.primary = mkEnableOption ""; - options.email = mkOption { type = str; }; - }); - }; -} diff --git a/ops/nix/users/sops.nix b/ops/nix/users/sops.nix new file mode 100644 index 00000000..d2d7338b --- /dev/null +++ b/ops/nix/users/sops.nix @@ -0,0 +1,45 @@ +# provide sops to the whole flake +{ + inputs, + config, + lib, + ... +}: +let + cfg = config.flake; + inherit (cfg.paths) secrets; + inherit (lib.attrsets) mapAttrs'; + inherit (cfg.manifest.users) admin; + inherit (lib.options) mkEnableOption; + inherit (lib.modules) mkIf; +in +{ + options.flake.manifest.users.sops.enable = mkEnableOption ""; + config.flake.modules.nixos.default = + { config, ... }: + let + sshKeyPath = "${config.users.users.${admin.username}.home}/.ssh/id_ed25519"; + in + { + imports = [ inputs.sops-nix.nixosModules.sops ]; + config = mkIf cfg.manifest.users.sops.enable { + system.activationScripts.ensureSshKey.text = # bash + '' + path="${sshKeyPath}" + if [ ! -f "$path" ]; then + echo "Error: SSH key missing at $path" + echo "Create or copy it before rebuilding." + exit 1 + fi + ''; + sops.age.sshKeyPaths = [ sshKeyPath ]; + sops.secrets = mapAttrs' (name: _value: { + name = "${name}/hashedPassword"; + value = { + neededForUsers = true; + sopsFile = secrets + /users.yaml; + }; + }) cfg.manifest.users; + }; + }; +} diff --git a/ops/nix/users/users.nix b/ops/nix/users/users.nix new file mode 100644 index 00000000..3ce34bf9 --- /dev/null +++ b/ops/nix/users/users.nix @@ -0,0 +1,36 @@ +{ lib, config, ... }: +let + cfg = config.flake; + inherit (builtins) mapAttrs; + inherit (lib.types) str attrsOf submodule; + inherit (lib.options) mkOption mkEnableOption; + inherit (lib.modules) mkIf; + inherit (lib.lists) optional; +in +{ + options.flake.manifest.users.users = mkOption { + type = attrsOf (submodule { + options = { + primary = mkEnableOption ""; + email = mkOption { type = str; }; + pubkey = mkOption { type = str; }; + }; + }); + }; + config.flake.modules.nixos.default = + { config, ... }: + { + security.sudo.wheelNeedsPassword = false; + users = { + groups.users.gid = 100; + mutableUsers = false; + users = mapAttrs (username: userConfig: { + extraGroups = optional userConfig.primary "wheel"; + hashedPasswordFile = mkIf (cfg.manifest.options.sops.enable or false + ) config.sops.secrets."${username}/hashedPassword".path; + isNormalUser = true; + openssh.authorizedKeys.keys = [ userConfig.pubkey ]; + }) cfg.manifest.users.users; + }; + }; +} From 41d3d0a0ddafedd89060d742e6fad794eb070088 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sun, 2 Nov 2025 20:12:14 +0800 Subject: [PATCH 11/21] refactor to atomic --- ops/nix/externals/nginx/node.nix | 26 ++++++++ ops/nix/externals/nginx/proxies.nix | 63 +++++++++++++++++++ .../nginx}/proxies/rrv-sh.nix | 0 ops/nix/externals/nginx/ssl.nix | 15 +++-- ops/nix/externals/nginx/virtual-hosts.nix | 50 --------------- ops/nix/helpers/config.nix | 28 --------- ops/nix/helpers/options.nix | 60 ------------------ ops/nix/manifest.nix | 53 ++++++++-------- ops/nix/nodes/default.nix | 8 +-- ops/nix/nodes/nixos/arch.nix | 31 +++++++++ ops/nix/nodes/nixos/createImage.nix | 29 ++++++--- ops/nix/nodes/nixos/modules.nix | 45 +++++++++++++ ops/nix/paths.nix | 23 +++++++ ops/nix/{users => secrets}/sops.nix | 23 +++++-- ops/nix/users/admin.nix | 18 +++--- ops/nix/users/users.nix | 16 +++-- 16 files changed, 278 insertions(+), 210 deletions(-) create mode 100644 ops/nix/externals/nginx/node.nix create mode 100644 ops/nix/externals/nginx/proxies.nix rename ops/nix/{nodes => externals/nginx}/proxies/rrv-sh.nix (100%) delete mode 100644 ops/nix/externals/nginx/virtual-hosts.nix delete mode 100644 ops/nix/helpers/config.nix delete mode 100644 ops/nix/helpers/options.nix create mode 100644 ops/nix/nodes/nixos/arch.nix create mode 100644 ops/nix/nodes/nixos/modules.nix create mode 100644 ops/nix/paths.nix rename ops/nix/{users => secrets}/sops.nix (59%) diff --git a/ops/nix/externals/nginx/node.nix b/ops/nix/externals/nginx/node.nix new file mode 100644 index 00000000..272feafa --- /dev/null +++ b/ops/nix/externals/nginx/node.nix @@ -0,0 +1,26 @@ +{ lib, config, ... }: +let + cfg = config.flake; + inherit (builtins) + attrNames + ; + inherit (lib.modules) mkIf; + inherit (lib.options) mkOption; + inherit (lib.types) enum; +in +{ + options.flake.externals.nginx.node = mkOption { + type = enum (attrNames cfg.nodes.nixos); + }; + config.flake.modules.nixos.default = + { hostName, ... }: + { + config = mkIf (hostName == cfg.externals.nginx.node) { + networking.firewall.allowedTCPPorts = [ + 80 # HTTP + 443 # HTTPS + ]; + services.nginx.enable = true; + }; + }; +} diff --git a/ops/nix/externals/nginx/proxies.nix b/ops/nix/externals/nginx/proxies.nix new file mode 100644 index 00000000..e6290299 --- /dev/null +++ b/ops/nix/externals/nginx/proxies.nix @@ -0,0 +1,63 @@ +{ lib, config, ... }: +let + cfg = config.flake; + inherit (builtins) + toString + map + listToAttrs + attrNames + foldl' + ; + inherit (lib.modules) mkIf; + inherit (lib.options) mkOption; + inherit (lib.trivial) pipe; + inherit (lib.types) + listOf + deferredModule + submodule + str + port + enum + ; + proxyApps = foldl' ( + acc: n: + acc + // { + n.node = (acc.${n.node} or [ ]) ++ n.apps; + } + ) { } cfg.externals.nginx.proxies; +in +{ + options.flake.externals.nginx.proxies = mkOption { + type = listOf (submodule { + options = { + node = mkOption { type = enum (attrNames cfg.nodes.nixos); }; + domain = mkOption { type = str; }; + port = mkOption { type = port; }; + apps = mkOption { type = listOf deferredModule; }; + }; + }); + default = [ ]; + }; + config.flake.modules.nixos.default = + { hostName, ... }: + { + imports = proxyApps.${hostName} or [ ]; + config = mkIf (hostName == cfg.externals.nginx.node) { + services.nginx.virtualHosts = pipe cfg.externals.nginx.proxies [ + (map (proxy: { + name = proxy.domain; + value = { + addSSL = cfg.externals.nginx.ssl.enable; + useACMEHost = if cfg.externals.nginx.ssl.enable then proxy.domain else null; + acmeRoot = null; # needed for DNS validation + locations."/".proxyPass = "http://${ + if (proxy.node == cfg.externals.nginx.node) then "localhost" else proxy.node + }:${toString proxy.port}"; + }; + })) + listToAttrs + ]; + }; + }; +} diff --git a/ops/nix/nodes/proxies/rrv-sh.nix b/ops/nix/externals/nginx/proxies/rrv-sh.nix similarity index 100% rename from ops/nix/nodes/proxies/rrv-sh.nix rename to ops/nix/externals/nginx/proxies/rrv-sh.nix diff --git a/ops/nix/externals/nginx/ssl.nix b/ops/nix/externals/nginx/ssl.nix index 404c2eea..5d1a9d77 100644 --- a/ops/nix/externals/nginx/ssl.nix +++ b/ops/nix/externals/nginx/ssl.nix @@ -1,34 +1,33 @@ { lib, config, ... }: let cfg = config.flake; - modCfg = config.flake.manifest.externals.nginx; - inherit (cfg.manifest.users) admin; + inherit (cfg.users) admin; inherit (cfg.paths) secrets; inherit (lib.modules) mkMerge mkIf; inherit (lib.options) mkOption mkEnableOption; inherit (lib.types) raw str; in { - options.flake.manifest.externals.nginx.ssl = { + options.flake.externals.nginx.ssl = { enable = mkEnableOption ""; dnsProvider = mkOption { type = str; }; certs = mkOption { type = raw; }; }; config.flake.modules.nixos.default = { hostName, config, ... }: - mkIf (hostName == modCfg.node) (mkMerge [ - (mkIf modCfg.ssl.enable { + mkIf (hostName == cfg.externals.nginx.node) (mkMerge [ + (mkIf cfg.externals.nginx.ssl.enable { users.users.nginx.extraGroups = [ "acme" ]; security.acme = { acceptTerms = true; defaults = { inherit (admin) email; - inherit (modCfg.ssl) dnsProvider; + inherit (cfg.externals.nginx.ssl) dnsProvider; }; - inherit (modCfg.ssl) certs; + inherit (cfg.externals.nginx.ssl) certs; }; }) - (mkIf (modCfg.ssl.dnsProvider == "cloudflare" && cfg.manifest.users.sops.enable) { + (mkIf (cfg.externals.nginx.ssl.dnsProvider == "cloudflare" && cfg.secrets.sops.enable) { sops.secrets."keys/cloudflare".sopsFile = secrets + /keys.yaml; security.acme.defaults.credentialFiles."CLOUDFLARE_DNS_API_TOKEN_FILE" = config.sops.secrets."keys/cloudflare".path; diff --git a/ops/nix/externals/nginx/virtual-hosts.nix b/ops/nix/externals/nginx/virtual-hosts.nix deleted file mode 100644 index b4203682..00000000 --- a/ops/nix/externals/nginx/virtual-hosts.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ lib, config, ... }: -let - cfg = config.flake; - modCfg = config.flake.manifest.externals.nginx; - inherit (builtins) - toString - map - concatLists - listToAttrs - attrNames - ; - inherit (lib.attrsets) mapAttrsToList; - inherit (lib.modules) mkIf; - inherit (lib.options) mkOption; - inherit (lib.trivial) pipe; - inherit (lib.types) enum; -in -{ - options.flake.manifest.externals.nginx.node = mkOption { - type = enum (attrNames cfg.manifest.nodes.nixos); - }; - config.flake.modules.nixos.default = - { hostName, ... }: - mkIf (hostName == modCfg.node) { - networking.firewall.allowedTCPPorts = [ - 80 # HTTP - 443 # HTTPS - ]; - services.nginx.enable = true; - services.nginx.virtualHosts = pipe cfg.manifest.nodes.nixos [ - # enrich each proxy attrset with the node name - (mapAttrsToList (nodeName: nodeConfig: map (x: x // { node = nodeName; }) nodeConfig.proxies)) - # combine all proxy attrsets in the manifest - concatLists - # construct virtual host config for proxies - (map (proxy: { - name = proxy.domain; - value = { - addSSL = modCfg.ssl.enable; - useACMEHost = if modCfg.ssl.enable then proxy.domain else null; - acmeRoot = null; # needed for DNS validation - locations."/".proxyPass = "http://${ - if (proxy.node == modCfg.node) then "localhost" else proxy.node - }:${toString proxy.port}"; - }; - })) - listToAttrs - ]; - }; -} diff --git a/ops/nix/helpers/config.nix b/ops/nix/helpers/config.nix deleted file mode 100644 index 434913a6..00000000 --- a/ops/nix/helpers/config.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - inputs, - ... -}: -let - cfg = config.flake; - inherit (cfg) manifest; - inherit (builtins) mapAttrs; - inherit (lib) nixosSystem; -in -{ - imports = [ inputs.flake-parts.flakeModules.modules ]; - flake = { - nixosConfigurations = mapAttrs ( - name: value: - nixosSystem { - specialArgs = { - inherit manifest; - hostName = name; - hostConfig = value; - }; - modules = [ cfg.modules.nixos.default ] ++ value.modules; - } - ) manifest.nodes.nixos; - }; -} diff --git a/ops/nix/helpers/options.nix b/ops/nix/helpers/options.nix deleted file mode 100644 index e56dac19..00000000 --- a/ops/nix/helpers/options.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ lib, config, ... }: -let - cfg = config.flake; - inherit (cfg.paths) root; - inherit (lib.options) mkOption; - inherit (lib.types) - deferredModule - attrsOf - submodule - str - bool - path - listOf - port - ; -in -{ - options.flake = { - manifest = { - nodes.nixos = mkOption { - type = attrsOf (submodule { - options = { - arch = mkOption { type = str; }; - createImage = mkOption { - type = bool; - default = false; - }; - proxies = mkOption { - type = listOf (submodule { - options = { - domain = mkOption { type = str; }; - port = mkOption { type = port; }; - }; - }); - default = [ ]; - }; - modules = mkOption { - type = listOf deferredModule; - default = [ ]; - }; - }; - }); - }; - }; - paths = { - root = mkOption { - type = path; - readOnly = true; - }; - secrets = mkOption { - type = path; - default = root + "/ops/sops"; - }; - www = mkOption { - type = path; - default = root + "/src/www"; - }; - }; - }; -} diff --git a/ops/nix/manifest.nix b/ops/nix/manifest.nix index 081e2527..197b9ba7 100644 --- a/ops/nix/manifest.nix +++ b/ops/nix/manifest.nix @@ -3,43 +3,40 @@ let cfg = config.flake; in { - flake.manifest = { - externals.nginx = { - node = "veil"; - ssl = { - enable = true; - dnsProvider = "cloudflare"; - certs."rrv.sh".extraDomainNames = [ "*.rrv.sh" ]; - }; + flake = { + users.users.rafiq = { + primary = true; + email = "rafiq@rrv.sh"; + pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq"; }; + secrets.sops.enable = true; nodes.nixos = { - nephalem = { - arch = "x86_64"; - }; + nephalem.arch = "x86_64"; veil = { arch = "aarch64"; createImage = true; - modules = with cfg.modules.nixos; [ rrv-sh ]; - proxies = [ - { - domain = "rrv.sh"; - port = 2309; - } - ]; }; }; - users = { - sops.enable = true; - users.rafiq = { - primary = true; - email = "rafiq@rrv.sh"; - pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq"; + externals.nginx = { + node = "veil"; + ssl = { + enable = true; + dnsProvider = "cloudflare"; + certs."rrv.sh".extraDomainNames = [ "*.rrv.sh" ]; }; + proxies = [ + { + node = "veil"; + domain = "rrv.sh"; + port = 2309; + apps = [ cfg.modules.nixos.rrv-sh ]; + } + ]; + }; + templates.pkg-shell = { + path = ./_templates/pkg-shell; + description = "premade package and shell for all systems with flake parts"; }; - }; - flake.templates.pkg-shell = { - path = ./_templates/pkg-shell; - description = "premade package and shell for all systems with flake parts"; }; perSystem = { pkgs, ... }: diff --git a/ops/nix/nodes/default.nix b/ops/nix/nodes/default.nix index c7c48073..a713d69a 100644 --- a/ops/nix/nodes/default.nix +++ b/ops/nix/nodes/default.nix @@ -4,12 +4,7 @@ let in { flake.modules.nixos.default = - { - hostName, - hostConfig, - config, - ... - }: + { hostName, config, ... }: { networking.hostName = hostName; nix.settings = { @@ -23,7 +18,6 @@ in ]; trusted-substituters = [ "https://nix-community.cachix.org" ]; }; - nixpkgs.hostPlatform.system = "${hostConfig.arch}-linux"; services = { openssh.enable = true; tailscale = { diff --git a/ops/nix/nodes/nixos/arch.nix b/ops/nix/nodes/nixos/arch.nix new file mode 100644 index 00000000..5cc179d5 --- /dev/null +++ b/ops/nix/nodes/nixos/arch.nix @@ -0,0 +1,31 @@ +{ + lib, + ... +}: +let + inherit (lib.options) mkOption; + inherit (lib.types) + attrsOf + submoduleWith + str + ; +in +{ + options.flake.nodes.nixos = mkOption { + type = attrsOf (submoduleWith { + modules = [ + { + options = { + arch = mkOption { type = str; }; + }; + } + ]; + }); + }; + config.flake.modules.nixos.default = + { hostConfig, ... }: + { + nixpkgs.hostPlatform.system = "${hostConfig.arch}-linux"; + system.stateVersion = "25.11"; + }; +} diff --git a/ops/nix/nodes/nixos/createImage.nix b/ops/nix/nodes/nixos/createImage.nix index 80bee2a0..c348a872 100644 --- a/ops/nix/nodes/nixos/createImage.nix +++ b/ops/nix/nodes/nixos/createImage.nix @@ -1,21 +1,36 @@ { - inputs, - lib, config, + lib, + inputs, ... }: let cfg = config.flake; - inherit (cfg) manifest; inherit (builtins) mapAttrs; inherit (lib.modules) mkIf; + inherit (lib.options) mkOption; inherit (lib.attrsets) filterAttrs; + inherit (lib.types) attrsOf submoduleWith bool; in { - flake.images = (mapAttrs (name: _: cfg.nixosConfigurations.${name}.config.system.build.sdImage)) ( - filterAttrs (_: value: value.createImage) manifest.nodes.nixos - ); - flake.modules.nixos.default = + options.flake.nodes.nixos = mkOption { + type = attrsOf (submoduleWith { + modules = [ + { + options = { + createImage = mkOption { + type = bool; + default = false; + }; + }; + } + ]; + }); + }; + config.flake.images = + (mapAttrs (name: _: cfg.nixosConfigurations.${name}.config.system.build.sdImage)) + (filterAttrs (_: value: value.createImage) cfg.nodes.nixos); + config.flake.modules.nixos.default = { hostName, hostConfig, ... }: { imports = [ "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-${hostConfig.arch}.nix" ]; diff --git a/ops/nix/nodes/nixos/modules.nix b/ops/nix/nodes/nixos/modules.nix new file mode 100644 index 00000000..c2d4ae2d --- /dev/null +++ b/ops/nix/nodes/nixos/modules.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + inputs, + ... +}: +let + cfg = config.flake; + inherit (builtins) mapAttrs; + inherit (lib) nixosSystem; + inherit (lib.options) mkOption; + inherit (lib.types) + deferredModule + attrsOf + submoduleWith + listOf + ; +in +{ + imports = [ inputs.flake-parts.flakeModules.modules ]; + options.flake.nodes.nixos = mkOption { + type = attrsOf (submoduleWith { + modules = [ + { + options = { + modules = mkOption { + type = listOf deferredModule; + default = [ ]; + }; + }; + } + ]; + }); + }; + config.flake.nixosConfigurations = mapAttrs ( + name: value: + nixosSystem { + specialArgs = { + hostName = name; + hostConfig = value; + }; + modules = [ cfg.modules.nixos.default ] ++ value.modules; + } + ) cfg.nodes.nixos; +} diff --git a/ops/nix/paths.nix b/ops/nix/paths.nix new file mode 100644 index 00000000..6ab751b4 --- /dev/null +++ b/ops/nix/paths.nix @@ -0,0 +1,23 @@ +{ lib, config, ... }: +let + cfg = config.flake; + inherit (cfg.paths) root; + inherit (lib.options) mkOption; + inherit (lib.types) path; +in +{ + options.flake.paths = { + root = mkOption { + type = path; + readOnly = true; + }; + secrets = mkOption { + type = path; + default = root + "/ops/sops"; + }; + www = mkOption { + type = path; + default = root + "/src/www"; + }; + }; +} diff --git a/ops/nix/users/sops.nix b/ops/nix/secrets/sops.nix similarity index 59% rename from ops/nix/users/sops.nix rename to ops/nix/secrets/sops.nix index d2d7338b..626ed7a7 100644 --- a/ops/nix/users/sops.nix +++ b/ops/nix/secrets/sops.nix @@ -1,4 +1,3 @@ -# provide sops to the whole flake { inputs, config, @@ -7,14 +6,16 @@ }: let cfg = config.flake; + sopsFilePath = secrets + /users.yaml; inherit (cfg.paths) secrets; + inherit (cfg.users) admin; + inherit (builtins) hasAttr pathExists; inherit (lib.attrsets) mapAttrs'; - inherit (cfg.manifest.users) admin; inherit (lib.options) mkEnableOption; inherit (lib.modules) mkIf; in { - options.flake.manifest.users.sops.enable = mkEnableOption ""; + options.flake.secrets.sops.enable = mkEnableOption ""; config.flake.modules.nixos.default = { config, ... }: let @@ -22,7 +23,17 @@ in in { imports = [ inputs.sops-nix.nixosModules.sops ]; - config = mkIf cfg.manifest.users.sops.enable { + config = mkIf cfg.secrets.sops.enable { + assertions = [ + { + assertion = hasAttr "users" cfg; + message = "You must have included the users module and defined users to use `secrets.sops`."; + } + { + assertion = pathExists sopsFilePath; + message = "You must have created ${sopsFilePath} to set user passwords."; + } + ]; system.activationScripts.ensureSshKey.text = # bash '' path="${sshKeyPath}" @@ -37,9 +48,9 @@ in name = "${name}/hashedPassword"; value = { neededForUsers = true; - sopsFile = secrets + /users.yaml; + sopsFile = sopsFilePath; }; - }) cfg.manifest.users; + }) cfg.users.users; }; }; } diff --git a/ops/nix/users/admin.nix b/ops/nix/users/admin.nix index 40975ab0..60de50eb 100644 --- a/ops/nix/users/admin.nix +++ b/ops/nix/users/admin.nix @@ -6,19 +6,15 @@ let inherit (lib.options) mkOption; inherit (lib.attrsets) filterAttrs; inherit (lib.lists) elemAt; - manifestAdmin = elemAt (attrValues ( - filterAttrs (_: value: value.primary or false) cfg.manifest.users.users - )) 0; + adminCfg = elemAt (attrValues (filterAttrs (_: value: value.primary or false) cfg.users.users)) 0; in { - options.flake.manifest.users = { - admin.username = mkOption { type = str; }; - admin.email = mkOption { type = str; }; + options.flake.users.admin = { + username = mkOption { type = str; }; + email = mkOption { type = str; }; }; - config.flake.manifest.users = { - admin.username = elemAt (attrNames ( - filterAttrs (_: value: value.primary or false) cfg.manifest.users.users - )) 0; - admin.email = manifestAdmin.email; + config.flake.users.admin = { + inherit (adminCfg) email; + username = elemAt (attrNames (filterAttrs (_: value: value.primary or false) cfg.users.users)) 0; }; } diff --git a/ops/nix/users/users.nix b/ops/nix/users/users.nix index 3ce34bf9..26916fc2 100644 --- a/ops/nix/users/users.nix +++ b/ops/nix/users/users.nix @@ -1,14 +1,14 @@ { lib, config, ... }: let cfg = config.flake; - inherit (builtins) mapAttrs; + inherit (builtins) mapAttrs attrValues; inherit (lib.types) str attrsOf submodule; inherit (lib.options) mkOption mkEnableOption; inherit (lib.modules) mkIf; - inherit (lib.lists) optional; + inherit (lib.lists) optional any; in { - options.flake.manifest.users.users = mkOption { + options.flake.users.users = mkOption { type = attrsOf (submodule { options = { primary = mkEnableOption ""; @@ -20,17 +20,23 @@ in config.flake.modules.nixos.default = { config, ... }: { + assertions = [ + { + assertion = any (u: u.primary) (attrValues cfg.users.users); + message = "At least one user must have `primary = true` in flake.users.users."; + } + ]; security.sudo.wheelNeedsPassword = false; users = { groups.users.gid = 100; mutableUsers = false; users = mapAttrs (username: userConfig: { extraGroups = optional userConfig.primary "wheel"; - hashedPasswordFile = mkIf (cfg.manifest.options.sops.enable or false + hashedPasswordFile = mkIf (cfg.secrets.sops.enable or false ) config.sops.secrets."${username}/hashedPassword".path; isNormalUser = true; openssh.authorizedKeys.keys = [ userConfig.pubkey ]; - }) cfg.manifest.users.users; + }) cfg.users.users; }; }; } From a8822cab990e47cb94452362041645c82d1bfa78 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sun, 2 Nov 2025 21:19:22 +0800 Subject: [PATCH 12/21] works --- ops/nix/externals/nginx/proxies.nix | 39 +++++++++-------- ops/nix/manifest.nix | 6 +-- ops/nix/nodes/_nodeOptions.nix | 5 +++ ops/nix/nodes/default.nix | 65 ++++++++++++++++++----------- ops/nix/nodes/nixos.nix | 35 ++++++++++++++++ ops/nix/nodes/nixos/arch.nix | 31 -------------- ops/nix/nodes/nixos/createImage.nix | 42 ------------------- ops/nix/nodes/nixos/modules.nix | 45 -------------------- 8 files changed, 100 insertions(+), 168 deletions(-) create mode 100644 ops/nix/nodes/_nodeOptions.nix create mode 100644 ops/nix/nodes/nixos.nix delete mode 100644 ops/nix/nodes/nixos/arch.nix delete mode 100644 ops/nix/nodes/nixos/createImage.nix delete mode 100644 ops/nix/nodes/nixos/modules.nix diff --git a/ops/nix/externals/nginx/proxies.nix b/ops/nix/externals/nginx/proxies.nix index e6290299..fab2e8bd 100644 --- a/ops/nix/externals/nginx/proxies.nix +++ b/ops/nix/externals/nginx/proxies.nix @@ -2,39 +2,31 @@ let cfg = config.flake; inherit (builtins) - toString - map - listToAttrs attrNames foldl' + listToAttrs + map + toString ; - inherit (lib.modules) mkIf; - inherit (lib.options) mkOption; - inherit (lib.trivial) pipe; inherit (lib.types) + enum listOf - deferredModule - submodule - str port - enum + str + submodule ; - proxyApps = foldl' ( - acc: n: - acc - // { - n.node = (acc.${n.node} or [ ]) ++ n.apps; - } - ) { } cfg.externals.nginx.proxies; + inherit (lib.modules) mkIf; + inherit (lib.options) mkOption; + inherit (lib.trivial) pipe; in { options.flake.externals.nginx.proxies = mkOption { type = listOf (submodule { options = { - node = mkOption { type = enum (attrNames cfg.nodes.nixos); }; + apps = mkOption { type = enum (attrNames cfg.modules.nixos); }; domain = mkOption { type = str; }; + node = mkOption { type = enum (attrNames cfg.nodes.nixos); }; port = mkOption { type = port; }; - apps = mkOption { type = listOf deferredModule; }; }; }); default = [ ]; @@ -42,7 +34,14 @@ in config.flake.modules.nixos.default = { hostName, ... }: { - imports = proxyApps.${hostName} or [ ]; + imports = + (foldl' ( + acc: n: + acc + // { + n.node = (acc.${n.node} or [ ]) ++ (map (app: cfg.modules.nixos.${app}) n.apps); + } + ) { } cfg.externals.nginx.proxies).${hostName} or [ ]; config = mkIf (hostName == cfg.externals.nginx.node) { services.nginx.virtualHosts = pipe cfg.externals.nginx.proxies [ (map (proxy: { diff --git a/ops/nix/manifest.nix b/ops/nix/manifest.nix index 197b9ba7..0db094fd 100644 --- a/ops/nix/manifest.nix +++ b/ops/nix/manifest.nix @@ -1,7 +1,3 @@ -{ config, ... }: -let - cfg = config.flake; -in { flake = { users.users.rafiq = { @@ -29,7 +25,7 @@ in node = "veil"; domain = "rrv.sh"; port = 2309; - apps = [ cfg.modules.nixos.rrv-sh ]; + apps = [ "rrv-sh" ]; } ]; }; diff --git a/ops/nix/nodes/_nodeOptions.nix b/ops/nix/nodes/_nodeOptions.nix new file mode 100644 index 00000000..c17f05a2 --- /dev/null +++ b/ops/nix/nodes/_nodeOptions.nix @@ -0,0 +1,5 @@ +{ lib }: +let + inherit (lib.types) raw; +in +raw diff --git a/ops/nix/nodes/default.nix b/ops/nix/nodes/default.nix index a713d69a..f8f84e09 100644 --- a/ops/nix/nodes/default.nix +++ b/ops/nix/nodes/default.nix @@ -1,31 +1,46 @@ -{ config, ... }: +{ + inputs, + config, + lib, + ... +}: let - inherit (config.flake.paths) secrets; + cfg = config.flake; + inherit (lib.modules) mkIf mkMerge; + inherit (cfg.paths) secrets; in { - flake.modules.nixos.default = - { hostName, config, ... }: + config.flake.modules.nixos.default = + { hostName, hostConfig, ... }: { - networking.hostName = hostName; - nix.settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; - substituters = [ "https://nix-community.cachix.org" ]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - trusted-substituters = [ "https://nix-community.cachix.org" ]; - }; - services = { - openssh.enable = true; - tailscale = { - authKeyFile = config.sops.secrets."keys/tailscale".path; - enable = true; - }; - }; - sops.secrets."keys/tailscale".sopsFile = secrets + /keys.yaml; - system.stateVersion = "25.11"; + imports = [ "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-${hostConfig.arch}.nix" ]; + config = mkMerge [ + (mkIf hostConfig.createImage { + image.fileName = "nixos-25-11-${hostConfig.arch}-${hostName}.img"; + sdImage.compressImage = false; + }) + { + nixpkgs.hostPlatform.system = "${hostConfig.arch}-linux"; + networking.hostName = hostName; + nix.settings = { + experimental-features = [ + "nix-command" + "flakes" + ]; + substituters = [ "https://nix-community.cachix.org" ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + trusted-substituters = [ "https://nix-community.cachix.org" ]; + }; + services = { + openssh.enable = true; + tailscale.enable = true; + tailscale.authKeyFile = config.sops.secrets."keys/tailscale".path or null; + }; + sops.secrets."keys/tailscale".sopsFile = secrets + /keys.yaml; + system.stateVersion = "25.11"; + } + ]; }; } diff --git a/ops/nix/nodes/nixos.nix b/ops/nix/nodes/nixos.nix new file mode 100644 index 00000000..1b786d1a --- /dev/null +++ b/ops/nix/nodes/nixos.nix @@ -0,0 +1,35 @@ +{ + inputs, + config, + lib, + ... +}: +let + cfg = config.flake; + inherit (builtins) mapAttrs; + inherit (lib) nixosSystem; + inherit (lib.options) mkOption; + inherit (lib.attrsets) filterAttrs; + inherit (lib.types) attrsOf; +in +{ + imports = [ inputs.flake-parts.flakeModules.modules ]; + options.flake.nodes.nixos = mkOption { + type = attrsOf (import ./_nodeOptions.nix { inherit lib; }); + }; + config.flake = { + images = (mapAttrs (name: _: cfg.nixosConfigurations.${name}.config.system.build.sdImage)) ( + filterAttrs (_: value: value.createImage or false) cfg.nodes.nixos + ); + nixosConfigurations = mapAttrs ( + name: value: + nixosSystem { + specialArgs = { + hostName = name; + hostConfig = value; + }; + modules = [ cfg.modules.nixos.default ]; + } + ) cfg.nodes.nixos; + }; +} diff --git a/ops/nix/nodes/nixos/arch.nix b/ops/nix/nodes/nixos/arch.nix deleted file mode 100644 index 5cc179d5..00000000 --- a/ops/nix/nodes/nixos/arch.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ - lib, - ... -}: -let - inherit (lib.options) mkOption; - inherit (lib.types) - attrsOf - submoduleWith - str - ; -in -{ - options.flake.nodes.nixos = mkOption { - type = attrsOf (submoduleWith { - modules = [ - { - options = { - arch = mkOption { type = str; }; - }; - } - ]; - }); - }; - config.flake.modules.nixos.default = - { hostConfig, ... }: - { - nixpkgs.hostPlatform.system = "${hostConfig.arch}-linux"; - system.stateVersion = "25.11"; - }; -} diff --git a/ops/nix/nodes/nixos/createImage.nix b/ops/nix/nodes/nixos/createImage.nix deleted file mode 100644 index c348a872..00000000 --- a/ops/nix/nodes/nixos/createImage.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ - config, - lib, - inputs, - ... -}: -let - cfg = config.flake; - inherit (builtins) mapAttrs; - inherit (lib.modules) mkIf; - inherit (lib.options) mkOption; - inherit (lib.attrsets) filterAttrs; - inherit (lib.types) attrsOf submoduleWith bool; -in -{ - options.flake.nodes.nixos = mkOption { - type = attrsOf (submoduleWith { - modules = [ - { - options = { - createImage = mkOption { - type = bool; - default = false; - }; - }; - } - ]; - }); - }; - config.flake.images = - (mapAttrs (name: _: cfg.nixosConfigurations.${name}.config.system.build.sdImage)) - (filterAttrs (_: value: value.createImage) cfg.nodes.nixos); - config.flake.modules.nixos.default = - { hostName, hostConfig, ... }: - { - imports = [ "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-${hostConfig.arch}.nix" ]; - config = mkIf hostConfig.createImage { - image.fileName = "nixos-25-11-${hostConfig.arch}-${hostName}.img"; - sdImage.compressImage = false; - }; - }; -} diff --git a/ops/nix/nodes/nixos/modules.nix b/ops/nix/nodes/nixos/modules.nix deleted file mode 100644 index c2d4ae2d..00000000 --- a/ops/nix/nodes/nixos/modules.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - config, - lib, - inputs, - ... -}: -let - cfg = config.flake; - inherit (builtins) mapAttrs; - inherit (lib) nixosSystem; - inherit (lib.options) mkOption; - inherit (lib.types) - deferredModule - attrsOf - submoduleWith - listOf - ; -in -{ - imports = [ inputs.flake-parts.flakeModules.modules ]; - options.flake.nodes.nixos = mkOption { - type = attrsOf (submoduleWith { - modules = [ - { - options = { - modules = mkOption { - type = listOf deferredModule; - default = [ ]; - }; - }; - } - ]; - }); - }; - config.flake.nixosConfigurations = mapAttrs ( - name: value: - nixosSystem { - specialArgs = { - hostName = name; - hostConfig = value; - }; - modules = [ cfg.modules.nixos.default ] ++ value.modules; - } - ) cfg.nodes.nixos; -} From 4ce56218b5a0c47cf9d28c9d152322ee53527b6d Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sun, 2 Nov 2025 22:13:19 +0800 Subject: [PATCH 13/21] build(nix): init facter --- flake.lock | 16 + flake.nix | 1 + ops/facter/rpi4b.json | 1005 +++++++++++++++++++++++++++++++++++++ ops/nix/manifest.nix | 3 +- ops/nix/nodes/default.nix | 62 +-- ops/nix/nodes/facter.nix | 9 + ops/nix/nodes/nixos.nix | 26 +- 7 files changed, 1067 insertions(+), 55 deletions(-) create mode 100644 ops/facter/rpi4b.json create mode 100644 ops/nix/nodes/facter.nix diff --git a/flake.lock b/flake.lock index 36912bf7..71b50242 100644 --- a/flake.lock +++ b/flake.lock @@ -76,6 +76,21 @@ "type": "github" } }, + "nixos-facter-modules": { + "locked": { + "lastModified": 1761137276, + "narHash": "sha256-4lDjGnWRBLwqKQ4UWSUq6Mvxu9r8DSqCCydodW/Jsi8=", + "owner": "nix-community", + "repo": "nixos-facter-modules", + "rev": "70bcd64225d167c7af9b475c4df7b5abba5c7de8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-facter-modules", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1759036355, @@ -98,6 +113,7 @@ "home-manager": "home-manager", "import-tree": "import-tree", "nix-darwin": "nix-darwin", + "nixos-facter-modules": "nixos-facter-modules", "nixpkgs": "nixpkgs", "rrv-sh": "rrv-sh", "sops-nix": "sops-nix", diff --git a/flake.nix b/flake.nix index ffa27706..bcb59891 100644 --- a/flake.nix +++ b/flake.nix @@ -22,5 +22,6 @@ systems.url = "github:nix-systems/default"; rrv-sh.url = "github:rrvsh/rrv.sh"; rrv-sh.inputs.nixpkgs.follows = "nixpkgs"; + nixos-facter-modules.url = "github:nix-community/nixos-facter-modules"; }; } diff --git a/ops/facter/rpi4b.json b/ops/facter/rpi4b.json new file mode 100644 index 00000000..bcb3ba20 --- /dev/null +++ b/ops/facter/rpi4b.json @@ -0,0 +1,1005 @@ +{ + "version": 1, + "system": "aarch64-linux", + "virtualisation": "none", + "hardware": { + "bridge": [ + { + "index": 8, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "14e4", + "name": "Broadcom", + "value": 5348 + }, + "device": { + "hex": "2711", + "value": 10001 + }, + "revision": { + "hex": "0010", + "value": 16 + }, + "model": "Broadcom PCI bridge", + "sysfs_id": "/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0", + "sysfs_bus_id": "0000:00:00.0", + "detail": { + "function": 0, + "command": 6, + "header_type": 1, + "secondary_bus": 1, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v000014E4d00002711sv00000000sd00000000bc06sc04i00" + } + ], + "cpu": [ + { + "architecture": "aarch64", + "vendor_name": "ARM Limited", + "family": 0, + "model": 3, + "stepping": 0, + "features": [ + "fp", + "asimd", + "evtstrm", + "crc32", + "cpuid" + ], + "bogo": 108, + "page_size": 4096, + "physical_id": 0, + "fpu": false, + "fpu_exception": false, + "write_protect": false, + "address_sizes": { + "physical": "0x0", + "virtual": "0x0" + } + } + ], + "disk": [ + { + "index": 16, + "attached_to": 14, + "class_list": [ + "disk", + "block_device" + ], + "base_class": { + "hex": "0106", + "name": "Mass Storage Device", + "value": 262 + }, + "sub_class": { + "hex": "0000", + "name": "Disk", + "value": 0 + }, + "serial": "0x597e0bab", + "model": "Disk", + "sysfs_id": "/class/block/mmcblk1", + "sysfs_bus_id": "mmc1:aaaa", + "sysfs_device_link": "/devices/platform/emmc2bus/fe340000.mmc/mmc_host/mmc1/mmc1:aaaa", + "unix_device_names": [ + "/dev/disk/by-id/mmc-SD32G_0x597e0bab", + "/dev/disk/by-path/platform-fe340000.mmc", + "/dev/mmcblk1" + ], + "resources": [ + { + "type": "disk_geo", + "cylinders": 973968, + "heads": 4, + "sectors": 16, + "size": "0x0", + "geo_type": "logical" + }, + { + "type": "size", + "unit": "sectors", + "value_1": 62333952, + "value_2": 512 + } + ], + "driver": "sdhci-iproc", + "drivers": [ + "mmcblk", + "sdhci-iproc" + ] + } + ], + "hub": [ + { + "index": 17, + "attached_to": 7, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.12.49 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0002", + "name": "xHCI Host Controller", + "value": 2 + }, + "revision": { + "hex": "0000", + "name": "6.12", + "value": 0 + }, + "serial": "0000:01:00.0", + "model": "Linux 6.12.49 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-0:1.0", + "sysfs_bus_id": "1-0:1.0", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 1, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v1D6Bp0002d0612dc09dsc00dp01ic09isc00ip00in00" + }, + { + "index": 18, + "attached_to": 17, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "2109", + "value": 8457 + }, + "device": { + "hex": "3431", + "name": "USB2.0 Hub", + "value": 13361 + }, + "revision": { + "hex": "0000", + "name": "4.21", + "value": 0 + }, + "model": "USB2.0 Hub", + "sysfs_id": "/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1:1.0", + "sysfs_bus_id": "1-1:1.0", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 1, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v2109p3431d0421dc09dsc00dp01ic09isc00ip00in00" + }, + { + "index": 19, + "attached_to": 7, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.12.49 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0003", + "name": "xHCI Host Controller", + "value": 3 + }, + "revision": { + "hex": "0000", + "name": "6.12", + "value": 0 + }, + "serial": "0000:01:00.0", + "model": "Linux 6.12.49 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb2/2-0:1.0", + "sysfs_bus_id": "2-0:1.0", + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 3, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v1D6Bp0003d0612dc09dsc00dp03ic09isc00ip00in00" + } + ], + "memory": [ + { + "index": 6, + "attached_to": 0, + "class_list": [ + "memory" + ], + "base_class": { + "hex": "0101", + "name": "Internally Used Class", + "value": 257 + }, + "sub_class": { + "hex": "0002", + "name": "Main Memory", + "value": 2 + }, + "model": "Main Memory", + "resources": [ + { + "type": "phys_mem", + "range": 4026531840 + } + ] + } + ], + "mmc_controller": [ + { + "index": 14, + "attached_to": 0, + "class_list": [ + "mmc_controller" + ], + "bus_type": { + "hex": "0093", + "name": "MMC", + "value": 147 + }, + "slot": { + "bus": 0, + "number": 1 + }, + "base_class": { + "hex": "0117", + "name": "MMC Controller", + "value": 279 + }, + "vendor": "", + "device": "SD Controller 1", + "model": "SD Controller 1", + "sysfs_id": "/devices/platform/emmc2bus/fe340000.mmc/mmc_host/mmc1/mmc1:aaaa", + "sysfs_bus_id": "mmc1:aaaa", + "driver": "mmcblk", + "drivers": [ + "mmcblk" + ] + }, + { + "index": 15, + "attached_to": 0, + "class_list": [ + "mmc_controller" + ], + "bus_type": { + "hex": "0093", + "name": "MMC", + "value": 147 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0117", + "name": "MMC Controller", + "value": 279 + }, + "vendor": "", + "device": "SDIO Controller 0", + "model": "SDIO Controller 0", + "sysfs_id": "/devices/platform/soc/fe300000.mmc/mmc_host/mmc0/mmc0:0001", + "sysfs_bus_id": "mmc0:0001" + } + ], + "network_controller": [ + { + "index": 10, + "attached_to": 0, + "class_list": [ + "network_controller", + "wlan_card" + ], + "bus_type": { + "hex": "0094", + "name": "SDIO", + "value": 148 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0002", + "name": "Network controller", + "value": 2 + }, + "sub_class": { + "hex": "0082", + "name": "WLAN controller", + "value": 130 + }, + "vendor": { + "hex": "02d0", + "name": "Broadcom Corp.", + "value": 720 + }, + "device": { + "hex": "a9a6", + "name": "BCM43438 combo WLAN and Bluetooth Low Energy (BLE)", + "value": 43430 + }, + "model": "Broadcom BCM43438 combo WLAN and Bluetooth Low Energy (BLE)", + "sysfs_id": "/devices/platform/soc/fe300000.mmc/mmc_host/mmc0/mmc0:0001/mmc0:0001:1", + "sysfs_bus_id": "mmc0:0001:1", + "unix_device_names": [ + "wlan0" + ], + "resources": [ + { + "type": "hwaddr", + "address": 101 + }, + { + "type": "phwaddr", + "address": 101 + }, + { + "type": "wlan", + "channels": [ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "36", + "40", + "44", + "48", + "52", + "56", + "60", + "64", + "100", + "104", + "108", + "112", + "116", + "120", + "124", + "128", + "132", + "136", + "140", + "144", + "149" + ], + "frequencies": [ + "2.412", + "2.417", + "2.422", + "2.427", + "2.432", + "2.437", + "2.442", + "2.447", + "2.452", + "2.457", + "2.462", + "5.18", + "5.2", + "5.22", + "5.24", + "5.26", + "5.28", + "5.3", + "5.32", + "5.5", + "5.52", + "5.54", + "5.56", + "5.58", + "5.6", + "5.62", + "5.64", + "5.66", + "5.68", + "5.7", + "5.72", + "5.745" + ], + "auth_modes": [ + "open", + "sharedkey", + "wpa-psk", + "wpa-eap" + ], + "enc_modes": [ + "WEP40", + "WEP104", + "TKIP", + "CCMP" + ] + } + ], + "driver": "brcmfmac", + "driver_module": "brcmfmac", + "drivers": [ + "brcmfmac" + ], + "driver_modules": [ + "brcmfmac", + "brcmfmac", + "brcmfmac" + ], + "module_alias": "sdio:c00v02D0dA9A6" + }, + { + "index": 12, + "attached_to": 0, + "class_list": [ + "network_controller" + ], + "base_class": { + "hex": "0002", + "name": "Network controller", + "value": 2 + }, + "sub_class": { + "hex": "0000", + "name": "Ethernet controller", + "value": 0 + }, + "device": { + "hex": "0000", + "name": "ARM Ethernet controller", + "value": 0 + }, + "model": "ARM Ethernet controller", + "sysfs_id": "/devices/platform/scb/fd580000.ethernet", + "sysfs_bus_id": "fd580000.ethernet", + "unix_device_names": [ + "end0" + ], + "resources": [ + { + "type": "hwaddr", + "address": 101 + }, + { + "type": "phwaddr", + "address": 101 + } + ], + "driver": "bcmgenet", + "driver_module": "genet", + "drivers": [ + "bcmgenet" + ], + "driver_modules": [ + "genet" + ], + "module_alias": "of:NethernetT(null)Cbrcm,bcm2711-genet-v5" + } + ], + "network_interface": [ + { + "index": 21, + "attached_to": 10, + "class_list": [ + "network_interface" + ], + "base_class": { + "hex": "0107", + "name": "Network Interface", + "value": 263 + }, + "sub_class": { + "hex": "000a", + "name": "WLAN", + "value": 10 + }, + "model": "WLAN network interface", + "sysfs_id": "/class/net/wlan0", + "sysfs_device_link": "/devices/platform/soc/fe300000.mmc/mmc_host/mmc0/mmc0:0001/mmc0:0001:1", + "unix_device_names": [ + "wlan0" + ], + "resources": [ + { + "type": "hwaddr", + "address": 101 + }, + { + "type": "phwaddr", + "address": 101 + } + ], + "driver": "brcmfmac", + "driver_module": "brcmfmac", + "drivers": [ + "brcmfmac" + ], + "driver_modules": [ + "brcmfmac", + "brcmfmac", + "brcmfmac" + ] + }, + { + "index": 22, + "attached_to": 0, + "class_list": [ + "network_interface" + ], + "base_class": { + "hex": "0107", + "name": "Network Interface", + "value": 263 + }, + "sub_class": { + "hex": "0000", + "name": "Loopback", + "value": 0 + }, + "model": "Loopback network interface", + "sysfs_id": "/class/net/lo", + "unix_device_names": [ + "lo" + ] + }, + { + "index": 23, + "attached_to": 12, + "class_list": [ + "network_interface" + ], + "base_class": { + "hex": "0107", + "name": "Network Interface", + "value": 263 + }, + "sub_class": { + "hex": "0001", + "name": "Ethernet", + "value": 1 + }, + "model": "Ethernet network interface", + "sysfs_id": "/class/net/end0", + "sysfs_device_link": "/devices/platform/scb/fd580000.ethernet", + "unix_device_names": [ + "end0" + ], + "resources": [ + { + "type": "hwaddr", + "address": 101 + }, + { + "type": "phwaddr", + "address": 101 + } + ], + "driver": "bcmgenet", + "driver_module": "genet", + "drivers": [ + "bcmgenet" + ], + "driver_modules": [ + "genet" + ] + } + ], + "system": {}, + "unknown": [ + { + "index": 9, + "attached_to": 0, + "class_list": [ + "unknown" + ], + "bus_type": { + "hex": "0094", + "name": "SDIO", + "value": 148 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": { + "hex": "02d0", + "name": "Broadcom Corp.", + "value": 720 + }, + "device": { + "hex": "a9a6", + "name": "BCM43438 combo WLAN and Bluetooth Low Energy (BLE)", + "value": 43430 + }, + "model": "Broadcom BCM43438 combo WLAN and Bluetooth Low Energy (BLE)", + "sysfs_id": "/devices/platform/soc/fe300000.mmc/mmc_host/mmc0/mmc0:0001/mmc0:0001:3", + "sysfs_bus_id": "mmc0:0001:3", + "module_alias": "sdio:c02v02D0dA9A6" + }, + { + "index": 11, + "attached_to": 0, + "class_list": [ + "unknown" + ], + "bus_type": { + "hex": "0094", + "name": "SDIO", + "value": 148 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": { + "hex": "02d0", + "name": "Broadcom Corp.", + "value": 720 + }, + "device": { + "hex": "a9a6", + "name": "BCM43438 combo WLAN and Bluetooth Low Energy (BLE)", + "value": 43430 + }, + "model": "Broadcom BCM43438 combo WLAN and Bluetooth Low Energy (BLE)", + "sysfs_id": "/devices/platform/soc/fe300000.mmc/mmc_host/mmc0/mmc0:0001/mmc0:0001:2", + "sysfs_bus_id": "mmc0:0001:2", + "driver": "brcmfmac", + "driver_module": "brcmfmac", + "drivers": [ + "brcmfmac" + ], + "driver_modules": [ + "brcmfmac", + "brcmfmac", + "brcmfmac" + ], + "module_alias": "sdio:c00v02D0dA9A6" + } + ], + "usb_controller": [ + { + "index": 7, + "attached_to": 8, + "class_list": [ + "usb_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 1, + "number": 0 + }, + "base_class": { + "hex": "000c", + "name": "Serial bus controller", + "value": 12 + }, + "sub_class": { + "hex": "0003", + "name": "USB Controller", + "value": 3 + }, + "pci_interface": { + "hex": "0030", + "value": 48 + }, + "vendor": { + "hex": "1106", + "value": 4358 + }, + "sub_vendor": { + "hex": "1106", + "value": 4358 + }, + "device": { + "hex": "3483", + "value": 13443 + }, + "sub_device": { + "hex": "3483", + "value": 13443 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "USB Controller", + "sysfs_id": "/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0", + "sysfs_bus_id": "0000:01:00.0", + "detail": { + "function": 0, + "command": 1350, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 48 + }, + "driver": "xhci_hcd", + "driver_module": "xhci_pci", + "drivers": [ + "xhci_hcd" + ], + "driver_modules": [ + "xhci_pci" + ], + "module_alias": "pci:v00001106d00003483sv00001106sd00003483bc0Csc03i30" + }, + { + "index": 13, + "attached_to": 0, + "class_list": [ + "usb_controller" + ], + "base_class": { + "hex": "000c", + "name": "Serial bus controller", + "value": 12 + }, + "sub_class": { + "hex": "0003", + "name": "USB Controller", + "value": 3 + }, + "pci_interface": { + "hex": "0000", + "name": "UHCI", + "value": 0 + }, + "device": { + "hex": "0000", + "name": "ARM USB controller", + "value": 0 + }, + "model": "ARM USB controller", + "sysfs_id": "/devices/platform/soc/fe980000.usb", + "sysfs_bus_id": "fe980000.usb", + "driver": "dwc2", + "drivers": [ + "dwc2" + ], + "driver_info": { + "type": "module", + "db_entry_0": [ + "uhci-hcd" + ], + "active": false, + "modprobe": true, + "names": [ + "uhci-hcd" + ], + "module_args": [ + "" + ], + "conf": "" + }, + "module_alias": "of:NusbT(null)Cbrcm,bcm2835-usb" + } + ] + }, + "smbios": {} +} diff --git a/ops/nix/manifest.nix b/ops/nix/manifest.nix index 0db094fd..13faac2e 100644 --- a/ops/nix/manifest.nix +++ b/ops/nix/manifest.nix @@ -7,9 +7,8 @@ }; secrets.sops.enable = true; nodes.nixos = { - nephalem.arch = "x86_64"; veil = { - arch = "aarch64"; + facter = ../facter/rpi4b.json; createImage = true; }; }; diff --git a/ops/nix/nodes/default.nix b/ops/nix/nodes/default.nix index f8f84e09..ff197d78 100644 --- a/ops/nix/nodes/default.nix +++ b/ops/nix/nodes/default.nix @@ -1,46 +1,34 @@ -{ - inputs, - config, - lib, - ... -}: +{ config, ... }: let cfg = config.flake; - inherit (lib.modules) mkIf mkMerge; inherit (cfg.paths) secrets; in { config.flake.modules.nixos.default = - { hostName, hostConfig, ... }: { - imports = [ "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-${hostConfig.arch}.nix" ]; - config = mkMerge [ - (mkIf hostConfig.createImage { - image.fileName = "nixos-25-11-${hostConfig.arch}-${hostName}.img"; - sdImage.compressImage = false; - }) - { - nixpkgs.hostPlatform.system = "${hostConfig.arch}-linux"; - networking.hostName = hostName; - nix.settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; - substituters = [ "https://nix-community.cachix.org" ]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - trusted-substituters = [ "https://nix-community.cachix.org" ]; - }; - services = { - openssh.enable = true; - tailscale.enable = true; - tailscale.authKeyFile = config.sops.secrets."keys/tailscale".path or null; - }; - sops.secrets."keys/tailscale".sopsFile = secrets + /keys.yaml; - system.stateVersion = "25.11"; - } - ]; + hostName, + config, + ... + }: + { + networking.hostName = hostName; + nix.settings = { + experimental-features = [ + "nix-command" + "flakes" + ]; + substituters = [ "https://nix-community.cachix.org" ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + trusted-substituters = [ "https://nix-community.cachix.org" ]; + }; + services = { + openssh.enable = true; + tailscale.enable = true; + tailscale.authKeyFile = config.sops.secrets."keys/tailscale".path or null; + }; + sops.secrets."keys/tailscale".sopsFile = secrets + /keys.yaml; + system.stateVersion = "25.11"; }; } diff --git a/ops/nix/nodes/facter.nix b/ops/nix/nodes/facter.nix new file mode 100644 index 00000000..d94c3987 --- /dev/null +++ b/ops/nix/nodes/facter.nix @@ -0,0 +1,9 @@ +{ inputs, ... }: +{ + flake.modules.nixos.default = + { hostConfig, ... }: + { + imports = [ inputs.nixos-facter-modules.nixosModules.facter ]; + facter.reportPath = hostConfig.facter or null; + }; +} diff --git a/ops/nix/nodes/nixos.nix b/ops/nix/nodes/nixos.nix index 1b786d1a..58cdf3b8 100644 --- a/ops/nix/nodes/nixos.nix +++ b/ops/nix/nodes/nixos.nix @@ -9,7 +9,6 @@ let inherit (builtins) mapAttrs; inherit (lib) nixosSystem; inherit (lib.options) mkOption; - inherit (lib.attrsets) filterAttrs; inherit (lib.types) attrsOf; in { @@ -17,19 +16,14 @@ in options.flake.nodes.nixos = mkOption { type = attrsOf (import ./_nodeOptions.nix { inherit lib; }); }; - config.flake = { - images = (mapAttrs (name: _: cfg.nixosConfigurations.${name}.config.system.build.sdImage)) ( - filterAttrs (_: value: value.createImage or false) cfg.nodes.nixos - ); - nixosConfigurations = mapAttrs ( - name: value: - nixosSystem { - specialArgs = { - hostName = name; - hostConfig = value; - }; - modules = [ cfg.modules.nixos.default ]; - } - ) cfg.nodes.nixos; - }; + config.flake.nixosConfigurations = mapAttrs ( + name: value: + nixosSystem { + specialArgs = { + hostName = name; + hostConfig = value; + }; + modules = [ cfg.modules.nixos.default ]; + } + ) cfg.nodes.nixos; } From ac7f3609f52d4a3f413218f3e793c1a730f80548 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sun, 2 Nov 2025 22:32:32 +0800 Subject: [PATCH 14/21] refactor(nix): rearrange paths --- flake.nix | 6 +++++- ops/nix/paths.nix | 23 ----------------------- 2 files changed, 5 insertions(+), 24 deletions(-) delete mode 100644 ops/nix/paths.nix diff --git a/flake.nix b/flake.nix index bcb59891..7dfd379f 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,11 @@ (inputs.import-tree ./ops/nix) // { systems = import inputs.systems; - flake.paths.root = ./.; + flake.paths = { + root = ./.; + facter = ./ops/facter; + secrets = ./ops/sops; + }; } ); inputs = { diff --git a/ops/nix/paths.nix b/ops/nix/paths.nix deleted file mode 100644 index 6ab751b4..00000000 --- a/ops/nix/paths.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ lib, config, ... }: -let - cfg = config.flake; - inherit (cfg.paths) root; - inherit (lib.options) mkOption; - inherit (lib.types) path; -in -{ - options.flake.paths = { - root = mkOption { - type = path; - readOnly = true; - }; - secrets = mkOption { - type = path; - default = root + "/ops/sops"; - }; - www = mkOption { - type = path; - default = root + "/src/www"; - }; - }; -} From d091795424e217a64b745f91278127ff32754511 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Sun, 2 Nov 2025 23:35:31 +0800 Subject: [PATCH 15/21] build(nix): init disko --- flake.lock | 37 +++++++++++++++++++++++++++++++++- flake.nix | 11 +++++----- ops/nix/manifest.nix | 3 ++- ops/nix/nodes/device.nix | 43 ++++++++++++++++++++++++++++++++++++++++ ops/nix/nodes/facter.nix | 9 --------- ops/nix/nodes/type.nix | 32 ++++++++++++++++++++++++++++++ 6 files changed, 119 insertions(+), 16 deletions(-) create mode 100644 ops/nix/nodes/device.nix delete mode 100644 ops/nix/nodes/facter.nix create mode 100644 ops/nix/nodes/type.nix diff --git a/flake.lock b/flake.lock index 71b50242..414b4caf 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,23 @@ { "nodes": { + "disko": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1761899396, + "narHash": "sha256-XOpKBp6HLzzMCbzW50TEuXN35zN5WGQREC7n34DcNMM=", + "owner": "nix-community", + "repo": "disko", + "rev": "6f4cf5abbe318e4cd1e879506f6eeafd83f7b998", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -92,6 +110,22 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1752596105, + "narHash": "sha256-lFNVsu/mHLq3q11MuGkMhUUoSXEdQjCHvpReaGP1S2k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dab3a6e781554f965bde3def0aa2fda4eb8f1708", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1759036355, "narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=", @@ -109,12 +143,13 @@ }, "root": { "inputs": { + "disko": "disko", "flake-parts": "flake-parts", "home-manager": "home-manager", "import-tree": "import-tree", "nix-darwin": "nix-darwin", "nixos-facter-modules": "nixos-facter-modules", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "rrv-sh": "rrv-sh", "sops-nix": "sops-nix", "systems": "systems" diff --git a/flake.nix b/flake.nix index 7dfd379f..04995ab2 100644 --- a/flake.nix +++ b/flake.nix @@ -13,19 +13,20 @@ } ); inputs = { + disko.url = "github:nix-community/disko"; flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; flake-parts.url = "github:hercules-ci/flake-parts"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.url = "github:nix-community/home-manager"; + import-tree.url = "github:vic/import-tree"; nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; nix-darwin.url = "github:nix-darwin/nix-darwin/master"; + nixos-facter-modules.url = "github:nix-community/nixos-facter-modules"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + rrv-sh.inputs.nixpkgs.follows = "nixpkgs"; + rrv-sh.url = "github:rrvsh/rrv.sh"; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; sops-nix.url = "github:Mic92/sops-nix"; - import-tree.url = "github:vic/import-tree"; - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; systems.url = "github:nix-systems/default"; - rrv-sh.url = "github:rrvsh/rrv.sh"; - rrv-sh.inputs.nixpkgs.follows = "nixpkgs"; - nixos-facter-modules.url = "github:nix-community/nixos-facter-modules"; }; } diff --git a/ops/nix/manifest.nix b/ops/nix/manifest.nix index 13faac2e..791740b3 100644 --- a/ops/nix/manifest.nix +++ b/ops/nix/manifest.nix @@ -8,7 +8,8 @@ secrets.sops.enable = true; nodes.nixos = { veil = { - facter = ../facter/rpi4b.json; + type = "rpi4b"; + device = "/dev/mmcblk1"; createImage = true; }; }; diff --git a/ops/nix/nodes/device.nix b/ops/nix/nodes/device.nix new file mode 100644 index 00000000..6cde2824 --- /dev/null +++ b/ops/nix/nodes/device.nix @@ -0,0 +1,43 @@ +{ inputs, ... }: +{ + imports = [ inputs.disko.flakeModules.default ]; + flake.diskoConfigurations.rpi4b = + { + device ? "", + ... + }: + { + disko.devices = { + disk.main = { + inherit device; + type = "disk"; + content = { + type = "gpt"; + partitions = { + firmware = { + type = "EF00"; + size = "64M"; + label = "FIRMWARE"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot/firmware"; + }; + }; + root = { + type = "8300"; + size = "100%"; + label = "NIXOS_SD"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = [ "noatime" ]; # disables access-time updates — improves SD card lifespan + }; + }; + }; + }; + }; + }; + }; +} diff --git a/ops/nix/nodes/facter.nix b/ops/nix/nodes/facter.nix deleted file mode 100644 index d94c3987..00000000 --- a/ops/nix/nodes/facter.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ inputs, ... }: -{ - flake.modules.nixos.default = - { hostConfig, ... }: - { - imports = [ inputs.nixos-facter-modules.nixosModules.facter ]; - facter.reportPath = hostConfig.facter or null; - }; -} diff --git a/ops/nix/nodes/type.nix b/ops/nix/nodes/type.nix new file mode 100644 index 00000000..57594b14 --- /dev/null +++ b/ops/nix/nodes/type.nix @@ -0,0 +1,32 @@ +{ + inputs, + config, + lib, + ... +}: +let + cfg = config.flake; + inherit (builtins) fromJSON readFile; + inherit (cfg.paths) facter; + inherit (lib.modules) mkMerge mkIf; +in +{ + flake.modules.nixos.default = + { hostConfig, ... }: + { + imports = [ + inputs.disko.nixosModules.default + inputs.nixos-facter-modules.nixosModules.facter + config.flake.diskoConfigurations.${hostConfig.type} + ]; + config = mkMerge [ + { + facter.report = fromJSON (readFile "${facter}/${hostConfig.type}.json"); + } + (mkIf (hostConfig.type == "rpi4b") { + boot.loader.grub.enable = false; + boot.loader.generic-extlinux-compatible.enable = true; + }) + ]; + }; +} From 1340ec90dcb845c1f75093bb4b3e57e65910bdcc Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 3 Nov 2025 00:01:03 +0800 Subject: [PATCH 16/21] build(nix): init networking --- ops/nix/internals/ssh.nix | 8 ++++++ ops/nix/internals/tailscale.nix | 22 ++++++++++++++++ ops/nix/nodes/default.nix | 45 ++++++++++----------------------- 3 files changed, 44 insertions(+), 31 deletions(-) create mode 100644 ops/nix/internals/ssh.nix create mode 100644 ops/nix/internals/tailscale.nix diff --git a/ops/nix/internals/ssh.nix b/ops/nix/internals/ssh.nix new file mode 100644 index 00000000..02fa20f6 --- /dev/null +++ b/ops/nix/internals/ssh.nix @@ -0,0 +1,8 @@ +{ + flake.modules.nixos.default = + { hostName, ... }: + { + networking.hostName = hostName; + services.openssh.enable = true; + }; +} diff --git a/ops/nix/internals/tailscale.nix b/ops/nix/internals/tailscale.nix new file mode 100644 index 00000000..78a1af79 --- /dev/null +++ b/ops/nix/internals/tailscale.nix @@ -0,0 +1,22 @@ +{ config, lib, ... }: +let + cfg = config.flake; + inherit (cfg.paths) secrets; + inherit (builtins) pathExists; + inherit (lib.modules) mkMerge mkIf; +in +{ + flake.modules.nixos.default = mkMerge [ + { services.tailscale.enable = true; } + (mkIf cfg.secrets.sops.enable { + assertions = [ + { + assertion = pathExists "${secrets}/keys.yaml"; + message = "You must have created `ops/sops/keys.yaml` to enable tailscale integration."; + } + ]; + services.tailscale.authKeyFile = config.sops.secrets."keys/tailscale".path or null; + sops.secrets."keys/tailscale".sopsFile = secrets + /keys.yaml; + }) + ]; +} diff --git a/ops/nix/nodes/default.nix b/ops/nix/nodes/default.nix index ff197d78..f63685a9 100644 --- a/ops/nix/nodes/default.nix +++ b/ops/nix/nodes/default.nix @@ -1,34 +1,17 @@ -{ config, ... }: -let - cfg = config.flake; - inherit (cfg.paths) secrets; -in { - config.flake.modules.nixos.default = - { - hostName, - config, - ... - }: - { - networking.hostName = hostName; - nix.settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; - substituters = [ "https://nix-community.cachix.org" ]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - trusted-substituters = [ "https://nix-community.cachix.org" ]; - }; - services = { - openssh.enable = true; - tailscale.enable = true; - tailscale.authKeyFile = config.sops.secrets."keys/tailscale".path or null; - }; - sops.secrets."keys/tailscale".sopsFile = secrets + /keys.yaml; - system.stateVersion = "25.11"; + config.flake.modules.nixos.default = { + nix.settings = { + experimental-features = [ + "nix-command" + "flakes" + ]; + substituters = [ "https://nix-community.cachix.org" ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + trusted-substituters = [ "https://nix-community.cachix.org" ]; }; + + system.stateVersion = "25.11"; + }; } From 88630e69e16a07fe6f287f2868c4f1bd86a68c88 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 3 Nov 2025 00:02:58 +0800 Subject: [PATCH 17/21] refactor(nix): finalise? nixos folder --- ops/nix/nodes/_nodeOptions.nix | 5 ----- ops/nix/nodes/default.nix | 17 ----------------- ops/nix/nodes/nixos.nix | 20 ++++++++++++++++---- 3 files changed, 16 insertions(+), 26 deletions(-) delete mode 100644 ops/nix/nodes/_nodeOptions.nix delete mode 100644 ops/nix/nodes/default.nix diff --git a/ops/nix/nodes/_nodeOptions.nix b/ops/nix/nodes/_nodeOptions.nix deleted file mode 100644 index c17f05a2..00000000 --- a/ops/nix/nodes/_nodeOptions.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ lib }: -let - inherit (lib.types) raw; -in -raw diff --git a/ops/nix/nodes/default.nix b/ops/nix/nodes/default.nix deleted file mode 100644 index f63685a9..00000000 --- a/ops/nix/nodes/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - config.flake.modules.nixos.default = { - nix.settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; - substituters = [ "https://nix-community.cachix.org" ]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - trusted-substituters = [ "https://nix-community.cachix.org" ]; - }; - - system.stateVersion = "25.11"; - }; -} diff --git a/ops/nix/nodes/nixos.nix b/ops/nix/nodes/nixos.nix index 58cdf3b8..811f8ab0 100644 --- a/ops/nix/nodes/nixos.nix +++ b/ops/nix/nodes/nixos.nix @@ -9,13 +9,11 @@ let inherit (builtins) mapAttrs; inherit (lib) nixosSystem; inherit (lib.options) mkOption; - inherit (lib.types) attrsOf; + inherit (lib.types) attrsOf raw; in { imports = [ inputs.flake-parts.flakeModules.modules ]; - options.flake.nodes.nixos = mkOption { - type = attrsOf (import ./_nodeOptions.nix { inherit lib; }); - }; + options.flake.nodes.nixos = mkOption { type = attrsOf raw; }; config.flake.nixosConfigurations = mapAttrs ( name: value: nixosSystem { @@ -26,4 +24,18 @@ in modules = [ cfg.modules.nixos.default ]; } ) cfg.nodes.nixos; + config.flake.modules.nixos.default = { + nix.settings = { + experimental-features = [ + "nix-command" + "flakes" + ]; + substituters = [ "https://nix-community.cachix.org" ]; + trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + ]; + trusted-substituters = [ "https://nix-community.cachix.org" ]; + }; + system.stateVersion = "25.11"; + }; } From d18bfc84a2a7211a080d6ce7e856f6de117be870 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 3 Nov 2025 00:37:01 +0800 Subject: [PATCH 18/21] feat(nix): add nephalem --- ops/facter/nephalem.json | 7499 ++++++++++++++++++++++++++++++++++++++ ops/nix/manifest.nix | 4 + ops/nix/nodes/device.nix | 73 + ops/nix/nodes/type.nix | 4 +- 4 files changed, 7579 insertions(+), 1 deletion(-) create mode 100644 ops/facter/nephalem.json diff --git a/ops/facter/nephalem.json b/ops/facter/nephalem.json new file mode 100644 index 00000000..562cf7f8 --- /dev/null +++ b/ops/facter/nephalem.json @@ -0,0 +1,7499 @@ +{ + "version": 1, + "system": "x86_64-linux", + "virtualisation": "none", + "hardware": { + "bios": { + "apm_info": { + "supported": false, + "enabled": false, + "version": 0, + "sub_version": 0, + "bios_flags": 0 + }, + "vbe_info": { + "version": 0, + "video_memory": 0 + }, + "pnp": false, + "pnp_id": 0, + "lba_support": false, + "low_memory_size": 0, + "smbios_version": 773 + }, + "bluetooth": [ + { + "index": 86, + "attached_to": 93, + "class_list": [ + "usb", + "bluetooth" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0115", + "name": "Bluetooth Device", + "value": 277 + }, + "vendor": { + "hex": "8087", + "value": 32903 + }, + "device": { + "hex": "0032", + "value": 50 + }, + "model": "Bluetooth Device", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0c.0/0000:0e:00.0/usb1/1-7/1-7:1.0", + "sysfs_bus_id": "1-7:1.0", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "00e0", + "name": "wireless", + "value": 224 + }, + "device_subclass": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "device_protocol": 1, + "interface_class": { + "hex": "00e0", + "name": "wireless", + "value": 224 + }, + "interface_subclass": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "interface_protocol": 1, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "btusb", + "driver_module": "btusb", + "drivers": [ + "btusb" + ], + "driver_modules": [ + "btusb" + ], + "module_alias": "usb:v8087p0032d0000dcE0dsc01dp01icE0isc01ip01in00" + }, + { + "index": 100, + "attached_to": 93, + "class_list": [ + "usb", + "bluetooth" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0115", + "name": "Bluetooth Device", + "value": 277 + }, + "vendor": { + "hex": "8087", + "value": 32903 + }, + "device": { + "hex": "0032", + "value": 50 + }, + "model": "Bluetooth Device", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0c.0/0000:0e:00.0/usb1/1-7/1-7:1.1", + "sysfs_bus_id": "1-7:1.1", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "00e0", + "name": "wireless", + "value": 224 + }, + "device_subclass": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "device_protocol": 1, + "interface_class": { + "hex": "00e0", + "name": "wireless", + "value": 224 + }, + "interface_subclass": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "interface_protocol": 1, + "interface_number": 1, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "btusb", + "driver_module": "btusb", + "drivers": [ + "btusb" + ], + "driver_modules": [ + "btusb" + ], + "module_alias": "usb:v8087p0032d0000dcE0dsc01dp01icE0isc01ip01in01" + } + ], + "bridge": [ + { + "index": 20, + "attached_to": 36, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 3, + "number": 0 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f4", + "value": 17396 + }, + "sub_device": { + "hex": "3328", + "value": 13096 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0", + "sysfs_bus_id": "0000:03:00.0", + "detail": { + "function": 0, + "command": 7, + "header_type": 1, + "secondary_bus": 4, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000043F4sv00001B21sd00003328bc06sc04i00" + }, + { + "index": 22, + "attached_to": 20, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 4, + "number": 6 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f5", + "value": 17397 + }, + "sub_device": { + "hex": "3328", + "value": 13096 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:06.0", + "sysfs_bus_id": "0000:04:06.0", + "detail": { + "function": 0, + "command": 1031, + "header_type": 1, + "secondary_bus": 8, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000043F5sv00001B21sd00003328bc06sc04i00" + }, + { + "index": 24, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 8 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14da", + "value": 5338 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:08.0", + "sysfs_bus_id": "0000:00:08.0", + "detail": { + "function": 0, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d000014DAsv00000000sd00000000bc06sc00i00" + }, + { + "index": 25, + "attached_to": 20, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 4, + "number": 11 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f5", + "value": 17397 + }, + "sub_device": { + "hex": "3328", + "value": 13096 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0b.0", + "sysfs_bus_id": "0000:04:0b.0", + "detail": { + "function": 0, + "command": 1031, + "header_type": 1, + "secondary_bus": 13, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000043F5sv00001B21sd00003328bc06sc04i00" + }, + { + "index": 26, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 24 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14e3", + "value": 5347 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:18.3", + "sysfs_bus_id": "0000:00:18.3", + "detail": { + "function": 3, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "k10temp", + "driver_module": "k10temp", + "drivers": [ + "k10temp" + ], + "driver_modules": [ + "k10temp" + ], + "module_alias": "pci:v00001022d000014E3sv00000000sd00000000bc06sc00i00" + }, + { + "index": 27, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 1 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14db", + "value": 5339 + }, + "sub_device": { + "hex": "1453", + "value": 5203 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:01.2", + "sysfs_bus_id": "0000:00:01.2", + "detail": { + "function": 2, + "command": 1031, + "header_type": 1, + "secondary_bus": 2, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000014DBsv00001022sd00001453bc06sc04i00" + }, + { + "index": 28, + "attached_to": 20, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 4, + "number": 9 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f5", + "value": 17397 + }, + "sub_device": { + "hex": "3328", + "value": 13096 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:09.0", + "sysfs_bus_id": "0000:04:09.0", + "detail": { + "function": 0, + "command": 1031, + "header_type": 1, + "secondary_bus": 11, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000043F5sv00001B21sd00003328bc06sc04i00" + }, + { + "index": 30, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 24 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14e1", + "value": 5345 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:18.1", + "sysfs_bus_id": "0000:00:18.1", + "detail": { + "function": 1, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d000014E1sv00000000sd00000000bc06sc00i00" + }, + { + "index": 32, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 1 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14da", + "value": 5338 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:01.0", + "sysfs_bus_id": "0000:00:01.0", + "detail": { + "function": 0, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d000014DAsv00000000sd00000000bc06sc00i00" + }, + { + "index": 33, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 4 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14da", + "value": 5338 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:04.0", + "sysfs_bus_id": "0000:00:04.0", + "detail": { + "function": 0, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d000014DAsv00000000sd00000000bc06sc00i00" + }, + { + "index": 34, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 20 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0001", + "name": "ISA bridge", + "value": 1 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1458", + "value": 5208 + }, + "device": { + "hex": "790e", + "value": 30990 + }, + "sub_device": { + "hex": "5001", + "value": 20481 + }, + "revision": { + "hex": "0051", + "value": 81 + }, + "model": "AMD ISA bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:14.3", + "sysfs_bus_id": "0000:00:14.3", + "detail": { + "function": 3, + "command": 15, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d0000790Esv00001458sd00005001bc06sc01i00" + }, + { + "index": 36, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 2 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14db", + "value": 5339 + }, + "sub_device": { + "hex": "1453", + "value": 5203 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1", + "sysfs_bus_id": "0000:00:02.1", + "detail": { + "function": 1, + "command": 1031, + "header_type": 1, + "secondary_bus": 3, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000014DBsv00001022sd00001453bc06sc04i00" + }, + { + "index": 37, + "attached_to": 20, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 4, + "number": 5 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f5", + "value": 17397 + }, + "sub_device": { + "hex": "3328", + "value": 13096 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:05.0", + "sysfs_bus_id": "0000:04:05.0", + "detail": { + "function": 0, + "command": 1031, + "header_type": 1, + "secondary_bus": 7, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000043F5sv00001B21sd00003328bc06sc04i00" + }, + { + "index": 38, + "attached_to": 20, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 4, + "number": 10 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f5", + "value": 17397 + }, + "sub_device": { + "hex": "3328", + "value": 13096 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0a.0", + "sysfs_bus_id": "0000:04:0a.0", + "detail": { + "function": 0, + "command": 1031, + "header_type": 1, + "secondary_bus": 12, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000043F5sv00001B21sd00003328bc06sc04i00" + }, + { + "index": 40, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 8 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14dd", + "value": 5341 + }, + "sub_device": { + "hex": "14dd", + "value": 5341 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:08.3", + "sysfs_bus_id": "0000:00:08.3", + "detail": { + "function": 3, + "command": 1031, + "header_type": 1, + "secondary_bus": 53, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000014DDsv00001022sd000014DDbc06sc04i00" + }, + { + "index": 41, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 24 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14e6", + "value": 5350 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:18.6", + "sysfs_bus_id": "0000:00:18.6", + "detail": { + "function": 6, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d000014E6sv00000000sd00000000bc06sc00i00" + }, + { + "index": 42, + "attached_to": 20, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 4, + "number": 8 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f5", + "value": 17397 + }, + "sub_device": { + "hex": "3328", + "value": 13096 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:08.0", + "sysfs_bus_id": "0000:04:08.0", + "detail": { + "function": 0, + "command": 1031, + "header_type": 1, + "secondary_bus": 10, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000043F5sv00001B21sd00003328bc06sc04i00" + }, + { + "index": 43, + "attached_to": 20, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 4, + "number": 13 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f5", + "value": 17397 + }, + "sub_device": { + "hex": "3328", + "value": 13096 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0d.0", + "sysfs_bus_id": "0000:04:0d.0", + "detail": { + "function": 0, + "command": 7, + "header_type": 1, + "secondary_bus": 15, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000043F5sv00001B21sd00003328bc06sc04i00" + }, + { + "index": 44, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14d8", + "value": 5336 + }, + "sub_device": { + "hex": "14d8", + "value": 5336 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:00.0", + "sysfs_bus_id": "0000:00:00.0", + "detail": { + "function": 0, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d000014D8sv00001022sd000014D8bc06sc00i00" + }, + { + "index": 46, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 8 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14dd", + "value": 5341 + }, + "sub_device": { + "hex": "14dd", + "value": 5341 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1", + "sysfs_bus_id": "0000:00:08.1", + "detail": { + "function": 1, + "command": 1031, + "header_type": 1, + "secondary_bus": 52, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000014DDsv00001022sd000014DDbc06sc04i00" + }, + { + "index": 47, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 24 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14e4", + "value": 5348 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:18.4", + "sysfs_bus_id": "0000:00:18.4", + "detail": { + "function": 4, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d000014E4sv00000000sd00000000bc06sc00i00" + }, + { + "index": 50, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 3 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14da", + "value": 5338 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:03.0", + "sysfs_bus_id": "0000:00:03.0", + "detail": { + "function": 0, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d000014DAsv00000000sd00000000bc06sc00i00" + }, + { + "index": 52, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 24 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14e2", + "value": 5346 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:18.2", + "sysfs_bus_id": "0000:00:18.2", + "detail": { + "function": 2, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d000014E2sv00000000sd00000000bc06sc00i00" + }, + { + "index": 53, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 1 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14db", + "value": 5339 + }, + "sub_device": { + "hex": "1453", + "value": 5203 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:01.1", + "sysfs_bus_id": "0000:00:01.1", + "detail": { + "function": 1, + "command": 1031, + "header_type": 1, + "secondary_bus": 1, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000014DBsv00001022sd00001453bc06sc04i00" + }, + { + "index": 54, + "attached_to": 20, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 4, + "number": 4 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f5", + "value": 17397 + }, + "sub_device": { + "hex": "3328", + "value": 13096 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:04.0", + "sysfs_bus_id": "0000:04:04.0", + "detail": { + "function": 0, + "command": 1031, + "header_type": 1, + "secondary_bus": 6, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000043F5sv00001B21sd00003328bc06sc04i00" + }, + { + "index": 56, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 24 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14e0", + "value": 5344 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:18.0", + "sysfs_bus_id": "0000:00:18.0", + "detail": { + "function": 0, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d000014E0sv00000000sd00000000bc06sc00i00" + }, + { + "index": 58, + "attached_to": 20, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 4, + "number": 7 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f5", + "value": 17397 + }, + "sub_device": { + "hex": "3328", + "value": 13096 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:07.0", + "sysfs_bus_id": "0000:04:07.0", + "detail": { + "function": 0, + "command": 1031, + "header_type": 1, + "secondary_bus": 9, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000043F5sv00001B21sd00003328bc06sc04i00" + }, + { + "index": 59, + "attached_to": 20, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 4, + "number": 12 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f5", + "value": 17397 + }, + "sub_device": { + "hex": "3328", + "value": 13096 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0c.0", + "sysfs_bus_id": "0000:04:0c.0", + "detail": { + "function": 0, + "command": 7, + "header_type": 1, + "secondary_bus": 14, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000043F5sv00001B21sd00003328bc06sc04i00" + }, + { + "index": 62, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 2 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14db", + "value": 5339 + }, + "sub_device": { + "hex": "1453", + "value": 5203 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.2", + "sysfs_bus_id": "0000:00:02.2", + "detail": { + "function": 2, + "command": 1031, + "header_type": 1, + "secondary_bus": 16, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000014DBsv00001022sd00001453bc06sc04i00" + }, + { + "index": 63, + "attached_to": 20, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 4, + "number": 0 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0004", + "name": "PCI bridge", + "value": 4 + }, + "pci_interface": { + "hex": "0000", + "name": "Normal decode", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f5", + "value": 17397 + }, + "sub_device": { + "hex": "3328", + "value": 13096 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD PCI bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:00.0", + "sysfs_bus_id": "0000:04:00.0", + "detail": { + "function": 0, + "command": 1031, + "header_type": 1, + "secondary_bus": 5, + "prog_if": 0 + }, + "driver": "pcieport", + "driver_module": "pcieportdrv", + "drivers": [ + "pcieport" + ], + "driver_modules": [ + "pcieportdrv" + ], + "module_alias": "pci:v00001022d000043F5sv00001B21sd00003328bc06sc04i00" + }, + { + "index": 65, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 2 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14da", + "value": 5338 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:02.0", + "sysfs_bus_id": "0000:00:02.0", + "detail": { + "function": 0, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d000014DAsv00000000sd00000000bc06sc00i00" + }, + { + "index": 66, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 24 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14e7", + "value": 5351 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:18.7", + "sysfs_bus_id": "0000:00:18.7", + "detail": { + "function": 7, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d000014E7sv00000000sd00000000bc06sc00i00" + }, + { + "index": 68, + "attached_to": 0, + "class_list": [ + "pci", + "bridge" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 24 + }, + "base_class": { + "hex": "0006", + "name": "Bridge", + "value": 6 + }, + "sub_class": { + "hex": "0000", + "name": "Host bridge", + "value": 0 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "14e5", + "value": 5349 + }, + "model": "AMD Host bridge", + "sysfs_id": "/devices/pci0000:00/0000:00:18.5", + "sysfs_bus_id": "0000:00:18.5", + "detail": { + "function": 5, + "command": 0, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d000014E5sv00000000sd00000000bc06sc00i00" + } + ], + "cpu": [ + { + "architecture": "x86_64", + "vendor_name": "AuthenticAMD", + "model_name": "AMD Ryzen 7 7800X3D 8-Core Processor", + "family": 25, + "model": 97, + "stepping": 2, + "features": [ + "fpu", + "vme", + "de", + "pse", + "tsc", + "msr", + "pae", + "mce", + "cx8", + "apic", + "sep", + "mtrr", + "pge", + "mca", + "cmov", + "pat", + "pse36", + "clflush", + "mmx", + "fxsr", + "sse", + "sse2", + "ht", + "syscall", + "nx", + "mmxext", + "fxsr_opt", + "pdpe1gb", + "rdtscp", + "lm", + "constant_tsc", + "rep_good", + "amd_lbr_v2", + "nopl", + "xtopology", + "nonstop_tsc", + "cpuid", + "extd_apicid", + "aperfmperf", + "rapl", + "pni", + "pclmulqdq", + "monitor", + "ssse3", + "fma", + "cx16", + "sse4_1", + "sse4_2", + "x2apic", + "movbe", + "popcnt", + "aes", + "xsave", + "avx", + "f16c", + "rdrand", + "lahf_lm", + "cmp_legacy", + "svm", + "extapic", + "cr8_legacy", + "abm", + "sse4a", + "misalignsse", + "3dnowprefetch", + "osvw", + "ibs", + "skinit", + "wdt", + "tce", + "topoext", + "perfctr_core", + "perfctr_nb", + "bpext", + "perfctr_llc", + "mwaitx", + "cpb", + "cat_l3", + "cdp_l3", + "hw_pstate", + "ssbd", + "mba", + "perfmon_v2", + "ibrs", + "ibpb", + "stibp", + "ibrs_enhanced", + "vmmcall", + "fsgsbase", + "bmi1", + "avx2", + "smep", + "bmi2", + "erms", + "invpcid", + "cqm", + "rdt_a", + "avx512f", + "avx512dq", + "rdseed", + "adx", + "smap", + "avx512ifma", + "clflushopt", + "clwb", + "avx512cd", + "sha_ni", + "avx512bw", + "avx512vl", + "xsaveopt", + "xsavec", + "xgetbv1", + "xsaves", + "cqm_llc", + "cqm_occup_llc", + "cqm_mbm_total", + "cqm_mbm_local", + "user_shstk", + "avx512_bf16", + "clzero", + "irperf", + "xsaveerptr", + "rdpru", + "wbnoinvd", + "cppc", + "arat", + "npt", + "lbrv", + "svm_lock", + "nrip_save", + "tsc_scale", + "vmcb_clean", + "flushbyasid", + "decodeassists", + "pausefilter", + "pfthreshold", + "avic", + "vgif", + "x2avic", + "v_spec_ctrl", + "vnmi", + "avx512vb" + ], + "bugs": [ + "sysret_ss_attrs", + "spectre_v1", + "spectre_v2", + "spec_store_bypass", + "srso", + "ibpb_no_ret", + "tsa" + ], + "power_management": [ + "ts", + "ttp", + "tm", + "hwpstate", + "cpb", + "eff_freq_ro", + "[13]", + "[14]" + ], + "bogo": 8384, + "cache": 1024, + "units": 16, + "page_size": 4096, + "physical_id": 0, + "siblings": 16, + "cores": 8, + "fpu": false, + "fpu_exception": false, + "cpuid_level": 16, + "write_protect": false, + "tlb_size": 3584, + "clflush_size": 64, + "cache_alignment": 64, + "address_sizes": { + "physical": "0x30", + "virtual": "0x30" + } + } + ], + "disk": [ + { + "index": 71, + "attached_to": 31, + "class_list": [ + "disk", + "block_device", + "nvme" + ], + "bus_type": { + "hex": "0096", + "name": "NVME", + "value": 150 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0106", + "name": "Mass Storage Device", + "value": 262 + }, + "sub_class": { + "hex": "0000", + "name": "Disk", + "value": 0 + }, + "vendor": { + "hex": "c0a9", + "value": 49321 + }, + "sub_vendor": { + "hex": "c0a9", + "value": 49321 + }, + "device": { + "hex": "540a", + "name": "CT2000P3SSD8", + "value": 21514 + }, + "sub_device": { + "hex": "5021", + "value": 20513 + }, + "serial": "2325E6E6888E", + "model": "CT2000P3SSD8", + "sysfs_id": "/class/block/nvme0n1", + "sysfs_bus_id": "nvme0", + "sysfs_device_link": "/devices/pci0000:00/0000:00:01.2/0000:02:00.0/nvme/nvme0", + "unix_device_names": [ + "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E6888E", + "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E6888E_1", + "/dev/disk/by-id/nvme-nvme.c0a9-323332354536453638383845-435432303030503353534438-00000001", + "/dev/disk/by-path/pci-0000:02:00.0-nvme-1", + "/dev/nvme0n1" + ], + "resources": [ + { + "type": "disk_geo", + "cylinders": 1907729, + "heads": 64, + "sectors": 32, + "size": "0x0", + "geo_type": "logical" + }, + { + "type": "size", + "unit": "sectors", + "value_1": 3907029168, + "value_2": 512 + } + ], + "driver": "nvme", + "driver_module": "nvme", + "drivers": [ + "nvme" + ], + "driver_modules": [ + "nvme" + ] + }, + { + "index": 72, + "attached_to": 60, + "class_list": [ + "disk", + "block_device", + "nvme" + ], + "bus_type": { + "hex": "0096", + "name": "NVME", + "value": 150 + }, + "slot": { + "bus": 0, + "number": 1 + }, + "base_class": { + "hex": "0106", + "name": "Mass Storage Device", + "value": 262 + }, + "sub_class": { + "hex": "0000", + "name": "Disk", + "value": 0 + }, + "vendor": { + "hex": "c0a9", + "value": 49321 + }, + "sub_vendor": { + "hex": "c0a9", + "value": 49321 + }, + "device": { + "hex": "540a", + "name": "CT2000P3SSD8", + "value": 21514 + }, + "sub_device": { + "hex": "5021", + "value": 20513 + }, + "serial": "2325E6E77434", + "model": "CT2000P3SSD8", + "sysfs_id": "/class/block/nvme1n1", + "sysfs_bus_id": "nvme1", + "sysfs_device_link": "/devices/pci0000:00/0000:00:02.2/0000:10:00.0/nvme/nvme1", + "unix_device_names": [ + "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434", + "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434_1", + "/dev/disk/by-id/nvme-nvme.c0a9-323332354536453737343334-435432303030503353534438-00000001", + "/dev/disk/by-path/pci-0000:10:00.0-nvme-1", + "/dev/nvme1n1" + ], + "resources": [ + { + "type": "disk_geo", + "cylinders": 1907729, + "heads": 64, + "sectors": 32, + "size": "0x0", + "geo_type": "logical" + }, + { + "type": "size", + "unit": "sectors", + "value_1": 3907029168, + "value_2": 512 + } + ], + "driver": "nvme", + "driver_module": "nvme", + "drivers": [ + "nvme" + ], + "driver_modules": [ + "nvme" + ] + } + ], + "graphics_card": [ + { + "index": 35, + "attached_to": 53, + "class_list": [ + "graphics_card", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 1, + "number": 0 + }, + "base_class": { + "hex": "0003", + "name": "Display controller", + "value": 3 + }, + "sub_class": { + "hex": "0000", + "name": "VGA compatible controller", + "value": 0 + }, + "pci_interface": { + "hex": "0000", + "name": "VGA", + "value": 0 + }, + "vendor": { + "hex": "10de", + "name": "nVidia Corporation", + "value": 4318 + }, + "sub_vendor": { + "hex": "1458", + "value": 5208 + }, + "device": { + "hex": "2488", + "value": 9352 + }, + "sub_device": { + "hex": "404c", + "value": 16460 + }, + "revision": { + "hex": "00a1", + "value": 161 + }, + "model": "nVidia VGA compatible controller", + "sysfs_id": "/devices/pci0000:00/0000:00:01.1/0000:01:00.0", + "sysfs_bus_id": "0000:01:00.0", + "resources": [ + { + "type": "io", + "base": 61440, + "range": 128, + "enabled": true, + "access": "read_write" + } + ], + "detail": { + "function": 0, + "command": 1031, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "nvidia", + "driver_module": "nvidia", + "drivers": [ + "nvidia" + ], + "driver_modules": [ + "nvidia" + ], + "module_alias": "pci:v000010DEd00002488sv00001458sd0000404Cbc03sc00i00" + }, + { + "index": 55, + "attached_to": 46, + "class_list": [ + "graphics_card", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 52, + "number": 0 + }, + "base_class": { + "hex": "0003", + "name": "Display controller", + "value": 3 + }, + "sub_class": { + "hex": "0000", + "name": "VGA compatible controller", + "value": 0 + }, + "pci_interface": { + "hex": "0000", + "name": "VGA", + "value": 0 + }, + "vendor": { + "hex": "1002", + "name": "ATI Technologies Inc", + "value": 4098 + }, + "sub_vendor": { + "hex": "1458", + "value": 5208 + }, + "device": { + "hex": "164e", + "value": 5710 + }, + "sub_device": { + "hex": "d000", + "value": 53248 + }, + "revision": { + "hex": "00cb", + "value": 203 + }, + "model": "ATI VGA compatible controller", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.0", + "sysfs_bus_id": "0000:34:00.0", + "resources": [ + { + "type": "io", + "base": 53248, + "range": 256, + "enabled": true, + "access": "read_write" + } + ], + "detail": { + "function": 0, + "command": 1031, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "amdgpu", + "driver_module": "amdgpu", + "drivers": [ + "amdgpu" + ], + "driver_modules": [ + "amdgpu" + ], + "module_alias": "pci:v00001002d0000164Esv00001458sd0000D000bc03sc00i00" + } + ], + "hub": [ + { + "index": 73, + "attached_to": 45, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.12.43 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0003", + "name": "xHCI Host Controller", + "value": 3 + }, + "revision": { + "hex": "0000", + "name": "6.12", + "value": 0 + }, + "serial": "0000:34:00.4", + "model": "Linux 6.12.43 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb6/6-0:1.0", + "sysfs_bus_id": "6-0:1.0", + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 3, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v1D6Bp0003d0612dc09dsc00dp03ic09isc00ip00in00" + }, + { + "index": 79, + "attached_to": 82, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "05e3", + "name": "GenesysLogic", + "value": 1507 + }, + "device": { + "hex": "0610", + "name": "USB2.1 Hub", + "value": 1552 + }, + "revision": { + "hex": "0000", + "name": "6.63", + "value": 0 + }, + "model": "GenesysLogic USB2.1 Hub", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.2/5-2.2:1.0", + "sysfs_bus_id": "5-2.2:1.0", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 1, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v05E3p0610d0663dc09dsc00dp01ic09isc00ip00in00" + }, + { + "index": 80, + "attached_to": 23, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.12.43 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0002", + "name": "xHCI Host Controller", + "value": 2 + }, + "revision": { + "hex": "0000", + "name": "6.12", + "value": 0 + }, + "serial": "0000:34:00.3", + "model": "Linux 6.12.43 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.3/usb3/3-0:1.0", + "sysfs_bus_id": "3-0:1.0", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 1, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v1D6Bp0002d0612dc09dsc00dp01ic09isc00ip00in00" + }, + { + "index": 82, + "attached_to": 98, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "05e3", + "name": "GenesysLogic", + "value": 1507 + }, + "device": { + "hex": "0610", + "name": "USB2.1 Hub", + "value": 1552 + }, + "revision": { + "hex": "0000", + "name": "6.63", + "value": 0 + }, + "model": "GenesysLogic USB2.1 Hub", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2:1.0", + "sysfs_bus_id": "5-2:1.0", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 1, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v05E3p0610d0663dc09dsc00dp01ic09isc00ip00in00" + }, + { + "index": 83, + "attached_to": 48, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.12.43 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0002", + "name": "xHCI Host Controller", + "value": 2 + }, + "revision": { + "hex": "0000", + "name": "6.12", + "value": 0 + }, + "serial": "0000:35:00.0", + "model": "Linux 6.12.43 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:08.3/0000:35:00.0/usb7/7-0:1.0", + "sysfs_bus_id": "7-0:1.0", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 1, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v1D6Bp0002d0612dc09dsc00dp01ic09isc00ip00in00" + }, + { + "index": 87, + "attached_to": 23, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.12.43 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0003", + "name": "xHCI Host Controller", + "value": 3 + }, + "revision": { + "hex": "0000", + "name": "6.12", + "value": 0 + }, + "serial": "0000:34:00.3", + "model": "Linux 6.12.43 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.3/usb4/4-0:1.0", + "sysfs_bus_id": "4-0:1.0", + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 3, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v1D6Bp0003d0612dc09dsc00dp03ic09isc00ip00in00" + }, + { + "index": 88, + "attached_to": 73, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "05e3", + "name": "GenesysLogic", + "value": 1507 + }, + "device": { + "hex": "0626", + "name": "USB3.1 Hub", + "value": 1574 + }, + "revision": { + "hex": "0000", + "name": "6.63", + "value": 0 + }, + "model": "GenesysLogic USB3.1 Hub", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb6/6-2/6-2:1.0", + "sysfs_bus_id": "6-2:1.0", + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 3, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v05E3p0626d0663dc09dsc00dp03ic09isc00ip00in00" + }, + { + "index": 89, + "attached_to": 83, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "05e3", + "value": 1507 + }, + "device": { + "hex": "0608", + "name": "USB2.0 Hub", + "value": 1544 + }, + "revision": { + "hex": "0000", + "name": "60.90", + "value": 0 + }, + "model": "USB2.0 Hub", + "sysfs_id": "/devices/pci0000:00/0000:00:08.3/0000:35:00.0/usb7/7-1/7-1:1.0", + "sysfs_bus_id": "7-1:1.0", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 1, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v05E3p0608d6090dc09dsc00dp01ic09isc00ip00in00" + }, + { + "index": 90, + "attached_to": 48, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.12.43 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0003", + "name": "xHCI Host Controller", + "value": 3 + }, + "revision": { + "hex": "0000", + "name": "6.12", + "value": 0 + }, + "serial": "0000:35:00.0", + "model": "Linux 6.12.43 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:08.3/0000:35:00.0/usb8/8-0:1.0", + "sysfs_bus_id": "8-0:1.0", + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 3, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "module_alias": "usb:v1D6Bp0003d0612dc09dsc00dp03ic09isc00ip00in00" + }, + { + "index": 93, + "attached_to": 57, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.12.43 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0002", + "name": "xHCI Host Controller", + "value": 2 + }, + "revision": { + "hex": "0000", + "name": "6.12", + "value": 0 + }, + "serial": "0000:0e:00.0", + "model": "Linux 6.12.43 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0c.0/0000:0e:00.0/usb1/1-0:1.0", + "sysfs_bus_id": "1-0:1.0", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 1, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v1D6Bp0002d0612dc09dsc00dp01ic09isc00ip00in00" + }, + { + "index": 97, + "attached_to": 88, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "05e3", + "name": "GenesysLogic", + "value": 1507 + }, + "device": { + "hex": "0626", + "name": "USB3.1 Hub", + "value": 1574 + }, + "revision": { + "hex": "0000", + "name": "6.63", + "value": 0 + }, + "model": "GenesysLogic USB3.1 Hub", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb6/6-2/6-2.2/6-2.2:1.0", + "sysfs_bus_id": "6-2.2:1.0", + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 3, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v05E3p0626d0663dc09dsc00dp03ic09isc00ip00in00" + }, + { + "index": 98, + "attached_to": 45, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.12.43 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0002", + "name": "xHCI Host Controller", + "value": 2 + }, + "revision": { + "hex": "0000", + "name": "6.12", + "value": 0 + }, + "serial": "0000:34:00.4", + "model": "Linux 6.12.43 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-0:1.0", + "sysfs_bus_id": "5-0:1.0", + "resources": [ + { + "type": "baud", + "speed": 480000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 1, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v1D6Bp0002d0612dc09dsc00dp01ic09isc00ip00in00" + }, + { + "index": 101, + "attached_to": 57, + "class_list": [ + "usb", + "hub" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "010a", + "name": "Hub", + "value": 266 + }, + "vendor": { + "hex": "1d6b", + "name": "Linux 6.12.43 xhci-hcd", + "value": 7531 + }, + "device": { + "hex": "0003", + "name": "xHCI Host Controller", + "value": 3 + }, + "revision": { + "hex": "0000", + "name": "6.12", + "value": 0 + }, + "serial": "0000:0e:00.0", + "model": "Linux 6.12.43 xhci-hcd xHCI Host Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0c.0/0000:0e:00.0/usb2/2-0:1.0", + "sysfs_bus_id": "2-0:1.0", + "detail": { + "device_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 3, + "interface_class": { + "hex": "0009", + "name": "hub", + "value": 9 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "hub", + "driver_module": "usbcore", + "drivers": [ + "hub" + ], + "driver_modules": [ + "usbcore" + ], + "module_alias": "usb:v1D6Bp0003d0612dc09dsc00dp03ic09isc00ip00in00" + } + ], + "keyboard": [ + { + "index": 102, + "attached_to": 79, + "class_list": [ + "keyboard", + "usb" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0108", + "name": "Keyboard", + "value": 264 + }, + "sub_class": { + "hex": "0000", + "name": "Keyboard", + "value": 0 + }, + "vendor": { + "hex": "55d4", + "name": "DH747", + "value": 21972 + }, + "device": { + "hex": "0461", + "name": "W-CORNE", + "value": 1121 + }, + "revision": { + "hex": "0000", + "name": "1.00", + "value": 0 + }, + "serial": "vial:f64c2b3c", + "model": "DH747 W-CORNE", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.2/5-2.2.3/5-2.2.3:1.0", + "sysfs_bus_id": "5-2.2.3:1.0", + "unix_device_names": [ + "/dev/input/by-id/usb-DH747_W-CORNE_vial:f64c2b3c-event-kbd", + "/dev/input/by-path/pci-0000:34:00.4-usb-0:2.2.3:1.0-event-kbd", + "/dev/input/by-path/pci-0000:34:00.4-usbv2-0:2.2.3:1.0-event-kbd", + "/dev/input/event16" + ], + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0003", + "name": "hid", + "value": 3 + }, + "interface_subclass": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "interface_protocol": 1, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "usbhid", + "driver_module": "usbhid", + "drivers": [ + "usbhid" + ], + "driver_modules": [ + "usbhid" + ], + "driver_info": { + "type": "keyboard", + "xkb_rules": "xfree86", + "xkb_model": "pc104" + }, + "module_alias": "usb:v55D4p0461d0100dc00dsc00dp00ic03isc01ip01in00" + } + ], + "memory": [ + { + "index": 19, + "attached_to": 0, + "class_list": [ + "memory" + ], + "base_class": { + "hex": "0101", + "name": "Internally Used Class", + "value": 257 + }, + "sub_class": { + "hex": "0002", + "name": "Main Memory", + "value": 2 + }, + "model": "Main Memory", + "resources": [ + { + "type": "phys_mem", + "range": 32212254720 + } + ] + } + ], + "monitor": [ + { + "index": 69, + "attached_to": 35, + "class_list": [ + "monitor" + ], + "base_class": { + "hex": "0100", + "name": "Monitor", + "value": 256 + }, + "sub_class": { + "hex": "0002", + "name": "LCD Monitor", + "value": 2 + }, + "vendor": { + "hex": "3def", + "value": 15855 + }, + "device": { + "hex": "2700", + "name": "AN-270W04K", + "value": 9984 + }, + "serial": "0", + "model": "AN-270W04K", + "resources": [ + { + "type": "monitor", + "width": 1024, + "height": 768, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 1024, + "height": 768, + "vertical_frequency": 70, + "interlaced": false + }, + { + "type": "monitor", + "width": 1024, + "height": 768, + "vertical_frequency": 75, + "interlaced": false + }, + { + "type": "monitor", + "width": 1280, + "height": 1024, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 1280, + "height": 1024, + "vertical_frequency": 75, + "interlaced": false + }, + { + "type": "monitor", + "width": 1280, + "height": 720, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 1600, + "height": 900, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 2560, + "height": 1440, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 3840, + "height": 2160, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 640, + "height": 480, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 640, + "height": 480, + "vertical_frequency": 72, + "interlaced": false + }, + { + "type": "monitor", + "width": 640, + "height": 480, + "vertical_frequency": 75, + "interlaced": false + }, + { + "type": "monitor", + "width": 720, + "height": 400, + "vertical_frequency": 70, + "interlaced": false + }, + { + "type": "monitor", + "width": 800, + "height": 600, + "vertical_frequency": 56, + "interlaced": false + }, + { + "type": "monitor", + "width": 800, + "height": 600, + "vertical_frequency": 60, + "interlaced": false + }, + { + "type": "monitor", + "width": 800, + "height": 600, + "vertical_frequency": 72, + "interlaced": false + }, + { + "type": "monitor", + "width": 800, + "height": 600, + "vertical_frequency": 75, + "interlaced": false + }, + { + "type": "size", + "unit": "mm", + "value_1": 597, + "value_2": 336 + } + ], + "detail": { + "manufacture_year": 2020, + "manufacture_week": 18, + "vertical_sync": { + "min": 44, + "max": 63 + }, + "horizontal_sync": { + "min": 23, + "max": 160 + }, + "horizontal_sync_timings": { + "disp": 3840, + "sync_start": 3888, + "sync_end": 3920, + "total": 4400 + }, + "vertical_sync_timings": { + "disp": 2160, + "sync_start": 2163, + "sync_end": 2169, + "total": 2250 + }, + "clock": 297000, + "width": 3840, + "height": 2160, + "width_millimetres": 597, + "height_millimetres": 336, + "horizontal_flag": 43, + "vertical_flag": 43, + "vendor": "", + "name": "AN-270W04K" + }, + "driver_info": { + "type": "display", + "width": 3840, + "height": 2160, + "vertical_sync": { + "min": 44, + "max": 63 + }, + "horizontal_sync": { + "min": 23, + "max": 160 + }, + "bandwidth": 0, + "horizontal_sync_timings": { + "disp": 3840, + "sync_start": 3888, + "sync_end": 3920, + "total": 4400 + }, + "vertical_sync_timings": { + "disp": 2160, + "sync_start": 2163, + "sync_end": 2169, + "total": 2250 + }, + "horizontal_flag": 43, + "vertical_flag": 43 + } + } + ], + "mouse": [ + { + "index": 81, + "attached_to": 79, + "class_list": [ + "mouse", + "usb" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0105", + "name": "Mouse", + "value": 261 + }, + "sub_class": { + "hex": "0003", + "name": "USB Mouse", + "value": 3 + }, + "vendor": { + "hex": "1532", + "name": "Razer", + "value": 5426 + }, + "device": { + "hex": "0083", + "name": "Razer Basilisk X HyperSpeed", + "value": 131 + }, + "revision": { + "hex": "0000", + "name": "2.00", + "value": 0 + }, + "compat_vendor": "Unknown", + "compat_device": "Generic USB Mouse", + "model": "Razer Basilisk X HyperSpeed", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.2/5-2.2.4/5-2.2.4:1.0", + "sysfs_bus_id": "5-2.2.4:1.0", + "unix_device_names": [ + "/dev/input/mice" + ], + "unix_device_name2": "/dev/input/mouse1", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0003", + "name": "hid", + "value": 3 + }, + "interface_subclass": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "interface_protocol": 2, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "usbhid", + "driver_module": "usbhid", + "drivers": [ + "usbhid" + ], + "driver_modules": [ + "usbhid" + ], + "driver_info": { + "type": "mouse", + "db_entry_0": [ + "explorerps/2", + "exps2" + ], + "xf86": "explorerps/2", + "gpm": "exps2", + "buttons": -1, + "wheels": -1 + }, + "module_alias": "usb:v1532p0083d0200dc00dsc00dp00ic03isc01ip02in00" + }, + { + "index": 99, + "attached_to": 79, + "class_list": [ + "mouse", + "usb" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0105", + "name": "Mouse", + "value": 261 + }, + "sub_class": { + "hex": "0003", + "name": "USB Mouse", + "value": 3 + }, + "vendor": { + "hex": "55d4", + "name": "DH747", + "value": 21972 + }, + "device": { + "hex": "0461", + "name": "W-CORNE", + "value": 1121 + }, + "revision": { + "hex": "0000", + "name": "1.00", + "value": 0 + }, + "serial": "vial:f64c2b3c", + "compat_vendor": "Unknown", + "compat_device": "Generic USB Mouse", + "model": "DH747 W-CORNE", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.2/5-2.2.3/5-2.2.3:1.2", + "sysfs_bus_id": "5-2.2.3:1.2", + "unix_device_names": [ + "/dev/input/mice" + ], + "unix_device_name2": "/dev/input/mouse0", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0003", + "name": "hid", + "value": 3 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 2, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "usbhid", + "driver_module": "usbhid", + "drivers": [ + "usbhid" + ], + "driver_modules": [ + "usbhid" + ], + "driver_info": { + "type": "mouse", + "db_entry_0": [ + "explorerps/2", + "exps2" + ], + "xf86": "explorerps/2", + "gpm": "exps2", + "buttons": -1, + "wheels": -1 + }, + "module_alias": "usb:v55D4p0461d0100dc00dsc00dp00ic03isc00ip00in02" + } + ], + "network_controller": [ + { + "index": 21, + "attached_to": 38, + "class_list": [ + "network_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 12, + "number": 0 + }, + "base_class": { + "hex": "0002", + "name": "Network controller", + "value": 2 + }, + "sub_class": { + "hex": "0000", + "name": "Ethernet controller", + "value": 0 + }, + "vendor": { + "hex": "10ec", + "value": 4332 + }, + "sub_vendor": { + "hex": "1458", + "value": 5208 + }, + "device": { + "hex": "8125", + "value": 33061 + }, + "sub_device": { + "hex": "e000", + "value": 57344 + }, + "revision": { + "hex": "0005", + "value": 5 + }, + "model": "Ethernet controller", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0a.0/0000:0c:00.0", + "sysfs_bus_id": "0000:0c:00.0", + "unix_device_names": [ + "enp12s0" + ], + "resources": [ + { + "type": "hwaddr", + "address": 55 + }, + { + "type": "io", + "base": 57344, + "range": 256, + "enabled": true, + "access": "read_write" + }, + { + "type": "phwaddr", + "address": 55 + } + ], + "detail": { + "function": 0, + "command": 1031, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "r8169", + "driver_module": "r8169", + "drivers": [ + "r8169" + ], + "driver_modules": [ + "r8169" + ], + "module_alias": "pci:v000010ECd00008125sv00001458sd0000E000bc02sc00i00" + }, + { + "index": 64, + "attached_to": 25, + "class_list": [ + "network_controller", + "pci", + "wlan_card" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 13, + "number": 0 + }, + "base_class": { + "hex": "0002", + "name": "Network controller", + "value": 2 + }, + "sub_class": { + "hex": "0082", + "name": "WLAN controller", + "value": 130 + }, + "vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "sub_vendor": { + "hex": "8086", + "name": "Intel Corporation", + "value": 32902 + }, + "device": { + "hex": "2725", + "value": 10021 + }, + "sub_device": { + "hex": "0024", + "value": 36 + }, + "revision": { + "hex": "001a", + "value": 26 + }, + "model": "Intel WLAN controller", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0b.0/0000:0d:00.0", + "sysfs_bus_id": "0000:0d:00.0", + "unix_device_names": [ + "wlp13s0" + ], + "resources": [ + { + "type": "hwaddr", + "address": 52 + }, + { + "type": "phwaddr", + "address": 52 + }, + { + "type": "wlan", + "channels": [ + "1", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "11", + "12", + "13", + "36", + "40", + "44", + "48", + "52", + "56", + "60", + "64", + "100", + "104", + "108", + "112", + "116", + "120", + "124", + "128", + "132", + "136", + "140" + ], + "frequencies": [ + "2.412", + "2.417", + "2.422", + "2.427", + "2.432", + "2.437", + "2.442", + "2.447", + "2.452", + "2.457", + "2.462", + "2.467", + "2.472", + "5.18", + "5.2", + "5.22", + "5.24", + "5.26", + "5.28", + "5.3", + "5.32", + "5.5", + "5.52", + "5.54", + "5.56", + "5.58", + "5.6", + "5.62", + "5.64", + "5.66", + "5.68", + "5.7" + ], + "auth_modes": [ + "open", + "sharedkey", + "wpa-psk", + "wpa-eap" + ], + "enc_modes": [ + "WEP40", + "WEP104", + "TKIP", + "CCMP" + ] + } + ], + "detail": { + "function": 0, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "iwlwifi", + "driver_module": "iwlwifi", + "drivers": [ + "iwlwifi" + ], + "driver_modules": [ + "iwlwifi" + ], + "module_alias": "pci:v00008086d00002725sv00008086sd00000024bc02sc80i00" + } + ], + "network_interface": [ + { + "index": 103, + "attached_to": 64, + "class_list": [ + "network_interface" + ], + "base_class": { + "hex": "0107", + "name": "Network Interface", + "value": 263 + }, + "sub_class": { + "hex": "0001", + "name": "Ethernet", + "value": 1 + }, + "model": "Ethernet network interface", + "sysfs_id": "/class/net/wlp13s0", + "sysfs_device_link": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0b.0/0000:0d:00.0", + "unix_device_names": [ + "wlp13s0" + ], + "resources": [ + { + "type": "hwaddr", + "address": 52 + }, + { + "type": "phwaddr", + "address": 52 + } + ], + "driver": "iwlwifi", + "driver_module": "iwlwifi", + "drivers": [ + "iwlwifi" + ], + "driver_modules": [ + "iwlwifi" + ] + }, + { + "index": 104, + "attached_to": 21, + "class_list": [ + "network_interface" + ], + "base_class": { + "hex": "0107", + "name": "Network Interface", + "value": 263 + }, + "sub_class": { + "hex": "0001", + "name": "Ethernet", + "value": 1 + }, + "model": "Ethernet network interface", + "sysfs_id": "/class/net/enp12s0", + "sysfs_device_link": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0a.0/0000:0c:00.0", + "unix_device_names": [ + "enp12s0" + ], + "resources": [ + { + "type": "hwaddr", + "address": 55 + }, + { + "type": "phwaddr", + "address": 55 + } + ], + "driver": "r8169", + "driver_module": "r8169", + "drivers": [ + "r8169" + ], + "driver_modules": [ + "r8169" + ] + }, + { + "index": 105, + "attached_to": 0, + "class_list": [ + "network_interface" + ], + "base_class": { + "hex": "0107", + "name": "Network Interface", + "value": 263 + }, + "sub_class": { + "hex": "0000", + "name": "Loopback", + "value": 0 + }, + "model": "Loopback network interface", + "sysfs_id": "/class/net/lo", + "unix_device_names": [ + "lo" + ] + } + ], + "pci": [ + { + "index": 51, + "attached_to": 46, + "class_list": [ + "pci", + "unknown" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 52, + "number": 0 + }, + "base_class": { + "hex": "0010", + "name": "Encryption controller", + "value": 16 + }, + "sub_class": { + "hex": "0080", + "name": "Encryption controller", + "value": 128 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "device": { + "hex": "1649", + "value": 5705 + }, + "sub_device": { + "hex": "1649", + "value": 5705 + }, + "model": "AMD Encryption controller", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.2", + "sysfs_bus_id": "0000:34:00.2", + "detail": { + "function": 2, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "ccp", + "driver_module": "ccp", + "drivers": [ + "ccp" + ], + "driver_modules": [ + "ccp" + ], + "module_alias": "pci:v00001022d00001649sv00001022sd00001649bc10sc80i00" + }, + { + "index": 67, + "attached_to": 0, + "class_list": [ + "pci", + "unknown" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 0, + "number": 20 + }, + "base_class": { + "hex": "000c", + "name": "Serial bus controller", + "value": 12 + }, + "sub_class": { + "hex": "0005", + "name": "SMBus", + "value": 5 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1458", + "value": 5208 + }, + "device": { + "hex": "790b", + "value": 30987 + }, + "sub_device": { + "hex": "5001", + "value": 20481 + }, + "revision": { + "hex": "0071", + "value": 113 + }, + "model": "AMD SMBus", + "sysfs_id": "/devices/pci0000:00/0000:00:14.0", + "sysfs_bus_id": "0000:00:14.0", + "detail": { + "function": 0, + "command": 1027, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "module_alias": "pci:v00001022d0000790Bsv00001458sd00005001bc0Csc05i00" + } + ], + "sound": [ + { + "index": 29, + "attached_to": 46, + "class_list": [ + "sound", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 52, + "number": 0 + }, + "base_class": { + "hex": "0004", + "name": "Multimedia controller", + "value": 4 + }, + "sub_class": { + "hex": "0003", + "value": 3 + }, + "vendor": { + "hex": "1002", + "name": "ATI Technologies Inc", + "value": 4098 + }, + "sub_vendor": { + "hex": "1002", + "name": "ATI Technologies Inc", + "value": 4098 + }, + "device": { + "hex": "1640", + "value": 5696 + }, + "sub_device": { + "hex": "1640", + "value": 5696 + }, + "model": "ATI Multimedia controller", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.1", + "sysfs_bus_id": "0000:34:00.1", + "detail": { + "function": 1, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "snd_hda_intel", + "driver_module": "snd_hda_intel", + "drivers": [ + "snd_hda_intel" + ], + "driver_modules": [ + "snd_hda_intel" + ], + "module_alias": "pci:v00001002d00001640sv00001002sd00001640bc04sc03i00" + }, + { + "index": 39, + "attached_to": 46, + "class_list": [ + "sound", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 52, + "number": 0 + }, + "base_class": { + "hex": "0004", + "name": "Multimedia controller", + "value": 4 + }, + "sub_class": { + "hex": "0003", + "value": 3 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1458", + "value": 5208 + }, + "device": { + "hex": "15e3", + "value": 5603 + }, + "sub_device": { + "hex": "a194", + "value": 41364 + }, + "model": "AMD Multimedia controller", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.6", + "sysfs_bus_id": "0000:34:00.6", + "detail": { + "function": 6, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "snd_hda_intel", + "driver_module": "snd_hda_intel", + "drivers": [ + "snd_hda_intel" + ], + "driver_modules": [ + "snd_hda_intel" + ], + "module_alias": "pci:v00001022d000015E3sv00001458sd0000A194bc04sc03i00", + "label": "Realtek ALC1220" + }, + { + "index": 61, + "attached_to": 53, + "class_list": [ + "sound", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 1, + "number": 0 + }, + "base_class": { + "hex": "0004", + "name": "Multimedia controller", + "value": 4 + }, + "sub_class": { + "hex": "0003", + "value": 3 + }, + "vendor": { + "hex": "10de", + "name": "nVidia Corporation", + "value": 4318 + }, + "sub_vendor": { + "hex": "1458", + "value": 5208 + }, + "device": { + "hex": "228b", + "value": 8843 + }, + "sub_device": { + "hex": "404c", + "value": 16460 + }, + "revision": { + "hex": "00a1", + "value": 161 + }, + "model": "nVidia Multimedia controller", + "sysfs_id": "/devices/pci0000:00/0000:00:01.1/0000:01:00.1", + "sysfs_bus_id": "0000:01:00.1", + "detail": { + "function": 1, + "command": 6, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 0 + }, + "driver": "snd_hda_intel", + "driver_module": "snd_hda_intel", + "drivers": [ + "snd_hda_intel" + ], + "driver_modules": [ + "snd_hda_intel" + ], + "module_alias": "pci:v000010DEd0000228Bsv00001458sd0000404Cbc04sc03i00" + }, + { + "index": 76, + "attached_to": 79, + "class_list": [ + "sound", + "usb" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0004", + "name": "Multimedia controller", + "value": 4 + }, + "sub_class": { + "hex": "0001", + "name": "Multimedia audio controller", + "value": 1 + }, + "vendor": { + "hex": "0d8c", + "name": "C-Media Electronics Inc.", + "value": 3468 + }, + "device": { + "hex": "0014", + "name": "USB Audio Device", + "value": 20 + }, + "revision": { + "hex": "0000", + "name": "1.00", + "value": 0 + }, + "model": "C-Media Electronics USB Audio Device", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.2/5-2.2.2/5-2.2.2:1.1", + "sysfs_bus_id": "5-2.2.2:1.1", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "interface_subclass": { + "hex": "0002", + "name": "comm", + "value": 2 + }, + "interface_protocol": 0, + "interface_number": 1, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "snd-usb-audio", + "driver_module": "snd_usb_audio", + "drivers": [ + "snd-usb-audio" + ], + "driver_modules": [ + "snd_usb_audio" + ], + "module_alias": "usb:v0D8Cp0014d0100dc00dsc00dp00ic01isc02ip00in01" + }, + { + "index": 91, + "attached_to": 79, + "class_list": [ + "sound", + "usb" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0004", + "name": "Multimedia controller", + "value": 4 + }, + "sub_class": { + "hex": "0001", + "name": "Multimedia audio controller", + "value": 1 + }, + "vendor": { + "hex": "0d8c", + "name": "C-Media Electronics Inc.", + "value": 3468 + }, + "device": { + "hex": "0014", + "name": "USB Audio Device", + "value": 20 + }, + "revision": { + "hex": "0000", + "name": "1.00", + "value": 0 + }, + "model": "C-Media Electronics USB Audio Device", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.2/5-2.2.2/5-2.2.2:1.2", + "sysfs_bus_id": "5-2.2.2:1.2", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "interface_subclass": { + "hex": "0002", + "name": "comm", + "value": 2 + }, + "interface_protocol": 0, + "interface_number": 2, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "snd-usb-audio", + "driver_module": "snd_usb_audio", + "drivers": [ + "snd-usb-audio" + ], + "driver_modules": [ + "snd_usb_audio" + ], + "module_alias": "usb:v0D8Cp0014d0100dc00dsc00dp00ic01isc02ip00in02" + }, + { + "index": 95, + "attached_to": 79, + "class_list": [ + "sound", + "usb" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0004", + "name": "Multimedia controller", + "value": 4 + }, + "sub_class": { + "hex": "0001", + "name": "Multimedia audio controller", + "value": 1 + }, + "vendor": { + "hex": "0d8c", + "name": "C-Media Electronics Inc.", + "value": 3468 + }, + "device": { + "hex": "0014", + "name": "USB Audio Device", + "value": 20 + }, + "revision": { + "hex": "0000", + "name": "1.00", + "value": 0 + }, + "model": "C-Media Electronics USB Audio Device", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.2/5-2.2.2/5-2.2.2:1.0", + "sysfs_bus_id": "5-2.2.2:1.0", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "interface_subclass": { + "hex": "0001", + "name": "audio", + "value": 1 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "snd-usb-audio", + "driver_module": "snd_usb_audio", + "drivers": [ + "snd-usb-audio" + ], + "driver_modules": [ + "snd_usb_audio" + ], + "module_alias": "usb:v0D8Cp0014d0100dc00dsc00dp00ic01isc01ip00in00" + } + ], + "storage_controller": [ + { + "index": 31, + "attached_to": 27, + "class_list": [ + "storage_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 2, + "number": 0 + }, + "base_class": { + "hex": "0001", + "name": "Mass storage controller", + "value": 1 + }, + "sub_class": { + "hex": "0008", + "value": 8 + }, + "pci_interface": { + "hex": "0002", + "value": 2 + }, + "vendor": { + "hex": "c0a9", + "value": 49321 + }, + "sub_vendor": { + "hex": "c0a9", + "value": 49321 + }, + "device": { + "hex": "540a", + "value": 21514 + }, + "sub_device": { + "hex": "5021", + "value": 20513 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "Mass storage controller", + "sysfs_id": "/devices/pci0000:00/0000:00:01.2/0000:02:00.0", + "sysfs_bus_id": "0000:02:00.0", + "detail": { + "function": 0, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 2 + }, + "driver": "nvme", + "driver_module": "nvme", + "drivers": [ + "nvme" + ], + "driver_modules": [ + "nvme" + ], + "module_alias": "pci:v0000C0A9d0000540Asv0000C0A9sd00005021bc01sc08i02" + }, + { + "index": 49, + "attached_to": 43, + "class_list": [ + "storage_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 15, + "number": 0 + }, + "base_class": { + "hex": "0001", + "name": "Mass storage controller", + "value": 1 + }, + "sub_class": { + "hex": "0006", + "value": 6 + }, + "pci_interface": { + "hex": "0001", + "value": 1 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f6", + "value": 17398 + }, + "sub_device": { + "hex": "1062", + "value": 4194 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD Mass storage controller", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0d.0/0000:0f:00.0", + "sysfs_bus_id": "0000:0f:00.0", + "detail": { + "function": 0, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 1 + }, + "driver": "ahci", + "driver_module": "ahci", + "drivers": [ + "ahci" + ], + "driver_modules": [ + "ahci" + ], + "module_alias": "pci:v00001022d000043F6sv00001B21sd00001062bc01sc06i01" + }, + { + "index": 60, + "attached_to": 62, + "class_list": [ + "storage_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 16, + "number": 0 + }, + "base_class": { + "hex": "0001", + "name": "Mass storage controller", + "value": 1 + }, + "sub_class": { + "hex": "0008", + "value": 8 + }, + "pci_interface": { + "hex": "0002", + "value": 2 + }, + "vendor": { + "hex": "c0a9", + "value": 49321 + }, + "sub_vendor": { + "hex": "c0a9", + "value": 49321 + }, + "device": { + "hex": "540a", + "value": 21514 + }, + "sub_device": { + "hex": "5021", + "value": 20513 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "Mass storage controller", + "sysfs_id": "/devices/pci0000:00/0000:00:02.2/0000:10:00.0", + "sysfs_bus_id": "0000:10:00.0", + "detail": { + "function": 0, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 2 + }, + "driver": "nvme", + "driver_module": "nvme", + "drivers": [ + "nvme" + ], + "driver_modules": [ + "nvme" + ], + "module_alias": "pci:v0000C0A9d0000540Asv0000C0A9sd00005021bc01sc08i02" + } + ], + "system": { + "form_factor": "desktop" + }, + "unknown": [ + { + "index": 70, + "attached_to": 0, + "class_list": [ + "unknown" + ], + "base_class": { + "hex": "0007", + "name": "Communication controller", + "value": 7 + }, + "sub_class": { + "hex": "0000", + "name": "Serial controller", + "value": 0 + }, + "pci_interface": { + "hex": "0002", + "name": "16550", + "value": 2 + }, + "device": { + "hex": "0000", + "name": "16550A", + "value": 0 + }, + "model": "16550A", + "unix_device_names": [ + "/dev/ttyS0" + ], + "resources": [ + { + "type": "io", + "base": 1016, + "range": 0, + "enabled": true, + "access": "read_write" + } + ] + } + ], + "usb": [ + { + "index": 74, + "attached_to": 79, + "class_list": [ + "usb", + "unknown" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": { + "hex": "0d8c", + "name": "C-Media Electronics Inc.", + "value": 3468 + }, + "device": { + "hex": "0014", + "name": "USB Audio Device", + "value": 20 + }, + "revision": { + "hex": "0000", + "name": "1.00", + "value": 0 + }, + "model": "C-Media Electronics USB Audio Device", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.2/5-2.2.2/5-2.2.2:1.3", + "sysfs_bus_id": "5-2.2.2:1.3", + "unix_device_names": [ + "/dev/input/by-id/usb-C-Media_Electronics_Inc._USB_Audio_Device-event-if03", + "/dev/input/by-path/pci-0000:34:00.4-usb-0:2.2.2:1.3-event", + "/dev/input/by-path/pci-0000:34:00.4-usbv2-0:2.2.2:1.3-event", + "/dev/input/event25" + ], + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0003", + "name": "hid", + "value": 3 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 3, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "usbhid", + "driver_module": "usbhid", + "drivers": [ + "usbhid" + ], + "driver_modules": [ + "usbhid" + ], + "module_alias": "usb:v0D8Cp0014d0100dc00dsc00dp00ic03isc00ip00in03" + }, + { + "index": 75, + "attached_to": 79, + "class_list": [ + "usb", + "unknown" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": { + "hex": "1532", + "name": "Razer", + "value": 5426 + }, + "device": { + "hex": "0083", + "name": "Razer Basilisk X HyperSpeed", + "value": 131 + }, + "revision": { + "hex": "0000", + "name": "2.00", + "value": 0 + }, + "model": "Razer Basilisk X HyperSpeed", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.2/5-2.2.4/5-2.2.4:1.2", + "sysfs_bus_id": "5-2.2.4:1.2", + "unix_device_names": [ + "/dev/input/by-id/usb-Razer_Razer_Basilisk_X_HyperSpeed-if02-event-kbd", + "/dev/input/by-path/pci-0000:34:00.4-usb-0:2.2.4:1.2-event-kbd", + "/dev/input/by-path/pci-0000:34:00.4-usbv2-0:2.2.4:1.2-event-kbd", + "/dev/input/event24" + ], + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0003", + "name": "hid", + "value": 3 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 1, + "interface_number": 2, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "usbhid", + "driver_module": "usbhid", + "drivers": [ + "usbhid" + ], + "driver_modules": [ + "usbhid" + ], + "module_alias": "usb:v1532p0083d0200dc00dsc00dp00ic03isc00ip01in02" + }, + { + "index": 77, + "attached_to": 82, + "class_list": [ + "usb", + "unknown" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": { + "hex": "1d50", + "name": "ZMK Project", + "value": 7504 + }, + "device": { + "hex": "615e", + "name": "urchin", + "value": 24926 + }, + "revision": { + "hex": "0000", + "name": "3.05", + "value": 0 + }, + "serial": "214AF0D66B273031", + "model": "ZMK Project urchin", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.4/5-2.4:1.1", + "sysfs_bus_id": "5-2.4:1.1", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "00ef", + "name": "miscellaneous", + "value": 239 + }, + "device_subclass": { + "hex": "0002", + "name": "comm", + "value": 2 + }, + "device_protocol": 1, + "interface_class": { + "hex": "000a", + "name": "data", + "value": 10 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 1, + "interface_alternate_setting": 0, + "interface_association": { + "function_class": { + "hex": "0002", + "name": "comm", + "value": 2 + }, + "function_subclass": { + "hex": "0002", + "name": "comm", + "value": 2 + }, + "function_protocol": 0, + "interface_count": 2, + "first_interface": 0 + } + }, + "hotplug": "usb", + "driver": "cdc_acm", + "driver_module": "cdc_acm", + "drivers": [ + "cdc_acm" + ], + "driver_modules": [ + "cdc_acm" + ], + "module_alias": "usb:v1D50p615Ed0305dcEFdsc02dp01ic0Aisc00ip00in01" + }, + { + "index": 78, + "attached_to": 93, + "class_list": [ + "usb", + "unknown" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": { + "hex": "048d", + "name": "Integrated Technology Express", + "value": 1165 + }, + "device": { + "hex": "5702", + "name": "ITE Device", + "value": 22274 + }, + "revision": { + "hex": "0000", + "name": "0.01", + "value": 0 + }, + "model": "Integrated Technology Express ITE Device", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0c.0/0000:0e:00.0/usb1/1-10/1-10:1.0", + "sysfs_bus_id": "1-10:1.0", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0003", + "name": "hid", + "value": 3 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "usbhid", + "driver_module": "usbhid", + "drivers": [ + "usbhid" + ], + "driver_modules": [ + "usbhid" + ], + "module_alias": "usb:v048Dp5702d0001dc00dsc00dp00ic03isc00ip00in00" + }, + { + "index": 84, + "attached_to": 79, + "class_list": [ + "usb", + "unknown" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": { + "hex": "55d4", + "name": "DH747", + "value": 21972 + }, + "device": { + "hex": "0461", + "name": "W-CORNE", + "value": 1121 + }, + "revision": { + "hex": "0000", + "name": "1.00", + "value": 0 + }, + "serial": "vial:f64c2b3c", + "model": "DH747 W-CORNE", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.2/5-2.2.3/5-2.2.3:1.1", + "sysfs_bus_id": "5-2.2.3:1.1", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0003", + "name": "hid", + "value": 3 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 1, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "usbhid", + "driver_module": "usbhid", + "drivers": [ + "usbhid" + ], + "driver_modules": [ + "usbhid" + ], + "module_alias": "usb:v55D4p0461d0100dc00dsc00dp00ic03isc00ip00in01" + }, + { + "index": 85, + "attached_to": 82, + "class_list": [ + "usb", + "unknown" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": { + "hex": "2dc8", + "name": "8BitDo", + "value": 11720 + }, + "device": { + "hex": "3109", + "name": "IDLE", + "value": 12553 + }, + "revision": { + "hex": "0000", + "name": "2.00", + "value": 0 + }, + "serial": "E417D863C16B", + "model": "8BitDo IDLE", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.3/5-2.3:1.0", + "sysfs_bus_id": "5-2.3:1.0", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0003", + "name": "hid", + "value": 3 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "usbhid", + "driver_module": "usbhid", + "drivers": [ + "usbhid" + ], + "driver_modules": [ + "usbhid" + ], + "module_alias": "usb:v2DC8p3109d0200dc00dsc00dp00ic03isc00ip00in00" + }, + { + "index": 92, + "attached_to": 82, + "class_list": [ + "usb", + "unknown" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": { + "hex": "1d50", + "name": "ZMK Project", + "value": 7504 + }, + "device": { + "hex": "615e", + "name": "urchin", + "value": 24926 + }, + "revision": { + "hex": "0000", + "name": "3.05", + "value": 0 + }, + "serial": "214AF0D66B273031", + "model": "ZMK Project urchin", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.4/5-2.4:1.2", + "sysfs_bus_id": "5-2.4:1.2", + "unix_device_names": [ + "/dev/input/by-id/usb-ZMK_Project_urchin_214AF0D66B273031-if02-event-kbd", + "/dev/input/by-path/pci-0000:34:00.4-usb-0:2.4:1.2-event-kbd", + "/dev/input/by-path/pci-0000:34:00.4-usbv2-0:2.4:1.2-event-kbd", + "/dev/input/event20" + ], + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "00ef", + "name": "miscellaneous", + "value": 239 + }, + "device_subclass": { + "hex": "0002", + "name": "comm", + "value": 2 + }, + "device_protocol": 1, + "interface_class": { + "hex": "0003", + "name": "hid", + "value": 3 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 0, + "interface_number": 2, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "usbhid", + "driver_module": "usbhid", + "drivers": [ + "usbhid" + ], + "driver_modules": [ + "usbhid" + ], + "module_alias": "usb:v1D50p615Ed0305dcEFdsc02dp01ic03isc00ip00in02" + }, + { + "index": 94, + "attached_to": 79, + "class_list": [ + "usb", + "unknown" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": { + "hex": "1532", + "name": "Razer", + "value": 5426 + }, + "device": { + "hex": "0083", + "name": "Razer Basilisk X HyperSpeed", + "value": 131 + }, + "revision": { + "hex": "0000", + "name": "2.00", + "value": 0 + }, + "model": "Razer Basilisk X HyperSpeed", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.2/5-2.2.4/5-2.2.4:1.1", + "sysfs_bus_id": "5-2.2.4:1.1", + "unix_device_names": [ + "/dev/input/by-id/usb-Razer_Razer_Basilisk_X_HyperSpeed-event-if01", + "/dev/input/by-path/pci-0000:34:00.4-usb-0:2.2.4:1.1-event", + "/dev/input/by-path/pci-0000:34:00.4-usbv2-0:2.2.4:1.1-event", + "/dev/input/event23" + ], + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "device_protocol": 0, + "interface_class": { + "hex": "0003", + "name": "hid", + "value": 3 + }, + "interface_subclass": { + "hex": "0000", + "name": "per_interface", + "value": 0 + }, + "interface_protocol": 1, + "interface_number": 1, + "interface_alternate_setting": 0 + }, + "hotplug": "usb", + "driver": "usbhid", + "driver_module": "usbhid", + "drivers": [ + "usbhid" + ], + "driver_modules": [ + "usbhid" + ], + "module_alias": "usb:v1532p0083d0200dc00dsc00dp00ic03isc00ip01in01" + }, + { + "index": 96, + "attached_to": 82, + "class_list": [ + "usb", + "unknown" + ], + "bus_type": { + "hex": "0086", + "name": "USB", + "value": 134 + }, + "slot": { + "bus": 0, + "number": 0 + }, + "base_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "sub_class": { + "hex": "0000", + "name": "Unclassified device", + "value": 0 + }, + "vendor": { + "hex": "1d50", + "name": "ZMK Project", + "value": 7504 + }, + "device": { + "hex": "615e", + "name": "urchin", + "value": 24926 + }, + "revision": { + "hex": "0000", + "name": "3.05", + "value": 0 + }, + "serial": "214AF0D66B273031", + "model": "ZMK Project urchin", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4/usb5/5-2/5-2.4/5-2.4:1.0", + "sysfs_bus_id": "5-2.4:1.0", + "resources": [ + { + "type": "baud", + "speed": 12000000, + "bits": 0, + "stop_bits": 0, + "parity": 0, + "handshake": 0 + } + ], + "detail": { + "device_class": { + "hex": "00ef", + "name": "miscellaneous", + "value": 239 + }, + "device_subclass": { + "hex": "0002", + "name": "comm", + "value": 2 + }, + "device_protocol": 1, + "interface_class": { + "hex": "0002", + "name": "comm", + "value": 2 + }, + "interface_subclass": { + "hex": "0002", + "name": "comm", + "value": 2 + }, + "interface_protocol": 0, + "interface_number": 0, + "interface_alternate_setting": 0, + "interface_association": { + "function_class": { + "hex": "0002", + "name": "comm", + "value": 2 + }, + "function_subclass": { + "hex": "0002", + "name": "comm", + "value": 2 + }, + "function_protocol": 0, + "interface_count": 2, + "first_interface": 0 + } + }, + "hotplug": "usb", + "driver": "cdc_acm", + "driver_module": "cdc_acm", + "drivers": [ + "cdc_acm" + ], + "driver_modules": [ + "cdc_acm" + ], + "module_alias": "usb:v1D50p615Ed0305dcEFdsc02dp01ic02isc02ip00in00" + } + ], + "usb_controller": [ + { + "index": 23, + "attached_to": 46, + "class_list": [ + "usb_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 52, + "number": 0 + }, + "base_class": { + "hex": "000c", + "name": "Serial bus controller", + "value": 12 + }, + "sub_class": { + "hex": "0003", + "name": "USB Controller", + "value": 3 + }, + "pci_interface": { + "hex": "0030", + "value": 48 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1458", + "value": 5208 + }, + "device": { + "hex": "15b6", + "value": 5558 + }, + "sub_device": { + "hex": "5007", + "value": 20487 + }, + "model": "AMD USB Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.3", + "sysfs_bus_id": "0000:34:00.3", + "detail": { + "function": 3, + "command": 1027, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 48 + }, + "driver": "xhci_hcd", + "driver_module": "xhci_pci", + "drivers": [ + "xhci_hcd" + ], + "driver_modules": [ + "xhci_pci" + ], + "module_alias": "pci:v00001022d000015B6sv00001458sd00005007bc0Csc03i30" + }, + { + "index": 45, + "attached_to": 46, + "class_list": [ + "usb_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 52, + "number": 0 + }, + "base_class": { + "hex": "000c", + "name": "Serial bus controller", + "value": 12 + }, + "sub_class": { + "hex": "0003", + "name": "USB Controller", + "value": 3 + }, + "pci_interface": { + "hex": "0030", + "value": 48 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1458", + "value": 5208 + }, + "device": { + "hex": "15b7", + "value": 5559 + }, + "sub_device": { + "hex": "5007", + "value": 20487 + }, + "model": "AMD USB Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:08.1/0000:34:00.4", + "sysfs_bus_id": "0000:34:00.4", + "detail": { + "function": 4, + "command": 1031, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 48 + }, + "driver": "xhci_hcd", + "driver_module": "xhci_pci", + "drivers": [ + "xhci_hcd" + ], + "driver_modules": [ + "xhci_pci" + ], + "module_alias": "pci:v00001022d000015B7sv00001458sd00005007bc0Csc03i30" + }, + { + "index": 48, + "attached_to": 40, + "class_list": [ + "usb_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 53, + "number": 0 + }, + "base_class": { + "hex": "000c", + "name": "Serial bus controller", + "value": 12 + }, + "sub_class": { + "hex": "0003", + "name": "USB Controller", + "value": 3 + }, + "pci_interface": { + "hex": "0030", + "value": 48 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1458", + "value": 5208 + }, + "device": { + "hex": "15b8", + "value": 5560 + }, + "sub_device": { + "hex": "5007", + "value": 20487 + }, + "model": "AMD USB Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:08.3/0000:35:00.0", + "sysfs_bus_id": "0000:35:00.0", + "detail": { + "function": 0, + "command": 1027, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 48 + }, + "driver": "xhci_hcd", + "driver_module": "xhci_pci", + "drivers": [ + "xhci_hcd" + ], + "driver_modules": [ + "xhci_pci" + ], + "module_alias": "pci:v00001022d000015B8sv00001458sd00005007bc0Csc03i30" + }, + { + "index": 57, + "attached_to": 59, + "class_list": [ + "usb_controller", + "pci" + ], + "bus_type": { + "hex": "0004", + "name": "PCI", + "value": 4 + }, + "slot": { + "bus": 14, + "number": 0 + }, + "base_class": { + "hex": "000c", + "name": "Serial bus controller", + "value": 12 + }, + "sub_class": { + "hex": "0003", + "name": "USB Controller", + "value": 3 + }, + "pci_interface": { + "hex": "0030", + "value": 48 + }, + "vendor": { + "hex": "1022", + "name": "AMD", + "value": 4130 + }, + "sub_vendor": { + "hex": "1b21", + "value": 6945 + }, + "device": { + "hex": "43f7", + "value": 17399 + }, + "sub_device": { + "hex": "1142", + "value": 4418 + }, + "revision": { + "hex": "0001", + "value": 1 + }, + "model": "AMD USB Controller", + "sysfs_id": "/devices/pci0000:00/0000:00:02.1/0000:03:00.0/0000:04:0c.0/0000:0e:00.0", + "sysfs_bus_id": "0000:0e:00.0", + "detail": { + "function": 0, + "command": 1030, + "header_type": 0, + "secondary_bus": 0, + "prog_if": 48 + }, + "driver": "xhci_hcd", + "driver_module": "xhci_pci", + "drivers": [ + "xhci_hcd" + ], + "driver_modules": [ + "xhci_pci" + ], + "module_alias": "pci:v00001022d000043F7sv00001B21sd00001142bc0Csc03i30" + } + ] + }, + "smbios": { + "bios": { + "handle": 0, + "vendor": "American Megatrends International, LLC.", + "version": "F4", + "date": "09/28/2022", + "features": [ + "PCI supported", + "BIOS flashable", + "BIOS shadowing allowed", + "CD boot supported", + "Selectable boot supported", + "BIOS ROM socketed", + "EDD spec supported", + "1.2MB NEC 9800 Japanese Floppy supported", + "1.2MB Toshiba Japanese Floppy supported", + "360kB Floppy supported", + "1.2MB Floppy supported", + "720kB Floppy supported", + "2.88MB Floppy supported", + "Print Screen supported", + "Serial Services supported", + "Printer Services supported", + "CGA/Mono Video supported", + "USB Legacy supported", + "BIOS Boot Spec supported" + ], + "start_address": "0xf0000", + "rom_size": 16777216 + }, + "board": { + "handle": 2, + "manufacturer": "Gigabyte Technology Co., Ltd.", + "product": "B650M GAMING X AX", + "version": "x.x", + "board_type": { + "hex": "000a", + "name": "Motherboard", + "value": 10 + }, + "features": [ + "Hosting Board", + "Replaceable" + ], + "location": "Default string", + "chassis": 3 + }, + "cache": [ + { + "handle": 10, + "socket": "L1 - Cache", + "size_max": 512, + "size_current": 512, + "speed": 1, + "mode": { + "hex": "0001", + "name": "Write Back", + "value": 1 + }, + "enabled": true, + "location": { + "hex": "0000", + "name": "Internal", + "value": 0 + }, + "socketed": false, + "level": 0, + "ecc": { + "hex": "0006", + "name": "Multi-bit", + "value": 6 + }, + "cache_type": { + "hex": "0005", + "name": "Unified", + "value": 5 + }, + "associativity": { + "hex": "0007", + "name": "8-way Set-Associative", + "value": 7 + }, + "sram_type_current": [ + "Pipeline Burst" + ], + "sram_type_supported": [ + "Pipeline Burst" + ] + }, + { + "handle": 11, + "socket": "L2 - Cache", + "size_max": 8192, + "size_current": 8192, + "speed": 1, + "mode": { + "hex": "0001", + "name": "Write Back", + "value": 1 + }, + "enabled": true, + "location": { + "hex": "0000", + "name": "Internal", + "value": 0 + }, + "socketed": false, + "level": 1, + "ecc": { + "hex": "0006", + "name": "Multi-bit", + "value": 6 + }, + "cache_type": { + "hex": "0005", + "name": "Unified", + "value": 5 + }, + "associativity": { + "hex": "0007", + "name": "8-way Set-Associative", + "value": 7 + }, + "sram_type_current": [ + "Pipeline Burst" + ], + "sram_type_supported": [ + "Pipeline Burst" + ] + }, + { + "handle": 12, + "socket": "L3 - Cache", + "size_max": 98304, + "size_current": 98304, + "speed": 1, + "mode": { + "hex": "0001", + "name": "Write Back", + "value": 1 + }, + "enabled": true, + "location": { + "hex": "0000", + "name": "Internal", + "value": 0 + }, + "socketed": false, + "level": 2, + "ecc": { + "hex": "0006", + "name": "Multi-bit", + "value": 6 + }, + "cache_type": { + "hex": "0005", + "name": "Unified", + "value": 5 + }, + "associativity": { + "hex": "0008", + "name": "16-way Set-Associative", + "value": 8 + }, + "sram_type_current": [ + "Pipeline Burst" + ], + "sram_type_supported": [ + "Pipeline Burst" + ] + } + ], + "chassis": [ + { + "handle": 3, + "manufacturer": "Default string", + "version": "Default string", + "chassis_type": { + "hex": "0003", + "name": "Desktop", + "value": 3 + }, + "lock_present": false, + "bootup_state": { + "hex": "0003", + "name": "Safe", + "value": 3 + }, + "power_state": { + "hex": "0003", + "name": "Safe", + "value": 3 + }, + "thermal_state": { + "hex": "0003", + "name": "Safe", + "value": 3 + }, + "security_state": { + "hex": "0003", + "name": "None", + "value": 3 + }, + "oem": "0x0" + } + ], + "config": { + "handle": 6, + "options": [ + "Default string" + ] + }, + "language": [ + { + "handle": 41, + "languages": [ + "en|US|iso8859-1", + "zh|TW|unicode", + "zh|CN|unicode", + "ru|RU|iso8859-5", + "de|DE|iso8859-1", + "ja|JP|unicode", + "ko|KR|unicode", + "es|ES|iso8859-1", + "fr|FR|iso8859-1", + "it|IT|iso8859-1", + "pt|PT|iso8859-1", + "vi|VI|iso8859-1", + "id|ID|iso8859-1", + "tr|TR|iso8859-1", + "pl|PL|iso8859-1" + ] + } + ], + "memory_array": [ + { + "handle": 15, + "location": { + "hex": "0003", + "name": "Motherboard", + "value": 3 + }, + "usage": { + "hex": "0003", + "name": "System memory", + "value": 3 + }, + "ecc": { + "hex": "0003", + "name": "None", + "value": 3 + }, + "max_size": "0x8000000", + "error_handle": 14, + "slots": 4 + } + ], + "memory_array_mapped_address": [ + { + "handle": 16, + "array_handle": 15, + "start_address": "0x0", + "end_address": "0x800000000", + "part_width": 2 + } + ], + "memory_device": [ + { + "handle": 18, + "location": "DIMM 0", + "bank_location": "P0 CHANNEL A", + "manufacturer": "Unknown", + "part_number": "Unknown", + "array_handle": 15, + "error_handle": 17, + "width": 0, + "ecc_bits": 0, + "size": 0, + "form_factor": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "set": 0, + "memory_type": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "memory_type_details": [ + "Unknown" + ], + "speed": 0 + }, + { + "handle": 20, + "location": "DIMM 1", + "bank_location": "P0 CHANNEL A", + "manufacturer": "Unknown", + "part_number": "CMH32GX5M2D6000C36", + "array_handle": 15, + "error_handle": 19, + "width": 64, + "ecc_bits": 0, + "size": 16777216, + "form_factor": { + "hex": "0009", + "name": "DIMM", + "value": 9 + }, + "set": 0, + "memory_type": { + "hex": "0022", + "name": "Other", + "value": 34 + }, + "memory_type_details": [ + "Synchronous" + ], + "speed": 6000 + }, + { + "handle": 23, + "location": "DIMM 0", + "bank_location": "P0 CHANNEL B", + "manufacturer": "Unknown", + "part_number": "Unknown", + "array_handle": 15, + "error_handle": 22, + "width": 0, + "ecc_bits": 0, + "size": 0, + "form_factor": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "set": 0, + "memory_type": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "memory_type_details": [ + "Unknown" + ], + "speed": 0 + }, + { + "handle": 25, + "location": "DIMM 1", + "bank_location": "P0 CHANNEL B", + "manufacturer": "Unknown", + "part_number": "CMH32GX5M2D6000C36", + "array_handle": 15, + "error_handle": 24, + "width": 64, + "ecc_bits": 0, + "size": 16777216, + "form_factor": { + "hex": "0009", + "name": "DIMM", + "value": 9 + }, + "set": 0, + "memory_type": { + "hex": "0022", + "name": "Other", + "value": 34 + }, + "memory_type_details": [ + "Synchronous" + ], + "speed": 6000 + } + ], + "memory_device_mapped_address": [ + { + "handle": 21, + "memory_device_handle": 20, + "array_map_handle": 16, + "start_address": "0x0", + "end_address": "0x400000000", + "row_position": 255, + "interleave_position": 255, + "interleave_depth": 255 + }, + { + "handle": 26, + "memory_device_handle": 25, + "array_map_handle": 16, + "start_address": "0x400000000", + "end_address": "0x800000000", + "row_position": 255, + "interleave_position": 255, + "interleave_depth": 255 + } + ], + "memory_error": [ + { + "handle": 14, + "error_type": { + "hex": "0003", + "name": "OK", + "value": 3 + }, + "granularity": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "operation": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "syndrome": 0, + "array_address": "0x80000000", + "device_address": "0x80000000", + "range": 2147483648 + }, + { + "handle": 17, + "error_type": { + "hex": "0003", + "name": "OK", + "value": 3 + }, + "granularity": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "operation": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "syndrome": 0, + "array_address": "0x80000000", + "device_address": "0x80000000", + "range": 2147483648 + }, + { + "handle": 19, + "error_type": { + "hex": "0003", + "name": "OK", + "value": 3 + }, + "granularity": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "operation": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "syndrome": 0, + "array_address": "0x80000000", + "device_address": "0x80000000", + "range": 2147483648 + }, + { + "handle": 22, + "error_type": { + "hex": "0003", + "name": "OK", + "value": 3 + }, + "granularity": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "operation": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "syndrome": 0, + "array_address": "0x80000000", + "device_address": "0x80000000", + "range": 2147483648 + }, + { + "handle": 24, + "error_type": { + "hex": "0003", + "name": "OK", + "value": 3 + }, + "granularity": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "operation": { + "hex": "0002", + "name": "Unknown", + "value": 2 + }, + "syndrome": 0, + "array_address": "0x80000000", + "device_address": "0x80000000", + "range": 2147483648 + } + ], + "onboard": [ + { + "handle": 4, + "devices": [ + { + "name": "To Be Filled By O.E.M.", + "type": { + "hex": "0003", + "name": "Video", + "value": 3 + }, + "enabled": true + } + ] + } + ], + "port_connector": [ + { + "handle": 28, + "port_type": { + "hex": "0010", + "name": "USB", + "value": 16 + }, + "internal_reference_designator": "J1500", + "external_connector_type": { + "hex": "0012", + "name": "Access Bus [USB]", + "value": 18 + }, + "external_reference_designator": "USB-C" + }, + { + "handle": 29, + "port_type": { + "hex": "0010", + "name": "USB", + "value": 16 + }, + "internal_reference_designator": "J1501", + "external_connector_type": { + "hex": "0012", + "name": "Access Bus [USB]", + "value": 18 + }, + "external_reference_designator": "USB-C" + }, + { + "handle": 30, + "port_type": { + "hex": "0010", + "name": "USB", + "value": 16 + }, + "internal_reference_designator": "J1502", + "external_connector_type": { + "hex": "0012", + "name": "Access Bus [USB]", + "value": 18 + }, + "external_reference_designator": "USB-C" + }, + { + "handle": 31, + "port_type": { + "hex": "0010", + "name": "USB", + "value": 16 + }, + "internal_reference_designator": "J1503", + "external_connector_type": { + "hex": "0012", + "name": "Access Bus [USB]", + "value": 18 + }, + "external_reference_designator": "USB 2.0" + }, + { + "handle": 32, + "port_type": { + "hex": "0010", + "name": "USB", + "value": 16 + }, + "internal_reference_designator": "J1504", + "external_connector_type": { + "hex": "0012", + "name": "Access Bus [USB]", + "value": 18 + }, + "external_reference_designator": "USB 3.2" + }, + { + "handle": 33, + "port_type": { + "hex": "001c", + "name": "Video Port", + "value": 28 + }, + "internal_reference_designator": "J1100", + "external_reference_designator": "Nova" + }, + { + "handle": 34, + "port_type": { + "hex": "001d", + "name": "Audio Port", + "value": 29 + }, + "internal_reference_designator": "J2100", + "external_connector_type": { + "hex": "001f", + "name": "Mini-jack [headphones]", + "value": 31 + }, + "external_reference_designator": "Front Audio" + }, + { + "handle": 35, + "port_type": { + "hex": "001d", + "name": "Audio Port", + "value": 29 + }, + "internal_reference_designator": "J2101", + "external_connector_type": { + "hex": "001f", + "name": "Mini-jack [headphones]", + "value": 31 + }, + "external_reference_designator": "Audio Jack" + }, + { + "handle": 36, + "port_type": { + "hex": "001d", + "name": "Audio Port", + "value": 29 + }, + "internal_reference_designator": "J2102", + "external_connector_type": { + "hex": "001f", + "name": "Mini-jack [headphones]", + "value": 31 + }, + "external_reference_designator": "HD Audio HDR" + } + ], + "processor": [ + { + "handle": 13, + "socket": "AM5", + "socket_type": { + "hex": "0001", + "name": "Other", + "value": 1 + }, + "socket_populated": true, + "manufacturer": "Advanced Micro Devices, Inc.", + "version": "AMD Ryzen 7 7800X3D 8-Core Processor", + "part": "Unknown", + "processor_type": { + "hex": "0003", + "name": "CPU", + "value": 3 + }, + "processor_family": { + "hex": "006b", + "name": "Other", + "value": 107 + }, + "processor_status": { + "hex": "0001", + "name": "Enabled", + "value": 1 + }, + "clock_ext": 100, + "clock_max": 5050, + "cache_handle_l1": 10, + "cache_handle_l2": 11, + "cache_handle_l3": 12 + } + ], + "slot": [ + { + "handle": 37, + "designation": "PCIE1", + "slot_type": { + "hex": "00a9", + "name": "Other", + "value": 169 + }, + "bus_width": { + "hex": "000b", + "name": "Other", + "value": 11 + }, + "usage": { + "hex": "0004", + "name": "In Use", + "value": 4 + }, + "length": { + "hex": "0003", + "name": "Short", + "value": 3 + }, + "id": 1, + "features": [ + "3.3 V", + "PME#" + ] + }, + { + "handle": 38, + "designation": "J3502", + "slot_type": { + "hex": "00a8", + "name": "Other", + "value": 168 + }, + "bus_width": { + "hex": "000a", + "name": "Other", + "value": 10 + }, + "usage": { + "hex": "0004", + "name": "In Use", + "value": 4 + }, + "length": { + "hex": "0003", + "name": "Short", + "value": 3 + }, + "id": 0, + "features": [ + "3.3 V", + "PME#" + ] + }, + { + "handle": 39, + "designation": "PCIE4", + "slot_type": { + "hex": "00a8", + "name": "Other", + "value": 168 + }, + "bus_width": { + "hex": "000a", + "name": "Other", + "value": 10 + }, + "usage": { + "hex": "0004", + "name": "In Use", + "value": 4 + }, + "length": { + "hex": "0003", + "name": "Short", + "value": 3 + }, + "id": 6, + "features": [ + "3.3 V", + "PME#" + ] + } + ], + "system": { + "handle": 1, + "manufacturer": "Gigabyte Technology Co., Ltd.", + "product": "B650M GAMING X AX", + "version": "Default string", + "wake_up": { + "hex": "0006", + "name": "Power Switch", + "value": 6 + } + } + } +} diff --git a/ops/nix/manifest.nix b/ops/nix/manifest.nix index 791740b3..b1b3fec0 100644 --- a/ops/nix/manifest.nix +++ b/ops/nix/manifest.nix @@ -7,6 +7,10 @@ }; secrets.sops.enable = true; nodes.nixos = { + nephalem = { + type = "nephalem"; + device = "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434"; + }; veil = { type = "rpi4b"; device = "/dev/mmcblk1"; diff --git a/ops/nix/nodes/device.nix b/ops/nix/nodes/device.nix index 6cde2824..d6991a86 100644 --- a/ops/nix/nodes/device.nix +++ b/ops/nix/nodes/device.nix @@ -40,4 +40,77 @@ }; }; }; + flake.diskoConfigurations.nephalem = + { + device ? "", + ... + }: + { + disko.devices.disk.main = { + inherit device; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + esp = { + name = "ESP"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + swap = { + size = "4G"; + content = { + type = "swap"; + resumeDevice = true; + }; + }; + root = { + name = "root"; + size = "100%"; + content = { + type = "lvm_pv"; + vg = "root_vg"; + }; + }; + }; + }; + }; + disko.devices.lvm_vg.root_vg = { + type = "lvm_vg"; + lvs.root = { + size = "100%FREE"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/root".mountpoint = "/"; + "/persist" = { + mountpoint = "/persist"; + mountOptions = [ + "subvol=persist" + "noatime" + ]; + }; + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ + "subvol=nix" + "noatime" + ]; + }; + }; + }; + }; + }; + }; } diff --git a/ops/nix/nodes/type.nix b/ops/nix/nodes/type.nix index 57594b14..2639a155 100644 --- a/ops/nix/nodes/type.nix +++ b/ops/nix/nodes/type.nix @@ -17,7 +17,7 @@ in imports = [ inputs.disko.nixosModules.default inputs.nixos-facter-modules.nixosModules.facter - config.flake.diskoConfigurations.${hostConfig.type} + (config.flake.diskoConfigurations.${hostConfig.type} { inherit (hostConfig) device; }) ]; config = mkMerge [ { @@ -27,6 +27,8 @@ in boot.loader.grub.enable = false; boot.loader.generic-extlinux-compatible.enable = true; }) + (mkIf (hostConfig.type == "nephalem") { + }) ]; }; } From e977aa6ac7c7bb8048199b11fb6f794250313c36 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Mon, 3 Nov 2025 01:00:02 +0800 Subject: [PATCH 19/21] temp: add nvidia --- ops/nix/manifest.nix | 1 - ops/nix/nodes/type.nix | 20 ++++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ops/nix/manifest.nix b/ops/nix/manifest.nix index b1b3fec0..63d650e0 100644 --- a/ops/nix/manifest.nix +++ b/ops/nix/manifest.nix @@ -14,7 +14,6 @@ veil = { type = "rpi4b"; device = "/dev/mmcblk1"; - createImage = true; }; }; externals.nginx = { diff --git a/ops/nix/nodes/type.nix b/ops/nix/nodes/type.nix index 2639a155..fea9e54e 100644 --- a/ops/nix/nodes/type.nix +++ b/ops/nix/nodes/type.nix @@ -6,13 +6,14 @@ }: let cfg = config.flake; - inherit (builtins) fromJSON readFile; + inherit (builtins) fromJSON readFile elem; inherit (cfg.paths) facter; inherit (lib.modules) mkMerge mkIf; + inherit (lib.strings) getName; in { flake.modules.nixos.default = - { hostConfig, ... }: + { hostConfig, pkgs, ... }: { imports = [ inputs.disko.nixosModules.default @@ -28,6 +29,21 @@ in boot.loader.generic-extlinux-compatible.enable = true; }) (mkIf (hostConfig.type == "nephalem") { + boot.kernelPackages = pkgs.linuxPackages_latest; + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = false; + open = false; + nvidiaSettings = true; + package = pkgs.linuxPackages_latest.nvidiaPackages.stable; + }; + nixpkgs.config.allowUnfreePredicate = + pkg: + elem (getName pkg) [ + "nvidia-settings" + "nvidia-x11" + ]; }) ]; }; From 7eac6153da7fbf77c573bb8af3da519538687922 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Tue, 4 Nov 2025 00:26:35 +0800 Subject: [PATCH 20/21] reabase agains lol --- .gitignore | 8 ++++- docs/README.md | 16 ++++++++++ docs/runbook.md | 4 +++ flake.lock | 37 ++++++++++++++++++++++ flake.nix | 2 ++ ops/facter/{nephalem.json => desktop.json} | 0 ops/nix/manifest.nix | 11 +------ ops/nix/nodes/device.nix | 2 +- ops/nix/nodes/type.nix | 33 ++++++------------- 9 files changed, 77 insertions(+), 36 deletions(-) rename ops/facter/{nephalem.json => desktop.json} (100%) diff --git a/.gitignore b/.gitignore index 079e9744..18e13b33 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ -tmp +# generated files + result .direnv +*.qcow2 +keys/ + +# developer choice +tmp diff --git a/docs/README.md b/docs/README.md index ce66fdc3..6926d14f 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,21 @@ ## current state +- externals + - nginx: proxies complete, todo is static sites and deeper config +- internals + - added ssh, tailscale +- nodes + - device: disko configurations + - type: facter and disko + - nixos: default nixos modules and construction +- secrets + - sops: done basically? figure out api +- users + - users: provides user info + - admin: provides admin user for e.g. sops + +TODO: + - figure out how to get one vm running thats it ## what this is diff --git a/docs/runbook.md b/docs/runbook.md index 0099665e..0d9bc98e 100644 --- a/docs/runbook.md +++ b/docs/runbook.md @@ -8,3 +8,7 @@ rg --no-binary --hidden --null -l '' \ echo "\n==== $f ====\n" cat "$f" end | pbcopy + +nix store info --store ssh://eu.nixbuild.net + +nix run nixpkgs#darwin.linux-builder diff --git a/flake.lock b/flake.lock index 414b4caf..76044ecc 100644 --- a/flake.lock +++ b/flake.lock @@ -94,6 +94,21 @@ "type": "github" } }, + "nixlib": { + "locked": { + "lastModified": 1736643958, + "narHash": "sha256-tmpqTSWVRJVhpvfSN9KXBvKEXplrwKnSZNAoNPf/S/s=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "1418bc28a52126761c02dd3d89b2d8ca0f521181", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixos-facter-modules": { "locked": { "lastModified": 1761137276, @@ -109,6 +124,27 @@ "type": "github" } }, + "nixos-generators": { + "inputs": { + "nixlib": "nixlib", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1751903740, + "narHash": "sha256-PeSkNMvkpEvts+9DjFiop1iT2JuBpyknmBUs0Un0a4I=", + "owner": "nix-community", + "repo": "nixos-generators", + "rev": "032decf9db65efed428afd2fa39d80f7089085eb", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-generators", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1752596105, @@ -149,6 +185,7 @@ "import-tree": "import-tree", "nix-darwin": "nix-darwin", "nixos-facter-modules": "nixos-facter-modules", + "nixos-generators": "nixos-generators", "nixpkgs": "nixpkgs_2", "rrv-sh": "rrv-sh", "sops-nix": "sops-nix", diff --git a/flake.nix b/flake.nix index 04995ab2..f93689af 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,8 @@ nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; nix-darwin.url = "github:nix-darwin/nix-darwin/master"; nixos-facter-modules.url = "github:nix-community/nixos-facter-modules"; + nixos-generators.inputs.nixpkgs.follows = "nixpkgs"; + nixos-generators.url = "github:nix-community/nixos-generators"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; rrv-sh.inputs.nixpkgs.follows = "nixpkgs"; rrv-sh.url = "github:rrvsh/rrv.sh"; diff --git a/ops/facter/nephalem.json b/ops/facter/desktop.json similarity index 100% rename from ops/facter/nephalem.json rename to ops/facter/desktop.json diff --git a/ops/nix/manifest.nix b/ops/nix/manifest.nix index 63d650e0..205e7d8e 100644 --- a/ops/nix/manifest.nix +++ b/ops/nix/manifest.nix @@ -6,16 +6,7 @@ pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq"; }; secrets.sops.enable = true; - nodes.nixos = { - nephalem = { - type = "nephalem"; - device = "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434"; - }; - veil = { - type = "rpi4b"; - device = "/dev/mmcblk1"; - }; - }; + nodes.nixos = { }; externals.nginx = { node = "veil"; ssl = { diff --git a/ops/nix/nodes/device.nix b/ops/nix/nodes/device.nix index d6991a86..6aeb465d 100644 --- a/ops/nix/nodes/device.nix +++ b/ops/nix/nodes/device.nix @@ -40,7 +40,7 @@ }; }; }; - flake.diskoConfigurations.nephalem = + flake.diskoConfigurations.desktop = { device ? "", ... diff --git a/ops/nix/nodes/type.nix b/ops/nix/nodes/type.nix index fea9e54e..5eca3418 100644 --- a/ops/nix/nodes/type.nix +++ b/ops/nix/nodes/type.nix @@ -6,21 +6,23 @@ }: let cfg = config.flake; - inherit (builtins) fromJSON readFile elem; + inherit (builtins) fromJSON readFile; inherit (cfg.paths) facter; inherit (lib.modules) mkMerge mkIf; - inherit (lib.strings) getName; + inherit (lib.lists) optional; in { flake.modules.nixos.default = - { hostConfig, pkgs, ... }: + { hostConfig, ... }: { imports = [ inputs.disko.nixosModules.default inputs.nixos-facter-modules.nixosModules.facter - (config.flake.diskoConfigurations.${hostConfig.type} { inherit (hostConfig) device; }) - ]; - config = mkMerge [ + ] + ++ optional (!hostConfig.isVm or true) ( + config.flake.diskoConfigurations.${hostConfig.type} { inherit (hostConfig) device; } + ); + config = mkIf (!hostConfig.isVm or true) (mkMerge [ { facter.report = fromJSON (readFile "${facter}/${hostConfig.type}.json"); } @@ -28,23 +30,6 @@ in boot.loader.grub.enable = false; boot.loader.generic-extlinux-compatible.enable = true; }) - (mkIf (hostConfig.type == "nephalem") { - boot.kernelPackages = pkgs.linuxPackages_latest; - services.xserver.videoDrivers = [ "nvidia" ]; - hardware.nvidia = { - modesetting.enable = true; - powerManagement.enable = false; - open = false; - nvidiaSettings = true; - package = pkgs.linuxPackages_latest.nvidiaPackages.stable; - }; - nixpkgs.config.allowUnfreePredicate = - pkg: - elem (getName pkg) [ - "nvidia-settings" - "nvidia-x11" - ]; - }) - ]; + ]); }; } From 693846e321d5c91e02a2279cb755a99fb4f84e88 Mon Sep 17 00:00:00 2001 From: Mohammad Rafiq Date: Tue, 4 Nov 2025 19:31:51 +0800 Subject: [PATCH 21/21] atomic --- Justfile | 6 +- docs/README.md | 18 +- flake.lock | 154 +----------------- flake.nix | 14 +- .../devices}/desktop.json | 0 ops/definitions/devices/desktop.nix | 68 ++++++++ .../devices}/rpi4b.json | 0 ops/definitions/devices/rpi4b.nix | 35 ++++ ops/{sops => definitions/secrets}/keys.yaml | 0 ops/{sops => definitions/secrets}/users.yaml | 0 ops/nix/dendri/README.md | 13 ++ ops/nix/dendri/imports.nix | 4 + ops/nix/{ => dendri}/users/admin.nix | 0 ops/nix/{secrets => dendri/users}/sops.nix | 26 +-- ops/nix/{ => dendri}/users/users.nix | 5 +- ops/nix/externals/nginx/node.nix | 26 --- ops/nix/externals/nginx/proxies.nix | 62 ------- ops/nix/externals/nginx/proxies/rrv-sh.nix | 8 - ops/nix/externals/nginx/ssl.nix | 36 ---- ops/nix/internals/ssh.nix | 8 - ops/nix/internals/tailscale.nix | 22 --- ops/nix/manifest.nix | 18 -- ops/nix/nodes/device.nix | 116 ------------- ops/nix/nodes/nixos.nix | 41 ----- ops/nix/nodes/type.nix | 35 ---- 25 files changed, 143 insertions(+), 572 deletions(-) rename ops/{facter => definitions/devices}/desktop.json (100%) create mode 100644 ops/definitions/devices/desktop.nix rename ops/{facter => definitions/devices}/rpi4b.json (100%) create mode 100644 ops/definitions/devices/rpi4b.nix rename ops/{sops => definitions/secrets}/keys.yaml (100%) rename ops/{sops => definitions/secrets}/users.yaml (100%) create mode 100644 ops/nix/dendri/README.md create mode 100644 ops/nix/dendri/imports.nix rename ops/nix/{ => dendri}/users/admin.nix (100%) rename ops/nix/{secrets => dendri/users}/sops.nix (61%) rename ops/nix/{ => dendri}/users/users.nix (90%) delete mode 100644 ops/nix/externals/nginx/node.nix delete mode 100644 ops/nix/externals/nginx/proxies.nix delete mode 100644 ops/nix/externals/nginx/proxies/rrv-sh.nix delete mode 100644 ops/nix/externals/nginx/ssl.nix delete mode 100644 ops/nix/internals/ssh.nix delete mode 100644 ops/nix/internals/tailscale.nix delete mode 100644 ops/nix/nodes/device.nix delete mode 100644 ops/nix/nodes/nixos.nix delete mode 100644 ops/nix/nodes/type.nix diff --git a/Justfile b/Justfile index 6f47ca5b..c44521ce 100644 --- a/Justfile +++ b/Justfile @@ -1,8 +1,8 @@ -check: format lint test +check: nice test -nice: format lint +nice: format-nix lint -format: format-nix +format: format-nix format-gha format-nix: treefmt diff --git a/docs/README.md b/docs/README.md index 6926d14f..ba618674 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,22 +1,6 @@ ## current state -- externals - - nginx: proxies complete, todo is static sites and deeper config -- internals - - added ssh, tailscale -- nodes - - device: disko configurations - - type: facter and disko - - nixos: default nixos modules and construction -- secrets - - sops: done basically? figure out api -- users - - users: provides user info - - admin: provides admin user for e.g. sops - -TODO: - - figure out how to get one vm running thats it - +nothing! ## what this is diff --git a/flake.lock b/flake.lock index 76044ecc..8566b21c 100644 --- a/flake.lock +++ b/flake.lock @@ -1,23 +1,5 @@ { "nodes": { - "disko": { - "inputs": { - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1761899396, - "narHash": "sha256-XOpKBp6HLzzMCbzW50TEuXN35zN5WGQREC7n34DcNMM=", - "owner": "nix-community", - "repo": "disko", - "rev": "6f4cf5abbe318e4cd1e879506f6eeafd83f7b998", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "disko", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -38,26 +20,6 @@ "type": "github" } }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1759236626, - "narHash": "sha256-1BjCUU2csqhR5umGYFnOOTU8r8Bi+bnB2SLsr0FLcws=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "9e0453a9b0c8ef22de0355b731d712707daa6308", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "home-manager", - "type": "github" - } - }, "import-tree": { "locked": { "lastModified": 1752730890, @@ -73,95 +35,7 @@ "type": "github" } }, - "nix-darwin": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1758805352, - "narHash": "sha256-BHdc43Lkayd+72W/NXRKHzX5AZ+28F3xaUs3a88/Uew=", - "owner": "nix-darwin", - "repo": "nix-darwin", - "rev": "c48e963a5558eb1c3827d59d21c5193622a1477c", - "type": "github" - }, - "original": { - "owner": "nix-darwin", - "ref": "master", - "repo": "nix-darwin", - "type": "github" - } - }, - "nixlib": { - "locked": { - "lastModified": 1736643958, - "narHash": "sha256-tmpqTSWVRJVhpvfSN9KXBvKEXplrwKnSZNAoNPf/S/s=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "1418bc28a52126761c02dd3d89b2d8ca0f521181", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, - "nixos-facter-modules": { - "locked": { - "lastModified": 1761137276, - "narHash": "sha256-4lDjGnWRBLwqKQ4UWSUq6Mvxu9r8DSqCCydodW/Jsi8=", - "owner": "nix-community", - "repo": "nixos-facter-modules", - "rev": "70bcd64225d167c7af9b475c4df7b5abba5c7de8", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixos-facter-modules", - "type": "github" - } - }, - "nixos-generators": { - "inputs": { - "nixlib": "nixlib", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1751903740, - "narHash": "sha256-PeSkNMvkpEvts+9DjFiop1iT2JuBpyknmBUs0Un0a4I=", - "owner": "nix-community", - "repo": "nixos-generators", - "rev": "032decf9db65efed428afd2fa39d80f7089085eb", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixos-generators", - "type": "github" - } - }, "nixpkgs": { - "locked": { - "lastModified": 1752596105, - "narHash": "sha256-lFNVsu/mHLq3q11MuGkMhUUoSXEdQjCHvpReaGP1S2k=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "dab3a6e781554f965bde3def0aa2fda4eb8f1708", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { "locked": { "lastModified": 1759036355, "narHash": "sha256-0m27AKv6ka+q270dw48KflE0LwQYrO7Fm4/2//KCVWg=", @@ -179,39 +53,13 @@ }, "root": { "inputs": { - "disko": "disko", "flake-parts": "flake-parts", - "home-manager": "home-manager", "import-tree": "import-tree", - "nix-darwin": "nix-darwin", - "nixos-facter-modules": "nixos-facter-modules", - "nixos-generators": "nixos-generators", - "nixpkgs": "nixpkgs_2", - "rrv-sh": "rrv-sh", + "nixpkgs": "nixpkgs", "sops-nix": "sops-nix", "systems": "systems" } }, - "rrv-sh": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1761744898, - "narHash": "sha256-LLpyw6/lbdc3JMmXDnJ3+Pcib/BB/f8vsr+W9coWbVk=", - "owner": "rrvsh", - "repo": "rrv.sh", - "rev": "eec76b1545ee1d21ff0f163e9d7addc92b9dc789", - "type": "github" - }, - "original": { - "owner": "rrvsh", - "repo": "rrv.sh", - "type": "github" - } - }, "sops-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index f93689af..791fff68 100644 --- a/flake.nix +++ b/flake.nix @@ -7,26 +7,16 @@ systems = import inputs.systems; flake.paths = { root = ./.; - facter = ./ops/facter; - secrets = ./ops/sops; + device = ./ops/definitions/devices; + secrets = ./ops/definitions/secrets; }; } ); inputs = { - disko.url = "github:nix-community/disko"; flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; flake-parts.url = "github:hercules-ci/flake-parts"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; - home-manager.url = "github:nix-community/home-manager"; import-tree.url = "github:vic/import-tree"; - nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; - nix-darwin.url = "github:nix-darwin/nix-darwin/master"; - nixos-facter-modules.url = "github:nix-community/nixos-facter-modules"; - nixos-generators.inputs.nixpkgs.follows = "nixpkgs"; - nixos-generators.url = "github:nix-community/nixos-generators"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - rrv-sh.inputs.nixpkgs.follows = "nixpkgs"; - rrv-sh.url = "github:rrvsh/rrv.sh"; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; sops-nix.url = "github:Mic92/sops-nix"; systems.url = "github:nix-systems/default"; diff --git a/ops/facter/desktop.json b/ops/definitions/devices/desktop.json similarity index 100% rename from ops/facter/desktop.json rename to ops/definitions/devices/desktop.json diff --git a/ops/definitions/devices/desktop.nix b/ops/definitions/devices/desktop.nix new file mode 100644 index 00000000..6939a838 --- /dev/null +++ b/ops/definitions/devices/desktop.nix @@ -0,0 +1,68 @@ +{ + disko.devices.disk.main = { + device = "/dev/disk/by-id/nvme-CT2000P3SSD8_2325E6E77434"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + esp = { + name = "ESP"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + swap = { + size = "4G"; + content = { + type = "swap"; + resumeDevice = true; + }; + }; + root = { + name = "root"; + size = "100%"; + content = { + type = "lvm_pv"; + vg = "root_vg"; + }; + }; + }; + }; + }; + disko.devices.lvm_vg.root_vg = { + type = "lvm_vg"; + lvs.root = { + size = "100%FREE"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/root".mountpoint = "/"; + "/persist" = { + mountpoint = "/persist"; + mountOptions = [ + "subvol=persist" + "noatime" + ]; + }; + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ + "subvol=nix" + "noatime" + ]; + }; + }; + }; + }; + }; +} diff --git a/ops/facter/rpi4b.json b/ops/definitions/devices/rpi4b.json similarity index 100% rename from ops/facter/rpi4b.json rename to ops/definitions/devices/rpi4b.json diff --git a/ops/definitions/devices/rpi4b.nix b/ops/definitions/devices/rpi4b.nix new file mode 100644 index 00000000..27e6294b --- /dev/null +++ b/ops/definitions/devices/rpi4b.nix @@ -0,0 +1,35 @@ +{ + disko.devices = { + disk.main = { + device = "/dev"; # FIXME: set to rpi device name + type = "disk"; + content = { + type = "gpt"; + partitions = { + firmware = { + type = "EF00"; + size = "64M"; + label = "FIRMWARE"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot/firmware"; + }; + }; + root = { + type = "8300"; + size = "100%"; + label = "NIXOS_SD"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = [ "noatime" ]; # disables access-time updates — improves SD card lifespan + }; + }; + }; + }; + }; + }; + +} diff --git a/ops/sops/keys.yaml b/ops/definitions/secrets/keys.yaml similarity index 100% rename from ops/sops/keys.yaml rename to ops/definitions/secrets/keys.yaml diff --git a/ops/sops/users.yaml b/ops/definitions/secrets/users.yaml similarity index 100% rename from ops/sops/users.yaml rename to ops/definitions/secrets/users.yaml diff --git a/ops/nix/dendri/README.md b/ops/nix/dendri/README.md new file mode 100644 index 00000000..c36eee55 --- /dev/null +++ b/ops/nix/dendri/README.md @@ -0,0 +1,13 @@ +# dendri + +this should be a flake-parts module that lets you define your users and nodes in a higher level than nixos. + +## folder structure + +`a/b/c/d` -> `options.flake.a.b.c.d` + +## architecture + +each module in a subfolder should result in changes to the relevant `config.flake.modules..leaf` lower-level module. + +each module in this folder should result in generated packages or configuration. diff --git a/ops/nix/dendri/imports.nix b/ops/nix/dendri/imports.nix new file mode 100644 index 00000000..1c75663b --- /dev/null +++ b/ops/nix/dendri/imports.nix @@ -0,0 +1,4 @@ +{ inputs, ... }: +{ + imports = [ inputs.flake-parts.flakeModules.modules ]; +} diff --git a/ops/nix/users/admin.nix b/ops/nix/dendri/users/admin.nix similarity index 100% rename from ops/nix/users/admin.nix rename to ops/nix/dendri/users/admin.nix diff --git a/ops/nix/secrets/sops.nix b/ops/nix/dendri/users/sops.nix similarity index 61% rename from ops/nix/secrets/sops.nix rename to ops/nix/dendri/users/sops.nix index 626ed7a7..9ed729e0 100644 --- a/ops/nix/secrets/sops.nix +++ b/ops/nix/dendri/users/sops.nix @@ -6,32 +6,32 @@ }: let cfg = config.flake; - sopsFilePath = secrets + /users.yaml; + userSecrets = secrets + /users.yaml; inherit (cfg.paths) secrets; inherit (cfg.users) admin; - inherit (builtins) hasAttr pathExists; + inherit (builtins) pathExists; inherit (lib.attrsets) mapAttrs'; - inherit (lib.options) mkEnableOption; + inherit (lib.options) mkOption; + inherit (lib.types) enum; inherit (lib.modules) mkIf; in { - options.flake.secrets.sops.enable = mkEnableOption ""; - config.flake.modules.nixos.default = + options.flake.users.secrets.type = mkOption { + type = enum [ "sops" ]; + default = "sops"; + }; + config.flake.modules.nixos.leaf = { config, ... }: let sshKeyPath = "${config.users.users.${admin.username}.home}/.ssh/id_ed25519"; in { imports = [ inputs.sops-nix.nixosModules.sops ]; - config = mkIf cfg.secrets.sops.enable { + config = mkIf (cfg.users.secrets.type == "sops") { assertions = [ { - assertion = hasAttr "users" cfg; - message = "You must have included the users module and defined users to use `secrets.sops`."; - } - { - assertion = pathExists sopsFilePath; - message = "You must have created ${sopsFilePath} to set user passwords."; + assertion = pathExists userSecrets; + message = "You must have created ${userSecrets} to set user passwords."; } ]; system.activationScripts.ensureSshKey.text = # bash @@ -48,7 +48,7 @@ in name = "${name}/hashedPassword"; value = { neededForUsers = true; - sopsFile = sopsFilePath; + sopsFile = userSecrets; }; }) cfg.users.users; }; diff --git a/ops/nix/users/users.nix b/ops/nix/dendri/users/users.nix similarity index 90% rename from ops/nix/users/users.nix rename to ops/nix/dendri/users/users.nix index 26916fc2..5ea32fbc 100644 --- a/ops/nix/users/users.nix +++ b/ops/nix/dendri/users/users.nix @@ -17,7 +17,7 @@ in }; }); }; - config.flake.modules.nixos.default = + config.flake.modules.nixos.leaf = { config, ... }: { assertions = [ @@ -32,7 +32,8 @@ in mutableUsers = false; users = mapAttrs (username: userConfig: { extraGroups = optional userConfig.primary "wheel"; - hashedPasswordFile = mkIf (cfg.secrets.sops.enable or false + hashedPasswordFile = mkIf ( + cfg.users.secrets.type == "sops" ) config.sops.secrets."${username}/hashedPassword".path; isNormalUser = true; openssh.authorizedKeys.keys = [ userConfig.pubkey ]; diff --git a/ops/nix/externals/nginx/node.nix b/ops/nix/externals/nginx/node.nix deleted file mode 100644 index 272feafa..00000000 --- a/ops/nix/externals/nginx/node.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ lib, config, ... }: -let - cfg = config.flake; - inherit (builtins) - attrNames - ; - inherit (lib.modules) mkIf; - inherit (lib.options) mkOption; - inherit (lib.types) enum; -in -{ - options.flake.externals.nginx.node = mkOption { - type = enum (attrNames cfg.nodes.nixos); - }; - config.flake.modules.nixos.default = - { hostName, ... }: - { - config = mkIf (hostName == cfg.externals.nginx.node) { - networking.firewall.allowedTCPPorts = [ - 80 # HTTP - 443 # HTTPS - ]; - services.nginx.enable = true; - }; - }; -} diff --git a/ops/nix/externals/nginx/proxies.nix b/ops/nix/externals/nginx/proxies.nix deleted file mode 100644 index fab2e8bd..00000000 --- a/ops/nix/externals/nginx/proxies.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ lib, config, ... }: -let - cfg = config.flake; - inherit (builtins) - attrNames - foldl' - listToAttrs - map - toString - ; - inherit (lib.types) - enum - listOf - port - str - submodule - ; - inherit (lib.modules) mkIf; - inherit (lib.options) mkOption; - inherit (lib.trivial) pipe; -in -{ - options.flake.externals.nginx.proxies = mkOption { - type = listOf (submodule { - options = { - apps = mkOption { type = enum (attrNames cfg.modules.nixos); }; - domain = mkOption { type = str; }; - node = mkOption { type = enum (attrNames cfg.nodes.nixos); }; - port = mkOption { type = port; }; - }; - }); - default = [ ]; - }; - config.flake.modules.nixos.default = - { hostName, ... }: - { - imports = - (foldl' ( - acc: n: - acc - // { - n.node = (acc.${n.node} or [ ]) ++ (map (app: cfg.modules.nixos.${app}) n.apps); - } - ) { } cfg.externals.nginx.proxies).${hostName} or [ ]; - config = mkIf (hostName == cfg.externals.nginx.node) { - services.nginx.virtualHosts = pipe cfg.externals.nginx.proxies [ - (map (proxy: { - name = proxy.domain; - value = { - addSSL = cfg.externals.nginx.ssl.enable; - useACMEHost = if cfg.externals.nginx.ssl.enable then proxy.domain else null; - acmeRoot = null; # needed for DNS validation - locations."/".proxyPass = "http://${ - if (proxy.node == cfg.externals.nginx.node) then "localhost" else proxy.node - }:${toString proxy.port}"; - }; - })) - listToAttrs - ]; - }; - }; -} diff --git a/ops/nix/externals/nginx/proxies/rrv-sh.nix b/ops/nix/externals/nginx/proxies/rrv-sh.nix deleted file mode 100644 index a63f3c73..00000000 --- a/ops/nix/externals/nginx/proxies/rrv-sh.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ inputs, ... }: -{ - flake.modules.nixos.rrv-sh = { - imports = [ inputs.rrv-sh.nixosModules.default ]; - services.rrv-sh.enable = true; - networking.firewall.allowedTCPPorts = [ 2309 ]; - }; -} diff --git a/ops/nix/externals/nginx/ssl.nix b/ops/nix/externals/nginx/ssl.nix deleted file mode 100644 index 5d1a9d77..00000000 --- a/ops/nix/externals/nginx/ssl.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ lib, config, ... }: -let - cfg = config.flake; - inherit (cfg.users) admin; - inherit (cfg.paths) secrets; - inherit (lib.modules) mkMerge mkIf; - inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) raw str; -in -{ - options.flake.externals.nginx.ssl = { - enable = mkEnableOption ""; - dnsProvider = mkOption { type = str; }; - certs = mkOption { type = raw; }; - }; - config.flake.modules.nixos.default = - { hostName, config, ... }: - mkIf (hostName == cfg.externals.nginx.node) (mkMerge [ - (mkIf cfg.externals.nginx.ssl.enable { - users.users.nginx.extraGroups = [ "acme" ]; - security.acme = { - acceptTerms = true; - defaults = { - inherit (admin) email; - inherit (cfg.externals.nginx.ssl) dnsProvider; - }; - inherit (cfg.externals.nginx.ssl) certs; - }; - }) - (mkIf (cfg.externals.nginx.ssl.dnsProvider == "cloudflare" && cfg.secrets.sops.enable) { - sops.secrets."keys/cloudflare".sopsFile = secrets + /keys.yaml; - security.acme.defaults.credentialFiles."CLOUDFLARE_DNS_API_TOKEN_FILE" = - config.sops.secrets."keys/cloudflare".path; - }) - ]); -} diff --git a/ops/nix/internals/ssh.nix b/ops/nix/internals/ssh.nix deleted file mode 100644 index 02fa20f6..00000000 --- a/ops/nix/internals/ssh.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - flake.modules.nixos.default = - { hostName, ... }: - { - networking.hostName = hostName; - services.openssh.enable = true; - }; -} diff --git a/ops/nix/internals/tailscale.nix b/ops/nix/internals/tailscale.nix deleted file mode 100644 index 78a1af79..00000000 --- a/ops/nix/internals/tailscale.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.flake; - inherit (cfg.paths) secrets; - inherit (builtins) pathExists; - inherit (lib.modules) mkMerge mkIf; -in -{ - flake.modules.nixos.default = mkMerge [ - { services.tailscale.enable = true; } - (mkIf cfg.secrets.sops.enable { - assertions = [ - { - assertion = pathExists "${secrets}/keys.yaml"; - message = "You must have created `ops/sops/keys.yaml` to enable tailscale integration."; - } - ]; - services.tailscale.authKeyFile = config.sops.secrets."keys/tailscale".path or null; - sops.secrets."keys/tailscale".sopsFile = secrets + /keys.yaml; - }) - ]; -} diff --git a/ops/nix/manifest.nix b/ops/nix/manifest.nix index 205e7d8e..336030b1 100644 --- a/ops/nix/manifest.nix +++ b/ops/nix/manifest.nix @@ -5,24 +5,6 @@ email = "rafiq@rrv.sh"; pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILdsZyY3gu8IGB8MzMnLdh+ClDxQQ2RYG9rkeetIKq8n rafiq"; }; - secrets.sops.enable = true; - nodes.nixos = { }; - externals.nginx = { - node = "veil"; - ssl = { - enable = true; - dnsProvider = "cloudflare"; - certs."rrv.sh".extraDomainNames = [ "*.rrv.sh" ]; - }; - proxies = [ - { - node = "veil"; - domain = "rrv.sh"; - port = 2309; - apps = [ "rrv-sh" ]; - } - ]; - }; templates.pkg-shell = { path = ./_templates/pkg-shell; description = "premade package and shell for all systems with flake parts"; diff --git a/ops/nix/nodes/device.nix b/ops/nix/nodes/device.nix deleted file mode 100644 index 6aeb465d..00000000 --- a/ops/nix/nodes/device.nix +++ /dev/null @@ -1,116 +0,0 @@ -{ inputs, ... }: -{ - imports = [ inputs.disko.flakeModules.default ]; - flake.diskoConfigurations.rpi4b = - { - device ? "", - ... - }: - { - disko.devices = { - disk.main = { - inherit device; - type = "disk"; - content = { - type = "gpt"; - partitions = { - firmware = { - type = "EF00"; - size = "64M"; - label = "FIRMWARE"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot/firmware"; - }; - }; - root = { - type = "8300"; - size = "100%"; - label = "NIXOS_SD"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - mountOptions = [ "noatime" ]; # disables access-time updates — improves SD card lifespan - }; - }; - }; - }; - }; - }; - }; - flake.diskoConfigurations.desktop = - { - device ? "", - ... - }: - { - disko.devices.disk.main = { - inherit device; - type = "disk"; - content = { - type = "gpt"; - partitions = { - boot = { - name = "boot"; - size = "1M"; - type = "EF02"; - }; - esp = { - name = "ESP"; - size = "500M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - swap = { - size = "4G"; - content = { - type = "swap"; - resumeDevice = true; - }; - }; - root = { - name = "root"; - size = "100%"; - content = { - type = "lvm_pv"; - vg = "root_vg"; - }; - }; - }; - }; - }; - disko.devices.lvm_vg.root_vg = { - type = "lvm_vg"; - lvs.root = { - size = "100%FREE"; - content = { - type = "btrfs"; - extraArgs = [ "-f" ]; - subvolumes = { - "/root".mountpoint = "/"; - "/persist" = { - mountpoint = "/persist"; - mountOptions = [ - "subvol=persist" - "noatime" - ]; - }; - "/nix" = { - mountpoint = "/nix"; - mountOptions = [ - "subvol=nix" - "noatime" - ]; - }; - }; - }; - }; - }; - }; -} diff --git a/ops/nix/nodes/nixos.nix b/ops/nix/nodes/nixos.nix deleted file mode 100644 index 811f8ab0..00000000 --- a/ops/nix/nodes/nixos.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - inputs, - config, - lib, - ... -}: -let - cfg = config.flake; - inherit (builtins) mapAttrs; - inherit (lib) nixosSystem; - inherit (lib.options) mkOption; - inherit (lib.types) attrsOf raw; -in -{ - imports = [ inputs.flake-parts.flakeModules.modules ]; - options.flake.nodes.nixos = mkOption { type = attrsOf raw; }; - config.flake.nixosConfigurations = mapAttrs ( - name: value: - nixosSystem { - specialArgs = { - hostName = name; - hostConfig = value; - }; - modules = [ cfg.modules.nixos.default ]; - } - ) cfg.nodes.nixos; - config.flake.modules.nixos.default = { - nix.settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; - substituters = [ "https://nix-community.cachix.org" ]; - trusted-public-keys = [ - "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - ]; - trusted-substituters = [ "https://nix-community.cachix.org" ]; - }; - system.stateVersion = "25.11"; - }; -} diff --git a/ops/nix/nodes/type.nix b/ops/nix/nodes/type.nix deleted file mode 100644 index 5eca3418..00000000 --- a/ops/nix/nodes/type.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - inputs, - config, - lib, - ... -}: -let - cfg = config.flake; - inherit (builtins) fromJSON readFile; - inherit (cfg.paths) facter; - inherit (lib.modules) mkMerge mkIf; - inherit (lib.lists) optional; -in -{ - flake.modules.nixos.default = - { hostConfig, ... }: - { - imports = [ - inputs.disko.nixosModules.default - inputs.nixos-facter-modules.nixosModules.facter - ] - ++ optional (!hostConfig.isVm or true) ( - config.flake.diskoConfigurations.${hostConfig.type} { inherit (hostConfig) device; } - ); - config = mkIf (!hostConfig.isVm or true) (mkMerge [ - { - facter.report = fromJSON (readFile "${facter}/${hostConfig.type}.json"); - } - (mkIf (hostConfig.type == "rpi4b") { - boot.loader.grub.enable = false; - boot.loader.generic-extlinux-compatible.enable = true; - }) - ]); - }; -}