Clean up common user modules

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-06-21 00:08:02 +03:00
parent 09b42521e4
commit ce37f320c2
24 changed files with 476 additions and 490 deletions

View File

@@ -4,7 +4,6 @@
imports = [
./configs/persist
./configs/sops
./configs/pipewire
./configs/zsh
./configs/neovim

View File

@@ -1,97 +0,0 @@
{ config, lib, pkgs, ... }:
{
home-manager = {
sharedModules = [{
programs.firefox = {
enable = true;
policies = {
DisableTelemetry = true;
DisableFirefoxStudies = true;
DontCheckDefaultBrowser = true;
DisablePocket = true;
DefaultDownloadDirectory = "\${HOME}/Downloads";
OfferToSaveLogins = false;
AutofillAddressEnabled = false;
AutofillCreditCardEnabled = false;
Preferences = {
"browser.aboutConfig.showWarning" = false;
"browser.contentblocking.category" = "strict";
"browser.download.useDownloadDir" = false;
"browser.newtabpage.activity-stream.feeds.section.topstories" = false;
"browser.newtabpage.activity-stream.showSponsored" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
"browser.toolbars.bookmarks.visibility" = true;
"browser.sessionstore.restore_on_demand" = true;
"browser.sessionstore.restore_pinned_tabs_on_demand" = false;
"browser.translations.automaticallyPopup" = false;
};
};
profiles.nick = {
search = {
default = "DuckDuckGo";
privateDefault = "DuckDuckGo";
order = [
"DuckDuckGo"
"Google"
"Wikipedia (en)"
"Nix Packages"
"Nix Options"
"Home Manager Options"
];
force = true;
engines = {
"Google".metaData.alias = "@g";
"DuckDuckGo".metaData.alias = "@d";
"Wikipedia (en)".metaData.alias = "@w";
"Nix Packages" = {
urls = [{
template = "https://search.nixos.org/packages";
params = [
{ name = "type"; value = "packages"; }
{ name = "query"; value = "{searchTerms}"; }
];
}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@np" ];
};
"Nix Options" = {
urls = [{
template = "https://search.nixos.org/options";
params = [
{ name = "type"; value = "options"; }
{ name = "query"; value = "{searchTerms}"; }
];
}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@no" ];
};
"Home Manager Options" = {
urls = [{
template = "https://home-manager-options.extranix.com/";
params = [
{ name = "query"; value = "{searchTerms}"; }
];
}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@nh" ];
};
};
};
};
};
}];
users = lib.attrsets.mapAttrs (user: config: ({
home.persistence."/persist${config.home}".directories = [ ".mozilla" ];
})) (lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users);
};
}

View File

@@ -1,34 +0,0 @@
{ config, lib, pkgs, ... }:
{
home-manager = {
sharedModules = [{
programs.git = {
enable = true;
lfs.enable = true;
signing = {
signByDefault = true;
key = null;
};
extraConfig.credential.helper = "store";
hooks = let
commit-msg-hook = pkgs.writeShellScriptBin "git-commit-msg" ''
git interpret-trailers --if-exists doNothing --trailer \
"Signed-off-by: $(git config user.name) <$(git config user.email)>" \
--in-place "$1"
'';
in
{
commit-msg = "${commit-msg-hook}/bin/git-commit-msg";
};
};
}];
users = lib.attrsets.mapAttrs (user: config: ({
programs.git = {
userName = config.fullName;
userEmail = config.email;
};
})) (lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users);
};
}

View File

@@ -1,132 +0,0 @@
{ config, lib, pkgs, ... }:
{
programs.hyprland.enable = true;
environment.sessionVariables.NIXOS_OZONE_WL = "1";
home-manager = {
sharedModules = [{
wayland.windowManager.hyprland = {
enable = true;
settings = {
"$mod" = "SUPER";
"$term" = "kitty";
bind = [
"$mod, Return, exec, $term"
"$mod, r, exec, rofi -show drun"
"$mod, b, exec, firefox"
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod, 0, workspace, 10"
"$mod_SHIFT, 1, movetoworkspacesilent, 1"
"$mod_SHIFT, 2, movetoworkspacesilent, 2"
"$mod_SHIFT, 3, movetoworkspacesilent, 3"
"$mod_SHIFT, 4, movetoworkspacesilent, 4"
"$mod_SHIFT, 5, movetoworkspacesilent, 5"
"$mod_SHIFT, 6, movetoworkspacesilent, 6"
"$mod_SHIFT, 7, movetoworkspacesilent, 7"
"$mod_SHIFT, 8, movetoworkspacesilent, 8"
"$mod_SHIFT, 9, movetoworkspacesilent, 9"
"$mod_SHIFT, 0, movetoworkspacesilent, 10"
"$mod_CTRL, Space, workspaceopt, allfloat"
"$mod, left, movefocus, l"
"$mod, h, movefocus, l"
"$mod, down, movefocus, d"
"$mod, j, movefocus, d"
"$mod, up, movefocus, u"
"$mod, k, movefocus, u"
"$mod, right, movefocus, r"
"$mod, l, movefocus, r"
"$mod_SHIFT, left, movewindow, l"
"$mod_SHIFT, h, movewindow, l"
"$mod_SHIFT, down, movewindow, d"
"$mod_SHIFT, j, movewindow, d"
"$mod_SHIFT, up, movewindow, u"
"$mod_SHIFT, k, movewindow, u"
"$mod_SHIFT, right, movewindow, r"
"$mod_SHIFT, l, movewindow, r"
"$mod_CTRL, left, resizeactive, -20 0"
"$mod_CTRL, h, resizeactive, -20 0"
"$mod_CTRL, down, resizeactive, 0 20"
"$mod_CTRL, j, resizeactive, 0 20"
"$mod_CTRL, up, resizeactive, 0 -20"
"$mod_CTRL, k, resizeactive, 0 -20"
"$mod_CTRL, right, resizeactive, 20 0"
"$mod_CTRL, l, resizeactive, 20 0"
"$mod, Tab, cyclenext"
"$mod, Tab, bringactivetotop"
"$mod_SHIFT, Tab, cyclenext, prev"
"$mod_SHIFT, Tab, bringactivetotop"
"$mod, f, fullscreen, 0"
"$mod, p, pin"
"$mod, Space, togglefloating"
"$mod, Space, centerwindow"
"$mod, q, killactive"
"CTRL_ALT, Delete, exit"
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
input = {
"accel_profile" = "flat";
};
misc = {
"disable_hyprland_logo" = true;
"disable_splash_rendering" = true;
};
};
};
programs.zsh.loginExtra = lib.mkAfter ''
if [ -z "''${WAYLAND_DISPLAY}" ] && [ ! -z "''${XDG_VTNR}" ] && [ "''${XDG_VTNR}" -eq 1 ]; then
${pkgs.hyprland}/bin/hyprland &> /tmp/hyprland.log
fi
'';
home.packages = with pkgs; [
swww
rofi-wayland
pavucontrol
];
}];
users = lib.attrsets.mapAttrs (user: config: (
let
init = pkgs.writeShellScriptBin "hyprland-init" ''
${pkgs.swww}/bin/swww-daemon &> /tmp/swww.log &
while ! ${pkgs.swww}/bin/swww query &> /dev/null; do
sleep 0.1
done
${pkgs.swww}/bin/swww img ${config.wallpaper}
'';
in
{
wayland.windowManager.hyprland.settings.exec-once = "${init}/bin/hyprland-init";
}
)) (lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users);
};
}

View File

@@ -1,28 +1,30 @@
{ config, inputs, lib, ... }:
{
programs.fuse.userAllowOther = true;
let
users = lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users;
in {
programs.fuse.userAllowOther = lib.mkIf (users != [ ]) true;
systemd.tmpfiles.rules = [ "d /persist/home 0755 root root -" ] ++
lib.attrsets.mapAttrsToList (user: config: "d /persist${config.home} 0700 ${user} users -")
(lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users);
systemd.tmpfiles.rules = lib.mkIf (users != [ ]) (
[ "d /persist/home 0755 root root -" ] ++
lib.attrsets.mapAttrsToList (user: config: "d /persist${config.home} 0700 ${user} users -") users
);
home-manager = {
sharedModules = [{ imports = [ inputs.impermanence.nixosModules.home-manager.impermanence ]; }];
users = lib.attrsets.mapAttrs (user: config: ({
home.persistence."/persist${config.home}" = {
allowOther = true;
directories = [
"Documents"
"Downloads"
"Music"
"Pictures"
"Videos"
"Templates"
"VMs"
"git"
];
};
})) (lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users);
};
home-manager.users = lib.attrsets.mapAttrs (user: config: ({
imports = [ inputs.impermanence.nixosModules.home-manager.impermanence ];
home.persistence."/persist${config.home}" = {
allowOther = true;
directories = [
"Documents"
"Downloads"
"Music"
"Pictures"
"Videos"
"Templates"
"VMs"
"git"
];
};
})) users;
}

View File

@@ -1,17 +1,17 @@
{ config, inputs, lib, ... }:
let
users = lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users;
sopsKeyPath = ".config/sops-nix/key.txt";
in
{
environment.sessionVariables.SOPS_AGE_KEY_FILE = "$HOME/${sopsKeyPath}";
in {
home-manager.users = lib.attrsets.mapAttrs (user: config: ({
imports = [ inputs.sops-nix.homeManagerModules.sops ];
home-manager = {
sharedModules = [{ imports = [ inputs.sops-nix.homeManagerModules.sops ]; }];
sops.age.keyFile = "/persist${config.home}/${sopsKeyPath}";
users = lib.attrsets.mapAttrs (user: config: ({
home.persistence."/persist${config.home}".files = [ sopsKeyPath ];
sops.age.keyFile = "/persist${config.home}/${sopsKeyPath}";
})) (lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users);
};
home = {
persistence."/persist${config.home}".files = [ sopsKeyPath ];
sessionVariables.SOPS_AGE_KEY_FILE = "${config.home}/${sopsKeyPath}";
};
})) users;
}

View File

@@ -1,17 +0,0 @@
{ config, inputs, lib, ... }:
{
home-manager = {
sharedModules = [{
imports = [ inputs.stylix.homeManagerModules.stylix ];
stylix.enable = true;
}];
users = lib.attrsets.mapAttrs (user: config: ({
stylix = {
image = config.wallpaper;
base16Scheme = config.base16Scheme;
};
})) (lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users);
};
}

View File

@@ -1,68 +0,0 @@
{ config, lib, pkgs, ... }:
{
imports = [
./langs/nix.nix
];
home-manager = {
sharedModules = [{
programs.vscode = {
enable = true;
mutableExtensionsDir = false;
userSettings = {
"editor.accessibilitySupport" = "off";
"editor.cursorBlinking" = "phase";
"editor.cursorSmoothCaretAnimation" = "on";
"editor.formatOnPaste" = true;
"editor.formatOnSave" = true;
"editor.formatOnType" = true;
"editor.indentSize" = "tabSize";
"editor.inlineSuggest.enabled" = true;
"editor.largeFileOptimizations" = false;
"editor.linkedEditing" = true;
"editor.renderFinalNewline" = "on";
"editor.smoothScrolling" = true;
"editor.stickyScroll.enabled" = true;
"editor.suggestSelection" = "first";
"editor.unicodeHighlight.includeComments" = true;
"editor.unicodeHighlight.nonBasicASCII" = true;
"explorer.confirmDelete" = false;
"explorer.confirmDragAndDrop" = false;
"explorer.confirmPasteNative" = false;
"files.autoSave" = "afterDelay";
"files.eol" = "\n";
"files.insertFinalNewline" = true;
"files.trimFinalNewlines" = true;
"files.trimTrailingWhitespace" = true;
"git.allowForcePush" = true;
"git.alwaysSignOff" = true;
"git.autofetch" = "all";
"git.closeDiffOnOperation" = true;
"git.confirmForcePush" = false;
"git.confirmSync" = false;
"git.enableCommitSigning" = true;
"git.enableSmartCommit" = true;
"git.ignoreRebaseWarning" = true;
"git.openRepositoryInParentFolders" = "always";
"git.path" = "${pkgs.git}/bin/git";
"mergeEditor.diffAlgorithm" = "advanced";
"open-in-browser.default" = "firefox";
"security.workspace.trust.enabled" = false;
"telemetry.telemetryLevel" = "off";
"terminal.external.linuxExec" = "kitty";
"terminal.integrated.confirmOnExit" = "hasChildProcesses";
"terminal.integrated.copyOnSelection" = true;
"window.autoDetectHighContrast" = false;
"window.menuBarVisibility" = "toggle";
"workbench.editor.historyBasedLanguageDetection" = true;
"workbench.list.smoothScrolling" = true;
};
};
}];
users = lib.attrsets.mapAttrs (user: config: ({
home.persistence."/persist${config.home}".directories = [ ".config/Code" ];
})) (lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users);
};
}

View File

@@ -1,23 +0,0 @@
{ pkgs, ... }:
{
home-manager = {
sharedModules = [{
programs.vscode = {
userSettings = {
"nix.enableLanguageServer" = true;
"nix.formatterPath" = "nixpkgs-fmt";
"nix.serverSettings" = {};
};
extensions = with pkgs; with vscode-extensions; [
jnoortheen.nix-ide
];
};
home.packages = with pkgs; [
nil
nixpkgs-fmt
];
}];
};
}

View File

@@ -1,23 +0,0 @@
{ config, lib, ... }:
{
home-manager = {
sharedModules = [{
programs.zsh = {
enable = true;
autocd = true;
history = {
path = "$HOME/.local/share/zsh/history";
expireDuplicatesFirst = true;
};
historySubstringSearch.enable = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
};
}];
users = lib.attrsets.mapAttrs (user: config: ({
home.persistence."/persist${config.home}".directories = [ ".local/share/zsh" ];
})) (lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users);
};
}

View File

@@ -3,20 +3,9 @@
{
imports = [
inputs.home-manager.nixosModules.default
./extra.nix
./options.nix
./configs/persist
./configs/sops
./configs/firefox
./configs/git
./configs/gpg-agent
./configs/hyprland
./configs/kitty
./configs/neovim
./configs/stylix
./configs/zsh
./configs/vscode
];
home-manager = {

View File

@@ -22,8 +22,7 @@ let
description = "Base16 scheme to use for the user's color palette.";
};
};
in
{
in {
options = with lib; with types; {
users.users = mkOption {
type = attrsOf (submodule userOptions);

View File

@@ -0,0 +1,93 @@
{ user ? throw "user argument is required" }: { pkgs, ... }:
{
home-manager.users."${user.name}" = {
programs.firefox = {
enable = true;
policies = {
DisableTelemetry = true;
DisableFirefoxStudies = true;
DontCheckDefaultBrowser = true;
DisablePocket = true;
DefaultDownloadDirectory = "\${HOME}/Downloads";
OfferToSaveLogins = false;
AutofillAddressEnabled = false;
AutofillCreditCardEnabled = false;
Preferences = {
"browser.aboutConfig.showWarning" = false;
"browser.contentblocking.category" = "strict";
"browser.download.useDownloadDir" = false;
"browser.newtabpage.activity-stream.feeds.section.topstories" = false;
"browser.newtabpage.activity-stream.showSponsored" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
"browser.toolbars.bookmarks.visibility" = true;
"browser.sessionstore.restore_on_demand" = true;
"browser.sessionstore.restore_pinned_tabs_on_demand" = false;
"browser.translations.automaticallyPopup" = false;
};
};
profiles.default = {
search = {
default = "DuckDuckGo";
privateDefault = "DuckDuckGo";
order = [
"DuckDuckGo"
"Google"
"Wikipedia (en)"
"Nix Packages"
"Nix Options"
"Home Manager Options"
];
force = true;
engines = {
"Google".metaData.alias = "@g";
"DuckDuckGo".metaData.alias = "@d";
"Wikipedia (en)".metaData.alias = "@w";
"Nix Packages" = {
urls = [{
template = "https://search.nixos.org/packages";
params = [
{ name = "type"; value = "packages"; }
{ name = "query"; value = "{searchTerms}"; }
];
}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@np" ];
};
"Nix Options" = {
urls = [{
template = "https://search.nixos.org/options";
params = [
{ name = "type"; value = "options"; }
{ name = "query"; value = "{searchTerms}"; }
];
}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@no" ];
};
"Home Manager Options" = {
urls = [{
template = "https://home-manager-options.extranix.com/";
params = [
{ name = "query"; value = "{searchTerms}"; }
];
}];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@nh" ];
};
};
};
};
};
home.persistence."/persist${user.home}".directories = [ ".mozilla" ];
};
}

View File

@@ -0,0 +1,26 @@
{ user ? throw "user argument is required" }: { pkgs, ... }:
{
home-manager.users."${user.name}" = {
programs.git = {
enable = true;
lfs.enable = true;
userName = user.fullName;
userEmail = user.email;
signing = {
signByDefault = true;
key = null;
};
extraConfig.credential.helper = "store";
hooks = let
commit-msg-hook = pkgs.writeShellScriptBin "git-commit-msg" ''
git interpret-trailers --if-exists doNothing --trailer \
"Signed-off-by: $(git config user.name) <$(git config user.email)>" \
--in-place "$1"
'';
in {
commit-msg = "${commit-msg-hook}/bin/git-commit-msg";
};
};
};
}

View File

@@ -1,17 +1,17 @@
{ config, lib, pkgs, ... }:
{ user ? throw "user argument is required" }: { pkgs, ... }:
{
home-manager = {
sharedModules = [{
services.gpg-agent = {
enable = true;
defaultCacheTtl = 31536000;
maxCacheTtl = 31536000;
};
home-manager.users."${user.name}" = {
services.gpg-agent = {
enable = true;
defaultCacheTtl = 31536000;
maxCacheTtl = 31536000;
};
systemd.user.services.gpg-agent-import = let
systemd.user = {
services.gpg-agent-import = let
init = pkgs.writeShellScriptBin "import-gpg-keys" ''
for keyfile in "$HOME"/.config/sops-nix/secrets/gpg-agent/*.key; do
for keyfile in "${user.home}"/.config/sops-nix/secrets/gpg-agent/*.key; do
passfile="''${keyfile%.key}.pass"
if [ -f "$passfile" ]; then
@@ -21,15 +21,14 @@
fi
gpg --with-colons --import-options show-only --import "$keyfile" | grep '^fpr' | cut -d: -f10 | while read -r KEY_ID; do
echo "$KEY_ID:6:" >> "$HOME"/.gnupg/otrust.txt
echo "$KEY_ID:6:" >> "${user.home}"/.gnupg/otrust.txt
done
done
gpg --import-ownertrust "$HOME"/.gnupg/otrust.txt
rm "$HOME"/.gnupg/otrust.txt
gpg --import-ownertrust "${user.home}"/.gnupg/otrust.txt
rm "${user.home}"/.gnupg/otrust.txt
'';
in
{
in {
Unit = {
Description = "Auto-import GPG keys";
Requires = [ "sops-nix.service" "gpg-agent.socket" ];
@@ -43,10 +42,8 @@
Install = { WantedBy = [ "default.target" ]; };
};
}];
users = lib.attrsets.mapAttrs (user: config: ({
systemd.user.tmpfiles.rules = [ "d ${config.home}/.gnupg 0700 ${user} users -" ];
})) (lib.attrsets.filterAttrs (name: config: config.isNormalUser) config.users.users);
tmpfiles.rules = [ "d ${user.home}/.gnupg 0700 ${user.name} users -" ];
};
};
}

View File

@@ -0,0 +1,126 @@
{ user ? throw "user argument is required" }: { lib, pkgs, ... }:
{
programs.hyprland.enable = true;
home-manager.users."${user.name}" = {
wayland.windowManager.hyprland = {
enable = true;
settings = {
"$mod" = "SUPER";
"$term" = "kitty";
bind = [
"$mod, Return, exec, $term"
"$mod, r, exec, rofi -show drun"
"$mod, b, exec, firefox"
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod, 0, workspace, 10"
"$mod_SHIFT, 1, movetoworkspacesilent, 1"
"$mod_SHIFT, 2, movetoworkspacesilent, 2"
"$mod_SHIFT, 3, movetoworkspacesilent, 3"
"$mod_SHIFT, 4, movetoworkspacesilent, 4"
"$mod_SHIFT, 5, movetoworkspacesilent, 5"
"$mod_SHIFT, 6, movetoworkspacesilent, 6"
"$mod_SHIFT, 7, movetoworkspacesilent, 7"
"$mod_SHIFT, 8, movetoworkspacesilent, 8"
"$mod_SHIFT, 9, movetoworkspacesilent, 9"
"$mod_SHIFT, 0, movetoworkspacesilent, 10"
"$mod_CTRL, Space, workspaceopt, allfloat"
"$mod, left, movefocus, l"
"$mod, h, movefocus, l"
"$mod, down, movefocus, d"
"$mod, j, movefocus, d"
"$mod, up, movefocus, u"
"$mod, k, movefocus, u"
"$mod, right, movefocus, r"
"$mod, l, movefocus, r"
"$mod_SHIFT, left, movewindow, l"
"$mod_SHIFT, h, movewindow, l"
"$mod_SHIFT, down, movewindow, d"
"$mod_SHIFT, j, movewindow, d"
"$mod_SHIFT, up, movewindow, u"
"$mod_SHIFT, k, movewindow, u"
"$mod_SHIFT, right, movewindow, r"
"$mod_SHIFT, l, movewindow, r"
"$mod_CTRL, left, resizeactive, -20 0"
"$mod_CTRL, h, resizeactive, -20 0"
"$mod_CTRL, down, resizeactive, 0 20"
"$mod_CTRL, j, resizeactive, 0 20"
"$mod_CTRL, up, resizeactive, 0 -20"
"$mod_CTRL, k, resizeactive, 0 -20"
"$mod_CTRL, right, resizeactive, 20 0"
"$mod_CTRL, l, resizeactive, 20 0"
"$mod, Tab, cyclenext"
"$mod, Tab, bringactivetotop"
"$mod_SHIFT, Tab, cyclenext, prev"
"$mod_SHIFT, Tab, bringactivetotop"
"$mod, f, fullscreen, 0"
"$mod, p, pin"
"$mod, Space, togglefloating"
"$mod, Space, centerwindow"
"$mod, q, killactive"
"CTRL_ALT, Delete, exit"
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
input = {
"accel_profile" = "flat";
};
misc = {
"disable_hyprland_logo" = true;
"disable_splash_rendering" = true;
};
exec-once = let
init = pkgs.writeShellScriptBin "hyprland-init" ''
${pkgs.swww}/bin/swww-daemon &> /tmp/swww.log &
while ! ${pkgs.swww}/bin/swww query &> /dev/null; do
sleep 0.1
done
${pkgs.swww}/bin/swww img ${user.wallpaper}
'';
in "${init}/bin/hyprland-init";
};
};
programs.zsh.loginExtra = lib.mkAfter ''
if [ -z "''${WAYLAND_DISPLAY}" ] && [ ! -z "''${XDG_VTNR}" ] && [ "''${XDG_VTNR}" -eq 1 ]; then
${pkgs.hyprland}/bin/hyprland &> /tmp/hyprland.log
fi
'';
home = {
sessionVariables.NIXOS_OZONE_WL = "1";
packages = with pkgs; [
swww
rofi-wayland
pavucontrol
];
};
};
}

View File

@@ -1,10 +1,12 @@
{ user ? throw "user argument is required" }: { ... }:
{
home-manager.sharedModules = [{
home-manager.users."${user.name}" = {
programs.kitty = {
enable = true;
extraConfig = ''
confirm_os_window_close 0
'';
};
}];
};
}

View File

@@ -1,5 +1,7 @@
{ user ? throw "user argument is required" }: { ... }:
{
home-manager.sharedModules = [{
home-manager.users."${user.name}" = {
programs.neovim = {
enable = true;
defaultEditor = true;
@@ -13,5 +15,5 @@
set smartindent
'';
};
}];
};
}

View File

@@ -0,0 +1,13 @@
{ user ? throw "user argument is required" }: { inputs, ... }:
{
home-manager.users."${user.name}" = {
imports = [ inputs.stylix.homeManagerModules.stylix ];
stylix = {
enable = true;
image = user.wallpaper;
base16Scheme = user.base16Scheme;
};
};
}

View File

@@ -0,0 +1,64 @@
{ user ? throw "user argument is required" }: { pkgs, ... }:
{
home-manager.users."${user.name}" = {
programs.vscode = {
enable = true;
mutableExtensionsDir = false;
userSettings = {
"editor.accessibilitySupport" = "off";
"editor.cursorBlinking" = "phase";
"editor.cursorSmoothCaretAnimation" = "on";
"editor.formatOnPaste" = true;
"editor.formatOnSave" = true;
"editor.formatOnType" = true;
"editor.indentSize" = "tabSize";
"editor.inlineSuggest.enabled" = true;
"editor.largeFileOptimizations" = false;
"editor.linkedEditing" = true;
"editor.renderFinalNewline" = "on";
"editor.smoothScrolling" = true;
"editor.stickyScroll.enabled" = true;
"editor.suggestSelection" = "first";
"editor.unicodeHighlight.includeComments" = true;
"editor.unicodeHighlight.nonBasicASCII" = true;
"explorer.confirmDelete" = false;
"explorer.confirmDragAndDrop" = false;
"explorer.confirmPasteNative" = false;
"files.autoSave" = "afterDelay";
"files.eol" = "\n";
"files.insertFinalNewline" = true;
"files.trimFinalNewlines" = true;
"files.trimTrailingWhitespace" = true;
"git.allowForcePush" = true;
"git.alwaysSignOff" = true;
"git.autofetch" = "all";
"git.closeDiffOnOperation" = true;
"git.confirmForcePush" = false;
"git.confirmSync" = false;
"git.enableCommitSigning" = true;
"git.enableSmartCommit" = true;
"git.ignoreRebaseWarning" = true;
"git.openRepositoryInParentFolders" = "always";
"git.path" = "${pkgs.git}/bin/git";
"mergeEditor.diffAlgorithm" = "advanced";
"open-in-browser.default" = "firefox";
"security.workspace.trust.enabled" = false;
"telemetry.telemetryLevel" = "off";
"terminal.external.linuxExec" = "kitty";
"terminal.integrated.confirmOnExit" = "hasChildProcesses";
"terminal.integrated.copyOnSelection" = true;
"window.autoDetectHighContrast" = false;
"window.menuBarVisibility" = "toggle";
"workbench.editor.historyBasedLanguageDetection" = true;
"workbench.list.smoothScrolling" = true;
};
};
imports = [
./langs/nix.nix
];
home.persistence."/persist${user.home}".directories = [ ".config/Code" ];
};
}

View File

@@ -0,0 +1,19 @@
{ pkgs, ... }:
{
programs.vscode = {
userSettings = {
"nix.enableLanguageServer" = true;
"nix.formatterPath" = "nixpkgs-fmt";
"nix.serverSettings" = {};
};
extensions = with pkgs; with vscode-extensions; [
jnoortheen.nix-ide
];
};
home.packages = with pkgs; [
nil
nixpkgs-fmt
];
}

View File

@@ -0,0 +1,19 @@
{ user ? throw "user argument is required" }: { ... }:
{
home-manager.users."${user.name}" = {
programs.zsh = {
enable = true;
autocd = true;
history = {
path = "${user.home}/.local/share/zsh/history";
expireDuplicatesFirst = true;
};
historySubstringSearch.enable = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
};
home.persistence."/persist${user.home}".directories = [ ".local/share/zsh" ];
};
}

View File

@@ -1,33 +1,19 @@
{ config, pkgs, ... }:
let
user = config.users.users.nick;
in
{
imports = [ ../common ];
sops.secrets.nick-password = {
sopsFile = ./secrets/secrets.yaml;
key = "password";
neededForUsers = true;
};
home-manager.users.nick.sops = {
defaultSopsFile = ./secrets/secrets.yaml;
secrets = {
"git" = { path = "/home/nick/.git-credentials"; };
"gpg-agent/pgp.key" = { };
"gpg-agent/pgp.pass" = { };
};
};
imports = [
./nogui.nix
(import ../configs/firefox { inherit user; })
(import ../configs/hyprland { inherit user; })
(import ../configs/kitty { inherit user; })
(import ../configs/vscode { inherit user; })
(import ../configs/stylix { inherit user; })
];
users.users.nick = {
isNormalUser = true;
home = "/home/nick";
email = "nick@karaolidis.com";
fullName = "Nikolaos Karaolidis";
description = config.users.users.nick.fullName;
hashedPasswordFile = config.sops.secrets.nick-password.path;
extraGroups = [ "wheel" ];
linger = true;
uid = 1000;
wallpaper = ./wallpapers/clouds.png;
base16Scheme = "${pkgs.base16-schemes}/share/themes/seti.yaml";
};

44
users/nick/nogui.nix Normal file
View File

@@ -0,0 +1,44 @@
{ config, ... }:
let
user = config.users.users.nick;
in
{
imports = [
../common
(import ../configs/zsh { inherit user; })
(import ../configs/git { inherit user; })
(import ../configs/neovim { inherit user; })
(import ../configs/gpg-agent { inherit user; })
];
sops.secrets.nick-password = {
sopsFile = ./secrets/secrets.yaml;
key = "password";
neededForUsers = true;
};
users.users.nick = {
isNormalUser = true;
home = "/home/nick";
email = "nick@karaolidis.com";
fullName = "Nikolaos Karaolidis";
description = config.users.users.nick.fullName;
hashedPasswordFile = config.sops.secrets.nick-password.path;
extraGroups = [ "wheel" ];
linger = true;
uid = 1000;
};
home-manager.users.nick = {
home.homeDirectory = config.users.users.nick.home;
sops = {
defaultSopsFile = ./secrets/secrets.yaml;
secrets = {
"git" = { path = "/home/nick/.git-credentials"; };
"gpg-agent/pgp.key" = { };
"gpg-agent/pgp.pass" = { };
};
};
};
}