Compare commits

...

15 Commits

Author SHA1 Message Date
Alexander Heldt
19a0c3d97d wip 2024-12-01 13:39:11 +01:00
Alexander Heldt
189cd4fe35 wip 2024-12-01 10:22:45 +01:00
Alexander Heldt
b19d28c442 test-vm: Add WHIB backend 2024-12-01 10:22:05 +01:00
Alexander Heldt
105aed70b4 Update README with documentation about the test-vm 2024-12-01 10:20:11 +01:00
Alexander Heldt
506f0574de test-vm: Resize terminal to host terminal size 2024-12-01 10:20:11 +01:00
Alexander Heldt
943db9b011 test-vm: Add alias of shutting down the VM 2024-12-01 10:20:11 +01:00
Alexander Heldt
045bfd269b test-vm: Auto login a user and assume its sudo 2024-12-01 10:20:11 +01:00
Alexander Heldt
b922b286b4 test-vm: Increase disk size 2024-12-01 10:20:11 +01:00
Alexander Heldt
5ab0ac4828 pinwheel: Add volume sharing for vms 2024-11-28 18:26:28 +01:00
Alexander Heldt
a3133defeb config-manager: Fix --update 2024-11-28 18:25:55 +01:00
Alexander Heldt
94e35677a6 pinwheel: Fix hyprland "smart gaps" 2024-11-28 18:25:38 +01:00
Alexander Heldt
bdb8df947f Update flake inputs 2024-11-28 18:25:27 +01:00
Alexander Heldt
52567105ff pinwheel: Update work github token 2024-11-25 08:47:50 +01:00
Alexander Heldt
f8b39ee30c pinwheel: Set intellij version to 2024.2.4 in for work 2024-11-24 19:08:59 +01:00
Alexander Heldt
c80e053c1c pinwheel: Indent js code in emacs with spaces 2024-11-21 08:55:25 +01:00
13 changed files with 222 additions and 83 deletions

View File

@@ -25,3 +25,13 @@ EDITOR=vim agenix -d "some-secret.age" -i ~/.ssh/alex.pinwheel
Or use some other SSH key that is has been used to key the secret. Or use some other SSH key that is has been used to key the secret.
# Test VM
Build the test VM with the command:
```
cm --build-test-vm
```
and test it with:
```
cm --run-test-vm
```

View File

