diff options
author | azahi <azat@bahawi.net> | 2025-02-17 02:21:56 +0300 |
---|---|---|
committer | azahi <azat@bahawi.net> | 2025-02-17 02:21:56 +0300 |
commit | 59180328cda59817d71cd58c8f48ead047375064 (patch) | |
tree | 2cdd7d1bfa309839ef624c19daf283f510aacf69 /modules/common/nix.nix | |
parent | 2025-02-05 (diff) |
2025-02-17
Diffstat (limited to '')
-rw-r--r-- | modules/common/nix.nix | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/modules/common/nix.nix b/modules/common/nix.nix index 0ce2ae4..6cb3787 100644 --- a/modules/common/nix.nix +++ b/modules/common/nix.nix @@ -6,7 +6,6 @@ this, ... }: -with lib; let cfg = config.nixfiles.modules.common.nix; in @@ -16,24 +15,24 @@ in mixins-trusted-nix-caches ]; - options.nixfiles.modules.common.nix.allowedUnfreePackages = mkOption { + options.nixfiles.modules.common.nix.allowedUnfreePackages = lib.mkOption { description = "A list of allowed unfree packages."; - type = with types; listOf str; + type = with lib.types; listOf str; default = [ ]; }; config = { _module.args = { - pkgsLocal = packages.useNixpkgs "${config.my.home}/src/nixpkgs"; # Impure! + pkgsLocal = lib.packages.useNixpkgs "${config.my.home}/src/nixpkgs"; # Impure! }; hm = { # Used primarily in conjunction with the "nixfiles" script. home.file.".nix-defexpr/default.nix".text = let - hostname = strings.escapeNixIdentifier this.hostname; + hostname = lib.strings.escapeNixIdentifier this.hostname; in - optionalString this.isHeadful '' + lib.optionalString this.isHeadful '' let self = builtins.getFlake "nixfiles"; configurations = self.nixosConfigurations; @@ -54,16 +53,16 @@ in nix = let - notSelfInputs = filterAttrs (n: _: n != "self") inputs; + notSelfInputs = lib.filterAttrs (n: _: n != "self") inputs; in { - package = mkForce pkgs.nix; # Only use stable Nix. + package = lib.mkForce pkgs.nix; # Only use stable Nix. - nixPath = mapAttrsToList (n: v: "${n}=${v}") notSelfInputs ++ [ + nixPath = lib.mapAttrsToList (n: v: "${n}=${v}") notSelfInputs ++ [ "nixfiles=${config.my.home}/src/nixfiles" ]; - registry = mapAttrs (_: flake: { inherit flake; }) notSelfInputs // { + registry = lib.mapAttrs (_: flake: { inherit flake; }) notSelfInputs // { nixfiles.flake = inputs.self; }; @@ -77,7 +76,7 @@ in "pipe-operators" ]; - trusted-users = [ my.username ]; + trusted-users = [ lib.my.username ]; substituters = [ "https://nix-community.cachix.org" @@ -95,7 +94,7 @@ in }; nixpkgs = { - config.allowUnfreePredicate = p: elem (getName p) cfg.allowedUnfreePackages; + config.allowUnfreePredicate = p: lib.elem (lib.getName p) cfg.allowedUnfreePackages; overlays = [ inputs.self.overlays.default ]; }; @@ -106,16 +105,16 @@ in defaultPackages = [ ]; systemPackages = with pkgs; - optionals this.isHeadful [ + lib.optionals this.isHeadful [ nix-tree nixfiles ]; variables = { - NIXFILES = optionalString this.isHeadful "${config.my.home}/src/nixfiles"; + NIXFILES = lib.optionalString this.isHeadful "${config.my.home}/src/nixfiles"; NIX_SHELL_PRESERVE_PROMPT = "1"; }; }; - system.stateVersion = this.stateVersion or trivial.release; + system.stateVersion = this.stateVersion or lib.trivial.release; }; } |