diff --git a/flake.lock b/flake.lock index 19d2fb1..5448419 100644 --- a/flake.lock +++ b/flake.lock @@ -3,7 +3,9 @@ "agenix": { "inputs": { "darwin": "darwin", - "home-manager": "home-manager", + "home-manager": [ + "home-manager" + ], "nixpkgs": [ "nixpkgs" ], @@ -151,16 +153,15 @@ "home-manager": { "inputs": { "nixpkgs": [ - "agenix", "nixpkgs" ] }, "locked": { - "lastModified": 1703113217, - "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", + "lastModified": 1740845322, + "narHash": "sha256-AXEgFj3C0YJhu9k1OhbRhiA6FnDr81dQZ65U3DhaWpw=", "owner": "nix-community", "repo": "home-manager", - "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", + "rev": "fcac3d6d88302a5e64f6cb8014ac785e08874c8d", "type": "github" }, "original": { @@ -269,6 +270,7 @@ "deploy-rs": "deploy-rs", "flake-compat": "flake-compat", "flake-utils": "flake-utils", + "home-manager": "home-manager", "nix-index-database": "nix-index-database", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", diff --git a/flake.nix b/flake.nix index d26c155..fbffdd2 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,12 @@ # NixOS hardware nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + # Home Manager + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + # Mail Server simple-nixos-mailserver = { url = "gitlab:simple-nixos-mailserver/nixos-mailserver/master"; @@ -33,6 +39,7 @@ inputs = { nixpkgs.follows = "nixpkgs"; systems.follows = "systems"; + home-manager.follows = "home-manager"; }; }; @@ -81,7 +88,9 @@ { inherit nixpkgs; assertionsModule = "${nixpkgs}/nixos/modules/misc/assertions.nix"; - }).machines.hosts; + }).machines; + machineHosts = machines.hosts; + machineRoles = machines.roles; in { nixosConfigurations = @@ -92,6 +101,7 @@ agenix.nixosModules.default dailybuild_modules.nixosModule nix-index-database.nixosModules.nix-index + home-manager.nixosModules.home-manager self.nixosModules.kernel-modules ({ lib, ... }: { config = { @@ -102,6 +112,13 @@ ]; networking.hostName = hostname; + + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.googlebot = import ./home/googlebot.nix { + inherit hostname; + inherit machineRoles; + }; }; # because nixos specialArgs doesn't work for containers... need to pass in inputs a different way @@ -139,7 +156,7 @@ nixpkgs.lib.mapAttrs (hostname: cfg: mkSystem cfg.arch nixpkgs cfg.configurationPath hostname) - machines; + machineHosts; packages = let @@ -176,7 +193,7 @@ nixpkgs.lib.mapAttrs (hostname: cfg: mkDeploy hostname cfg.arch (builtins.head cfg.hostNames)) - machines; + machineHosts; checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib; diff --git a/home/googlebot.nix b/home/googlebot.nix new file mode 100644 index 0000000..667b0a4 --- /dev/null +++ b/home/googlebot.nix @@ -0,0 +1,83 @@ +{ hostname, machineRoles }: +{ config, lib, pkgs, ... }: + +let + # Check if the current machine has the role "personal" + thisMachineIsPersonal = builtins.elem hostname machineRoles.personal; +in +{ + home.username = "googlebot"; + home.homeDirectory = "/home/googlebot"; + + home.stateVersion = "24.11"; + programs.home-manager.enable = true; + + programs.zed-editor = { + enable = thisMachineIsPersonal; + extensions = [ + "nix" + "toml" + "html" + "make" + "git-firefly" + "vue" + "scss" + ]; + + userSettings = { + assistant = { + enabled = true; + version = "2"; + default_model = { + provider = "openai"; + model = "gpt-4-turbo"; + }; + }; + + features = { + edit_prediction_provider = "zed"; + }; + + node = { + path = lib.getExe pkgs.nodejs; + npm_path = lib.getExe' pkgs.nodejs "npm"; + }; + + auto_update = false; + + terminal = { + blinking = "off"; + copy_on_select = false; + }; + + lsp = { + rust-analyzer = { + # binary = { + # path = lib.getExe pkgs.rust-analyzer; + # }; + binary = { + path = "/run/current-system/sw/bin/nix"; + arguments = [ "develop" "--command" "rust-analyzer" ]; + }; + initialization_options = { + cargo = { + features = "all"; + }; + }; + }; + }; + + # tell zed to use direnv and direnv can use a flake.nix enviroment. + load_direnv = "shell_hook"; + + base_keymap = "VSCode"; + theme = { + mode = "system"; + light = "One Light"; + dark = "Andrometa"; + }; + ui_font_size = 12; + buffer_font_size = 12; + }; + }; +}