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

Support NixOS & home-manager's stable branches #155

Closed
getchoo opened this issue Apr 30, 2024 · 5 comments · Fixed by #182
Closed

Support NixOS & home-manager's stable branches #155

getchoo opened this issue Apr 30, 2024 · 5 comments · Fixed by #182
Labels
help wanted Extra attention is needed
Milestone

Comments

@getchoo
Copy link
Member

getchoo commented Apr 30, 2024

i.e., 23.11, 24.05. for now we target and test against nixos-unstable and the master branch of home-manager

recommendations on how to approach this are welcome :)

@getchoo getchoo added the help wanted Extra attention is needed label Apr 30, 2024
@vdbe
Copy link
Contributor

vdbe commented Apr 30, 2024

Maybe something like

  mkVersionedOpt = minimumVersion: opt:
    if (lib.strings.versionAtLeast
      (config.home.version.release or config.system.nixos.version)
      minimumVersion)
    then opt
    else lib.options.mkSinkUndeclaredOptions { };
  options.programs.tofi = ctp.mkVersionedOpt "24.05" {
    catppuccin = ctp.mkCatppuccinOpt "tofi";
  };

Tested it with https://github.com/Misterio77/nix-starter-configs and it builds.

Don't know the best way to get the home manager version (hardcoded to "23.05" here), maybe lib.version but that is from nixpkgs not home manager.

https://github.com/vdbe/catppuccin-nix/tree/feat/versioned-options

@Lichthagel
Copy link
Contributor

Don't know the best way to get the home manager version (hardcoded to "23.05" here), maybe lib.version but that is from nixpkgs not home manager.

There is config.home.version.release: https://github.com/nix-community/home-manager/blob/f8e6694edabe4aaa7a85aac47b43ea5d978b116d/modules/misc/version.nix#L53-L60

@vdbe
Copy link
Contributor

vdbe commented Apr 30, 2024

Forgot that internal doesn't show on search.

config.home.version.release or config.system.nixos.version would work covers home manager and nixos.

@vdbe
Copy link
Contributor

vdbe commented Apr 30, 2024

Was trying to add a warning, but don't think it is possible:

  • else lib.trivial.warn "warning" (lib.options.mkSinkUndeclaredOptions {}); and else lib.options.mkSinkUndeclaredOptions (lib.trivial.warn "warning" {}); warn always.
  • else lib.options.mkSinkUndeclaredOptions {default = lib.trivial.warn "warning" opt;}; never warns.

@becknik
Copy link

becknik commented May 4, 2024

I'm using nixos & home-manager 23.11 and am currently stuck in a

       error: attribute 'enable' missing

       at /nix/store/flqfgj6fnp3cqfy19041lw4j1lhds76n-home-manager/tofi.nix:9:26:

            8|   cfg = config.programs.tofi.catppuccin;
            9|   enable = cfg.enable && config.programs.tofi.enable;
             |                          ^
           10| in

I don't have any experience in the maintenance in multi-version targeting projects, but I'd use git branches for the version separations. This would avoid cluttering the source code and enable easy backporting if a component of home-manager/ nixos gets backported too (if there is the wish to do this, of course).
E.g. the nixvim project handles it like this.

becknik added a commit to becknik/dotfiles.nix that referenced this issue May 4, 2024
Had to remove the catpuccin update manually due to following open issue:
catppuccin/nix#155
@getchoo getchoo added this to the 1.0.0 milestone May 14, 2024
becknik added a commit to becknik/dotfiles.nix that referenced this issue May 14, 2024
Had to remove the catpuccin update manually due to following issue:
catppuccin/nix#155
becknik added a commit to becknik/dotfiles.nix that referenced this issue May 18, 2024
    Flake lock file updates:

    • ~~Updated input 'catppuccin'~~ catppuccin/nix#155
    • Updated input 'darwin':
        'github:lnl7/nix-darwin/de8b0d60d6fd34f35abffc46adc94ebaa6996ce2' (2024-05-14)
      → 'github:lnl7/nix-darwin/ffc01182f90118119930bdfc528c1ee9a39ecef8' (2024-05-16)
    • Updated input 'devenv':
        'github:cachix/devenv/725c90407ef53cc2a1b53701c6d2d0745cf2484f' (2024-05-13)
      → 'github:cachix/devenv/c30bdfd2c289e77e9d278ac0d9262d856b17f324' (2024-05-17)
    • Updated input 'disko':
        'github:nix-community/disko/e972a78f4a49cd92075d64b6feeef64d26bf2996' (2024-05-13)
      → 'github:nix-community/disko/5f6dbcce99d60dd77f96dfc66d06bbea149a40e1' (2024-05-16)
    • Updated input 'nixos-hardware':
        'github:NixOS/nixos-hardware/a4e2b7909fc1bdf30c30ef21d388fde0b5cdde4a' (2024-05-08)
      → 'github:NixOS/nixos-hardware/b55712de78725c8fcde422ee0a0fe682046e73c3' (2024-05-18)
    • Updated input 'nixpkgs':
        'github:NixOS/nixpkgs/44072e24566c5bcc0b7aa9178a0104f4cfffab19' (2024-05-12)
      → 'github:NixOS/nixpkgs/bacb8503d3a51d9e9b52e52a1ba45e2c380ad07d' (2024-05-17)
    • Updated input 'nixpkgs-unstable':
        'github:NixOS/nixpkgs/2057814051972fa1453ddfb0d98badbea9b83c06' (2024-05-12)
      → 'github:NixOS/nixpkgs/33d1e753c82ffc557b4a585c77de43d4c922ebb5' (2024-05-15)
    • Updated input 'nixvim':
        'github:nix-community/nixvim/4530a35bad28a0e8b21905b0817a225e6387811c' (2024-05-13)
      → 'github:nix-community/nixvim/7c4fe30f814595bc617d6b1b682ab9cbfe535d33' (2024-05-17)
    • Updated input 'nixvim/nix-darwin':
        'github:lnl7/nix-darwin/230a197063de9287128e2c68a7a4b0cd7d0b50a7' (2024-04-24)
      → 'github:lnl7/nix-darwin/de8b0d60d6fd34f35abffc46adc94ebaa6996ce2' (2024-05-14)
    • Updated input 'nixvim/pre-commit-hooks':
        'github:cachix/pre-commit-hooks.nix/2849da033884f54822af194400f8dff435ada242' (2024-04-30)
      → 'github:cachix/pre-commit-hooks.nix/c182c876690380f8d3b9557c4609472ebfa1b141' (2024-05-13)
    • Updated input 'ohmyzsh':
        'github:ohmyzsh/ohmyzsh/b1c5315a5fbc33624525e434ddbaec3bb30030e2' (2024-05-12)
      → 'github:ohmyzsh/ohmyzsh/a779d6563ffb2f0093b4b74c8d5ff0982fa3e930' (2024-05-16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants