Refactor config to be more homogeneous
This commit is contained in:
parent
3cb0b72ee9
commit
85431d86e3
|
@ -26,12 +26,6 @@ let
|
|||
"twitter.com"
|
||||
"chaos.social"
|
||||
];
|
||||
setStartpage = startpage:
|
||||
{ ... }: {
|
||||
programs.firefox.profiles."maralorn-default".settings = {
|
||||
"browser.startup.homepage" = startpage;
|
||||
};
|
||||
};
|
||||
makeConfig = hostName: imports:
|
||||
{ ... }: {
|
||||
imports = imports ++ [ ./roles/default.nix ];
|
||||
|
@ -43,135 +37,74 @@ let
|
|||
config.xdg.configFile."autostart/${name}.desktop".source =
|
||||
"${config.home.path}/share/applications/${name}.desktop";
|
||||
};
|
||||
makeBlock = list:
|
||||
{ pkgs, lib, ... }: {
|
||||
systemd.user.services.blockserver = {
|
||||
Unit.Description = "Serve a blocklist";
|
||||
Service =
|
||||
let
|
||||
blocklist = pkgs.writeTextDir "blocklist" (lib.concatStringsSep "\r\n" list);
|
||||
startpage = pkgs.writeTextDir "index.html" (builtins.readFile ./startpage.html);
|
||||
in
|
||||
{
|
||||
ExecStart = "${pkgs.python3}/bin/python -m http.server 8842 -d ${pkgs.symlinkJoin { name = "blockserver-dir"; paths = [ blocklist startpage ]; }}";
|
||||
Restart = "always";
|
||||
};
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
on-my-machines = [
|
||||
./roles/on-my-machine.nix
|
||||
./roles/mail.nix
|
||||
./roles/kassandra.nix
|
||||
./roles/taskwarrior.nix
|
||||
./roles/vdirsyncer.nix
|
||||
./roles/khard.nix
|
||||
./roles/khal.nix
|
||||
./roles/mode-switching.nix
|
||||
];
|
||||
daily-driver = name: extra:
|
||||
let
|
||||
all = extra ++ on-my-machines ++ [
|
||||
(import ./roles/firefox.nix "http://localhost:8842")
|
||||
(makeAutostart "kassandra2")
|
||||
(makeAutostart "unlock-ssh")
|
||||
./roles/accounting.nix
|
||||
./roles/beets.nix
|
||||
./roles/daily-driver-programs.nix
|
||||
./roles/desktop-items.nix
|
||||
./roles/desktop.nix
|
||||
./roles/git-sign.nix
|
||||
./roles/gnome.nix
|
||||
./roles/hoogle.nix
|
||||
./roles/kitty.nix
|
||||
./roles/mpclient.nix
|
||||
./roles/mpd.nix
|
||||
./roles/pythia.nix
|
||||
./roles/research.nix
|
||||
./roles/sleep-nag.nix
|
||||
./roles/systemd-exporter.nix
|
||||
./roles/tinkering.nix
|
||||
./roles/update_tasks.nix
|
||||
];
|
||||
orgaExtra = [
|
||||
./roles/accounting.nix
|
||||
./roles/mail-client.nix
|
||||
./roles/pythia.nix
|
||||
./roles/tinkering.nix
|
||||
];
|
||||
blockServer = import ./roles/block-server.nix;
|
||||
in
|
||||
{
|
||||
research = makeConfig name (all ++ [ (blockServer restrictedPages) ]);
|
||||
orga = makeConfig name (all ++ orgaExtra ++ [ (blockServer restrictedPages) ]);
|
||||
leisure = makeConfig name (
|
||||
all ++ orgaExtra ++ [
|
||||
./roles/games.nix
|
||||
./roles/chat.nix
|
||||
(blockServer [ ])
|
||||
]
|
||||
);
|
||||
};
|
||||
in
|
||||
{
|
||||
apollo =
|
||||
let
|
||||
install = f: ({ pkgs, ... }: { home.packages = f pkgs; });
|
||||
apolloConfig = name: imports:
|
||||
makeConfig "apollo" (
|
||||
imports ++ [
|
||||
./roles/systemd-exporter.nix
|
||||
./roles/battery.nix
|
||||
./roles/beets.nix
|
||||
./roles/daily-driver-programs.nix
|
||||
./roles/desktop
|
||||
./roles/git-sign.nix
|
||||
./roles/hoogle.nix
|
||||
./roles/kassandra.nix
|
||||
./roles/khal.nix
|
||||
./roles/khard.nix
|
||||
./roles/mail.nix
|
||||
./roles/mpclient.nix
|
||||
./roles/mpd.nix
|
||||
./roles/on-my-machine.nix
|
||||
./roles/research.nix
|
||||
./roles/taskwarrior-git.nix
|
||||
./roles/taskwarrior.nix
|
||||
./roles/update_tasks.nix
|
||||
./roles/vdirsyncer.nix
|
||||
./roles/zettelkasten.nix
|
||||
(import ./roles/mode-switching.nix { modeDir = ".modes"; })
|
||||
(makeAutostart "unlock-ssh")
|
||||
]
|
||||
);
|
||||
unrestricted = [
|
||||
./roles/accounting.nix
|
||||
./roles/mail-client.nix
|
||||
./roles/pythia.nix
|
||||
./roles/tinkering.nix
|
||||
./roles/chat.nix
|
||||
(setStartpage "https://stats.maralorn.de")
|
||||
(makeBlock [ ])
|
||||
];
|
||||
in
|
||||
{
|
||||
leisure = apolloConfig "Leisure" (unrestricted ++ [ ./roles/games.nix ]);
|
||||
orga = apolloConfig "Orga" [
|
||||
./roles/mail-client.nix
|
||||
./roles/accounting.nix
|
||||
./roles/pythia.nix
|
||||
(setStartpage "https://habitica.com")
|
||||
(makeBlock restrictedPages)
|
||||
(makeAutostart "kassandra2")
|
||||
(install (p: [ p.discord ])) # For teaching
|
||||
];
|
||||
research = apolloConfig "Research" [
|
||||
(makeBlock restrictedPages)
|
||||
];
|
||||
};
|
||||
zeus =
|
||||
let
|
||||
all = [
|
||||
./roles/accounting.nix
|
||||
./roles/systemd-exporter.nix
|
||||
./roles/beets.nix
|
||||
./roles/daily-driver-programs.nix
|
||||
./roles/desktop
|
||||
./roles/git-sign.nix
|
||||
./roles/hoogle.nix
|
||||
./roles/hourly-maintenance.nix
|
||||
./roles/kassandra.nix
|
||||
./roles/khal.nix
|
||||
./roles/khard.nix
|
||||
./roles/mail.nix
|
||||
./roles/mpclient.nix
|
||||
./roles/mpd.nix
|
||||
./roles/on-my-machine.nix
|
||||
./roles/pythia.nix
|
||||
./roles/research.nix
|
||||
./roles/state.nix
|
||||
./roles/taskwarrior.nix
|
||||
./roles/tinkering.nix
|
||||
./roles/update_tasks.nix
|
||||
./roles/vdirsyncer.nix
|
||||
(import ./roles/mode-switching.nix { modeDir = ".volatile/modes"; })
|
||||
(setStartpage "http://localhost:8842")
|
||||
(makeAutostart "kassandra2")
|
||||
(makeAutostart "unlock-ssh")
|
||||
];
|
||||
orga = all ++ [
|
||||
./roles/mail-client.nix
|
||||
];
|
||||
leisure = orga ++ [
|
||||
./roles/games.nix
|
||||
./roles/chat.nix
|
||||
];
|
||||
in
|
||||
{
|
||||
research = makeConfig "zeus" (all ++ [ (makeBlock restrictedPages) ]);
|
||||
orga = makeConfig "zeus" (orga ++ [ (makeBlock restrictedPages) ]);
|
||||
leisure = makeConfig "zeus" (leisure ++ [ (makeBlock [ ]) ]);
|
||||
};
|
||||
apollo = daily-driver "apollo" [
|
||||
./roles/battery.nix
|
||||
];
|
||||
zeus = daily-driver "zeus" [
|
||||
./roles/hourly-maintenance.nix
|
||||
./roles/state.nix
|
||||
];
|
||||
hera = {
|
||||
default = makeConfig "hera" [
|
||||
./roles/on-my-machine.nix
|
||||
./roles/headless.nix
|
||||
./roles/weechat
|
||||
./roles/headless-mpd.nix
|
||||
./roles/mail.nix
|
||||
./roles/kassandra.nix
|
||||
./roles/mail2rss.nix
|
||||
./roles/taskwarrior.nix
|
||||
./roles/vdirsyncer.nix
|
||||
./roles/khard.nix
|
||||
./roles/khal.nix
|
||||
./roles/headless-mpd.nix
|
||||
./roles/headless.nix
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
16
home-manager/roles/block-server.nix
Normal file
16
home-manager/roles/block-server.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
list:
|
||||
{ pkgs, lib, ... }: {
|
||||
systemd.user.services.blockserver = {
|
||||
Unit.Description = "Serve a blocklist";
|
||||
Service =
|
||||
let
|
||||
blocklist = pkgs.writeTextDir "blocklist" (lib.concatStringsSep "\r\n" list);
|
||||
startpage = pkgs.writeTextDir "index.html" (builtins.readFile ./startpage.html);
|
||||
in
|
||||
{
|
||||
ExecStart = "${pkgs.python3}/bin/python -m http.server 8842 -d ${pkgs.symlinkJoin { name = "blockserver-dir"; paths = [ blocklist startpage ]; }}";
|
||||
Restart = "always";
|
||||
};
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
};
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
let inherit (import ../../../lib) colors;
|
||||
let inherit (import ../../lib) colors;
|
||||
in
|
||||
{
|
||||
imports =
|
||||
[ ./sleep-nag.nix ./kitty.nix ./gnome.nix ./firefox.nix ./desktop-items.nix ];
|
||||
m-0.colors = colors;
|
||||
home = {
|
||||
packages = builtins.attrValues pkgs.desktop-pkgs;
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }: {
|
||||
startpage: { pkgs, ... }: {
|
||||
programs.firefox = {
|
||||
profiles.maralorn-default = {
|
||||
extraConfig = ""; # user.js
|
||||
|
@ -14,6 +14,7 @@
|
|||
"browser.newtab.privateAllowed" = "true";
|
||||
"font.name.serif.x-western" = "B612";
|
||||
"services.sync.username" = "firefox@maralorn.de";
|
||||
"browser.startup.homepage" = startpage;
|
||||
};
|
||||
};
|
||||
enable = true;
|
|
@ -1,6 +1,6 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
my-lib = import ../../../lib;
|
||||
my-lib = import ../../lib;
|
||||
theme = my-lib.themes.default;
|
||||
in
|
||||
{
|
|
@ -1,9 +1,9 @@
|
|||
opts: { pkgs, lib, config, ... }:
|
||||
{ pkgs, lib, config, ... }:
|
||||
let
|
||||
inherit (config.m-0) hostName;
|
||||
modes = pkgs.lib.attrNames (import ../machines.nix).${hostName};
|
||||
modeFile = "${config.home.homeDirectory}/.mode";
|
||||
modeDir = "${config.home.homeDirectory}/${opts.modeDir}";
|
||||
modeDir = "${config.home.homeDirectory}/.volatile/modes";
|
||||
configPath = "${config.home.homeDirectory}/git/config";
|
||||
configGit = "${pkgs.git}/bin/git -C ${configPath}";
|
||||
in
|
||||
|
|
Loading…
Reference in a new issue