home: use proper modules

This commit is contained in:
Max Headroom 2022-02-15 23:18:57 +01:00
parent 283ba0515e
commit d25971bc1c
7 changed files with 138 additions and 118 deletions

View file

@ -12,20 +12,59 @@ let
meta = if args ? meta then args.meta else import ./userinfo.nix pkgs;
isNixos = args ? isNixos;
optionalDesktopModule = lib.optional (systemProfile == "desktop") {
# other files
home.file.templates-directory = import ./home/templates.nix meta;
home.file.steam-skins = {
source = inputs.self.packages.x86_64-linux.steam-metro-skin;
target = ".local/share/Steam/skins/metro-for-steam";
recursive = true;
};
home.file.sound-theme = let
bell = "${pkgs.gnome.gnome-control-center}/share/sounds/gnome/default/alerts/sonar.ogg";
themeFile = pkgs.writeText "index.theme" (lib.generators.toINI {} {
"Sound Theme" = {
Name = "Custom";
Inherits = "freedesktop";
Directories = ".";
};
});
in {
source = pkgs.linkFarm "sound-theme" [
{ name = "bell-terminal.ogg"; path = bell; }
{ name = "bell-window-system.ogg"; path = bell; }
{ name = "index.theme"; path = themeFile; }
];
target = ".local/share/sounds/__custom";
recursive = true;
};
# chromium extensions
programs.chromium = import ./home/chromium.nix pkgs.ungoogled-chromium inputs.nix-crx.packages.x86_64-linux;
gtk.enable = true;
gtk.theme.name = "Adwaita-dark";
dconf.settings = import ./home/dconf { inherit meta config; };
};
in
lib.recursiveUpdate
{
manual.json.enable = false;
manual.html.enable = false;
manual.manpages.enable = false;
_module.args = { inherit meta inputs; };
# general program config
programs.bat = import ./home/bat.nix meta;
programs.fzf = import ./home/fzf.nix meta;
programs.lsd = import ./home/lsd.nix meta;
programs.git = import ./home/git.nix { inherit lib meta pkgs; };
programs.htop = import ./home/htop.nix meta;
programs.ssh = import ./home/ssh.nix meta;
imports = [
./home/bat.nix
./home/fzf.nix
./home/lsd.nix
./home/git.nix
./home/htop.nix
./home/ssh.nix
] ++ optionalDesktopModule;
# direnv
programs.direnv.enable = true;
@ -36,37 +75,4 @@ lib.recursiveUpdate
home.packages = with pkgs; [ neovim-remote ];
} (lib.optionalAttrs (systemProfile == "desktop") {
# other files
home.file.templates-directory = import ./home/templates.nix meta;
home.file.steam-skins = {
source = inputs.self.packages.x86_64-linux.steam-metro-skin;
target = ".local/share/Steam/skins/metro-for-steam";
recursive = true;
};
home.file.sound-theme = let
bell = "${pkgs.gnome.gnome-control-center}/share/sounds/gnome/default/alerts/sonar.ogg";
themeFile = pkgs.writeText "index.theme" (lib.generators.toINI {} {
"Sound Theme" = {
Name = "Custom";
Inherits = "freedesktop";
Directories = ".";
};
});
in {
source = pkgs.linkFarm "sound-theme" [
{ name = "bell-terminal.ogg"; path = bell; }
{ name = "bell-window-system.ogg"; path = bell; }
{ name = "index.theme"; path = themeFile; }
];
target = ".local/share/sounds/__custom";
recursive = true;
};
# chromium extensions
programs.chromium = import ./home/chromium.nix pkgs.ungoogled-chromium inputs.nix-crx.packages.x86_64-linux;
gtk.enable = true;
gtk.theme.name = "Adwaita-dark";
dconf.settings = import ./home/dconf { inherit meta config; };
})
}

View file

