diff --git a/nixos/maintainers/scripts/azure-new/README.md b/nixos/maintainers/scripts/azure-new/README.md index 1bc8d8a2938..ee1fc682534 100644 --- a/nixos/maintainers/scripts/azure-new/README.md +++ b/nixos/maintainers/scripts/azure-new/README.md @@ -6,6 +6,11 @@ Here's a demo of this being used: https://asciinema.org/a/euXb9dIeUybE3VkstLWLbv ## Usage +This is meant to be an example image that you can copy into your own +project and modify to your own needs. Notice that the example image +includes a built-in test user account, which by default uses your +`~/.ssh/id_ed25519.pub` as an `authorized_key`. + Build and upload the image ```shell $ ./upload-image.sh ./examples/basic/image.nix diff --git a/nixos/maintainers/scripts/azure-new/examples/basic/system.nix b/nixos/maintainers/scripts/azure-new/examples/basic/system.nix index 7e4d245d6cc..5f98216d183 100644 --- a/nixos/maintainers/scripts/azure-new/examples/basic/system.nix +++ b/nixos/maintainers/scripts/azure-new/examples/basic/system.nix @@ -1,42 +1,31 @@ { pkgs, modulesPath, ... }: +let username = "azurenixosuser"; +in { imports = [ "${modulesPath}/virtualisation/azure-common.nix" "${modulesPath}/virtualisation/azure-image.nix" ]; - ##### test user ###### - users.extraGroups."cole".gid = 1000; - users.extraUsers."cole" = { - isNormalUser = true; - home = "/home/cole"; - description = "Cole Mickens"; - openssh.authorizedKeys.keys = ["ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC9YAN+P0umXeSP/Cgd5ZvoD5gpmkdcrOjmHdonvBbptbMUbI/Zm0WahBDK0jO5vfJ/C6A1ci4quMGCRh98LRoFKFRoWdwlGFcFYcLkuG/AbE8ObNLHUxAwqrdNfIV6z0+zYi3XwVjxrEqyJ/auZRZ4JDDBha2y6Wpru8v9yg41ogeKDPgHwKOf/CKX77gCVnvkXiG5ltcEZAamEitSS8Mv8Rg/JfsUUwULb6yYGh+H6RECKriUAl9M+V11SOfv8MAdkXlYRrcqqwuDAheKxNGHEoGLBk+Fm+orRChckW1QcP89x6ioxpjN9VbJV0JARF+GgHObvvV+dGHZZL1N3jr8WtpHeJWxHPdBgTupDIA5HeL0OCoxgSyyfJncMl8odCyUqE+lqXVz+oURGeRxnIbgJ07dNnX6rFWRgQKrmdV4lt1i1F5Uux9IooYs/42sKKMUQZuBLTN4UzipPQM/DyDO01F0pdcaPEcIO+tp2U6gVytjHhZqEeqAMaUbq7a6ucAuYzczGZvkApc85nIo9jjW+4cfKZqV8BQfJM1YnflhAAplIq6b4Tzayvw1DLXd2c5rae+GlVCsVgpmOFyT6bftSon/HfxwBE4wKFYF7fo7/j6UbAeXwLafDhX+S5zSNR6so1epYlwcMLshXqyJePJNhtsRhpGLd9M3UqyGDAFoOQ== (none)"]; - #mkpasswd -m sha-512 - hashedPassword = "$6$k.vT0coFt3$BbZN9jqp6Yw75v9H/wgFs9MZfd5Ycsfthzt3Jdw8G93YhaiFjkmpY5vCvJ.HYtw0PZOye6N9tBjNS698tM3i/1"; - uid = 1000; - group = "cole"; - }; - nix.trustedUsers = [ "cole" ]; - ##### test user ###### + users.users."${username}" = { + isNormalUser = true; + home = "/home/${username}"; + description = "Azure NixOS Test User"; + openssh.authorizedKeys.keys = [ (builtins.readFile ~/.ssh/id_ed25519.pub) ]; + }; + nix.trustedUsers = [ username ]; virtualisation.azureImage.diskSize = 2500; system.stateVersion = "20.03"; - networking.hostName = "azbuildworld"; boot.kernelPackages = pkgs.linuxPackages_latest; - #environment.noXlibs = true; - #documentation.enable = false; - #documentation.nixos.enable = false; - + # test user doesn't have a password services.openssh.passwordAuthentication = false; - programs.mosh.enable = true; - security.sudo.wheelNeedsPassword = false; - + environment.systemPackages = with pkgs; [ - git neovim jq file htop ripgrep cachix wget curl tmux zsh + git file htop wget curl ]; }