Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming default user #381

Closed
blm768 opened this issue Oct 1, 2021 · 2 comments
Closed

Renaming default user #381

blm768 opened this issue Oct 1, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@blm768
Copy link
Contributor

blm768 commented Oct 1, 2021

I'm playing around with a basic DevOS configuration, and I'd like to rename the default user, but something seems to be hard-coded to refer to the nixos user. Here's what I've attempted so far:

  1. Start from commit 287cb82d.

  2. Run bud vm NixOS. The VM builds.

  3. Apply the following patch:

    diff --git a/flake.nix b/flake.nix
    index d87fdce..dfb458c 100644
    --- a/flake.nix
    +++ b/flake.nix
    @@ -123,7 +123,7 @@
                   users = digga.lib.rakeLeaves ./users;
                 };
                 suites = with profiles; rec {
    -              base = [ core users.nixos users.root ];
    +              base = [ core users.test users.root ];
                 };
               };
             };
    diff --git a/hosts/bootstrap.nix b/hosts/bootstrap.nix
    index d491855..04179ec 100644
    --- a/hosts/bootstrap.nix
    +++ b/hosts/bootstrap.nix
    @@ -8,7 +8,7 @@
         # profiles.networking
         profiles.core
         profiles.users.root # make sure to configure ssh keys
    -    profiles.users.nixos
    +    profiles.users.test
       ];
     
       boot.loader.systemd-boot.enable = true;
    diff --git a/users/nixos/default.nix b/users/test/default.nix
    similarity index 56%
    rename from users/nixos/default.nix
    rename to users/test/default.nix
    index 5c037fe..daed888 100644
    --- a/users/nixos/default.nix
    +++ b/users/test/default.nix
    @@ -1,10 +1,10 @@
     { hmUsers, ... }:
     {
    -  home-manager.users = { inherit (hmUsers) nixos; };
    +  home-manager.users = { inherit (hmUsers) test; };
     
    -  users.users.nixos = {
    +  users.users.test = {
         uid = 1000;
    -    password = "nixos";
    +    password = "test";
         description = "default";
         isNormalUser = true;
         extraGroups = [ "wheel" ];
  4. Now bud vm NixOS fails with the following:

    error: attribute 'test' missing
    
        at /nix/store/37v2bwx9ij1gnm226v7k3ydjm4knz0j2-source/users/test/default.nix:3:25:
    
             2| {
             3|   home-manager.users = { inherit (hmUsers) test; };
              |                         ^
             4|
    (use '--show-trace' to show detailed location information)
    

Reverting the change to the home-manager.users line produces a different error:

error:
       Failed assertions:
       - Exactly one of users.users.nixos.isSystemUser and users.users.nixos.isNormalUser must be set.
(use '--show-trace' to show detailed location information)

I got this to work with a previous version of the template, so if it's not immediately obvious what I'm missing, I can run a git bisect later when I have more time.

@blm768 blm768 added the bug Something isn't working label Oct 1, 2021
@montchr
Copy link
Collaborator

montchr commented Oct 1, 2021

@blm768
Copy link
Contributor Author

blm768 commented Oct 4, 2021

Have you tried changing nixos to test here?

You know, I'm pretty sure I did, and it worked. And then I realized I'd previously done something that messed up all my diffs, so I reverted everything, tried to walk back through the steps, and failed to find the option again. I assumed in my sleep-deprived stupor that I must have accidentally merged stuff from an older version of the template into the latest version or something.

Anyway, I've got this working now, so thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants