1# "Global"/Extra Options 2a way of passing additional options "globally" to modules is by using extraOpts. 3 4in nix flakes, this is accomplished by using `specialArgs` in `nixosSystem`. 5 6for example, check out these few lines in our flake.nix: [[source]](https://github.com/soopyc/nix-on-koumakan/blob/492dfaa01808c2aa5dbb2d8223163e92bcef673b/flake.nix#L29-L34) 7 8```nix 9# note: unrelated attributes stripped and removed. 10# note2: this code is now out of date from our code, but can still be referenced. 11{ 12 outputs = { ... }:{ 13 nixosConfigurations = { 14 koumakan = lib.nixosSystem { 15 specialArgs = { 16 _utils = (import ./global/utils.nix) { inherit pkgs; }; 17 18 someOtherArg = {thisCanBe = "LiterallyAnything";}; 19 }; 20 }; 21 }; 22 }; 23} 24``` 25 26With this, you can now do this in other imported nixos modules. 27 28```nix 29{ someOtherArg, ... }: { 30 users.users.${someOtherArg} = {}; 31} 32``` 33 34this avoids the horror of `import ../../../utils/bar.nix;` and various other things. 35 36refer to [nixpkgs:nixos/lib/eval-config.nix] and [nixpkgs:lib/modules.nix#122] for more info 37 38*pointers by \@natsukagami* 39 40[nixpkgs:lib/modules.nix#122]: https://github.com/NixOS/nixpkgs/blob/6e68daefde56a7a8e6fe7c3ca9ceeb436294bb9f/lib/modules.nix#L122 41[nixpkgs:nixos/lib/eval-config.nix]: https://github.com/NixOS/nixpkgs/blob/5054472759a3b0df8e18cfe4031a5eff92d4cdc3/nixos/lib/eval-config.nix