diff options
Diffstat (limited to '')
| -rw-r--r-- | modules/by-name/ni/nix/module.nix | 82 |
1 files changed, 45 insertions, 37 deletions
diff --git a/modules/by-name/ni/nix/module.nix b/modules/by-name/ni/nix/module.nix index ed4462f4..65b6ed5c 100644 --- a/modules/by-name/ni/nix/module.nix +++ b/modules/by-name/ni/nix/module.nix @@ -9,63 +9,71 @@ # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, + libraries, + config, + lib, # flakes sources, self, system, externalDependencies, ... -}: -let +}: let nixpkgs = sources.loadFlake "nixpkgs"; + + cfg = config.soispha.nix; in { - # TODO(@bpeetz): Modularize <2025-02-08> + options.soispha.nix = { + enable = libraries.base.options.mkEnable "nix"; + }; - nix = { - package = pkgs.lixPackageSets.latest.lix; + config = lib.mkIf cfg.enable { + nix = { + package = pkgs.lixPackageSets.latest.lix; - # Disable nix channels (this is a remnant of old days) - channel.enable = false; + # Disable nix channels (this is a remnant of old days) + channel.enable = false; - registry = { - nixpkgs.flake = nixpkgs; - n.flake = - nixpkgs - // { - # Otherwise nixpkgs's config and overlays are not available: + registry = { + nixpkgs.flake = nixpkgs; + n.flake = + nixpkgs + // { + # Otherwise nixpkgs's config and overlays are not available: - # Both attrs exists, so we just override both and hope - outputs.legacyPackages."${system}" = pkgs; - legacyPackages."${system}" = pkgs; - }; + # Both attrs exists, so we just override both and hope + outputs.legacyPackages."${system}" = pkgs; + legacyPackages."${system}" = pkgs; + }; - t.flake = externalDependencies.templates; + t.flake = externalDependencies.templates; - my_flake.flake = self; - m.flake = self; - }; + my_flake.flake = self; + m.flake = self; + }; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 7d"; - }; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; - settings = { - auto-optimise-store = true; - experimental-features = [ - "nix-command" - "flakes" - ]; + settings = { + auto-optimise-store = true; + experimental-features = [ + "nix-command" + "flakes" + ]; - use-xdg-base-directories = true; + use-xdg-base-directories = true; - fallback = true; # Build from source, if binary can't be substituted + fallback = true; # Build from source, if binary can't be substituted - keep-failed = false; # keep failed tmp build dirs - pure-eval = true; # restrict file system and network access to hash + keep-failed = false; # keep failed tmp build dirs + pure-eval = true; # restrict file system and network access to hash - sandbox-fallback = false; # Don't disable the sandbox, if the kernel doesn't support it + sandbox-fallback = false; # Don't disable the sandbox, if the kernel doesn't support it + }; }; }; } |
