hosts/common: cleanup uses of sane-lib.fs.wantedText
This commit is contained in:
parent
a8382fed12
commit
1642734aa3
|
@ -1,4 +1,4 @@
|
|||
{ config, sane-lib, ...}:
|
||||
{ config, ...}:
|
||||
|
||||
let
|
||||
# TODO: should move all of this into `sane.programs` to not ship broken associations
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 <https://manpages.ubuntu.com/manpages/bionic/man5/user-dirs.conf.5.html>
|
||||
sane.user.fs.".config/user-dirs.conf" = sane-lib.fs.wantedText "enabled=False";
|
||||
sane.user.fs.".config/user-dirs.conf".symlink.text = "enabled=False";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user