From 243ae05a68085f8d2d7669431de22a1a58ffe004 Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 3 Nov 2024 17:25:55 +0000 Subject: [PATCH] dasht: ship --- hosts/by-name/desko/default.nix | 1 - hosts/by-name/lappy/default.nix | 1 - hosts/common/fs/default.nix | 11 +++++++++ hosts/common/programs/assorted.nix | 1 + hosts/common/programs/dasht.nix | 9 ++++++++ hosts/common/programs/default.nix | 1 + hosts/common/programs/docsets.nix | 14 ++++++++---- hosts/common/programs/zeal.nix | 2 +- hosts/modules/roles/default.nix | 12 +--------- hosts/modules/roles/dev-machine.nix | 29 ------------------------ pkgs/by-name/cargoDocsetHook/hook.sh | 4 ++-- pkgs/by-name/cargoDocsetHook/package.nix | 7 +++--- 12 files changed, 40 insertions(+), 52 deletions(-) create mode 100644 hosts/common/programs/dasht.nix delete mode 100644 hosts/modules/roles/dev-machine.nix diff --git a/hosts/by-name/desko/default.nix b/hosts/by-name/desko/default.nix index 733432ee8..d5b982dfa 100644 --- a/hosts/by-name/desko/default.nix +++ b/hosts/by-name/desko/default.nix @@ -22,7 +22,6 @@ sane.roles.build-machine.enable = true; sane.roles.client = true; - sane.roles.dev-machine = true; sane.roles.pc = true; sane.services.ollama.enable = true; sane.services.wg-home.enable = true; diff --git a/hosts/by-name/lappy/default.nix b/hosts/by-name/lappy/default.nix index 967d73f6b..fc38cf224 100644 --- a/hosts/by-name/lappy/default.nix +++ b/hosts/by-name/lappy/default.nix @@ -5,7 +5,6 @@ ]; sane.roles.client = true; - sane.roles.dev-machine = true; sane.roles.pc = true; sane.services.wg-home.enable = true; sane.services.wg-home.ip = config.sane.hosts.by-name."lappy".wg-home.ip; diff --git a/hosts/common/fs/default.nix b/hosts/common/fs/default.nix index c3e5c9cdb..52ba5fe01 100644 --- a/hosts/common/fs/default.nix +++ b/hosts/common/fs/default.nix @@ -7,6 +7,17 @@ # some services which use private directories error if the parent (/var/lib/private) isn't 700. sane.fs."/var/lib/private".dir.acl.mode = "0700"; + + # allocate a proper /tmp fs, else its capacity will be limited as per impermanence defaults (i.e. 1 GB). + fileSystems."/tmp" = { + device = "none"; + fsType = "tmpfs"; + options = [ + "mode=777" + "defaults" + ]; + }; + # in-memory compressed RAM # defaults to compressing at most 50% size of RAM # claimed compression ratio is about 2:1 diff --git a/hosts/common/programs/assorted.nix b/hosts/common/programs/assorted.nix index 900149dca..f659d80c5 100644 --- a/hosts/common/programs/assorted.nix +++ b/hosts/common/programs/assorted.nix @@ -187,6 +187,7 @@ in ]; pcConsoleUtils = declPackageSet [ + "dasht" # docset documentation viewer # "gh" # MS GitHub cli "haredoc" "nix-index" diff --git a/hosts/common/programs/dasht.nix b/hosts/common/programs/dasht.nix new file mode 100644 index 000000000..593320295 --- /dev/null +++ b/hosts/common/programs/dasht.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + sane.programs.dasht = { + suggestedPrograms = [ "docsets" ]; + fs.".local/share/dasht/docsets".symlink.target = "/run/current-system/sw/share/docsets"; + + sandbox.method = null; #< TODO: sandbox! + }; +} diff --git a/hosts/common/programs/default.nix b/hosts/common/programs/default.nix index 2ea88c1a0..c41e24c77 100644 --- a/hosts/common/programs/default.nix +++ b/hosts/common/programs/default.nix @@ -32,6 +32,7 @@ ./cups.nix ./curl.nix ./curlftpfs.nix + ./dasht.nix ./dbus.nix ./dconf.nix ./deadd-notification-center diff --git a/hosts/common/programs/docsets.nix b/hosts/common/programs/docsets.nix index 752ae730d..3225995a8 100644 --- a/hosts/common/programs/docsets.nix +++ b/hosts/common/programs/docsets.nix @@ -34,13 +34,13 @@ in { ]; }); in - "${toString withDocs}/share/docset" + "${toString withDocs}/share/docsets" ) cfg.config.rustPkgs; # link only the docs (not any binaries) postBuild = '' - mkdir -p $out/share/docset + mkdir -p $out/share/docsets ${lib.optionalString (cfg.config.rustPkgs != []) '' - mv $out/*.docset $out/share/docset + mv $out/*.docset $out/share/docsets ''} ''; }; @@ -48,6 +48,12 @@ in { }; environment.pathsToLink = lib.mkIf cfg.enabled [ - "/share/docset" + "/share/docsets" + ]; + + # populate a few default docsets + sane.programs.docsets.config.rustPkgs = [ + "lemmy-server" + # "mx-sanebot" ]; } diff --git a/hosts/common/programs/zeal.nix b/hosts/common/programs/zeal.nix index 215b91862..2caa3cc71 100644 --- a/hosts/common/programs/zeal.nix +++ b/hosts/common/programs/zeal.nix @@ -7,7 +7,7 @@ ".cache/Zeal" ".local/share/Zeal" ]; - fs.".local/share/Zeal/Zeal/docsets/system".symlink.target = "/run/current-system/sw/share/docset"; + fs.".local/share/Zeal/Zeal/docsets/system".symlink.target = "/run/current-system/sw/share/docsets"; suggestedPrograms = [ "docsets" ]; }; } diff --git a/hosts/modules/roles/default.nix b/hosts/modules/roles/default.nix index 081869ccf..873c51700 100644 --- a/hosts/modules/roles/default.nix +++ b/hosts/modules/roles/default.nix @@ -1,19 +1,9 @@ -{ config, lib, ... }: +{ ... }: { imports = [ ./build-machine.nix ./client - ./dev-machine.nix ./handheld.nix ./pc.nix ]; - - fileSystems."/tmp" = lib.mkIf (config.sane.roles.build-machine.enable || config.sane.roles.dev-machine) { - device = "none"; - fsType = "tmpfs"; - options = [ - "mode=777" - "defaults" - ]; - }; } diff --git a/hosts/modules/roles/dev-machine.nix b/hosts/modules/roles/dev-machine.nix deleted file mode 100644 index 8c65d0e21..000000000 --- a/hosts/modules/roles/dev-machine.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ config, lib, ... }: - -let - cfg = config.sane.roles.dev-machine; -in -{ - options.sane.roles.dev-machine = with lib; mkOption { - type = types.bool; - default = false; - description = '' - enable if this machine is used generally for "development" - and you want tools to support that (e.g. docs). - ''; - }; - - config = with lib; mkMerge [ - { - sane.programs.docsets.config.rustPkgs = [ - # "lemmy-server" - # "mx-sanebot" - ]; - } - (mkIf cfg { - sane.programs.docsets.enableFor.system = true; - # sane.programs.ldd-aarch64.enableFor.user.colin = true; #< requires binfmt - # sane.programs.zeal.enableFor.user.colin = true; - }) - ]; -} diff --git a/pkgs/by-name/cargoDocsetHook/hook.sh b/pkgs/by-name/cargoDocsetHook/hook.sh index da71464a4..9723cf274 100644 --- a/pkgs/by-name/cargoDocsetHook/hook.sh +++ b/pkgs/by-name/cargoDocsetHook/hook.sh @@ -6,6 +6,6 @@ _cargoDocset() { } _cargoDocsetInstall() { - mkdir -p $out/share/docset - cp -R target/docset/* $out/share/docset/ + mkdir -p $out/share/docsets + cp -R target/docset/* $out/share/docsets/ } diff --git a/pkgs/by-name/cargoDocsetHook/package.nix b/pkgs/by-name/cargoDocsetHook/package.nix index 209f109f4..c46067bc4 100644 --- a/pkgs/by-name/cargoDocsetHook/package.nix +++ b/pkgs/by-name/cargoDocsetHook/package.nix @@ -1,6 +1,7 @@ -{ makeSetupHook -, cargo -, cargo-docset +{ + makeSetupHook, + cargo, + cargo-docset, }: makeSetupHook { name = "cargo-docset-hook";