diff --git a/flake.lock b/flake.lock index b79e661..b4b7f27 100644 --- a/flake.lock +++ b/flake.lock @@ -20,6 +20,27 @@ "type": "github" } }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1673343300, + "narHash": "sha256-5Xdj6kpXYMie0MlnGwqK5FaMdsedxvyuakWtyKB3zaQ=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "176e455371a8371586e8a3ff0d56ee9f3ca2324e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1673345971, @@ -55,9 +76,25 @@ "root": { "inputs": { "agenix": "agenix", + "home-manager": "home-manager", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" } + }, + "utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index d426e1b..72195a9 100644 --- a/flake.nix +++ b/flake.nix @@ -5,11 +5,14 @@ agenix.url = "github:ryantm/agenix"; agenix.inputs.nixpkgs.follows = "nixpkgs"; + + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; description = "Hillion Nix flake"; - outputs = { self, nixpkgs, nixpkgs-unstable, agenix }@inputs: { + outputs = { self, nixpkgs, nixpkgs-unstable, agenix, home-manager }@inputs: { nixosConfigurations = let fqdns = builtins.attrNames (builtins.readDir ./hosts); @@ -21,6 +24,7 @@ modules = [ ./hosts/${fqdn}/default.nix agenix.nixosModule + home-manager.nixosModule { system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; } diff --git a/modules/common/default.nix b/modules/common/default.nix index 036d72a..527358f 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -2,6 +2,7 @@ { imports = [ + ../home/default.nix ./shell.nix ./ssh.nix ./tailscale.nix @@ -28,7 +29,6 @@ users."jake" = { isNormalUser = true; extraGroups = [ "wheel" ]; # enable sudo - shell = pkgs.zsh; }; }; diff --git a/modules/common/shell.nix b/modules/common/shell.nix index cdeb864..234c459 100644 --- a/modules/common/shell.nix +++ b/modules/common/shell.nix @@ -1,6 +1,8 @@ -{ lib, config, ... }: +{ pkgs, lib, config, ... }: { + config.users.defaultUserShell = pkgs.zsh; + config.programs.zsh = { enable = true; histSize = 100000; @@ -9,12 +11,6 @@ syntaxHighlighting = { enable = true; }; - - autosuggestions = { - enable = true; - highlightStyle = "fg=5"; - strategy = [ "match_prev_cmd" "completion" "history" ]; - }; }; } diff --git a/modules/home/default.nix b/modules/home/default.nix new file mode 100644 index 0000000..e376b77 --- /dev/null +++ b/modules/home/default.nix @@ -0,0 +1,15 @@ +{ pkgs, lib, config, ... }: + +{ + home-manager.users.root.home.stateVersion = "22.11"; + home-manager.users.jake.home.stateVersion = "22.11"; + + imports = [ + ./tmux/default.nix + ]; + + ## Set an empty ZSH config and defer to the global one + ## This is particularly important for root on tmpfs + home-manager.users.root.programs.zsh.enable = true; + home-manager.users.jake.programs.zsh.enable = true; +} diff --git a/modules/home/tmux/.tmux.conf b/modules/home/tmux/.tmux.conf new file mode 100644 index 0000000..9407618 --- /dev/null +++ b/modules/home/tmux/.tmux.conf @@ -0,0 +1,10 @@ +setw -g mouse on + +# Bindings +bind C-Y set-window-option synchronize-panes +bind -n C-k clear-history + +# New panes in the same directory +bind '"' split-window -c "#{pane_current_path}" +bind % split-window -h -c "#{pane_current_path}" +bind c new-window -c "#{pane_current_path}" diff --git a/modules/home/tmux/default.nix b/modules/home/tmux/default.nix new file mode 100644 index 0000000..f98c5d4 --- /dev/null +++ b/modules/home/tmux/default.nix @@ -0,0 +1,8 @@ +{ pkgs, lib, config, ... }: + +{ + home-manager.users.jake.programs.tmux = { + enable = true; + extraConfig = lib.readFile ./.tmux.conf; + }; +}