From a2c941ea44b0277e4c9183abb84ff3a1c1b2ce41 Mon Sep 17 00:00:00 2001 From: Spotlight Date: Wed, 24 Jan 2024 12:48:54 -0600 Subject: [PATCH] Allow overriding username More specifically, this assists with the Steam Deck. --- flake.lock | 12 ++++++------ flake.nix | 10 ++++++++++ home/home.nix | 16 ++++++++++------ 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index de9920c..2f6c686 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1705169127, - "narHash": "sha256-j9OEtNxOIPWZWjbECVMkI1TO17SzlpHMm0LnVWKOR/g=", + "lastModified": 1706080884, + "narHash": "sha256-qhxisCrSraN5YWVb0lNCFH8ovqnCw5W9ldac4Dzr0Nw=", "owner": "nix-community", "repo": "home-manager", - "rev": "f2942f3385f1b35cc8a1abb03a45e29c9cb4d3c8", + "rev": "6b28ab2d798c1c84e24053d95f4ee1dd9d81e2fb", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1705133751, - "narHash": "sha256-rCIsyE80jgiOU78gCWN3A0wE0tR2GI5nH6MlS+HaaSQ=", + "lastModified": 1705856552, + "narHash": "sha256-JXfnuEf5Yd6bhMs/uvM67/joxYKoysyE3M2k6T3eWbg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9b19f5e77dd906cb52dade0b7bd280339d2a1f3d", + "rev": "612f97239e2cc474c13c9dafa0df378058c5ad8d", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index fce4b25..4ebf332 100644 --- a/flake.nix +++ b/flake.nix @@ -51,6 +51,16 @@ gpg = true; }; }; + + # For a special case: with the Steam Deck, we have to assume the user + # is named `deck` due to its immutable system image. + x86_64-linux.homeConfigurations.deck = homeManager { + system = "x86_64-linux"; + specialArgs = { + gpg = true; + username = "deck"; + }; + }; }; nixosModules.default = { diff --git a/home/home.nix b/home/home.nix index 74c52d3..638981f 100644 --- a/home/home.nix +++ b/home/home.nix @@ -8,22 +8,26 @@ let # Whether to configure various programs to leverage GPG. gpg = specialArgs.gpg or false; -in -{ + # It's standard convention that Darwin has the username - # "spot" - "spotlight" was reserved by the system at some point. + # "spot" - regretfully, "spotlight" is reserved by the system. # (Sigh... the downsides of sharing a namesake.) - home.username = + nativeUsername = if pkgs.stdenv.isDarwin then "spot" else "spotlight"; + username = specialArgs.username or nativeUsername; +in +{ + home.username = username; + home.homeDirectory = if pkgs.stdenv.isDarwin then - "/Users/spot" + "/Users/" + username else - "/home/spotlight"; + "/home/" + username; # Git programs.git = {