diff --git a/flake.nix b/flake.nix index aa556f9..4e518a3 100644 --- a/flake.nix +++ b/flake.nix @@ -67,12 +67,14 @@ xremap-flake, attic, ... - }: { + }: let + user = "matt"; + in { # Gaming PC, Mini, VM, Raspberry Pi nixosConfigurations = ( import ./hosts/nixos { inherit (nixpkgs) lib; - inherit inputs nixpkgs nixos-hardware home-manager hyprland sops-nix helix-flake attic; + inherit inputs nixpkgs nixos-hardware home-manager hyprland sops-nix helix-flake attic user; } ); @@ -80,7 +82,7 @@ asahiConfiguration = ( import ./hosts/asahi { inherit (nixpkgs) lib; - inherit inputs nixpkgs home-manager sops-nix helix-flake; + inherit inputs nixpkgs home-manager sops-nix helix-flake user; } ); diff --git a/hosts/asahi/default.nix b/hosts/asahi/default.nix index a755ea2..18f1f5f 100644 --- a/hosts/asahi/default.nix +++ b/hosts/asahi/default.nix @@ -52,7 +52,7 @@ in { sops-nix.homeManagerModule { sops.defaultSopsFormat = "yaml"; - sops.age.keyFile = "/home/matt/.config/sops/age/keys.txt"; + sops.age.keyFile = "/home/${user}/.config/sops/age/keys.txt"; } { # override home manager helix with my fork diff --git a/hosts/nixos/config-common.nix b/hosts/nixos/config-common.nix index 6406201..80c8fc2 100644 --- a/hosts/nixos/config-common.nix +++ b/hosts/nixos/config-common.nix @@ -1,7 +1,11 @@ -{pkgs, ...}: { +{ + pkgs, + user, + ... +}: { time.timeZone = "America/Los_Angeles"; - users.users.matt = { + users.users.${user} = { openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAmdl6XNEdT+EWf1IDRjHAygUIGpNCaBv9Qhm19cRCEm" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGi7DLE/5v9yI2ZRPeKOftyngeNMvXOX/RDIyA0J3rtI matt@mini" diff --git a/hosts/nixos/default.nix b/hosts/nixos/default.nix index 1204a75..db60a6b 100644 --- a/hosts/nixos/default.nix +++ b/hosts/nixos/default.nix @@ -8,10 +8,9 @@ helix-flake, sops-nix, attic, + user, ... -}: let - user = "matt"; -in { +}: { nixos-vm = lib.nixosSystem { pkgs = import nixpkgs { system = "aarch64-linux"; @@ -20,6 +19,9 @@ in { (import ../../overlay/overlay.nix) ]; }; + specialArgs = { + inherit user; + }; modules = [ ./config-common.nix ./networking.nix @@ -47,6 +49,9 @@ in { (import ../../overlay/overlay.nix) ]; }; + specialArgs = { + inherit user; + }; modules = [ ./config-common.nix ./networking.nix @@ -116,6 +121,9 @@ in { (import ../../overlay/overlay.nix) ]; }; + specialArgs = { + inherit user; + }; modules = [ nixos-hardware.nixosModules.raspberry-pi-4 ./config-common.nix diff --git a/hosts/nixos/mini/kopia.nix b/hosts/nixos/mini/kopia.nix index 935d9f9..95c19f1 100644 --- a/hosts/nixos/mini/kopia.nix +++ b/hosts/nixos/mini/kopia.nix @@ -1,6 +1,7 @@ { pkgs, config, + user, ... }: { environment.systemPackages = with pkgs; [ @@ -23,7 +24,7 @@ serviceConfig = { ExecStart = "${pkgs.kopia}/bin/kopia server start --insecure --server-username $USERNAME --server-password $PASSWORD"; Type = "simple"; - User = "matt"; + User = user; Group = "users"; EnvironmentFile = [ config.sops.secrets."kopia/PASSWORD".path diff --git a/hosts/nixos/pi4/configuration.nix b/hosts/nixos/pi4/configuration.nix index ec9ee97..b0062a8 100644 --- a/hosts/nixos/pi4/configuration.nix +++ b/hosts/nixos/pi4/configuration.nix @@ -4,6 +4,7 @@ { config, pkgs, + user, ... }: let yazi = pkgs.symlinkJoin { @@ -73,7 +74,7 @@ in { # command = [ "/bin/sh" ]; # args = [ "-c" "echo 'Hello, world!'" ]; volumes = [ - "/home/matt/SyncWork/Notes/Notes:/space" + "/home/${user}/SyncWork/Notes/Notes:/space" ]; # restartPolicy = "always"; }; @@ -117,7 +118,7 @@ in { services = { syncthing = { enable = true; - user = "matt"; + user = user; dataDir = "/mnt/syncthing/personal"; configDir = "/mnt/syncthing/config"; }; @@ -153,7 +154,7 @@ in { # services.xserver.libinput.enable = true; # Define a user account. Don't forget to set a password with ‘passwd’. - # users.users.matt = { + # users.users.${user} = { # shell = pkgs.fish; # isNormalUser = true; # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. @@ -186,7 +187,6 @@ in { services.caddy = { enable = true; - virtualHosts."pihole.c4er.com".extraConfig = '' tls /mnt/certs/c4er.com/c4er.com.crt /mnt/certs/c4er.com/c4er.com.key diff --git a/hosts/nixos/vm/configuration.nix b/hosts/nixos/vm/configuration.nix index 50bcbad..2c53a09 100644 --- a/hosts/nixos/vm/configuration.nix +++ b/hosts/nixos/vm/configuration.nix @@ -4,6 +4,7 @@ { config, pkgs, + user, ... }: { imports = [ @@ -56,7 +57,7 @@ # services.xserver.libinput.enable = true; # Define a user account. Don't forget to set a password with ‘passwd’. - # users.users.matt = { + # users.users.${user} = { # shell = pkgs.fish; # isNormalUser = true; # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. diff --git a/hosts/nixos/vm2/configuration.nix b/hosts/nixos/vm2/configuration.nix index 09e5ca0..cbff5ed 100644 --- a/hosts/nixos/vm2/configuration.nix +++ b/hosts/nixos/vm2/configuration.nix @@ -4,6 +4,7 @@ { config, pkgs, + user, ... }: { imports = [ @@ -81,9 +82,9 @@ # services.xserver.libinput.enable = true; # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.matt = { + users.users.${user} = { isNormalUser = true; - description = "matt"; + description = user; extraGroups = ["networkmanager" "wheel"]; packages = with pkgs; [ firefox diff --git a/modules/shell/git.nix b/modules/shell/git.nix index 5df8e00..0b05350 100644 --- a/modules/shell/git.nix +++ b/modules/shell/git.nix @@ -1,5 +1,4 @@ {user, ...}: let - inherit user; fullName = "${user.firstName} ${user.lastName}"; #email = user.email; in { @@ -23,7 +22,7 @@ in { defaultBranch = "main"; }; core = { - excludesfile = "/home/matt/.gitignore_global"; + excludesfile = "/home/${user}/.gitignore_global"; autocrlf = "input"; trustctime = false; pager = "delta";