programs: remove wantedBy from the fs, and make it implicit

This commit is contained in:
Colin 2023-05-08 21:41:02 +00:00
parent 836b74991a
commit 74ed7bff11
15 changed files with 63 additions and 65 deletions

View File

@ -1,5 +1,5 @@
# Terminal UI mail client # Terminal UI mail client
{ config, sane-lib, ... }: { ... }:
{ {
sane.programs.aerc.secrets.".config/aerc/accounts.conf" = ../../../secrets/universal/aerc_accounts.conf.bin; sane.programs.aerc.secrets.".config/aerc/accounts.conf" = ../../../secrets/universal/aerc_accounts.conf.bin;

View File

@ -1,10 +1,10 @@
{ lib, pkgs, sane-lib, ... }: { lib, pkgs, ... }:
let let
mkCfg = lib.generators.toINI { }; mkCfg = lib.generators.toINI { };
in in
{ {
sane.programs.git.fs.".config/git/config" = sane-lib.fs.wantedText (mkCfg { sane.programs.git.fs.".config/git/config".symlink.text = mkCfg {
user.name = "Colin"; user.name = "Colin";
user.email = "colin@uninsane.org"; user.email = "colin@uninsane.org";
alias.co = "checkout"; alias.co = "checkout";
@ -14,5 +14,5 @@ in
difftool.prompt = false; difftool.prompt = false;
"difftool \"difftastic\"".cmd = ''${pkgs.difftastic}/bin/difft "$LOCAL" "$REMOTE"''; "difftool \"difftastic\"".cmd = ''${pkgs.difftastic}/bin/difft "$LOCAL" "$REMOTE"'';
# now run `git difftool` to use difftastic git # now run `git difftool` to use difftastic git
}); };
} }

View File

@ -6,37 +6,35 @@ let
all-feeds = config.sane.feeds; all-feeds = config.sane.feeds;
wanted-feeds = feeds.filterByFormat ["text" "image"] all-feeds; wanted-feeds = feeds.filterByFormat ["text" "image"] all-feeds;
in { in {
sane.programs.gnome-feeds.fs.".config/org.gabmus.gfeeds.json" = sane-lib.fs.wantedText ( sane.programs.gnome-feeds.fs.".config/org.gabmus.gfeeds.json".symlink.text = builtins.toJSON {
builtins.toJSON { # feed format is a map from URL to a dict,
# feed format is a map from URL to a dict, # with dict["tags"] a list of string tags.
# with dict["tags"] a list of string tags. feeds = sane-lib.mapToAttrs (feed: {
feeds = sane-lib.mapToAttrs (feed: { name = feed.url;
name = feed.url; value.tags = [ feed.cat feed.freq ];
value.tags = [ feed.cat feed.freq ]; }) wanted-feeds;
}) wanted-feeds; dark_reader = false;
dark_reader = false; new_first = true;
new_first = true; # windowsize = {
# windowsize = { # width = 350;
# width = 350; # height = 650;
# height = 650; # };
# }; max_article_age_days = 90;
max_article_age_days = 90; enable_js = false;
enable_js = false; max_refresh_threads = 3;
max_refresh_threads = 3; # saved_items = {};
# saved_items = {}; # read_items = [];
# read_items = []; show_read_items = true;
show_read_items = true; full_article_title = true;
full_article_title = true; # views: "webview", "reader", "rsscont"
# views: "webview", "reader", "rsscont" default_view = "rsscont";
default_view = "rsscont"; open_links_externally = true;
open_links_externally = true; full_feed_name = false;
full_feed_name = false; refresh_on_startup = true;
refresh_on_startup = true; tags = lib.unique (
tags = lib.unique ( (builtins.catAttrs "cat" wanted-feeds) ++ (builtins.catAttrs "freq" wanted-feeds)
(builtins.catAttrs "cat" wanted-feeds) ++ (builtins.catAttrs "freq" wanted-feeds) );
); open_youtube_externally = false;
open_youtube_externally = false; media_player = "vlc"; # default: mpv
media_player = "vlc"; # default: mpv };
}
);
} }

View File

@ -6,7 +6,7 @@ let
all-feeds = config.sane.feeds; all-feeds = config.sane.feeds;
wanted-feeds = feeds.filterByFormat ["podcast"] all-feeds; wanted-feeds = feeds.filterByFormat ["podcast"] all-feeds;
in { in {
sane.programs.gpodder.fs.".config/gpodderFeeds.opml" = sane-lib.fs.wantedText ( sane.programs.gpodder.fs.".config/gpodderFeeds.opml".symlink.text =
feeds.feedsToOpml wanted-feeds feeds.feedsToOpml wanted-feeds
); ;
} }

View File

@ -1,7 +1,7 @@
{ pkgs, sane-lib, ... }: { ... }:
{ {
sane.programs.kitty.fs.".config/kitty/kitty.conf" = sane-lib.fs.wantedText '' sane.programs.kitty.fs.".config/kitty/kitty.conf".symlink.text = ''
# docs: https://sw.kovidgoyal.net/kitty/conf/ # docs: https://sw.kovidgoyal.net/kitty/conf/
# disable terminal bell (when e.g. you backspace too many times) # disable terminal bell (when e.g. you backspace too many times)
enable_audio_bell no enable_audio_bell no

View File

@ -1,8 +1,8 @@
{ sane-lib, ... }: { ... }:
{ {
# libreoffice: disable first-run stuff # libreoffice: disable first-run stuff
sane.programs.libreoffice-fresh.fs.".config/libreoffice/4/user/registrymodifications.xcu" = sane-lib.fs.wantedText '' sane.programs.libreoffice-fresh.fs.".config/libreoffice/4/user/registrymodifications.xcu".symlink.text = ''
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<item oor:path="/org.openoffice.Office.Common/Misc"><prop oor:name="FirstRun" oor:op="fuse"><value>false</value></prop></item> <item oor:path="/org.openoffice.Office.Common/Misc"><prop oor:name="FirstRun" oor:op="fuse"><value>false</value></prop></item>

View File

@ -1,10 +1,10 @@
{ sane-lib, ... }: { ... }:
{ {
sane.programs.mpv = { sane.programs.mpv = {
persist.plaintext = [ ".config/mpv/watch_later" ]; persist.plaintext = [ ".config/mpv/watch_later" ];
# format is <key>=%<length>%<value> # format is <key>=%<length>%<value>
fs.".config/mpv/mpv.conf" = sane-lib.fs.wantedText '' fs.".config/mpv/mpv.conf".symlink.text = ''
save-position-on-quit=%3%yes save-position-on-quit=%3%yes
keep-open=%3%yes keep-open=%3%yes
''; '';

View File

@ -8,8 +8,8 @@ let
in { in {
sane.programs.newsflash = { sane.programs.newsflash = {
persist.plaintext = [ ".local/share/news-flash" ]; persist.plaintext = [ ".local/share/news-flash" ];
fs.".config/newsflashFeeds.opml" = sane-lib.fs.wantedText ( fs.".config/newsflashFeeds.opml".symlink.text =
feeds.feedsToOpml wanted-feeds feeds.feedsToOpml wanted-feeds
); ;
}; };
} }

View File

@ -1,9 +1,9 @@
{ sane-lib, ... }: { ... }:
{ {
# .ignore file is read by ripgrep (rg), silver searcher (ag), maybe others. # .ignore file is read by ripgrep (rg), silver searcher (ag), maybe others.
# ignore translation files by default when searching, as they tend to have # ignore translation files by default when searching, as they tend to have
# a LOT of duplicate text. # a LOT of duplicate text.
sane.programs.ripgrep.fs.".ignore" = sane-lib.fs.wantedText '' sane.programs.ripgrep.fs.".ignore".symlink.text = ''
po/ po/
''; '';
} }

View File

@ -1,12 +1,12 @@
# borrows from: # borrows from:
# - default config: <https://github.com/cspeterson/splatmoji/blob/master/splatmoji.config> # - default config: <https://github.com/cspeterson/splatmoji/blob/master/splatmoji.config>
# - wayland: <https://github.com/cspeterson/splatmoji/issues/32#issuecomment-830862566> # - wayland: <https://github.com/cspeterson/splatmoji/issues/32#issuecomment-830862566>
{ pkgs, sane-lib, ... }: { pkgs, ... }:
{ {
sane.programs.splatmoji = { sane.programs.splatmoji = {
persist.plaintext = [ ".local/state/splatmoji" ]; persist.plaintext = [ ".local/state/splatmoji" ];
fs.".config/splatmoji/splatmoji.config" = sane-lib.fs.wantedText '' fs.".config/splatmoji/splatmoji.config".symlink.text = ''
# XXX doesn't seem to understand ~ as shorthand for `$HOME` # XXX doesn't seem to understand ~ as shorthand for `$HOME`
history_file=/home/colin/.local/state/splatmoji/history history_file=/home/colin/.local/state/splatmoji/history
history_length=5 history_length=5

View File

@ -12,7 +12,7 @@ in
sane.programs.vlc = { sane.programs.vlc = {
# vlc remembers play position in ~/.config/vlc/vlc-qt-interface.conf # vlc remembers play position in ~/.config/vlc/vlc-qt-interface.conf
persist.plaintext = [ ".config/vlc" ]; persist.plaintext = [ ".config/vlc" ];
fs.".config/vlc/vlcrc" = sane-lib.fs.wantedText '' fs.".config/vlc/vlcrc".symlink.text = ''
[podcast] [podcast]
podcast-urls=${podcast-urls} podcast-urls=${podcast-urls}
[core] [core]

View File

@ -6,7 +6,7 @@
# many of the settings below won't have effect without those patches. # many of the settings below won't have effect without those patches.
# see: https://gitlab.com/librewolf-community/settings/-/blob/master/distribution/policies.json # see: https://gitlab.com/librewolf-community/settings/-/blob/master/distribution/policies.json
{ config, lib, pkgs, sane-lib, ...}: { config, lib, pkgs, ...}:
with lib; with lib;
let let
cfg = config.sane.programs.web-browser.config; cfg = config.sane.programs.web-browser.config;
@ -167,7 +167,7 @@ in
# the specific attribute path is found via scraping ublock code here: # the specific attribute path is found via scraping ublock code here:
# - <https://github.com/gorhill/uBlock/blob/master/src/js/storage.js> # - <https://github.com/gorhill/uBlock/blob/master/src/js/storage.js>
# - <https://github.com/gorhill/uBlock/blob/master/assets/assets.json> # - <https://github.com/gorhill/uBlock/blob/master/assets/assets.json>
fs."${cfg.browser.dotDir}/managed-storage/uBlock0@raymondhill.net.json" = sane-lib.fs.wantedText '' fs."${cfg.browser.dotDir}/managed-storage/uBlock0@raymondhill.net.json".symlink.text = ''
{ {
"name": "uBlock0@raymondhill.net", "name": "uBlock0@raymondhill.net",
"description": "ignored", "description": "ignored",
@ -177,16 +177,16 @@ in
} }
} }
''; '';
fs."${cfg.browser.dotDir}/${cfg.browser.libName}.overrides.cfg" = sane-lib.fs.wantedText '' fs."${cfg.browser.dotDir}/${cfg.browser.libName}.overrides.cfg".symlink.text = ''
// if we can't query the revocation status of a SSL cert because the issuer is offline, // if we can't query the revocation status of a SSL cert because the issuer is offline,
// treat it as unrevoked. // treat it as unrevoked.
// see: <https://librewolf.net/docs/faq/#im-getting-sec_error_ocsp_server_error-what-can-i-do> // see: <https://librewolf.net/docs/faq/#im-getting-sec_error_ocsp_server_error-what-can-i-do>
defaultPref("security.OCSP.require", false); defaultPref("security.OCSP.require", false);
''; '';
fs."${cfg.browser.dotDir}/default" = sane-lib.fs.wantedDir; fs."${cfg.browser.dotDir}/default".dir = {};
# instruct Firefox to put the profile in a predictable directory (so we can do things like persist just it). # instruct Firefox to put the profile in a predictable directory (so we can do things like persist just it).
# XXX: the directory *must* exist, even if empty; Firefox will not create the directory itself. # XXX: the directory *must* exist, even if empty; Firefox will not create the directory itself.
fs."${cfg.browser.dotDir}/profiles.ini" = sane-lib.fs.wantedText '' fs."${cfg.browser.dotDir}/profiles.ini".symlink.text = ''
[Profile0] [Profile0]
Name=default Name=default
IsRelative=1 IsRelative=1

View File

@ -1,8 +1,7 @@
{ config, lib, pkgs, sane-lib, ... }: { config, lib, pkgs, ... }:
let let
inherit (builtins) map; inherit (builtins) map;
inherit (lib) mkIf mkOption optionalString types; inherit (lib) mkIf mkOption optionalString types;
inherit (sane-lib) mapToAttrs;
cfg = config.sane.programs.docsets.config; cfg = config.sane.programs.docsets.config;
configOpts = types.submodule { configOpts = types.submodule {
options = { options = {
@ -18,7 +17,7 @@ in {
".cache/Zeal" ".cache/Zeal"
".local/share/Zeal" ".local/share/Zeal"
]; ];
fs.".local/share/Zeal/Zeal/docsets/system" = sane-lib.fs.wantedSymlinkTo "/run/current-system/sw/share/docset"; fs.".local/share/Zeal/Zeal/docsets/system".symlink.target = "/run/current-system/sw/share/docset";
suggestedPrograms = [ "docsets" ]; suggestedPrograms = [ "docsets" ];
}; };

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, sane-lib, ... }: { config, lib, pkgs, ... }:
let let
inherit (lib) mkIf mkMerge mkOption types; inherit (lib) mkIf mkMerge mkOption types;
@ -51,12 +51,12 @@ in
]; ];
# zsh/prezto complains if zshrc doesn't exist; but it does allow an "empty" file. # zsh/prezto complains if zshrc doesn't exist; but it does allow an "empty" file.
fs.".config/zsh/.zshrc" = sane-lib.fs.wantedText "# "; fs.".config/zsh/.zshrc".symlink.text = "# ";
# prezto = oh-my-zsh fork; controls prompt, auto-completion, etc. # prezto = oh-my-zsh fork; controls prompt, auto-completion, etc.
# see: https://github.com/sorin-ionescu/prezto # see: https://github.com/sorin-ionescu/prezto
# i believe this file is auto-sourced by the prezto init.zsh script. # i believe this file is auto-sourced by the prezto init.zsh script.
fs.".config/zsh/.zpreztorc" = sane-lib.fs.wantedText '' fs.".config/zsh/.zpreztorc".symlink.text = ''
zstyle ':prezto:*:*' color 'yes' zstyle ':prezto:*:*' color 'yes'
# modules (they ship with prezto): # modules (they ship with prezto):

View File

@ -145,9 +145,10 @@ let
sane.users = mapAttrs (user: en: optionalAttrs en { sane.users = mapAttrs (user: en: optionalAttrs en {
inherit (p) persist; inherit (p) persist;
fs = mkMerge [ fs = mkMerge [
p.fs # make every fs entry wanted by system boot:
(mapAttrs (_path: sane-lib.fs.wanted) p.fs)
# link every secret into the fs:
(mapAttrs (mapAttrs
# link every secret into the fs
# TODO: user the user's *actual* home directory, don't guess. # TODO: user the user's *actual* home directory, don't guess.
(homePath: _src: sane-lib.fs.wantedSymlinkTo "/run/secrets/home/${user}/${homePath}") (homePath: _src: sane-lib.fs.wantedSymlinkTo "/run/secrets/home/${user}/${homePath}")
p.secrets p.secrets