@@ -33,7 +33,7 @@ let
update() { update() {
echo -e "\033[0;31mUPDATING FLAKE\033[0m" echo -e "\033[0;31mUPDATING FLAKE\033[0m"
nix flake update ${flakePath} nix flake update --flake ${flakePath}
} }
switch() { switch() {

86
flake.lock generated
View File

@@ -47,18 +47,17 @@
}, },
"emacs-overlay": { "emacs-overlay": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1730513067, "lastModified": 1732784553,
"narHash": "sha256-0MHc5yR4qmQK4O8MzraisT3gnv907fn813Qb2J134CU=", "narHash": "sha256-S3PiqgTS8ST07ihFDL2cPExoxHcd9I8ITecpgMz+s4M=",
"owner": "nix-community", "owner": "nix-community",
"repo": "emacs-overlay", "repo": "emacs-overlay",
"rev": "6afb2183cef03dcfce47c3bf22b2d44ded54ace0", "rev": "fb81e75180369a888db920df8f6097fbf2f603e9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -67,24 +66,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -113,11 +94,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1730490306, "lastModified": 1732793095,
"narHash": "sha256-AvCVDswOUM9D368HxYD25RsSKp+5o0L0/JHADjLoD38=", "narHash": "sha256-6TrknJ8CpvSSF4gviQSeD+wyj3siRcMvdBKhOXkEMKU=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "1743615b61c7285976f85b303a36cdf88a556503", "rev": "2f7739d01080feb4549524e8f6927669b61c6ee3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -133,11 +114,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1729224425, "lastModified": 1730743354,
"narHash": "sha256-w9dNUedNe2qnhHuhcRf7A1l29+/6DxdMfwN6g4U3c/w=", "narHash": "sha256-gU4NySYyXeAzVaF5bI6BKmj2CdgiwGFnuPjXUId3Dx0=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "contrib", "repo": "contrib",
"rev": "d72bc8b1cd30d448bd438e8328f8eeb4c0f2ddb6", "rev": "792f6b83dc719214e0e2a0b380c34f147b28ece2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -153,11 +134,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1728371783, "lastModified": 1732782112,
"narHash": "sha256-ufI7115ims2PPxggpWQhigAUrwlwu155wVgngZzzyZ0=", "narHash": "sha256-8rxzWGOVyijmE2ojWJxPEWqtUQ7i/lA5TvLoklwI4qw=",
"owner": "viperML", "owner": "viperML",
"repo": "nh", "repo": "nh",
"rev": "afdff9ab4fdb9c329b5d97c5b742242b97f8754d", "rev": "24293d624556d32bd502c440b352e4fef4eeab6d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -183,11 +164,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1730537918, "lastModified": 1732483221,
"narHash": "sha256-GJB1/aaTnAtt9sso/EQ77TAGJ/rt6uvlP0RqZFnWue8=", "narHash": "sha256-kF6rDeCshoCgmQz+7uiuPdREVFuzhIorGOoPXMalL2U=",
"owner": "nixos", "owner": "nixos",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "f6e0cd5c47d150c4718199084e5764f968f1b560", "rev": "45348ad6fb8ac0e8415f6e5e96efe47dd7f39405",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -199,11 +180,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1730200266, "lastModified": 1732521221,
"narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=", "narHash": "sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", "rev": "4633a7c72337ea8fd23a4f2ba3972865e3ec685d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -215,11 +196,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1730327045, "lastModified": 1732632634,
"narHash": "sha256-xKel5kd1AbExymxoIfQ7pgcX6hjw9jCgbiBjiUfSVJ8=", "narHash": "sha256-+G7n/ZD635aN0sEXQLynU7pWMd3PKDM7yBIXvYmjABQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "080166c15633801df010977d9d7474b4a6c549d7", "rev": "6f6076c37180ea3a916f84928cf3a714c5207a30",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -260,7 +241,8 @@
"nix-gc-env": "nix-gc-env", "nix-gc-env": "nix-gc-env",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"pppdotpm-site": "pppdotpm-site" "pppdotpm-site": "pppdotpm-site",
"whib-backend": "whib-backend"
} }
}, },
"systems": { "systems": {
@@ -278,19 +260,21 @@
"type": "github" "type": "github"
} }
}, },
"systems_2": { "whib-backend": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1733056232,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-TlGxaIEzV+4dithjWT4xtl/yOgayHIqZqj7okKufF8E=",
"owner": "nix-systems", "path": "/home/alex/code/own/whib",
"repo": "default", "type": "path"
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
}, },
"original": { "original": {
"owner": "nix-systems", "path": "/home/alex/code/own/whib",
"repo": "default", "type": "path"
"type": "github"
} }
} }
}, },

View File

@@ -37,6 +37,12 @@
url = "git+ssh://gitea@git.ppp.pm:1122/alex/ppp.pm-site.git?ref=main"; url = "git+ssh://gitea@git.ppp.pm:1122/alex/ppp.pm-site.git?ref=main";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
whib-backend = {
# url = "git+ssh://gitea@git.ppp.pm:1122/alex/whib.git?ref=nix-flake";
url = "path:/home/alex/code/own/whib";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =
@@ -77,12 +83,19 @@
]; ];
}; };
test-vm = inputs.nixpkgs.lib.nixosSystem { test-vm =
let
system = "x86_64-linux"; system = "x86_64-linux";
in
inputs.nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { specialArgs = {
inherit inputs; inherit inputs;
}; };
modules = [ ./hosts/test-vm/configuration.nix ]; modules = [
./hosts/test-vm/configuration.nix
inputs.whib-backend.nixosModules.${system}.default
];
}; };
}; };

View File

