From 1642734aa370b2de9d616794345caecc0ab5e534 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 13 Jul 2023 22:19:18 +0000 Subject: [PATCH] hosts/common: cleanup uses of `sane-lib.fs.wantedText` --- hosts/common/home/mime.nix | 2 +- hosts/common/home/ssh.nix | 20 ++++++++++---------- hosts/common/home/xdg-dirs.nix | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hosts/common/home/mime.nix b/hosts/common/home/mime.nix index 90076910..760466d5 100644 --- a/hosts/common/home/mime.nix +++ b/hosts/common/home/mime.nix @@ -1,4 +1,4 @@ -{ config, sane-lib, ...}: +{ config, ...}: let # TODO: should move all of this into `sane.programs` to not ship broken associations diff --git a/hosts/common/home/ssh.nix b/hosts/common/home/ssh.nix index ad486997..211c3658 100644 --- a/hosts/common/home/ssh.nix +++ b/hosts/common/home/ssh.nix @@ -1,15 +1,14 @@ # TODO: this should be moved to users/colin.nix -{ config, lib, sane-lib, ... }: +{ config, lib, ... }: -with lib; let host = config.networking.hostName; user-pubkey-full = config.sane.ssh.pubkeys."colin@${host}" or {}; user-pubkey = user-pubkey-full.asUserKey or null; - host-keys = filter (k: k.user == "root") (attrValues config.sane.ssh.pubkeys); - known-hosts-text = concatStringsSep + host-keys = lib.filter (k: k.user == "root") (lib.attrValues config.sane.ssh.pubkeys); + known-hosts-text = lib.concatStringsSep "\n" - (map (k: k.asHostKey) host-keys) + (builtins.map (k: k.asHostKey) host-keys) ; in { @@ -17,13 +16,14 @@ in sane.user.persist.private = [ { type = "file"; path = ".ssh/id_ed25519"; } ]; - sane.user.fs.".ssh/id_ed25519.pub" = - mkIf (user-pubkey != null) (sane-lib.fs.wantedText user-pubkey); - sane.user.fs.".ssh/known_hosts" = sane-lib.fs.wantedText known-hosts-text; + sane.user.fs.".ssh/id_ed25519.pub" = lib.mkIf (user-pubkey != null) { + symlink.text = user-pubkey; + }; + sane.user.fs.".ssh/known_hosts".symlink.text = known-hosts-text; users.users.colin.openssh.authorizedKeys.keys = let - user-keys = filter (k: k.user == "colin") (attrValues config.sane.ssh.pubkeys); + user-keys = lib.filter (k: k.user == "colin") (lib.attrValues config.sane.ssh.pubkeys); in - map (k: k.asUserKey) user-keys; + builtins.map (k: k.asUserKey) user-keys; } diff --git a/hosts/common/home/xdg-dirs.nix b/hosts/common/home/xdg-dirs.nix index 7a74bc1c..33b53046 100644 --- a/hosts/common/home/xdg-dirs.nix +++ b/hosts/common/home/xdg-dirs.nix @@ -1,9 +1,9 @@ -{ lib, sane-lib, ...}: +{ ... }: { # XDG defines things like ~/Desktop, ~/Downloads, etc. # these clutter the home, so i mostly don't use them. - sane.user.fs.".config/user-dirs.dirs" = sane-lib.fs.wantedText '' + sane.user.fs.".config/user-dirs.dirs".symlink.text = '' XDG_DESKTOP_DIR="$HOME/.xdg/Desktop" XDG_DOCUMENTS_DIR="$HOME/dev" XDG_DOWNLOAD_DIR="$HOME/tmp" @@ -16,5 +16,5 @@ # prevent `xdg-user-dirs-update` from overriding/updating our config # see - sane.user.fs.".config/user-dirs.conf" = sane-lib.fs.wantedText "enabled=False"; + sane.user.fs.".config/user-dirs.conf".symlink.text = "enabled=False"; }