gmodena / nix-flatpak

Install flatpaks declaratively
Apache License 2.0
302 stars 10 forks source link

Unable to import the module and build the flake #72

Closed Marin-Kitagawa closed 3 months ago

Marin-Kitagawa commented 3 months ago

I always get the following error

error: The option `services.flatpak.update' in `/nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/flake.nix' is already declared in `/nix/store/ld4456rdvvyxd7lma5iw7pb6sdsa3d4w-source/flatpak.nix'

My flake.nix is given below

{
  description = "Description";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
    stylix.url = "github:danth/stylix";
    nix-flatpak.url = "github:gmodena/nix-flatpak";
  };

  outputs = { nixpkgs, ... }@inputs:
  {
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
      specialArgs = {
        inherit inputs;
      };
      modules = [
        inputs.stylix.nixosModules.stylix
        inputs.nix-flatpak.nixosModules.nix-flatpak
        ./configuration.nix
      ];
    };
  };
}

My flatpak.nix

{ inputs, lib, ... }: {

  imports = [
    inputs.nix-flatpak.nixosModules.nix-flatpak
  ];
  # nix-flatpak setup
  services.flatpak.remotes = lib.mkOptionDefault [{
    name = "flathub-beta";
    location = "https://flathub.org/beta-repo/flathub-beta.flatpakrepo";
  }];

  services.flatpak.packages = [
    "com.vivaldi.Vivaldi"
  ];
}

I am a new NixOS user. So, I am not sure if this is the right way to do it. Besides, I even tried to clone the repo and then use it in my configuration.nix. I got the exact same error. But I have never used services.flatpak.update anywhere in my configuration.nix file. My configuration.nix file imports this flatpak.nix file. Besides, I even removed the options that allows auto updating of flatpaks and auto uninstallation of unmanaged flatpaks. Still I get the above error.

