diff --git a/lib/devos/devosSystem.nix b/lib/devos/devosSystem.nix index 32af38a..dbe3af4 100644 --- a/lib/devos/devosSystem.nix +++ b/lib/devos/devosSystem.nix @@ -1,4 +1,4 @@ -{ lib, nixpkgs, self, inputs, ... }: +{ lib, nixpkgs, userSelf, inputs, ... }: { modules, ... } @ args: lib.nixosSystem (args // { @@ -27,11 +27,11 @@ lib.nixosSystem (args // { isoImage.isoBaseName = "nixos-" + config.networking.hostName; isoImage.contents = [{ - source = self; + source = userSelf; target = "/devos/"; }]; isoImage.storeContents = [ - self.devShell.${config.nixpkgs.system} + userSelf.devShell.${config.nixpkgs.system} # include also closures that are "switched off" by the # above profile filter on the local config attribute fullHostConfig.system.build.toplevel diff --git a/lib/devos/mkHomeConfigurations.nix b/lib/devos/mkHomeConfigurations.nix index 490975a..5d39cdd 100644 --- a/lib/devos/mkHomeConfigurations.nix +++ b/lib/devos/mkHomeConfigurations.nix @@ -1,4 +1,4 @@ -{ lib, self, ... }: +{ lib, userSelf, ... }: with lib; let @@ -6,7 +6,7 @@ let mapAttrs' (user: v: nameValuePair "${user}@${host}" v.home) config.config.system.build.homes; - hmConfigs = mapAttrs mkHomes self.nixosConfigurations; + hmConfigs = mapAttrs mkHomes userSelf.nixosConfigurations; in foldl recursiveUpdate { } (attrValues hmConfigs) diff --git a/lib/devos/mkHosts.nix b/lib/devos/mkHosts.nix index 984e70c..1bc6bf9 100644 --- a/lib/devos/mkHosts.nix +++ b/lib/devos/mkHosts.nix @@ -1,4 +1,4 @@ -{ lib, dev, nixpkgs, inputs, self, ... }: +{ lib, dev, nixpkgs, inputs, userSelf, ... }: { dir, extern, suites, overrides, multiPkgs, ... }: let @@ -29,7 +29,7 @@ let useUserPackages = true; extraSpecialArgs = extern.userSpecialArgs // { suites = suites.user; }; - sharedModules = extern.userModules ++ (builtins.attrValues self.homeModules); + sharedModules = extern.userModules ++ (builtins.attrValues userSelf.homeModules); }; users.mutableUsers = lib.mkDefault false; @@ -37,14 +37,14 @@ let nix.nixPath = [ "nixpkgs=${nixpkgs}" - "nixos-config=${self}/compat/nixos" + "nixos-config=${userSelf}/compat/nixos" "home-manager=${inputs.home}" ]; nixpkgs.pkgs = lib.mkDefault multiPkgs.${config.nixpkgs.system}; nix.registry = { - devos.flake = self; + devos.flake = userSelf; nixos.flake = nixpkgs; override.flake = inputs.override; }; @@ -57,11 +57,11 @@ let } ''; - system.configurationRevision = lib.mkIf (self ? rev) self.rev; + system.configurationRevision = lib.mkIf (userSelf ? rev) userSelf.rev; }; # Everything in `./modules/list.nix`. - flakeModules = { imports = builtins.attrValues self.nixosModules ++ extern.modules; }; + flakeModules = { imports = builtins.attrValues userSelf.nixosModules ++ extern.modules; }; cachix = ../../cachix.nix; }; @@ -78,7 +78,7 @@ let networking = { inherit hostName; }; _module.args = { - inherit self; + self = userSelf; hosts = builtins.mapAttrs (_: host: host.config) (removeAttrs hosts [ hostName ]); }; diff --git a/lib/devos/mkPackages.nix b/lib/devos/mkPackages.nix index a876ea0..1b3404a 100644 --- a/lib/devos/mkPackages.nix +++ b/lib/devos/mkPackages.nix @@ -1,8 +1,8 @@ -{ lib, dev, self, ... }: +{ lib, dev, userSelf, ... }: { pkgs }: let - inherit (self) overlay overlays; + inherit (userSelf) overlay overlays; packagesNames = lib.attrNames (overlay null null) ++ lib.attrNames (dev.concatAttrs (lib.attrValues diff --git a/lib/devos/mkPkgs.nix b/lib/devos/mkPkgs.nix index 260e97b..d2d07db 100644 --- a/lib/devos/mkPkgs.nix +++ b/lib/devos/mkPkgs.nix @@ -1,4 +1,4 @@ -{ lib, dev, nixpkgs, self, inputs, ... }: +{ lib, dev, nixpkgs, userSelf, inputs, ... }: { extern, overrides }: (inputs.utils.lib.eachDefaultSystem @@ -17,10 +17,10 @@ }); }) (overridesOverlay overridePkgs) - self.overlay + userSelf.overlay ] ++ extern.overlays - ++ (lib.attrValues self.overlays); + ++ (lib.attrValues userSelf.overlays); in { pkgs = dev.os.pkgImport nixpkgs overlays system; } ) diff --git a/lib/mkFlake/default.nix b/lib/mkFlake/default.nix index 916e349..6fdca16 100644 --- a/lib/mkFlake/default.nix +++ b/lib/mkFlake/default.nix @@ -7,13 +7,15 @@ in _: { self, ... } @ args: let + userSelf = self; + cfg = (dev.mkFlake.evalOldArgs { inherit args; }).config; multiPkgs = os.mkPkgs { inherit (cfg) extern overrides; }; outputs = { nixosConfigurations = os.mkHosts { - inherit self multiPkgs; + inherit userSelf multiPkgs; inherit (cfg) extern suites overrides; dir = cfg.hosts; }; @@ -27,7 +29,7 @@ let overlay = cfg.packages; inherit (cfg) overlays; - deploy.nodes = os.mkNodes deploy self.nixosConfigurations; + deploy.nodes = os.mkNodes deploy userSelf.nixosConfigurations; }; systemOutputs = utils.lib.eachDefaultSystem (system: @@ -39,9 +41,9 @@ let in { checks = pkgs-lib.tests.mkChecks { - inherit (self.deploy) nodes; - hosts = self.nixosConfigurations; - homes = self.homeConfigurations; + inherit (userSelf.deploy) nodes; + hosts = userSelf.nixosConfigurations; + homes = userSelf.homeConfigurations; }; inherit legacyPackages; diff --git a/lib/mkFlake/evalArgs.nix b/lib/mkFlake/evalArgs.nix index ac3d0c8..ad866ea 100644 --- a/lib/mkFlake/evalArgs.nix +++ b/lib/mkFlake/evalArgs.nix @@ -1,4 +1,4 @@ -{ self, dev, lib, inputs, utils, ... }: +{ userSelf, dev, lib, inputs, utils, ... }: { args }: let @@ -161,8 +161,8 @@ let }; profiles = mkOption { type = path; - default = "${self}/profiles"; - defaultText = "\${self}/profiles"; + default = "${userSelf}/profiles"; + defaultText = "\${userSelf}/profiles"; apply = x: os.mkProfileAttrs (toString x); description = "path to profiles folder that can be collected into suites"; }; diff --git a/lib/mkFlake/evalOldArgs.nix b/lib/mkFlake/evalOldArgs.nix index ef9360a..f728b48 100644 --- a/lib/mkFlake/evalOldArgs.nix +++ b/lib/mkFlake/evalOldArgs.nix @@ -1,4 +1,4 @@ -{ self, dev, lib, inputs, ... }: +{ userSelf, dev, lib, inputs, ... }: { args }: let @@ -22,8 +22,8 @@ let }; hosts = mkOption { type = path; - default = "${self}/hosts"; - defaultText = "\${self}/hosts"; + default = "${userSelf}/hosts"; + defaultText = "\${userSelf}/hosts"; apply = toString; description = '' Path to directory containing host configurations that will be exported @@ -64,15 +64,15 @@ let }; profiles = mkOption { type = path; - default = "${self}/profiles"; - defaultText = "\${self}/profiles"; + default = "${userSelf}/profiles"; + defaultText = "\${userSelf}/profiles"; apply = x: os.mkProfileAttrs (toString x); description = "path to profiles folder that can be collected into suites"; }; userProfiles = mkOption { type = path; - default = "${self}/users/profiles"; - defaultText = "\${self}/users/profiles"; + default = "${userSelf}/users/profiles"; + defaultText = "\${userSelf}/users/profiles"; apply = x: os.mkProfileAttrs (toString x); description = "path to user profiles folder that can be collected into userSuites"; }; @@ -97,8 +97,8 @@ let }; users = mkOption { type = path; - default = "${self}/users"; - defaultText = "\${self}/users"; + default = "${userSelf}/users"; + defaultText = "\${userSelf}/users"; apply = x: os.mkProfileAttrs (toString x); description = '' path to folder containing profiles that define system users @@ -121,9 +121,9 @@ let { modules = []; overlays = []; specialArgs = []; userModules = []; userSpecialArgs = []; } ''; # So unneeded extern attributes can safely be deleted - apply = x: defaults // (x { inputs = inputs // self.inputs; }); + apply = x: defaults // (x { inputs = inputs // userSelf.inputs; }); description = '' - Function with argument 'inputs' that contains all devos and ''${self}'s inputs. + Function with argument 'inputs' that contains all devos and ''${userSelf}'s inputs. The function should return an attribute set with modules, overlays, and specialArgs to be included across nixos and home manager configurations. Only attributes that are used should be returned. @@ -131,8 +131,8 @@ let }; overlays = mkOption { type = path; - default = "${self}/overlays"; - defaultText = "\${self}/overlays"; + default = "${userSelf}/overlays"; + defaultText = "\${userSelf}/overlays"; apply = x: dev.pathsToImportedAttrs (dev.pathsIn (toString x)); description = '' path to folder containing overlays which will be applied to pkgs and exported in