-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Notes from a NixOS install #95
Comments
Thanks for sharing! Probably saved me from a long debugging session. On 3.6 I was getting away with my-headplane-3.6.nix |
Also @tecosaur regarding that issue you mentioned (48) I'm not clear as to what the issue is there, but if you are talking about sharing the generated yaml that headscale generates, to headplane I solved it like this: Note specifically this part let
....
settingsFormat = pkgs.formats.yaml {};
headscaleConfig = settingsFormat.generate "headscale-settings.yaml" config.services.headscale.settings;
in {
environment.etc."headscale/config.yaml".source =
lib.mkForce (settingsFormat.generate "headscale-config.yaml" config.services.headscale.settings); This is a more fleshed out config, but still severely trimmed down. { config, pkgs, pkgs-unstable, lib, ... }:
let
# .....
headscale_fqdn = "${headscale_host}.${headscale_tld}";
headplane_port = "3000";
headplanePkg = pkgs.callPackage ../packages/headplane.nix {};
settingsFormat = pkgs.formats.yaml {};
headscaleConfig = settingsFormat.generate "headscale-settings.yaml" config.services.headscale.settings;
in {
environment.etc."headscale/config.yaml".source =
lib.mkForce (settingsFormat.generate "headscale-config.yaml" config.services.headscale.settings);
services = {
headscale = {
enable = true;
address = "127.0.0.1";
port = 8080;
package = pkgs-unstable.headscale;
settings = {
server_url = "https://${headscale_fqdn}";
dns.base_domain = "internal-${headscale_fqdn}";
oidc = {
# .....
};
};
};
};
systemd.services.headplane = {
description = "Headplane Service";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${headplanePkg}/bin/headplane";
WorkingDirectory = "${headplanePkg}";
Restart = "always";
User = "headplane";
Group = "headplane";
EnvironmentFile = config.sops.secrets.headplane.path;
Environment = [
"HOST=127.0.0.1"
"PORT=${headplane_port}"
"HEADSCALE_INTEGRATION=proc"
"HEADSCALE_URL=https://${headscale_fqdn}"
"DEBUG=true"
"HEADSCALE_CONFIG_UNSTRICT=true"
];
};
};
} Hope that helps! |
Thanks for sharing, seems like a pretty similar solution, just writing the copy somewhere else. Along the lines of #48, it would be good if headplane might recognise read-only Configs and make the settings web page present itself as read-only to reflect that. |
Still WIP, I have a very big update coming out as Headplane 0.5 and that's planned with it. |
@tale that's awesome! Thanks. As a side note. If I made a PR with a Nix CI pipeline to test new builds would you be interested in adopting it? It seems we have a small community of people who want to use your project on Nix. |
@StealthBadger747 @tecosaur I believe Headplane should already support read-only config files, do you have debug logs that could indicate what is happening on startup. Also is the DNS/Settings tabs just completely hidden? |
As I mentioned in the other issue I just opened, I've managed to get this working on my NixOS server (in case it's of interest: https://code.tecosaur.net/tec/golgi/commit/53f3218c28168c7f619a1fd8de2093fe823d2f83)
Packaging was rather straightforward, except for these two hacks I seemed to need to do:
sed -i 's;/build/source/node_modules/react-router/dist/development/index.mjs;react-router;' $out/share/headplane/build/headplane/server.js
because the build path was hardcoded into some of the bundled codesed -i 's;define_process_env_default.PORT;process.env.PORT;' $out/share/headplane/build/headplane/server.js
because thePORT
envvar wasn't being loaded correctlyTo work around the read-only config file issue mentioned in #48, I run
cp ${headscale-config-copy} /tmp/headscale.yaml; chmod u+w /tmp/headscale.yaml'
as aExecStartPre
step in the service. I figure it will just get overwritten every time the service is started, but that's fine as a stop-gap.I thought I'd mention this here in case there's anything that can be done to remove the need for the packaging hacks I mention, and in case it helps anyone else :)
The text was updated successfully, but these errors were encountered: