GithubHelp home page GithubHelp logo

Comments (5)

Lichthagel avatar Lichthagel commented on August 26, 2024 1

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

from nix.

vdbe avatar vdbe commented on August 26, 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

from nix.

vdbe avatar vdbe commented on August 26, 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.

from nix.

vdbe avatar vdbe commented on August 26, 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.

from nix.

becknik avatar becknik commented on August 26, 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.

from nix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.