!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

465 Members
Rust111 Servers

Load older messages


SenderMessageTime
19 Aug 2024
@blitz:chat.x86.lolblitzDo you have module.nix as well?08:18:27
@simon.brandner:envs.netŠimon BrandnerSure08:18:35
@simon.brandner:envs.netŠimon Brandner
{
  lib,
  config,
  pkgs,
  ...
}: let
  cfg = config.programs.oblichey;
in
  with lib; {
    options.programs.oblichey = {
      enable = mkEnableOption "oblichey";
      package = mkOption {
        type = types.package;
        default = pkgs.callPackage ./package.nix {};
        description = ''
          The oblichey package to use.
        '';
      };
      settings = {
        camera = {
          path = mkOption {
            type = types.str;
            description = "Path to the IR camera to be used.";
          };
        };
      };
    };
    config = mkIf cfg.enable {
      environment.etc."oblichey.toml".text = ''
        [camera]
        path=${cfg.settings.camera.path}
      '';
    };
  }
08:19:17
@blitz:chat.x86.lolblitzIn module.nix you do pkgs.callPackage to build your program. This pkgs is the one where you use the module. I assume this is where your problem comes from 08:20:30
@blitz:chat.x86.lolblitzThe quick fix would be in your NixOS config to manually set the package option of this module to the package output of the flake 08:21:31
@blitz:chat.x86.lolblitzThis is a pretty common issue with flakes and modules. 08:21:56
@samasaur:matrix.orgsamasaur I think the real fix is running nix flake lock --update-input nixpkgs in your nixos config 08:22:10
@blitz:chat.x86.lolblitzBut it 'works as designed'08:22:11
@blitz:chat.x86.lolblitzOr that :)08:22:19
@simon.brandner:envs.netŠimon Brandner Not sure I follow - I would think this would be the pkgs specified in the flake.lock of the app's flake... 08:23:04
@simon.brandner:envs.netŠimon Brandner
In reply to @samasaur:matrix.org
I think the real fix is running nix flake lock --update-input nixpkgs in your nixos config
(I am blocked by a few things 😅)
08:23:24
@samasaur:matrix.orgsamasaurhonestly I would have thought so too but the error you’re getting seems to be an issue with nixpkgs being out of date08:23:56
@samasaur:matrix.orgsamasaurand given that building standalone is working I am assuming the issue is with your nixos config flake08:24:16
@samasaur:matrix.orgsamasaursince idk where else nixpkgs could be coming from08:24:28
@samasaur:matrix.orgsamasaurmight be something about how the module system means that it is using the nixpkgs that made the nixosSystem08:25:35
@samasaur:matrix.orgsamasaur
In reply to @blitz:chat.x86.lol
The quick fix would be in your NixOS config to manually set the package option of this module to the package output of the flake
this is probably the right solution for your use case
08:25:51
@samasaur:matrix.orgsamasaurif you can’t update the nixpkgs input of your config flake08:26:16
@simon.brandner:envs.netŠimon BrandnerHmm, it seems to be building now08:29:09
@simon.brandner:envs.netŠimon BrandnerI would expect this to be a very common problem and I don't really understand why it works this way...08:29:46
@blitz:chat.x86.lolblitzYou might want to try the NixOS discourse for these kinds of questions 08:29:55
@simon.brandner:envs.netŠimon BrandnerIs there another way to use a flake in my system config?08:29:58
@blitz:chat.x86.lolblitzIt's a problem with how the module is written 08:31:40
@simon.brandner:envs.netŠimon BrandnerHow should I write it instead?08:31:55
@blitz:chat.x86.lolblitzhttps://flake.parts/define-module-in-separate-file <- flake parts has a solution for this exact problem but it has its own steep learning curve 08:32:47
@blitz:chat.x86.lolblitzYou have to use outputs.packages... to define the default of the package option and not callPackage again 08:33:49
@blitz:chat.x86.lolblitzThe quick version would be to pass the flake's self parameter to the module 08:34:16
@blitz:chat.x86.lolblitzBut I'm currently sitting in a plane and can't directly edit your example. If you post it on discourse I'm sure someone can help you improve the module 08:35:00
@simon.brandner:envs.netŠimon BrandnerSounds good, I'll look at the link and possibly post on discourse08:39:15
@simon.brandner:envs.netŠimon Brandner
In reply to @blitz:chat.x86.lol
But I'm currently sitting in a plane and can't directly edit your example. If you post it on discourse I'm sure someone can help you improve the module
Here: https://discourse.nixos.org/t/nixos-module-using-system-nixpkgs-instead-of-the-nixpkgs-specified-in-the-modules-flake/50816
09:22:30
@mightyiam:matrix.orgShahar "Dawn" Or (mightyiam) joined the room.09:55:33

Show newer messages


Back to Room ListRoom Version: 6