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

codd: init at 0.1.4 #338660

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mzabani
Copy link

@mzabani mzabani commented Aug 31, 2024

Description of changes

Codd is developed by me and is essentially a tool that applies postgresql SQL migrations. Its homepage is https://github.com/mzabani/codd

Feel free to be direct and point out anything wrong here. I never had contributions merged into nixpkgs before.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` label Aug 31, 2024
@mzabani mzabani changed the title Add postgresql migration tool codd codd: init at 0.1.4 Aug 31, 2024
@mzabani mzabani marked this pull request as ready for review August 31, 2024 17:37
@mzabani mzabani force-pushed the add-codd-postgres-migration-tool branch from d4e226a to d841b63 Compare September 1, 2024 11:52
Copy link
Contributor

@eclairevoyant eclairevoyant left a comment

Choose a reason for hiding this comment

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

looks okay to me but I've no haskell experience, will probably let others review

@mzabani
Copy link
Author

mzabani commented Sep 10, 2024

@eclairevoyant what is the typical flow when adding new packages? Should I ping the Haskell maintainers? Or maybe I should ask in the discourse thread for a review?

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/4622

@FliegendeWurst FliegendeWurst added the 11.by: upstream-developer This issue or PR was created by the developer of packaged software label Nov 3, 2024
"/SystemResourcesSpecs/"
];

description = "CLI tool that applies plain postgres SQL migrations atomically with strong and automatic cross-environment schema equality checks";
Copy link
Member

Choose a reason for hiding this comment

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

This and below need to be wrapped in a meta = block.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks! I tried that but then building led to an error. Maybe Haskell's mkDerivation is different and requires these as top-level attributes? That's what it seems like from looking at other Haskell packages like Koka:

https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/compilers/koka/default.nix#L100-L107

I rebased to resolve the conflict and pushed again just in case.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I didn't see that. Then it is okay.

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 9, 2024
@mzabani mzabani force-pushed the add-codd-postgres-migration-tool branch from d841b63 to f7af0ba Compare November 10, 2024 12:10
@@ -6130,6 +6130,8 @@ with pkgs;
clangStdenv = if stdenv.cc.isClang then stdenv else lowPrio llvmPackages.stdenv;
libcxxStdenv = if stdenv.hostPlatform.isDarwin then stdenv else lowPrio llvmPackages.libcxxStdenv;

codd = haskell.lib.compose.justStaticExecutables (haskellPackages.callPackage ../development/tools/database/codd { });
Copy link
Member

Choose a reason for hiding this comment

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

Should be in pkgs/by-name

Copy link
Author

Choose a reason for hiding this comment

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

Thanks. I followed the pkgs/by-name README and some other packages as examples. I hope I did the right thing.

"/SystemResourcesSpecs/"
];

description = "CLI tool that applies plain postgres SQL migrations atomically with strong and automatic cross-environment schema equality checks";
Copy link
Member

Choose a reason for hiding this comment

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

Oh, I didn't see that. Then it is okay.

@mzabani mzabani force-pushed the add-codd-postgres-migration-tool branch from 8c9ab25 to b81969f Compare November 10, 2024 13:46
typed-process
unliftio
];

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
testToolDepends = [ haskellPackages.hspec-discover ];

Copy link
Author

Choose a reason for hiding this comment

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

Thanks! I'm curious what this changes, as it seemed tests would run even if I didn't declare hspec-discover as a dependency.

Copy link
Member

Choose a reason for hiding this comment

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

It only matters if you set strictDeps = true. I'm currently trying strictDepsByDefault = true, which has already found a lot of issues like this.

pkgs/by-name/co/codd/generated.nix Outdated Show resolved Hide resolved
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 11, 2024
Comment on lines +1 to +3
# This was generated with cabal2nix but contains important modifications like jailbreaking haxl
# and disabling tests selectively, among a few other minor things.
# Don't just blindly replace it with something generated by cabal2nix.
Copy link
Contributor

Choose a reason for hiding this comment

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

Have a look at https://github.com/NixOS/nixpkgs/tree/master/pkgs/by-name/ni/nixfmt-rfc-style to see how this can be split up in a purely generated file and overrides for the modifications. This even includes an update script, which will give us auto-updates.

Can we do something like that here, too?

Copy link
Author

Choose a reason for hiding this comment

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

I took a look but having an additional script and running instructions felt a bit overkill. Unless this is the standard for all packages now, I'd prefer to keep this as is, particularly since I'm the author of the tool and will be keeping this up-to-date myself.

One intermediate approach is to do some splitting without a bash script, though. Let me know what you prefer!

Copy link
Contributor

Choose a reason for hiding this comment

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

The update script is entirely optional. My main point is maintainability: It's currently impossible for somebody else except you to handle updates etc., because of "Don't just blindly replace it with something generated by cabal2nix.". Only you know which changes you intended and which would be because of an update.

So you should really split the generated code from the intentional overrides.

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 8.has: maintainer-list (update) This PR changes `maintainers/maintainer-list.nix` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 10.rebuild-linux: 1 11.by: package-maintainer This PR was created by the maintainer of the package it changes 11.by: upstream-developer This issue or PR was created by the developer of packaged software
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants