From bf8bccb40456c4079dd25a9f55efd6668ee75711 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sun, 18 Jun 2023 05:10:08 +0200 Subject: [PATCH] stuff --- .envrc | 4 +-- flake.nix | 13 +++++-- profiles/web/docs/nixpkgs.nix | 68 +++++++++++++++++++++++++++++++---- 3 files changed, 72 insertions(+), 13 deletions(-) diff --git a/.envrc b/.envrc index ce40950..4d19475 100644 --- a/.envrc +++ b/.envrc @@ -18,9 +18,7 @@ fi use flake .#envrc if test -s .remote.toml; then - if ! command -v remote-init >/dev/null || ! command -v tomlq >/dev/null; then - use flake .#envrc-remote - fi + use flake .#envrc-remote echo echo "Current remote: $(remote-host)" tomlq <.remote.toml '.hosts | to_entries[] | "remote-set \(.key+1) # -> \(.value.host)"' -r diff --git a/flake.nix b/flake.nix index f9ed403..537088e 100644 --- a/flake.nix +++ b/flake.nix @@ -15,6 +15,13 @@ #sops-nix.inputs.nixpkgs.follows = "nixpkgs"; #matrix-next.url = "github:dali99/nixos-matrix-modules"; # see https://git.pvv.ntnu.no/Drift/pvv-nixos-config/src/main/flake.nix + # used to host old docs + #nixpkgs-22.url = "github:NixOS/nixpkgs/nixos-22.11"; + #nixpkgs-21.url = "github:NixOS/nixpkgs/nixos-21.11"; + #nixpkgs-20.url = "github:NixOS/nixpkgs/nixos-20.09"; + #nixpkgs-19.url = "github:NixOS/nixpkgs/nixos-19.09"; + #nixpkgs-19.flake = false; # Earlier versions are not pure + # TODO: somehow make these private repos optional (a lazy fetch would be nice) pbsds-papers.url = "git+ssh://git@github.com/pbsds/papers.git"; @@ -48,9 +55,9 @@ disabledModules = [ "services/misc/polaris.nix" ]; imports = [ "${inputs.pr-polaris14}/nixos/modules/services/misc/polaris.nix" ]; nixpkgs.overlays = [(final: prev: { # TODO: nixpkgs.config.packageOverrides ? - remote-exec = prev.python3Packages.callPackage "${inputs.pr-remote-exec}/pkgs/tools/misc/remote-exec" { }; polaris = prev.callPackage "${inputs.pr-polaris14}/pkgs/servers/polaris" { }; polaris-web = prev.callPackage "${inputs.pr-polaris14}/pkgs/servers/polaris/web.nix" { }; + remote-exec = prev.python3Packages.callPackage "${inputs.pr-remote-exec}/pkgs/tools/misc/remote-exec" { }; })]; }; mkConfig = hostname: system: modules: nixlib.nixosSystem { @@ -84,7 +91,7 @@ inherit inputs; overlays.remote-exec = (final: prev: { - remote-exec = prev.python3Packages.callPackage ( inputs.pr-remote-exec + "/pkgs/tools/misc/remote-exec" ) {}; + remote-exec = prev.python3Packages.callPackage "${inputs.pr-remote-exec}/pkgs/tools/misc/remote-exec" {}; }); packages = forAllSystems(system: @@ -125,7 +132,7 @@ pkgs.home-manager pkgs.nix-output-monitor ]; - encrc-remote = mkShell [ + envrc-remote = mkShell [ remote-exec pkgs.yq ]; diff --git a/profiles/web/docs/nixpkgs.nix b/profiles/web/docs/nixpkgs.nix index 0c9b917..8bfd82d 100644 --- a/profiles/web/docs/nixpkgs.nix +++ b/profiles/web/docs/nixpkgs.nix @@ -1,26 +1,80 @@ -{ config, pkgs, lib, inputs, ... }: +{ config, pkgs, lib, inputs, system, ... }: let # https://stackoverflow.com/a/60232211 - nixpkgs-manual = import "${inputs.nixpkgs}/doc" { inherit pkgs; }; - nixos-manual = (import "${inputs.nixpkgs}/nixos/release.nix" { inherit (inputs) nixpkgs; }).manualHTML.${config.nixpkgs.system}; + system = config.nixpkgs.system; + + #mk-nixpkgs-manual = input: import "${input}/doc" { pkgs = import input { inherit system; }; }; + mk-nixpkgs-manual = input: (import "${input}/pkgs/top-level/release.nix" { nixpkgs = import input { inherit system; }; }).manual; + mk-nixos-manual = input: (import "${input}/nixos/release.nix" { nixpkgs = import input { inherit system; }; }).manualHTML.${system}; + in { services.docs-to-host.docs = [ { dirname = "nix-manual"; path = "${pkgs.nix.doc}/share/doc/nix/manual"; - desc = "Official nixpkgs manual"; + desc = "Official Nix manual"; } { dirname = "nixpkgs-manual"; basename= "manual.html"; - path = "${nixpkgs-manual}/share/doc/nixpkgs"; - desc = "Official nixpkgs manual"; + path = "${mk-nixpkgs-manual inputs.nixpkgs}/share/doc/nixpkgs"; + desc = "Official Nixpkgs manual"; } { dirname = "nixos-manual"; - path = "${nixos-manual}/share/doc/nixos"; + path = "${mk-nixos-manual inputs.nixpkgs}/share/doc/nixos"; desc = "Official Nixos manual"; } + # == Old Nixpkgs manuals == + /** / + { + dirname = "nixpkgs-manual-22.11"; + basename= "manual.html"; + path = "${mk-nixpkgs-manual inputs.nixpkgs-22}/share/doc/nixpkgs"; + desc = "Official Nixpkgs 22.11 manual"; + } + { + dirname = "nixpkgs-manual-21.11"; + basename= "manual.html"; + path = "${mk-nixpkgs-manual inputs.nixpkgs-21}/share/doc/nixpkgs"; + desc = "Official Nixpkgs 21.11 manual"; + } + { + dirname = "nixpkgs-manual-20.09"; + basename= "manual.html"; + path = "${mk-nixpkgs-manual inputs.nixpkgs-20}/share/doc/nixpkgs"; + desc = "Official Nixpkgs 20.09 manual"; + } + { + dirname = "nixpkgs-manual-19.09"; + basename= "manual.html"; + path = "${mk-nixpkgs-manual inputs.nixpkgs-19}/share/doc/nixpkgs"; + desc = "Official Nixpkgs 19.09 manual"; + } + /**/ + # == Old Nixos manuals == + /** / + { + dirname = "nixos-manual-22.11"; + path = "${mk-nixos-manual inputs.nixpkgs-22}/share/doc/nixos"; + desc = "Official Nixos 22.11 manual"; + } + { + dirname = "nixos-manual-21.11"; + path = "${mk-nixos-manual inputs.nixpkgs-21}/share/doc/nixos"; + desc = "Official Nixos 21.11 manual"; + } + { + dirname = "nixos-manual-20.09"; + path = "${mk-nixos-manual inputs.nixpkgs-20}/share/doc/nixos"; + desc = "Official Nixos 20.09 manual"; + } + { + dirname = "nixos-manual-19.09"; + path = "${mk-nixos-manual inputs.nixpkgs-19}/share/doc/nixos"; + desc = "Official Nixos 19.09 manual"; + } + /**/ ]; }