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; meta = if args ? meta then args.meta else import ./userinfo.nix pkgs;
isNixos = args ? isNixos; 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 in
lib.recursiveUpdate
{ {
manual.json.enable = false; manual.json.enable = false;
manual.html.enable = false; manual.html.enable = false;
manual.manpages.enable = false; manual.manpages.enable = false;
_module.args = { inherit meta inputs; };
# general program config # general program config
programs.bat = import ./home/bat.nix meta; imports = [
programs.fzf = import ./home/fzf.nix meta; ./home/bat.nix
programs.lsd = import ./home/lsd.nix meta; ./home/fzf.nix
programs.git = import ./home/git.nix { inherit lib meta pkgs; }; ./home/lsd.nix
programs.htop = import ./home/htop.nix meta; ./home/git.nix
programs.ssh = import ./home/ssh.nix meta; ./home/htop.nix
./home/ssh.nix
] ++ optionalDesktopModule;
# direnv # direnv
programs.direnv.enable = true; programs.direnv.enable = true;
@ -36,37 +75,4 @@ lib.recursiveUpdate
home.packages = with pkgs; [ neovim-remote ]; 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; programs.bat = {
config = { enable = true;
paging = "never"; config = {
theme = "DarkNeon"; paging = "never";
theme = "DarkNeon";
};
}; };
} }

View file

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

View file

@ -1,27 +1,31 @@
{ lib, meta, pkgs }: { { lib, meta, pkgs, ... }:
enable = true;
userName = meta.firstName; {
userEmail = meta.email; programs.git = {
enable = true;
aliases = rec { userName = meta.firstName;
ac = "!git add . && git commit"; userEmail = meta.email;
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 = { aliases = rec {
init.defaultBranch = "master"; ac = "!git add . && git commit";
pull.rebase = true; 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; programs.htop = {
settings = { enable = true;
detailed_cpu_time = true; settings = {
hide_userland_threads = true; detailed_cpu_time = true;
highlight_base_name = true; hide_userland_threads = true;
show_cpu_frequency = true; highlight_base_name = true;
show_program_path = false; show_cpu_frequency = true;
column_meters_0 = [ "LeftCPUs" "Memory" "Swap" ]; show_program_path = false;
column_meters_1 = [ "RightCPUs" "Tasks" "LoadAverage" "Uptime" ]; column_meters_0 = [ "LeftCPUs" "Memory" "Swap" ];
column_meter_modes_0 = [ 0 0 0 ]; column_meters_1 = [ "RightCPUs" "Tasks" "LoadAverage" "Uptime" ];
column_meter_modes_1 = [ 0 0 0 0 ]; column_meter_modes_0 = [ 0 0 0 ];
column_meter_modes_1 = [ 0 0 0 0 ];
};
}; };
} }

View file

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

View file

@ -1,4 +1,4 @@
meta: { meta, ... }:
let let
gitHost = { gitHost = {
user = "git"; user = "git";
@ -23,37 +23,39 @@ let
}; };
equip = host: cfgSet: cfgSet // { inherit host; }; equip = host: cfgSet: cfgSet // { inherit host; };
in { in {
enable = true; programs.ssh = {
controlMaster = "auto"; enable = true;
controlPersist = "15m"; controlMaster = "auto";
controlPath = "~/.ssh/muxctl:%h:%p:%r"; controlPersist = "15m";
controlPath = "~/.ssh/muxctl:%h:%p:%r";
forwardAgent = true; forwardAgent = true;
serverAliveInterval = 60; serverAliveInterval = 60;
extraOptionOverrides = { extraOptionOverrides = {
ExitOnForwardFailure = "yes"; ExitOnForwardFailure = "yes";
TCPKeepAlive = "no"; TCPKeepAlive = "no";
GSSAPIAuthentication = "yes"; GSSAPIAuthentication = "yes";
GSSAPIDelegateCredentials = "yes"; GSSAPIDelegateCredentials = "yes";
VerifyHostKeyDNS = "yes"; VerifyHostKeyDNS = "yes";
PKCS11Provider = builtins.elemAt meta.security.pkcs11Providers 0; PKCS11Provider = builtins.elemAt meta.security.pkcs11Providers 0;
CanonicalDomains = builtins.concatStringsSep " " CanonicalDomains = builtins.concatStringsSep " "
((map (sub: "${sub}.${meta.orgDomain}") [ ((map (sub: "${sub}.${meta.orgDomain}") [
"backbone" "backbone"
"services" "services"
"int" "int"
"core" "core"
"node" "node"
"search" "search"
]) ++ [ meta.orgDomain ]); ]) ++ [ meta.orgDomain ]);
CanonicalizeHostname = "always"; CanonicalizeHostname = "always";
CanonicalizeMaxDots = "0"; 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;
} }