make home configs work
This commit is contained in:
parent
f0c21b2e79
commit
30f81b2b79
29 changed files with 2131 additions and 2033 deletions
104
defaults/machine-config.nix
Normal file
104
defaults/machine-config.nix
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
flakes,
|
||||
machine,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./machine-or-home-config.nix
|
||||
./xdg.nix
|
||||
];
|
||||
|
||||
system.stateVersion = machine.stateVersion;
|
||||
services.resolved.enable = false;
|
||||
|
||||
xdg.mime.enable = lib.mkForce false;
|
||||
|
||||
# Enable SSH
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
PasswordAuthentication = lib.mkDefault false;
|
||||
PermitRootLogin = lib.mkDefault "no";
|
||||
};
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [ 22 ];
|
||||
|
||||
# Disable sudo prompt for `wheel` users.
|
||||
security.sudo.wheelNeedsPassword = lib.mkDefault false;
|
||||
|
||||
# Configure the root account
|
||||
users.extraUsers.root = {
|
||||
# Allow my SSH keys for logging in as root. TODO: find from users list
|
||||
# openssh.authorizedKeys.keys = ;
|
||||
|
||||
# Also use zsh for root
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
programs.zsh.enable = true;
|
||||
programs.fish.enable = true;
|
||||
|
||||
services.qemuGuest.enable = true;
|
||||
|
||||
# Clean /tmp on boot.
|
||||
boot.tmp.cleanOnBoot = true;
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = lib.mkDefault "Europe/Amsterdam";
|
||||
|
||||
systemd.oomd = {
|
||||
enableRootSlice = true;
|
||||
# enableUserServices = true;
|
||||
enableUserSlices = true;
|
||||
};
|
||||
|
||||
# Limit the systemd journal to 100 MB of disk or the
|
||||
# last 7 days of logs, whichever happens first.
|
||||
services.journald.extraConfig = ''
|
||||
SystemMaxUse=100M
|
||||
MaxFileSec=7day
|
||||
'';
|
||||
|
||||
nix = {
|
||||
package = pkgs.lix;
|
||||
settings = {
|
||||
auto-optimise-store = true;
|
||||
};
|
||||
optimise = {
|
||||
automatic = true;
|
||||
dates = [ "weekly" ];
|
||||
};
|
||||
gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
randomizedDelaySec = "3h";
|
||||
options = "--delete-older-than 7d";
|
||||
};
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
};
|
||||
|
||||
# Debloat
|
||||
documentation = {
|
||||
enable = lib.mkForce false;
|
||||
doc.enable = lib.mkForce false;
|
||||
man.enable = lib.mkForce false;
|
||||
info.enable = lib.mkForce false;
|
||||
nixos.enable = lib.mkForce false;
|
||||
};
|
||||
|
||||
security.polkit.enable = true;
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
|
||||
extraSpecialArgs = {
|
||||
inherit flakes;
|
||||
};
|
||||
};
|
||||
}
|
||||
9
defaults/machine-or-home-config.nix
Normal file
9
defaults/machine-or-home-config.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
(../modules/program.nix)
|
||||
(../programs)
|
||||
(../users)
|
||||
];
|
||||
|
||||
}
|
||||
156
defaults/xdg.nix
Normal file
156
defaults/xdg.nix
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
{ ... }@inputs:
|
||||
let
|
||||
browsers = [
|
||||
"firefox.desktop"
|
||||
];
|
||||
|
||||
defaultApps = {
|
||||
text = [
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanvim.desktop"
|
||||
];
|
||||
image = [ "org.gnome.Loupe.desktop" ];
|
||||
audio = [ "mpv.desktop" ];
|
||||
video = [ "mpv.desktop" ];
|
||||
directory = [
|
||||
"nautilus.desktop"
|
||||
"org.gnome.Nautilus.desktop"
|
||||
];
|
||||
mail = [ ] ++ browsers;
|
||||
calendar = [ ] ++ browsers;
|
||||
browser = [ ] ++ browsers;
|
||||
office = [ "libreoffice.desktop" ];
|
||||
pdf = [ ] ++ browsers;
|
||||
ebook = [ ];
|
||||
magnet = [ ];
|
||||
signal = [ "signal.desktop" ];
|
||||
};
|
||||
|
||||
mimeMap = {
|
||||
text = [
|
||||
"text/plain"
|
||||
"text/english"
|
||||
"application/x-zerosize"
|
||||
"text/x-makefile"
|
||||
"text/x-c++hdr"
|
||||
"text/x-c++src"
|
||||
"text/x-chdr"
|
||||
"text/x-csrc"
|
||||
"text/x-java"
|
||||
"text/x-moc"
|
||||
"text/x-pascal"
|
||||
"text/x-tcl"
|
||||
"text/x-tex"
|
||||
"application/x-shellscript"
|
||||
"text/x-c"
|
||||
"text/x-c++"
|
||||
];
|
||||
image = [
|
||||
"image/bmp"
|
||||
"image/gif"
|
||||
"image/jpeg"
|
||||
"image/jpg"
|
||||
"image/png"
|
||||
"image/svg+xml"
|
||||
"image/tiff"
|
||||
"image/vnd.microsoft.icon"
|
||||
"image/webp"
|
||||
];
|
||||
audio = [
|
||||
"audio/aac"
|
||||
"audio/mpeg"
|
||||
"audio/ogg"
|
||||
"audio/opus"
|
||||
"audio/wav"
|
||||
"audio/webm"
|
||||
"audio/x-matroska"
|
||||
];
|
||||
video = [
|
||||
"video/mp2t"
|
||||
"video/mp4"
|
||||
"video/mpeg"
|
||||
"video/ogg"
|
||||
"video/webm"
|
||||
"video/x-flv"
|
||||
"video/x-matroska"
|
||||
"video/x-msvideo"
|
||||
];
|
||||
directory = [ "inode/directory" ];
|
||||
mail = [ "x-scheme-handler/mailto" ];
|
||||
calendar = [
|
||||
"text/calendar"
|
||||
"x-scheme-handler/webcal"
|
||||
];
|
||||
browser = [
|
||||
"text/html"
|
||||
"x-scheme-handler/about"
|
||||
"x-scheme-handler/http"
|
||||
"x-scheme-handler/https"
|
||||
"x-scheme-handler/unknown"
|
||||
];
|
||||
office = [
|
||||
"application/vnd.oasis.opendocument.text"
|
||||
"application/vnd.oasis.opendocument.spreadsheet"
|
||||
"application/vnd.oasis.opendocument.presentation"
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
|
||||
"application/msword"
|
||||
"application/vnd.ms-excel"
|
||||
"application/vnd.ms-powerpoint"
|
||||
"application/rtf"
|
||||
];
|
||||
pdf = [ "application/pdf" ];
|
||||
ebook = [ "application/epub+zip" ];
|
||||
magnet = [ "x-scheme-handler/magnet" ];
|
||||
signal = [ "signal.desktop" ];
|
||||
};
|
||||
|
||||
associations =
|
||||
with inputs.lib;
|
||||
with builtins;
|
||||
listToAttrs (
|
||||
flatten (mapAttrsToList (key: map (type: attrsets.nameValuePair type defaultApps."${key}")) mimeMap)
|
||||
);
|
||||
removedAssociations = {
|
||||
"text/plain" = "dev.zed.Zed.desktop";
|
||||
"application/x-zerosize" = "dev.zed.Zed.desktop";
|
||||
};
|
||||
in
|
||||
{
|
||||
custom.program.homedirs = {
|
||||
home-config =
|
||||
{ config, ... }:
|
||||
{
|
||||
xdg = {
|
||||
enable = true;
|
||||
mime.enable = true;
|
||||
configHome = "${config.home.homeDirectory}/.config";
|
||||
userDirs = {
|
||||
enable = true;
|
||||
documents = "${config.home.homeDirectory}/Documents";
|
||||
desktop = "${config.home.homeDirectory}/Documents";
|
||||
download = "${config.home.homeDirectory}/Downloads";
|
||||
music = "${config.home.homeDirectory}/Documents/personal/music";
|
||||
pictures = "${config.home.homeDirectory}/Documents/personal/pictures";
|
||||
};
|
||||
configFile."mimeapps.list".force = true;
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
associations.added = associations;
|
||||
associations.removed = removedAssociations;
|
||||
defaultApplications = associations;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
xdg = {
|
||||
mime = {
|
||||
enable = true;
|
||||
defaultApplications = associations;
|
||||
addedAssociations = associations;
|
||||
inherit removedAssociations;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue