From 6d395c18c4236bea3eade2fc0c41cf87aa32ef08 Mon Sep 17 00:00:00 2001 From: Alex Ottr Date: Wed, 11 Jun 2025 22:21:51 +0200 Subject: [PATCH] add git and gpg --- hosts/otter/configuration.nix | 29 +++++++---------- hosts/otter/hardware-configuration.nix | 13 +++----- hosts/otter/home.nix | 1 + modules/home-manager/git.nix | 45 ++++++++++++++++++++++++++ modules/nixos/common/gpg.nix | 12 +++++++ 5 files changed, 73 insertions(+), 27 deletions(-) create mode 100644 modules/home-manager/git.nix create mode 100644 modules/nixos/common/gpg.nix diff --git a/hosts/otter/configuration.nix b/hosts/otter/configuration.nix index f04bf9f..24c4d91 100644 --- a/hosts/otter/configuration.nix +++ b/hosts/otter/configuration.nix @@ -1,9 +1,11 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: { imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix + ../../modules/nixos/common/i18n.nix + ../../modules/nixos/common/gpg.nix ]; # Bootloader. @@ -14,33 +16,24 @@ boot.kernelPackages = pkgs.linuxPackages_latest; boot.initrd.luks.devices."luks-7736f743-324d-43d9-b3ad-5ddd3b3bd0e0".device = "/dev/disk/by-uuid/7736f743-324d-43d9-b3ad-5ddd3b3bd0e0"; - networking.hostName = "otter"; # Define your hostname. + + networking = { + hostName = "otter"; + networkmanager.enable = true; + domain = "otter.place"; + useDHCP = lib.mkDefault true; + }; + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # Configure network proxy if necessary # networking.proxy.default = "http://user:password@proxy:port/"; # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - # Enable networking - networking.networkmanager.enable = true; # Set your time zone. time.timeZone = "Europe/Paris"; - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "fr_FR.UTF-8"; - LC_IDENTIFICATION = "fr_FR.UTF-8"; - LC_MEASUREMENT = "fr_FR.UTF-8"; - LC_MONETARY = "fr_FR.UTF-8"; - LC_NAME = "fr_FR.UTF-8"; - LC_NUMERIC = "fr_FR.UTF-8"; - LC_PAPER = "fr_FR.UTF-8"; - LC_TELEPHONE = "fr_FR.UTF-8"; - LC_TIME = "fr_FR.UTF-8"; - }; # Enable the X11 windowing system. # You can disable this if you're only using the Wayland session. diff --git a/hosts/otter/hardware-configuration.nix b/hosts/otter/hardware-configuration.nix index e79c536..ca1b4da 100644 --- a/hosts/otter/hardware-configuration.nix +++ b/hosts/otter/hardware-configuration.nix @@ -10,7 +10,10 @@ boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - powerManagement.cpuFreqGovernor = "powersave"; + # powerManagement = { + # cpuFreqGovernor = "powersave"; + # powertop.enable = true; + # }; fileSystems."/" = { device = "/dev/disk/by-uuid/9b07d71e-c941-4369-97d7-eb2d8b223508"; @@ -29,14 +32,6 @@ [ { device = "/dev/disk/by-uuid/8e8176f7-0b19-4fed-8ddf-721cc27abe2f"; } ]; - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp193s0f3u1.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/otter/home.nix b/hosts/otter/home.nix index 7658d96..8478859 100644 --- a/hosts/otter/home.nix +++ b/hosts/otter/home.nix @@ -7,6 +7,7 @@ imports = [ ../../modules/home-manager/vscode.nix + ../../modules/home-manager/git.nix ]; home.packages = []; diff --git a/modules/home-manager/git.nix b/modules/home-manager/git.nix new file mode 100644 index 0000000..0d34142 --- /dev/null +++ b/modules/home-manager/git.nix @@ -0,0 +1,45 @@ +{ + config, + lib, + pkgs, + ... +}: { + + programs.fish.shellAbbrs = { + g = "git"; + ga = "git add"; + gcm = "git commit -sm"; + gp = "git push"; + gpl = "git pull"; + gr = "git rebase"; + gs = "git status"; + }; + + + programs.gh = { + enable = true; + settings = { + version = "1"; + git_protocol = "ssh"; + }; + }; + + programs.git = { + enable = true; + + userName = "Alex Ottr"; + userEmail = "alex@otter.foo"; + signing = { + key = "B899892A9D13D8A761B5F3E0E3DC722E2943A517"; + signByDefault = true; + }; + + extraConfig = { + init.defaultBranch = "main"; + pull.rebase = true; + rerere.enabled = true; + + tag.gpgSign = false; + }; + }; +} \ No newline at end of file diff --git a/modules/nixos/common/gpg.nix b/modules/nixos/common/gpg.nix new file mode 100644 index 0000000..725ca83 --- /dev/null +++ b/modules/nixos/common/gpg.nix @@ -0,0 +1,12 @@ +{...}: { + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + settings = { + default-cache-ttl = 1209600; + default-cache-ttl-ssh = 1209600; + max-cache-ttl = 1209600; + max-cache-ttl-ssh = 1209600; + }; + }; +} \ No newline at end of file -- 2.51.2