Compare commits

...
15 Commits
13 changed files with 222 additions and 83 deletions
+10
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
```
+1 -1
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() {
Generated
+35 -51
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"
} }
} }
}, },
+19 -6
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,13 +83,20 @@
]; ];
}; };
test-vm = inputs.nixpkgs.lib.nixosSystem { test-vm =
system = "x86_64-linux"; let
specialArgs = { system = "x86_64-linux";
inherit inputs; in
inputs.nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
};
modules = [
./hosts/test-vm/configuration.nix
inputs.whib-backend.nixosModules.${system}.default
];
}; };
modules = [ ./hosts/test-vm/configuration.nix ];
};
}; };
devShells = devShells =
+2
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
+2 -1
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
+7 -1
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 =
+4 -1
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 = {
+29 -14
View File
@@ -16,24 +16,39 @@ 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 =
# (pkgs.callPackage ./pants.nix { inherit (pkgs) system; }) let
(pkgs.callPackage ./syb-cli.nix { }) 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 ./syb-cli.nix { })
(pkgs.jetbrains.plugins.addPlugins pkgs.jetbrains.idea-ultimate [ "ideavim" ]) (pkgs.jetbrains.plugins.addPlugins intellij [ "ideavim" ])
(pkgs.google-cloud-sdk.withExtraComponents [
pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin
])
pkgs.graphite-cli (pkgs.google-cloud-sdk.withExtraComponents [
pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin
])
pkgs.postman pkgs.graphite-cli
pkgs.grpcurl
# for `radio` pkgs.postman
pkgs.go-mockery pkgs.grpcurl
pkgs.golangci-lint
]; # for `radio`
pkgs.go-mockery
pkgs.golangci-lint
];
programs.go = lib.mkIf goEnabled { programs.go = lib.mkIf goEnabled {
goPrivate = [ "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.work-go-private.path})" ]; goPrivate = [ "$(${pkgs.coreutils}/bin/cat ${config.age.secrets.work-go-private.path})" ];
+17 -1
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";
+89
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;
}
];
};
};
};
}
+1
View File
@@ -0,0 +1 @@
abc123
+6 -7
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
³¬W7Lõg)]¦©å<6;U‰Ð\îí ‘´ôE¬ '—rû|j„±.ØÉ­ÛìŸ{ÈA–ª_4ž§qêMÿmE7¨“Ù¾š ´þŸGT3çyÝ,Bëö÷­ïͶKËÔÊLÀa;&ÝžÚ
rÞã‰A•Ñú'Õ8|ÝxXÊãèjÞœ¥=#TùήÕ§¥/