Full stack trace ```nix error: … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/attrsets.nix:1571:24: 1570| let f = attrPath: 1571| zipAttrsWith (n: values: | ^ 1572| let here = attrPath ++ [n]; in … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/attrsets.nix:1205:18: 1204| mapAttrs 1205| (name: value: | ^ 1206| if isAttrs value && cond value … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/attrsets.nix:1208:18: 1207| then recurse (path ++ [ name ]) value 1208| else f (path ++ [ name ]) value); | ^ 1209| in … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:254:72: 253| # For definitions that have an associated option 254| declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options; | ^ 255| … while evaluating the option `system.build.toplevel': … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:836:28: 835| # Process mkMerge and mkIf properties. 836| defs' = concatMap (m: | ^ 837| map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value)) … while evaluating definitions from `/nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/nixos/modules/system/activation/top-level.nix': … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:837:128: 836| defs' = concatMap (m: 837| map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value)) | ^ 838| ) defs; … while calling 'dischargeProperties' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:908:25: 907| */ 908| dischargeProperties = def: | ^ 909| if def._type or "" == "merge" then … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/nixos/modules/system/activation/top-level.nix:71:12: 70| # Replace runtime dependencies 71| system = foldr ({ oldDependency, newDependency }: drv: | ^ 72| pkgs.replaceDependency { inherit oldDependency newDependency drv; } … while calling 'foldr' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/lists.nix:121:20: 120| */ 121| foldr = op: nul: list: | ^ 122| let … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/lists.nix:128:8: 127| else op (elemAt list n) (fold' (n + 1)); 128| in fold' 0; | ^ 129| … while calling 'fold'' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/lists.nix:124:15: 123| len = length list; 124| fold' = n: | ^ 125| if n == len … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/nixos/modules/system/activation/top-level.nix:68:10: 67| then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}" 68| else showWarnings config.warnings baseSystem; | ^ 69| … while calling 'showWarnings' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/trivial.nix:927:28: 926| 927| showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings; | ^ 928| … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/trivial.nix:927:33: 926| 927| showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings; | ^ 928| … while calling 'foldr' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/lists.nix:121:20: 120| */ 121| foldr = op: nul: list: | ^ 122| let … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/lists.nix:128:8: 127| else op (elemAt list n) (fold' (n + 1)); 128| in fold' 0; | ^ 129| … while calling 'fold'' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/lists.nix:124:15: 123| len = length list; 124| fold' = n: | ^ 125| if n == len … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/attrsets.nix:1205:18: 1204| mapAttrs 1205| (name: value: | ^ 1206| if isAttrs value && cond value … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/attrsets.nix:1208:18: 1207| then recurse (path ++ [ name ]) value 1208| else f (path ++ [ name ]) value); | ^ 1209| in … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:254:72: 253| # For definitions that have an associated option 254| declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options; | ^ 255| … while evaluating the option `warnings': … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:836:28: 835| # Process mkMerge and mkIf properties. 836| defs' = concatMap (m: | ^ 837| map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value)) … while evaluating definitions from `/nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/nixos/modules/system/boot/systemd.nix': … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:837:128: 836| defs' = concatMap (m: 837| map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value)) | ^ 838| ) defs; … while calling 'dischargeProperties' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:908:25: 907| */ 908| dischargeProperties = def: | ^ 909| if def._type or "" == "merge" then … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/nixos/modules/system/boot/systemd.nix:466:9: 465| ++ (mkNetOnlineWarns "socket" cfg.sockets) 466| ++ (mkNetOnlineWarns "timer" cfg.timers) | ^ 467| ++ (mkNetOnlineWarns "path" cfg.paths) … while calling 'mkNetOnlineWarns' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/nixos/modules/system/boot/systemd.nix:439:35: 438| "${name}.${typeStr} is ordered after 'network-online.target' but doesn't depend on it"; 439| mkNetOnlineWarns = typeStr: defs: lib.concatLists (lib.mapAttrsToList (mkOneNetOnlineWarn typeStr) defs); | ^ 440| mkMountNetOnlineWarns = typeStr: defs: lib.concatLists (map (m: mkOneNetOnlineWarn typeStr m.what m) defs); … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/nixos/modules/system/boot/systemd.nix:439:58: 438| "${name}.${typeStr} is ordered after 'network-online.target' but doesn't depend on it"; 439| mkNetOnlineWarns = typeStr: defs: lib.concatLists (lib.mapAttrsToList (mkOneNetOnlineWarn typeStr) defs); | ^ 440| mkMountNetOnlineWarns = typeStr: defs: lib.concatLists (map (m: mkOneNetOnlineWarn typeStr m.what m) defs); … while calling 'mapAttrsToList' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/attrsets.nix:1095:5: 1094| f: 1095| attrs: | ^ 1096| map (name: f name attrs.${name}) (attrNames attrs); … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/attrsets.nix:1205:18: 1204| mapAttrs 1205| (name: value: | ^ 1206| if isAttrs value && cond value … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/attrsets.nix:1208:18: 1207| then recurse (path ++ [ name ]) value 1208| else f (path ++ [ name ]) value); | ^ 1209| in … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:254:72: 253| # For definitions that have an associated option 254| declaredConfig = mapAttrsRecursiveCond (v: ! isOption v) (_: v: v.value) options; | ^ 255| … while evaluating the option `systemd.timers': … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:858:59: 857| if isDefined then 858| if all (def: type.check def.value) defsFinal then type.merge loc defsFinal | ^ 859| else let allInvalid = filter (def: ! type.check def.value) defsFinal; … while calling 'merge' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/types.nix:582:20: 581| check = isAttrs; 582| merge = loc: defs: | ^ 583| mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs: … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/types.nix:583:35: 582| merge = loc: defs: 583| mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs: | ^ 584| (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue … while calling 'filterAttrs' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/attrsets.nix:646:5: 645| pred: 646| set: | ^ 647| listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set)); … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/attrsets.nix:647:29: 646| set: 647| listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set)); | ^ 648| … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/attrsets.nix:647:62: 646| set: 647| listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set)); | ^ 648| … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/types.nix:583:51: 582| merge = loc: defs: 583| mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs: | ^ 584| (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/types.nix:583:86: 582| merge = loc: defs: 583| mapAttrs (n: v: v.value) (filterAttrs (n: v: v ? value) (zipAttrsWith (name: defs: | ^ 584| (mergeDefinitions (loc ++ [name]) elemType defs).optionalValue … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:836:28: 835| # Process mkMerge and mkIf properties. 836| defs' = concatMap (m: | ^ 837| map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value)) … while evaluating definitions from `/nix/store/4qdv2zfsqz43gl87jzqff477p5hhz5ix-source/flatpak.nix': … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:837:128: 836| defs' = concatMap (m: 837| map (value: { inherit (m) file; inherit value; }) (addErrorContext "while evaluating definitions from `${m.file}':" (dischargeProperties m.value)) | ^ 838| ) defs; … while calling 'dischargeProperties' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:908:25: 907| */ 908| dischargeProperties = def: | ^ 909| if def._type or "" == "merge" then … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/attrsets.nix:1205:18: 1204| mapAttrs 1205| (name: value: | ^ 1206| if isAttrs value && cond value … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:688:37: 687| 688| matchedOptions = mapAttrs (n: v: v.matchedOptions) resultsByName; | ^ 689| … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:658:32: 657| in { 658| matchedOptions = evalOptionValue loc opt defns'; | ^ 659| unmatchedDefns = []; … while calling 'evalOptionValue' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:792:31: 791| config value. */ 792| evalOptionValue = loc: opt: defs: | ^ 793| let … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:817:9: 816| warnDeprecation = 817| warnIf (opt.type.deprecationMessage != null) | ^ 818| "The type `types.${opt.type.name}' of option `${showOption loc}' defined in ${showFiles opt.declarations} is deprecated. ${opt.type.deprecationMessage}"; … while calling 'warnIf' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/trivial.nix:789:18: 788| */ 789| warnIf = cond: msg: if cond then warn msg else x: x; | ^ 790| … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:656:23: 655| if length optionDecls == length decls then 656| let opt = fixupOptionType loc (mergeOptionDecls loc decls); | ^ 657| in { … while calling 'fixupOptionType' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:969:26: 968| # TODO: Merge this into mergeOptionDecls 969| fixupOptionType = loc: opt: | ^ 970| if opt.type.getSubModules or null == null … from call site at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:656:44: 655| if length optionDecls == length decls then 656| let opt = fixupOptionType loc (mergeOptionDecls loc decls); | ^ 657| in { … while calling 'mergeOptionDecls' at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:753:9: 752| mergeOptionDecls = 753| loc: opts: | ^ 754| foldl' (res: opt: … while calling anonymous lambda at /nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/lib/modules.nix:754:18: 753| loc: opts: 754| foldl' (res: opt: | ^ 755| let t = res.type; error: The option `services.flatpak.update' in `/nix/store/70y8v9qfn34sdfsnwh3l9772lk4rpfiy-source/flake.nix' is already declared in `/nix/store/4qdv2zfsqz43gl87jzqff477p5hhz5ix-source/flatpak.nix'. ```

Could you please help me rectify this?