feat: create nixos options.json importer
Alan Pearce alan@alanpearce.eu
Fri, 03 May 2024 11:52:06 +0200
4 files changed, 25 insertions(+), 0 deletions(-)
M .gitignore → .gitignore
@@ -23,3 +23,4 @@ /.env /.envrc /.pre-commit-config.yaml /frontend/static/base.css +/data/
M default.nix → default.nix
@@ -14,6 +14,10 @@ css = pkgs.fetchurl { inherit (sources.simple-css) url sha256; }; + nixos-options = import (./. + "/importers/nixos-options.nix") { + inherit pkgs; + }; + searchix = pkgs.buildGoApplication { pname = "searchix"; version = "0.1";
A importers/nixos-options.nix
@@ -0,0 +1,17 @@+{ pkgs ? import <nixpkgs> { } +, system ? builtins.currentSystem +, stateVersion ? pkgs.lib.version +, ... +}: +let + inherit (pkgs) lib; + nixos = pkgs.nixos ({ lib, pkgs, config, ... }: { + nixpkgs.hostPlatform = system; + system.stateVersion = lib.versions.majorMinor stateVersion; + }); + + doc = pkgs.nixosOptionsDoc { + inherit (nixos) options; + }; +in +doc.optionsJSON