@@ -14,6 +14,8 @@
home.homeDirectory = "/home/alex"; home.homeDirectory = "/home/alex";
home.packages = [ home.packages = [
inputs.whib-backend.packages.${pkgs.system}.whib-import
pkgs.beekeeper-studio
pkgs.bitwarden-desktop pkgs.bitwarden-desktop
pkgs.gimp pkgs.gimp
pkgs.zip pkgs.zip

View File

@@ -604,7 +604,8 @@ Setup prefix for keybindings.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq (setq
js-indent-level 2 js-indent-level 2
js2-basic-offset 2) js2-basic-offset 2
indent-tabs-mode nil)
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))
#+END_SRC #+END_SRC

View File

@@ -42,6 +42,13 @@ in
workspace = 9, monitor:eDP-1 workspace = 9, monitor:eDP-1
workspace = 10, monitor:eDP-1 workspace = 10, monitor:eDP-1
workspace = w[tv1], gapsout:0, gapsin:0
workspace = f[1], gapsout:0, gapsin:0
windowrulev2 = bordersize 0, floating:0, onworkspace:w[tv1]
windowrulev2 = rounding 0, floating:0, onworkspace:w[tv1]
windowrulev2 = bordersize 0, floating:0, onworkspace:f[1]
windowrulev2 = rounding 0, floating:0, onworkspace:f[1]
exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
''; '';
@@ -84,7 +91,6 @@ in
dwindle = { dwindle = {
force_split = 2; force_split = 2;
no_gaps_when_only = 1;
}; };
bind = bind =

View File

