Refactor everything to make a better iso image

This commit is contained in:
Alexander Bantyev 2021-06-14 11:57:39 +03:00
parent 758446365d
commit 8b6e9d994b
Signed by: balsoft
GPG Key ID: E081FF12ADCB4AD5
13 changed files with 128 additions and 99 deletions

View File

@ -1,7 +1,12 @@
{ modulesPath, lib, inputs, pkgs, ... }: {
imports = [
imports = with inputs.self.nixosModules; [
"${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix"
inputs.self.nixosProfiles.base
themes
fonts
cage
gtk
alacritty
];
networking.wireless.enable = lib.mkForce false;
services.openssh.permitRootLogin = lib.mkForce "no";

View File

@ -0,0 +1,48 @@
{ config, pkgs, ... }: {
startupApplications = with config.defaultApplications; [
browser.cmd
mail.cmd
matrix.cmd
];
environment.sessionVariables = {
EDITOR = config.defaultApplications.editor.cmd;
VISUAL = config.defaultApplications.editor.cmd;
};
home-manager.users.balsoft = {
home.activation."mimeapps-remove" = {
before = [ "checkLinkTargets" ];
after = [ ];
data = "rm -f /home/balsoft/.config/mimeapps.list";
};
xdg.mimeApps = {
enable = true;
defaultApplications = with config.defaultApplications;
builtins.mapAttrs (name: value:
if value ? desktop then [ "${value.desktop}.desktop" ] else value) {
"text/html" = browser;
"image/*" = { desktop = "org.gnome.eog"; };
"application/zip" = archive;
"application/rar" = archive;
"application/7z" = archive;
"application/*tar" = archive;
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/about" = browser;
"x-scheme-handler/mailto" = mail;
"x-scheme-handler/matrix" = matrix;
"application/pdf" = { desktop = "org.kde.okular"; };
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" =
text_processor;
"application/msword" = text_processor;
"application/vnd.oasis.opendocument.text" = text_processor;
"text/csv" = spreadsheet;
"application/vnd.oasis.opendocument.spreadsheet" = spreadsheet;
"text/plain" =
editor; # This actually makes Emacs an editor for everything... XDG is wierd
};
};
};
}

View File

@ -1,43 +1,23 @@
{ pkgs, config, lib, ... }: {
options.defaultApplications = lib.mkOption {
type = lib.types.attrs;
description = "Preferred applications";
};
options = with lib;
with types; {
defaultApplications = mkOption {
type = attrsOf (submodule ({ name, ... }: {
options = {
cmd = mkOption { type = path; };
desktop = mkOption { type = str; };
};
}));
description = "Preferred applications";
};
startupApplications = mkOption {
type = listOf path;
description = "Applications to run on startup";
};
};
config = rec {
defaultApplications = {
term = {
cmd = "${pkgs.alacritty}/bin/alacritty";
desktop = "alacritty";
};
editor = {
cmd =
"${config.home-manager.users.balsoft.programs.emacs.finalPackage}/bin/emacsclient -c $@";
desktop = "emacsclient";
};
browser = {
cmd = "${pkgs.firefox-wayland}/bin/firefox";
desktop = "firefox";
};
fm = {
cmd = "${pkgs.gnome3.nautilus}/bin/nautilus";
desktop = "org.gnome.Nautilus";
};
matrix = {
cmd = "${pkgs.nheko}/bin/nheko";
desktop = "nheko";
};
monitor = {
cmd = "${pkgs.gnome3.gnome-system-monitor}/bin/gnome-system-monitor";
desktop = "gnome-system-monitor";
};
archive = {
cmd = "${pkgs.gnome3.file-roller}/bin/file-roller";
desktop = "org.gnome.FileRoller";
};
mail = {
cmd = "${pkgs.gnome3.geary}/bin/geary";
desktop = "org.gnome.Geary";
};
text_processor = {
cmd = "${pkgs.abiword}/bin/abiword";
desktop = "abiword";
@ -47,46 +27,5 @@
desktop = "gnumeric";
};
};
environment.sessionVariables = {
EDITOR = config.defaultApplications.editor.cmd;
VISUAL = config.defaultApplications.editor.cmd;
};
home-manager.users.balsoft = {
home.activation."mimeapps-remove" = {
before = [ "checkLinkTargets" ];
after = [ ];
data = "rm -f /home/balsoft/.config/mimeapps.list";
};
xdg.mimeApps = {
enable = true;
defaultApplications = with config.defaultApplications;
builtins.mapAttrs (name: value:
if value ? desktop then [ "${value.desktop}.desktop" ] else value) {
"text/html" = browser;
"image/*" = { desktop = "org.gnome.eog"; };
"application/zip" = archive;
"application/rar" = archive;
"application/7z" = archive;
"application/*tar" = archive;
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/about" = browser;
"x-scheme-handler/mailto" = mail;
"x-scheme-handler/matrix" = matrix;
"application/pdf" = { desktop = "org.kde.okular"; };
"application/vnd.openxmlformats-officedocument.wordprocessingml.document" =
text_processor;
"application/msword" = text_processor;
"application/vnd.oasis.opendocument.text" = text_processor;
"text/csv" = spreadsheet;
"application/vnd.oasis.opendocument.spreadsheet" = spreadsheet;
"text/plain" =
editor; # This actually makes Emacs an editor for everything... XDG is wierd
};
};
};
};
}

View File

@ -1,5 +1,8 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
defaultApplications.term = {
cmd = "${pkgs.alacritty}/bin/alacritty";
desktop = "alacritty";
};
home-manager.users.balsoft.programs.alacritty = {
enable = true;
settings = {

View File

@ -18,6 +18,12 @@ in {
persist.state.homeFiles =
[ ".config/emacs/custom" ".config/emacs/eshell/history" ];
defaultApplications.editor = {
cmd =
"${config.home-manager.users.balsoft.programs.emacs.finalPackage}/bin/emacsclient -c $@";
desktop = "emacsclient";
};
home-manager.users.balsoft = {
programs.emacs = {
enable = true;

View File

@ -11,6 +11,11 @@ in {
persist.state.directories = [ "/home/balsoft/.mozilla/firefox/default" ];
defaultApplications.browser = {
cmd = "${pkgs.firefox-wayland}/bin/firefox";
desktop = "firefox";
};
home-manager.users.balsoft = lib.mkIf (config.deviceSpecific.goodMachine) {
programs.browserpass = {
enable = true;

View File

@ -9,7 +9,7 @@ let
save_sent = true;
sender_mailboxes = "Alexander Bantyev <balsoft@balsoft.ru>;";
service_provider = "other";
signature = builtins.replaceStrings ["\n"] ["\\n"] ''
signature = builtins.replaceStrings [ "\n" ] [ "\\n" ] ''
--
Александр Бантьев /Alexander Bantyev/ aka balsoft
@ -57,6 +57,11 @@ in {
persist.cache.directories = [ "/home/balsoft/.local/share/geary" ];
defaultApplications.mail = {
cmd = "${pkgs.gnome3.geary}/bin/geary";
desktop = "org.gnome.Geary";
};
home-manager.users.balsoft = {
xdg.configFile."geary/user-style.css".text = ''
*, html, body, body.plain div, body.plain a, body.plain p, body.plain span {
@ -70,7 +75,9 @@ in {
'';
home.activation.geary = ''
mkdir -p "$XDG_CONFIG_HOME/geary/account_03"
$DRY_RUN_CMD ln -sf $VERBOSE_ARG ${builtins.toFile "geary.ini" (pkgs.my-lib.genIni gearyConfig)} "$XDG_CONFIG_HOME/geary/account_03/geary.ini"
$DRY_RUN_CMD ln -sf $VERBOSE_ARG ${
builtins.toFile "geary.ini" (pkgs.my-lib.genIni gearyConfig)
} "$XDG_CONFIG_HOME/geary/account_03/geary.ini"
'';
};
}

View File

@ -1,8 +1,9 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
home-manager.users.balsoft.home.packages = [ pkgs.nheko ];
persist.state.directories = [
"/home/balsoft/.local/share/nheko"
"/home/balsoft/.config/nheko"
];
defaultApplications.matrix = {
cmd = "${pkgs.nheko}/bin/nheko";
desktop = "nheko";
};
persist.state.directories =
[ "/home/balsoft/.local/share/nheko" "/home/balsoft/.config/nheko" ];
}

View File

@ -0,0 +1,7 @@
{ config, pkgs, lib, ... }: {
services.cage = {
enable = true;
program = config.defaultApplications.term.cmd;
user = "balsoft";
};
}

View File

@ -22,6 +22,21 @@
value.options = [ "x-gvfs-hide" ];
}) (state.directories ++ cache.directories ++ derivative.directories)));
defaultApplications = {
fm = {
cmd = "${pkgs.gnome3.nautilus}/bin/nautilus";
desktop = "org.gnome.Nautilus";
};
monitor = {
cmd = "${pkgs.gnome3.gnome-system-monitor}/bin/gnome-system-monitor";
desktop = "gnome-system-monitor";
};
archive = {
cmd = "${pkgs.gnome3.file-roller}/bin/file-roller";
desktop = "org.gnome.FileRoller";
};
};
home-manager.users.balsoft = {
home.activation.gnome = ''
$DRY_RUN_CMD mkdir -p "$XDG_DATA_HOME/keyrings"

View File

@ -90,15 +90,7 @@ in {
}
];
};
startup = [
{ command = apps.browser.cmd; }
{ command = apps.mail.cmd; }
# {
# command =
# "${pkgs.mate.mate-polkit}/libexec/polkit-mate-authentication-agent-1";
# }
{ command = "${pkgs.nheko}/bin/nheko"; }
startup = (map (command: { inherit command; }) config.startupApplications) ++ [
{ command = toString (pkgs.writeShellScript "slack" ''
firefox https://serokell.slack.com &
sleep 10

View File

@ -2,6 +2,7 @@
imports = with inputs.self.nixosModules; [
inputs.home-manager.nixosModules.home-manager
applications
boot
secrets
secrets-envsubst

View File

@ -2,7 +2,7 @@
imports = with inputs.self.nixosModules; [
./base.nix
applications
applications-setup
ezwg
hardware
themes