stuff
This commit is contained in:
1 parent
7a249c596a
commit
dbdd9034c9
5 files changed
+34
-11
No files matched your search
@@ -1,10 +1,27 @@
|
||||
# Nixos on GCP
|
||||
# Nixos on Google Cloud
|
||||
|
||||
## Building image
|
||||
|
||||
To build the gpc image use the below command
|
||||
|
||||
```shell
|
||||
nix build .#gcp
|
||||
```
|
||||
|
||||
Once the image has been built,
|
||||
|
||||
|
||||
```shell
|
||||
python upload.py --file result/nixos-image-...
|
||||
```
|
||||
|
||||
|
||||
|
||||
### GCE shit
|
||||
|
||||
|
||||
#### Metadata
|
||||
|
||||
```
|
||||
img_path=$(echo result/*.tar.gz)
|
||||
img_name=${IMAGE_NAME:-$(basename "$img_path")}
|
||||
img_id=$(echo "$img_name" | sed 's|.raw.tar.gz$||;s|\.|-|g;s|_|-|g')
|
||||
img_family=$(echo "$img_id" | cut -d - -f1-4)
|
||||
gcloud compute images create "$img_id" --source-uri "gs://${BUCKET_NAME}/$img_name" --family="$img_family"
|
||||
gcloud compute images add-iam-policy-binding "$img_id" --member='allAuthenticatedUsers' --role='roles/compute.imageUser'
|
||||
enable-oslogin: TRUE
|
||||
```
|
||||
@@ -18,7 +18,7 @@
|
||||
system = "x86_64-linux";
|
||||
|
||||
modules = [ ./gcp-configuration.nix ];
|
||||
format = "gce";
|
||||
format = "vm";
|
||||
|
||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
lib = nixpkgs.legacyPackages.x86_64-linux.lib;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
config = {
|
||||
system.stateVersion = "23.11";
|
||||
boot.kernel.sysctl."net.ipv4.ip_forward" = true;
|
||||
networking.hostName = "trainer-0001";
|
||||
|
||||
networking.nameservers = [ "8.8.8.8" ];
|
||||
|
||||
@@ -27,6 +28,8 @@
|
||||
};
|
||||
};
|
||||
|
||||
users.defaultUserShell = pkgs.zsh;
|
||||
|
||||
users.extraUsers.didier = {
|
||||
createHome = true;
|
||||
isNormalUser = true;
|
||||
@@ -35,6 +38,8 @@
|
||||
group = "users";
|
||||
extraGroups = [ "wheel" ];
|
||||
useDefaultShell = true;
|
||||
hashedPassword =
|
||||
"$6$tFmX1GFwslsmHJ6A$9O7jYzbo6hV2/ed39Y.ynhqoQbsPAiqTW5HR1CvnubWBysaOljPtUHlnqaPbvEkxdjUwuqHwhhvWIvsHsSMmF1";
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILtqtELim0nDxVG0j/IJc/ZcWYfFBCay8fVIw/16ieDy didier.amyot@all-dressed-programming.com"
|
||||
];
|
||||
@@ -54,5 +59,7 @@
|
||||
|
||||
services.openssh.settings.PasswordAuthentication = false;
|
||||
|
||||
programs.zsh.enable = true;
|
||||
|
||||
};
|
||||
}
|
||||
Binary file not shown.
@@ -29,15 +29,14 @@ def main(file, bucket_name):
|
||||
cmd = [
|
||||
'gsutil', 'cp', file, s3_loc
|
||||
]
|
||||
check_call(cmd)
|
||||
print(" ".join([str(s) for s in cmd]))
|
||||
# return
|
||||
|
||||
cmd = [
|
||||
'gcloud', 'compute','images','create', img_id,
|
||||
'--source-uri', s3_loc, '--family', img_family
|
||||
]
|
||||
# check_call(cmd)
|
||||
# print(' '.join(cmd))
|
||||
# return
|
||||
|
||||
cmd = [
|
||||
'gcloud', 'compute', 'images', 'add-iam-policy-binding',
|
||||
|
||||
Reference in new issue
Block a user