@ -1,7 +1,9 @@
meta: {
enable = true;
config = {
paging = "never";
theme = "DarkNeon";
{
programs.bat = {
enable = true;
config = {
paging = "never";
theme = "DarkNeon";
};
};
}

View file

@ -1,4 +1,6 @@
meta: {
enable = true;
enableZshIntegration = true;
{
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
}

View file

@ -1,27 +1,31 @@
{ lib, meta, pkgs }: {
enable = true;
{ lib, meta, pkgs, ... }:
userName = meta.firstName;
userEmail = meta.email;
{
programs.git = {
enable = true;
aliases = rec {
ac = "!git add . && git commit";
dump = "!cd ~/Projects/dump && git clone --depth=1";
grab = "clone --depth=1";
graph = "log --all --decorate --graph --oneline";
gud = ac;
honk = "push";
next = "!git add --all && git commit -am next";
nuke = "!git reset --hard HEAD && git clean -d -f";
patchwork = "!git init && git add . && git commit -m pre";
strip = "!rm -rf .git/ && echo Stripped repository information";
unfuck = "reset --hard";
what = "diff HEAD";
where = "diff --name-status HEAD";
};
userName = meta.firstName;
userEmail = meta.email;
extraConfig = {
init.defaultBranch = "master";
pull.rebase = true;
aliases = rec {
ac = "!git add . && git commit";
dump = "!cd ~/Projects/dump && git clone --depth=1";
grab = "clone --depth=1";
graph = "log --all --decorate --graph --oneline";
gud = ac;
honk = "push";
next = "!git add --all && git commit -am next";
nuke = "!git reset --hard HEAD && git clean -d -f";
patchwork = "!git init && git add . && git commit -m pre";
strip = "!rm -rf .git/ && echo Stripped repository information";
unfuck = "reset --hard";
what = "diff HEAD";
where = "diff --name-status HEAD";
};
extraConfig = {
init.defaultBranch = "master";
pull.rebase = true;
};
};
}

View file

@ -1,14 +1,16 @@
meta: {
enable = true;
settings = {
detailed_cpu_time = true;
hide_userland_threads = true;
highlight_base_name = true;
show_cpu_frequency = true;
show_program_path = false;
column_meters_0 = [ "LeftCPUs" "Memory" "Swap" ];
column_meters_1 = [ "RightCPUs" "Tasks" "LoadAverage" "Uptime" ];
column_meter_modes_0 = [ 0 0 0 ];
column_meter_modes_1 = [ 0 0 0 0 ];
{
programs.htop = {
enable = true;
settings = {
detailed_cpu_time = true;
hide_userland_threads = true;
highlight_base_name = true;
show_cpu_frequency = true;
show_program_path = false;
column_meters_0 = [ "LeftCPUs" "Memory" "Swap" ];
column_meters_1 = [ "RightCPUs" "Tasks" "LoadAverage" "Uptime" ];
column_meter_modes_0 = [ 0 0 0 ];
column_meter_modes_1 = [ 0 0 0 0 ];
};
};
}

View file

@ -1,5 +1,7 @@
meta: {
enable = true;
enableAliases = true;
settings = { date = "relative"; };
{
programs.lsd = {
enable = true;
enableAliases = true;
settings = { date = "relative"; };
};
}

View file

@ -1,4 +1,4 @@
meta:
{ meta, ... }:
let
gitHost = {
user = "git";
@ -23,37 +23,39 @@ let
};
equip = host: cfgSet: cfgSet // { inherit host; };
in {
enable = true;
controlMaster = "auto";
controlPersist = "15m";
controlPath = "~/.ssh/muxctl:%h:%p:%r";
programs.ssh = {
enable = true;
controlMaster = "auto";
controlPersist = "15m";
controlPath = "~/.ssh/muxctl:%h:%p:%r";
forwardAgent = true;
serverAliveInterval = 60;
forwardAgent = true;
serverAliveInterval = 60;
extraOptionOverrides = {
ExitOnForwardFailure = "yes";
TCPKeepAlive = "no";
GSSAPIAuthentication = "yes";
GSSAPIDelegateCredentials = "yes";
VerifyHostKeyDNS = "yes";
PKCS11Provider = builtins.elemAt meta.security.pkcs11Providers 0;
CanonicalDomains = builtins.concatStringsSep " "
((map (sub: "${sub}.${meta.orgDomain}") [
"backbone"
"services"
"int"
"core"
"node"
"search"
]) ++ [ meta.orgDomain ]);
CanonicalizeHostname = "always";
CanonicalizeMaxDots = "0";
extraOptionOverrides = {
ExitOnForwardFailure = "yes";
TCPKeepAlive = "no";
GSSAPIAuthentication = "yes";
GSSAPIDelegateCredentials = "yes";
VerifyHostKeyDNS = "yes";
PKCS11Provider = builtins.elemAt meta.security.pkcs11Providers 0;
CanonicalDomains = builtins.concatStringsSep " "
((map (sub: "${sub}.${meta.orgDomain}") [
"backbone"
"services"
"int"
"core"
"node"
"search"
]) ++ [ meta.orgDomain ]);
CanonicalizeHostname = "always";
CanonicalizeMaxDots = "0";
};
matchBlocks.github = equip "github.com" gitHost;
matchBlocks.gnomeGitlab = equip "gitlab.gnome.org" gitHost;
matchBlocks.pveGitlab = equip "git.${meta.orgDomain}" gitHost // { user = "gitlab"; };
matchBlocks.labHost = equip "*.lab" labHost;
matchBlocks.mdnsLocal = equip "*.local" features.noFancyDNS;
};
matchBlocks.github = equip "github.com" gitHost;
matchBlocks.gnomeGitlab = equip "gitlab.gnome.org" gitHost;
matchBlocks.pveGitlab = equip "git.${meta.orgDomain}" gitHost // { user = "gitlab"; };
matchBlocks.labHost = equip "*.lab" labHost;
matchBlocks.mdnsLocal = equip "*.local" features.noFancyDNS;
}