diff options
author | Alan Pearce | 2024-05-03 11:52:06 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-03 11:52:06 +0200 |
commit | 1fb64b09e2dba34784732a61cbebc119cd847803 (patch) | |
tree | 1dc21f3c66c6682089bb8731f84d40ef13bcd424 | |
parent | 0945da8f9654252008ff6bd56022f9363fd3cca6 (diff) | |
download | searchix-1fb64b09e2dba34784732a61cbebc119cd847803.tar.lz searchix-1fb64b09e2dba34784732a61cbebc119cd847803.tar.zst searchix-1fb64b09e2dba34784732a61cbebc119cd847803.zip |
feat: create nixos options.json importer
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | default.nix | 4 | ||||
-rw-r--r-- | importers/nixos-options.nix | 17 | ||||
-rw-r--r-- | justfile | 3 |
4 files changed, 25 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index 5849147..7297725 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ go.work /.envrc /.pre-commit-config.yaml /frontend/static/base.css +/data/ diff --git a/default.nix b/default.nix index bcd04db..3db0a44 100644 --- a/default.nix +++ b/default.nix @@ -14,6 +14,10 @@ in inherit (sources.simple-css) url sha256; }; + nixos-options = import (./. + "/importers/nixos-options.nix") { + inherit pkgs; + }; + searchix = pkgs.buildGoApplication { pname = "searchix"; version = "0.1"; diff --git a/importers/nixos-options.nix b/importers/nixos-options.nix new file mode 100644 index 0000000..894f05e --- /dev/null +++ b/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 diff --git a/justfile b/justfile index b780c07..b878de3 100644 --- a/justfile +++ b/justfile @@ -4,6 +4,9 @@ default: prepare: ln -sf $(nix-build --no-out-link -A css) frontend/static/base.css +update-nixos-options: + ln -sf $(nix-build --no-out-link -A nixos-options)/share/doc/nixos/options.json data/nixos-options.json + checkformat: gofmt -d . goimports -d . |