1
0
Fork 0

Build symlinks on apollo to always have all modes in a gc-root

This commit is contained in:
Malte Brandy 2020-05-09 14:45:58 +02:00
parent 6facc0f281
commit d19cdcc8f5
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9

200
home.nix
View file

@ -1,98 +1,117 @@
let let
inherit (import <nixpkgs> { }) lib;
makeConfig = hostName: imports: makeConfig = hostName: imports:
{ ... }: { { ... }: {
imports = imports ++ [ ./home ]; imports = imports ++ [ ./home ];
m-0.hostName = hostName; m-0.hostName = hostName;
}; };
setStartpage = startpage: wrapWithOthers = config: all:
{ ... }: { { lib, ... }: {
programs.firefox.profiles."fz2sm95u.default".settings = { imports = [ config ];
"browser.startup.homepage" = startpage; home.file = lib.listToAttrs (builtins.map (name: {
}; inherit name;
value = {
source = (import <home-manager/home-manager/home-manager.nix> {
confPath = ~/git/config/home.nix;
confAttr = "apollo-${name}-without-symlinks";
}).activationPackage;
target = ".gc-roots-home/${name}";
};
}) (lib.attrNames all));
}; };
makeBlock = list: apollo = let
{ pkgs, lib, ... }: { setStartpage = startpage:
systemd.user = { { ... }: {
services.blockserver = { programs.firefox.profiles."fz2sm95u.default".settings = {
Unit = { Description = "Serve a blocklist"; }; "browser.startup.homepage" = startpage;
Service = {
ExecStart = "${pkgs.python3}/bin/python -m http.server 8842 -d ${
pkgs.writeTextDir "blocklist" (lib.concatStringsSep "\r\n" list)
}";
Restart = "always";
};
Install = { WantedBy = [ "default.target" ]; };
}; };
}; };
}; makeBlock = list:
tinkerPages = [ { pkgs, lib, ... }: {
"reddit.com" systemd.user = {
"github.com" services.blockserver = {
"*.ccc.de" Unit = { Description = "Serve a blocklist"; };
"haskell.org" Service = {
"*.haskell.org" ExecStart = "${pkgs.python3}/bin/python -m http.server 8842 -d ${
"*.nixos.org" pkgs.writeTextDir "blocklist"
"nixos.org" (lib.concatStringsSep "\r\n" list)
"matrix.org" }";
"riot.im" Restart = "always";
]; };
leisurePages = [ Install = { WantedBy = [ "default.target" ]; };
"zeit.de" };
"heise.de" };
"spiegel.de" };
"youtube.de" tinkerPages = [
"youtube.com" "reddit.com"
"xkcd.com" "github.com"
"smbc-comics.com" "*.ccc.de"
"tagesschau.de" "haskell.org"
"welt.de" "*.haskell.org"
"ndr.de" "*.nixos.org"
"ard.de" "nixos.org"
"zdf.de" "matrix.org"
"twitter.com" "riot.im"
"chaos.social" ];
]; leisurePages = [
apolloConfig = imports: "zeit.de"
makeConfig "apollo" (imports ++ [ "heise.de"
home/battery.nix "spiegel.de"
home/mpd.nix "youtube.de"
home/mpclient.nix "youtube.com"
home/on-my-machine.nix "xkcd.com"
home/desktop "smbc-comics.com"
home/firefox.nix "tagesschau.de"
home/git-sign.nix "welt.de"
home/laptop.nix "ndr.de"
]); "ard.de"
"zdf.de"
"twitter.com"
"chaos.social"
];
apolloConfig = imports:
makeConfig "apollo" (imports ++ [
home/battery.nix
home/mpd.nix
home/mpclient.nix
home/on-my-machine.nix
home/desktop
home/firefox.nix
home/git-sign.nix
home/laptop.nix
]);
in {
orga = apolloConfig [
home/accounting.nix
home/mail.nix
home/pythia.nix
home/update_tasks.nix
(setStartpage "https://cloud.maralorn.de/apps/calendar")
(makeBlock (tinkerPages ++ leisurePages))
];
research = apolloConfig [
home/latex.nix
(makeBlock (tinkerPages ++ leisurePages))
(setStartpage "http://localhost:8042")
];
tinkering = apolloConfig [
home/mail.nix
home/update-script.nix
home/tinkering.nix
home/chat.nix
(makeBlock leisurePages)
(setStartpage "https://stats.maralorn.de/d/health-status")
];
leisure = apolloConfig [
home/games.nix
home/chat.nix
(makeBlock [ ])
(setStartpage "https://stats.maralorn.de/d/health-status")
];
};
in { in {
apollo-orga = apolloConfig [
home/accounting.nix
home/mail.nix
home/pythia.nix
home/update_tasks.nix
(setStartpage "https://cloud.maralorn.de/apps/calendar")
(makeBlock (tinkerPages ++ leisurePages))
];
apollo-research = apolloConfig [
home/latex.nix
(makeBlock (tinkerPages ++ leisurePages))
(setStartpage "http://localhost:8042")
];
apollo-tinkering = apolloConfig [
home/mail.nix
home/update-script.nix
home/tinkering.nix
home/chat.nix
(makeBlock leisurePages)
(setStartpage "https://stats.maralorn.de/d/health-status")
];
apollo-leisure = apolloConfig [
home/games.nix
home/chat.nix
(makeBlock [ ])
(setStartpage "https://stats.maralorn.de/d/health-status")
];
hera = makeConfig "hera" [ hera = makeConfig "hera" [
./home ./home
home/on-my-machine.nix home/on-my-machine.nix
@ -102,4 +121,13 @@ in {
home/headless-mpd.nix home/headless-mpd.nix
home/mail.nix home/mail.nix
]; ];
} } // lib.listToAttrs (lib.flatten (lib.mapAttrsToList (name: config: [
{
name = "apollo-${name}";
value = wrapWithOthers config apollo;
}
{
name = "apollo-${name}-without-symlinks";
value = config;
}
]) apollo))