From aafa5da904a3f5249da6e71632bfb62fcc1406e0 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Sat, 6 Sep 2025 23:25:59 +0200 Subject: [PATCH] Add NixOS home manager config and fix flake warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add hosts/nixos/home-default.nix with nvim, ssh, and other modules - Add hosts/nixos/hs/home.nix importing home-default - Fix nixpkgs.config conflict by moving allowUnfree to system level - Fix root user password conflicts by explicitly clearing all options - Add home-manager integration to hs system configuration - Update hostId from placeholder to actual value (8425e349) - Add claude-code support for x86_64-linux architecture 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- flake.nix | 7 ++++++ hosts/nixos/home-default.nix | 45 ++++++++++++++++++++++++++++++++++++ hosts/nixos/hs/home.nix | 11 +++++++++ hosts/nixos/hs/system.nix | 22 ++++++++++++++++-- 4 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 hosts/nixos/home-default.nix create mode 100644 hosts/nixos/hs/home.nix diff --git a/flake.nix b/flake.nix index c565112..d275fcf 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,7 @@ ./hosts/nixos/hs/system.nix ./hosts/nixos/hs/disk-config.nix ]; + specialArgs = { inherit home-manager nixvim claude-code; }; }; nixosConfigurations."hs-iso" = nixpkgs.lib.nixosSystem { @@ -64,6 +65,12 @@ modules = [ ./hosts/darwin/mba/home.nix ]; extraSpecialArgs = { inherit claude-code nixvim firefox-addons; }; }; + + "yanlin@hs" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + modules = [ ./hosts/nixos/hs/home.nix ]; + extraSpecialArgs = { inherit claude-code nixvim; }; + }; }; }; } diff --git a/hosts/nixos/home-default.nix b/hosts/nixos/home-default.nix new file mode 100644 index 0000000..96c70e9 --- /dev/null +++ b/hosts/nixos/home-default.nix @@ -0,0 +1,45 @@ +{ config, pkgs, nixvim, claude-code, ... }: + +{ + imports = [ + nixvim.homeModules.nixvim + ../../modules/nvim.nix + ../../modules/tmux.nix + ../../modules/zsh.nix + ../../modules/ssh.nix + ../../modules/git.nix + ../../modules/lazygit.nix + ../../modules/termscp.nix + ../../modules/rsync.nix + ../../modules/btop.nix + ../../config/fonts.nix + ]; + + home.username = "yanlin"; + home.homeDirectory = "/home/yanlin"; + home.stateVersion = "24.05"; + + programs.home-manager.enable = true; + + home.packages = with pkgs; [ + # Network and file transfer + lftp + httpie + openssh + gnumake + + # Command-line utilities + ncdu + git-credential-oauth + zoxide + delta + fastfetch + + # Development and build tools + python312 + uv + claude-code.packages.x86_64-linux.claude-code + lazysql + sqlite + ]; +} diff --git a/hosts/nixos/hs/home.nix b/hosts/nixos/hs/home.nix new file mode 100644 index 0000000..4f6710b --- /dev/null +++ b/hosts/nixos/hs/home.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ../home-default.nix + ]; + + # hs-specific home configuration + # Example: Server-specific tools, monitoring utilities, etc. + +} \ No newline at end of file diff --git a/hosts/nixos/hs/system.nix b/hosts/nixos/hs/system.nix index 6ba0f96..c30bad0 100644 --- a/hosts/nixos/hs/system.nix +++ b/hosts/nixos/hs/system.nix @@ -1,7 +1,8 @@ -{ config, pkgs, ... }: { +{ config, pkgs, home-manager, nixvim, claude-code, ... }: { imports = [ ./hardware-configuration.nix ./disk-config.nix + home-manager.nixosModules.home-manager ]; # GRUB bootloader with ZFS support @@ -24,7 +25,7 @@ # Network configuration networking = { hostName = "hs"; - hostId = "12345678"; # Required for ZFS, good practice for any system + hostId = "8425e349"; # Required for ZFS, good practice for any system networkmanager.enable = true; firewall.enable = false; # firewall.allowedTCPPorts = [ 22 ]; # SSH @@ -49,6 +50,12 @@ # Define a user account users.users.root = { + # Clear any inherited password settings + hashedPassword = null; + hashedPasswordFile = null; + password = null; + initialHashedPassword = null; + initialPassword = null; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG35m0DgTrEOAM+1wAlYZ8mvLelNTcx65cFccGPQcxmo yanlin@imac" ]; @@ -110,6 +117,17 @@ autodetect = true; }; + # Allow unfree packages globally + nixpkgs.config.allowUnfree = true; + + # Home Manager configuration + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.yanlin = import ./home.nix; + extraSpecialArgs = { inherit claude-code nixvim; }; + }; + # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It's perfectly fine and recommended to leave