From 062d80750c8b21d297aad46ae06daf869604c5ff Mon Sep 17 00:00:00 2001 From: Yuri Tatishchev Date: Thu, 5 Jun 2025 18:47:15 -0700 Subject: [PATCH] home: add git config and common module for headless systems --- flake.nix | 8 +++- home/cazzzer-laptop.nix | 3 +- home/cazzzer-pc.nix | 3 +- home/common-desktop.nix | 21 ++++++++++ home/common.nix | 32 ++++++++++++++++ home/modules/default.nix | 83 ---------------------------------------- home/modules/git.nix | 64 +++++++++++++++++++++++++++++++ 7 files changed, 127 insertions(+), 87 deletions(-) create mode 100644 home/common-desktop.nix create mode 100644 home/common.nix delete mode 100644 home/modules/default.nix create mode 100644 home/modules/git.nix diff --git a/flake.nix b/flake.nix index bf65494..bfba84f 100644 --- a/flake.nix +++ b/flake.nix @@ -27,6 +27,8 @@ outputs = { self, nixpkgs, home-manager, plasma-manager, nixos-generators, secrix }: let hmModule = file: { + imports = [ home-manager.nixosModules.home-manager ]; + home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ]; @@ -49,7 +51,6 @@ ./hosts/Yura-PC ./users/cazzzer # https://nix-community.github.io/home-manager/index.xhtml#sec-flakes-nixos-module - home-manager.nixosModules.home-manager (hmModule ./home/cazzzer-pc.nix) ]; }; @@ -62,7 +63,6 @@ ./hosts/Yura-TPX13 ./users/cazzzer # https://nix-community.github.io/home-manager/index.xhtml#sec-flakes-nixos-module - home-manager.nixosModules.home-manager (hmModule ./home/cazzzer-laptop.nix) ]; }; @@ -74,6 +74,7 @@ ./hosts/hw-vm.nix ./hosts/vm ./users/cazzzer + (hmModule ./home/cazzzer-pc.nix) ]; }; router = nixpkgs.lib.nixosSystem { @@ -84,6 +85,7 @@ ./hosts/common.nix ./hosts/router ./users/cazzzer + (hmModule ./home/common.nix) ]; }; }; @@ -97,6 +99,7 @@ ./hosts/hw-proxmox.nix ./hosts/vm ./users/cazzzer + (hmModule ./home/cazzzer-pc.nix) ]; format = "proxmox"; }; @@ -109,6 +112,7 @@ ./hosts/hw-proxmox.nix ./hosts/vm ./users/cazzzer + (hmModule ./home/cazzzer-pc.nix) ]; }; in diff --git a/home/cazzzer-laptop.nix b/home/cazzzer-laptop.nix index 6142795..4068da5 100644 --- a/home/cazzzer-laptop.nix +++ b/home/cazzzer-laptop.nix @@ -2,7 +2,8 @@ { imports = [ - ./modules + ./common.nix + ./common-desktop.nix ]; programs.plasma = { diff --git a/home/cazzzer-pc.nix b/home/cazzzer-pc.nix index b692730..9b870ad 100644 --- a/home/cazzzer-pc.nix +++ b/home/cazzzer-pc.nix @@ -2,7 +2,8 @@ { imports = [ - ./modules + ./common.nix + ./common-desktop.nix ]; programs.plasma.kwin.virtualDesktops.number = 2; diff --git a/home/common-desktop.nix b/home/common-desktop.nix new file mode 100644 index 0000000..79641a3 --- /dev/null +++ b/home/common-desktop.nix @@ -0,0 +1,21 @@ +{ config, lib, pkgs, ... }: +{ + imports = [ + ./modules/starship.nix + ./modules/plasma.nix + ]; + + services.darkman = { + enable = true; + settings = { + lat = 37.3387; + lng = -121.8853; + }; + lightModeScripts = { + plasma-color = "plasma-apply-colorscheme BreezeLight"; + }; + darkModeScripts = { + plasma-color = "plasma-apply-colorscheme BreezeDark"; + }; + }; +} diff --git a/home/common.nix b/home/common.nix new file mode 100644 index 0000000..b73b072 --- /dev/null +++ b/home/common.nix @@ -0,0 +1,32 @@ +{ config, lib, pkgs, ... }: +let + username = "cazzzer"; +in +{ + imports = [ + ./modules/fish.nix + ./modules/git.nix + ]; + + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = username; + home.homeDirectory = "/home/${username}"; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + home.sessionVariables = { + EDITOR = "micro"; + SHELL = "fish"; + }; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "24.11"; # Please read the comment before changing. +} diff --git a/home/modules/default.nix b/home/modules/default.nix deleted file mode 100644 index f6e50aa..0000000 --- a/home/modules/default.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ config, lib, pkgs, ... }: -let - username = "cazzzer"; -in -{ - imports = [ - ./fish.nix - ./starship.nix - ./plasma.nix - ]; - - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = username; - home.homeDirectory = "/home/${username}"; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - - home.sessionVariables = { - EDITOR = "micro"; - SHELL = "fish"; - }; - - services.darkman = { - enable = true; - settings = { - lat = 37.3387; - lng = -121.8853; - }; - lightModeScripts = { - plasma-color = "plasma-apply-colorscheme BreezeLight"; - }; - darkModeScripts = { - plasma-color = "plasma-apply-colorscheme BreezeDark"; - }; - }; - - # This value determines the Home Manager release that your configuration is - # compatible with. This helps avoid breakage when a new Home Manager release - # introduces backwards incompatible changes. - # - # You should not change this value, even if you update Home Manager. If you do - # want to update the value, then make sure to first check the Home Manager - # release notes. - home.stateVersion = "24.11"; # Please read the comment before changing. - - # The home.packages option allows you to install Nix packages into your - # environment. - # home.packages = [ - # # Adds the 'hello' command to your environment. It prints a friendly - # # "Hello, world!" when run. - # pkgs.hello - - # # It is sometimes useful to fine-tune packages, for example, by applying - # # overrides. You can do that directly here, just don't forget the - # # parentheses. Maybe you want to install Nerd Fonts with a limited number of - # # fonts? - # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) - - # # You can also create simple shell scripts directly inside your - # # configuration. For example, this adds a command 'my-hello' to your - # # environment: - # (pkgs.writeShellScriptBin "my-hello" '' - # echo "Hello, ${config.home.username}!" - # '') - # ]; - - # Home Manager is pretty good at managing dotfiles. The primary way to manage - # plain files is through 'home.file'. - # home.file = { - # # Building this configuration will create a copy of 'dotfiles/screenrc' in - # # the Nix store. Activating the configuration will then make '~/.screenrc' a - # # symlink to the Nix store copy. - # ".screenrc".source = dotfiles/screenrc; - - # # You can also set the file content immediately. - # ".gradle/gradle.properties".text = '' - # org.gradle.console=verbose - # org.gradle.daemon.idletimeout=3600000 - # ''; - # }; -} diff --git a/home/modules/git.nix b/home/modules/git.nix new file mode 100644 index 0000000..f87e388 --- /dev/null +++ b/home/modules/git.nix @@ -0,0 +1,64 @@ +{ config, lib, pkgs, ... }: +let + name = "Yuri Tatishchev"; + email = "itatishch@gmail.com"; + signingKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE02AhJIZtrtZ+5sZhna39LUUCEojQzmz2BDWguT9ZHG"; +in +{ + programs.git = { + enable = true; + + userName = name; + userEmail = email; + + signing = { + key = signingKey; + signByDefault = true; + format = "ssh"; + }; + + aliases = { + co = "checkout"; + s = "switch"; + }; + + extraConfig = { + url = { + "https://gitea.cazzzer.com/" = { + insteadOf = "caztea:"; + }; + "https://github.com/" = { + insteadOf = "github:"; + }; + }; + + core = { + autocrlf = "input"; + editor = "micro"; + }; + + color = { + ui = true; + }; + + pull = { + ff = "only"; + }; + + filter.lfs = { + clean = "git-lfs clean -- %f"; + smudge = "git-lfs smudge -- %f"; + process = "git-lfs filter-process"; + required = true; + }; + + credential = { + helper = "libsecret"; + }; + + merge = { + conflictStyle = "zdiff3"; + }; + }; + }; +}