Skip to content
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

Add appName To options for flake. #1993

Merged
merged 5 commits into from
Aug 1, 2024

Conversation

Montmorency
Copy link
Contributor

@Montmorency Montmorency commented Jul 26, 2024

When hosting multiple ihp apps on a particular server it is helpful for debugging/maintenance/tooling to be able to inspect which binaries are in the production servers /nix/store by their name (not just hash). This is consistent with all other nixpkgs that contain the hash and the package name in the store.

For managed production clusters it is also nice for roll back to be able to give semver names to app packages so that it is easy to instantly roll back to a prev version of app binary on a prod server if required. This PR adds option of appName to ihp flake-modules so users can specify the appName. The appName option gets passed all the way to ihp's (un)optimized-prod-server package mkDerivation (where it is called name and is a standard attribute for nix's mkDerivation.). We could call it name at the top level so it matches specifically but in the context of the app level flake it is probably less ambiguous to call it appName.

Furthermore having an appName option at top level flake has been found useful for a number of other IHP production helpers i.e. scripts to synchronize databases and deploy to servers etc. that can leverage the appName variable as well.

Copy link
Member

@mpscholten mpscholten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

flake-module.nix Outdated
Comment on lines 55 to 62
appName = lib.mkOption {
description =''
The derivation name.
Can be omitted if pname and version are set, in which case it is automatically set to ''${pname}-''${version}.
'';
type= lib.types.str;
default="app";
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation here is messed up.

Also Can be omitted if pname and version are set, in which case it is automatically set to ''${pname}-''${version}. can be removed

flake-module.nix Outdated
@@ -139,6 +148,7 @@ ihpFlake:
pkgs = pkgs;
rtsFlags = cfg.rtsFlags;
optimizationLevel = cfg.optimizationLevel;
appName=cfg.appName;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
appName=cfg.appName;
appName = cfg.appName;

flake-module.nix Outdated
@@ -152,6 +162,7 @@ ihpFlake:
pkgs = pkgs;
rtsFlags = cfg.rtsFlags;
optimizationLevel = "0";
appName=cfg.appName;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
appName=cfg.appName;
appName = cfg.appName;

@Montmorency
Copy link
Contributor Author

Fixed comments, indentation and whitespace.

Copy link
Member

@mpscholten mpscholten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@mpscholten mpscholten merged commit 040d1b2 into digitallyinduced:master Aug 1, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants