nixos/azure: simplify example image

authored by colemickens.tngl.sh and committed by Jon c2b2cc6d 20f981de

+17 -23
+5
nixos/maintainers/scripts/azure-new/README.md
··· 6 6 7 7 ## Usage 8 8 9 + This is meant to be an example image that you can copy into your own 10 + project and modify to your own needs. Notice that the example image 11 + includes a built-in test user account, which by default uses your 12 + `~/.ssh/id_ed25519.pub` as an `authorized_key`. 13 + 9 14 Build and upload the image 10 15 ```shell 11 16 $ ./upload-image.sh ./examples/basic/image.nix
+12 -23
nixos/maintainers/scripts/azure-new/examples/basic/system.nix
··· 1 1 { pkgs, modulesPath, ... }: 2 2 3 + let username = "azurenixosuser"; 4 + in 3 5 { 4 6 imports = [ 5 7 "${modulesPath}/virtualisation/azure-common.nix" 6 8 "${modulesPath}/virtualisation/azure-image.nix" 7 9 ]; 8 10 9 - ##### test user ###### 10 - users.extraGroups."cole".gid = 1000; 11 - users.extraUsers."cole" = { 12 - isNormalUser = true; 13 - home = "/home/cole"; 14 - description = "Cole Mickens"; 15 - 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)"]; 16 - #mkpasswd -m sha-512 17 - hashedPassword = "$6$k.vT0coFt3$BbZN9jqp6Yw75v9H/wgFs9MZfd5Ycsfthzt3Jdw8G93YhaiFjkmpY5vCvJ.HYtw0PZOye6N9tBjNS698tM3i/1"; 18 - uid = 1000; 19 - group = "cole"; 20 - }; 21 - nix.trustedUsers = [ "cole" ]; 22 - ##### test user ###### 11 + users.users."${username}" = { 12 + isNormalUser = true; 13 + home = "/home/${username}"; 14 + description = "Azure NixOS Test User"; 15 + openssh.authorizedKeys.keys = [ (builtins.readFile ~/.ssh/id_ed25519.pub) ]; 16 + }; 17 + nix.trustedUsers = [ username ]; 23 18 24 19 virtualisation.azureImage.diskSize = 2500; 25 20 26 21 system.stateVersion = "20.03"; 27 - networking.hostName = "azbuildworld"; 28 22 boot.kernelPackages = pkgs.linuxPackages_latest; 29 23 30 - #environment.noXlibs = true; 31 - #documentation.enable = false; 32 - #documentation.nixos.enable = false; 33 - 24 + # test user doesn't have a password 34 25 services.openssh.passwordAuthentication = false; 35 - programs.mosh.enable = true; 36 - 37 26 security.sudo.wheelNeedsPassword = false; 38 - 27 + 39 28 environment.systemPackages = with pkgs; [ 40 - git neovim jq file htop ripgrep cachix wget curl tmux zsh 29 + git file htop wget curl 41 30 ]; 42 31 }