@@ -17,7 +17,10 @@ in
config = lib.mkIf enabled { config = lib.mkIf enabled {
virtualisation = { virtualisation = {
spiceUSBRedirection.enable = true; # Allow redirecting USB to the VM spiceUSBRedirection.enable = true; # Allow redirecting USB to the VM
libvirtd.enable = true; libvirtd = {
enable = true;
qemu.vhostUserPackages = [ pkgs.virtiofsd ];
};
}; };
users.users.alex = { users.users.alex = {

View File

@@ -16,11 +16,26 @@ in
GITHUB_TOKEN = "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.work-github-token.path})"; GITHUB_TOKEN = "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.work-github-token.path})";
}; };
home.packages = [ home.packages =
let
intellij = (
pkgs.jetbrains.idea-ultimate.overrideAttrs (
final: prev: {
version = "2024.2.4";
src = pkgs.fetchurl {
url = "https://download.jetbrains.com/idea/ideaIU-${final.version}.tar.gz";
sha256 = "8411fda793a20356a4982e4f18f6691839d8a471e2081ab6d8cc78b3f8b02532";
};
}
)
);
in
[
# (pkgs.callPackage ./pants.nix { inherit (pkgs) system; }) # (pkgs.callPackage ./pants.nix { inherit (pkgs) system; })
(pkgs.callPackage ./syb-cli.nix { }) # (pkgs.callPackage ./syb-cli.nix { })
(pkgs.jetbrains.plugins.addPlugins intellij [ "ideavim" ])
(pkgs.jetbrains.plugins.addPlugins pkgs.jetbrains.idea-ultimate [ "ideavim" ])
(pkgs.google-cloud-sdk.withExtraComponents [ (pkgs.google-cloud-sdk.withExtraComponents [
pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin
]) ])

View File

@@ -2,6 +2,7 @@
{ {
imports = [ imports = [
./ppp.pm-site.nix ./ppp.pm-site.nix
./whib-backend.nix
]; ];
config = { config = {
@@ -10,7 +11,8 @@
networking.hostName = "test-vm"; networking.hostName = "test-vm";
mod = { mod = {
pppdotpm-site.enable = true; pppdotpm-site.enable = false;
whib-backend.enable = true;
}; };
users.users.a = { users.users.a = {
@@ -18,16 +20,30 @@
extraGroups = [ "wheel" ]; extraGroups = [ "wheel" ];
password = "a"; password = "a";
}; };
services.getty.autologinUser = "a";
security.sudo.wheelNeedsPassword = false;
virtualisation.vmVariant = { virtualisation.vmVariant = {
# following configuration is added only when building VM with build-vm # following configuration is added only when building VM with build-vm
virtualisation = { virtualisation = {
diskSize = 4096;
memorySize = 2048; memorySize = 2048;
cores = 3; cores = 3;
graphics = false; graphics = false;
}; };
}; };
# Resize terminal to host terminal size
environment.loginShellInit = ''
${pkgs.xterm}/bin/resize
echo alias 'sd' can be used to shutdown the VM
'';
environment.interactiveShellInit = ''
alias sd='sudo shutdown now'
'';
environment.systemPackages = [ ]; environment.systemPackages = [ ];
system.stateVersion = "24.05"; system.stateVersion = "24.05";

View File

@@ -0,0 +1,89 @@
{
pkgs,
lib,
config,
...
}:
let
enabled = config.mod.whib-backend.enable;
in
{
options = {
mod.whib-backend = {
enable = lib.mkEnableOption "enable WHIB backend";
};
};
config = lib.mkIf enabled {
environment.systemPackages = [ pkgs.gnupg ];
services.whib-backend = {
enable = true;
domain = "whib-backend.local";
backend = {
signingKey = "super-secret-key";
};
postgres = {
password = "postgrespassword";
backup = {
gpgPassphraseFile = ./whib-gpgPassfile;
backblazeBucket = "whib-postgres-backups";
backblazeKeyID = "003867c33cd1a9b0000000003";
backblazeKey = "K003+GUNG0lwTOMS5EheKC9YzgxFzuU";
};
};
grafana = {
password = "granfanapassword";
};
};
virtualisation.vmVariant = {
virtualisation = {
sharedDirectories = {
my-shared = {
source = "/home/alex/whib-backup";
target = "/mnt/shared";
};
};
forwardPorts = [
{
# Service API
from = "host";
host.port = 8080;
guest.port = 8080;
}
{
# Service Metrics
from = "host";
host.port = 8181;
guest.port = 8181;
}
{
# Postgres
from = "host";
host.port = 5432;
guest.port = 5432;
}
{
# Grafana
from = "host";
host.port = 3000;
guest.port = 3000;
}
{
# Prometheus
from = "host";
host.port = 9090;
guest.port = 9090;
}
];
};
};
};
}

View File

@@ -0,0 +1 @@
abc123

View File

@@ -1,8 +1,7 @@
age-encryption.org/v1 age-encryption.org/v1
-> ssh-ed25519 vxPbZg Bmvy3//fQLVj/L4NPxOJ97lZi3mnr4JRYd4LMsQhZFo -> ssh-ed25519 vxPbZg kPlQg/h4GOsYY4xhXBt7tf3FKpRLKcCWJ++qzFyEW0U
AUKgDUPbXxY9hdvw/p227xJs1zy97bZdzSq+dU8SvjI HPEO63dlU+IxFyRH11bBRDi0mCeW8CGgMChm6s62JHs
-> ssh-ed25519 +oNaHQ GLTMdsKIZZQBuTUQGfNvow1vawla7/MHIBHMzeIjp1w -> ssh-ed25519 +oNaHQ uVezQzhewJvvudpJHCqFDRikj/J4tJXN85ESjkXoJjU
HcbCdXR0TkTe7MxctOubSCB00zc2LD8mmQsluhYxIMs cGUGizHtXZ/d+vO9jVoURNC19vHo77rXq5Cnd4cRwUU
--- jg1CbPpvJyFLXfpizH6ibgJ8Fil8lsxjpysOk2QOJks --- DtoPmQklXZeD4zDS/wJvQhx26S8kM2S64Rf9R+AlO2Y
<05><>W7L<>g)]<5D><><EFBFBD><EFBFBD><6;U<><1C>\<5C><> <20><><EFBFBD>E<EFBFBD> '<1B>r<EFBFBD>|j<><6A>.<2E>ɭ<EFBFBD><C9AD><EFBFBD>{<7B>A<><41>_4<5F><34>q<EFBFBD>M<EFBFBD>mE7<><37>پ<EFBFBD>
r<EFBFBD><EFBFBD><01>A<EFBFBD><41><EFBFBD>'<06>8|<7C>xX<78><58><EFBFBD><6A>=#Tùήէ<>/