From 144edf77f5d3503eb8524f3c126984c4aa399f2a Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Fri, 2 Jan 2026 10:43:56 +0000 Subject: [PATCH] chore(pm): replace pkgs.system uses Change-Id: xmwrwntzskmorymnkrrppqmotowwnnqv For fixing the warning > trace: evaluation warning: 'system' has been renamed to/replaced by 'stdenv.hostPlatform.system' There's a few bits and pieces in upstream libraries, which have been updated to unreleased (or unmerged) versions - I'm putting this through because it's so critical, with approval from Coded - we will need to upstream, verify, etc. these changes more properly to consider this "fixed". This is a "good enough for now" --- packetmix/modules/nilla-home/home.nix | 7 -- packetmix/modules/nilla-home/homes-type.nix | 8 +- packetmix/modules/nilla-home/nixos.nix | 101 +++++++------------- packetmix/npins/sources.json | 37 ++++--- packetmix/packages/josh/default.nix | 4 +- packetmix/packages/opensearch/default.nix | 1 - packetmix/systems/teal/josh.nix | 2 +- 7 files changed, 58 insertions(+), 102 deletions(-) diff --git a/packetmix/modules/nilla-home/home.nix b/packetmix/modules/nilla-home/home.nix index 6a463073..efb0a5db 100644 --- a/packetmix/modules/nilla-home/home.nix +++ b/packetmix/modules/nilla-home/home.nix @@ -12,11 +12,4 @@ in default.value = { }; type = homes-type; }; - - config = { - assertions = lib.attrs.mapToList (name: value: { - assertion = !(builtins.isNull value.pkgs); - message = "A Nixpkgs instance is required for the home-manager home \"${name}\", but none was provided and \"inputs.nixpkgs\" does not exist."; - }) config.homes; - }; } diff --git a/packetmix/modules/nilla-home/homes-type.nix b/packetmix/modules/nilla-home/homes-type.nix index 84672f2a..452381d6 100644 --- a/packetmix/modules/nilla-home/homes-type.nix +++ b/packetmix/modules/nilla-home/homes-type.nix @@ -16,7 +16,7 @@ lib.types.attrs.of ( name = "home"; description = "A home-manager home"; module = - { config }@submodule: + { config, name }@submodule: let home_name = config.__module__.args.dynamic.name; home_name_parts = builtins.match "([a-z][-a-z0-9]*)(@([-A-Za-z0-9]+))?(:([-_A-Za-z0-9]+))?" home_name; @@ -106,7 +106,11 @@ lib.types.attrs.of ( description = "The created Home Manager home for each of the systems."; type = lib.types.attrs.of lib.types.raw; writable = false; - default.value = result; + default.value = + if builtins.isNull config.pkgs then + "A Nixpkgs instance is required for the home-manager home \"${name}\", but none was provided and \"inputs.nixpkgs\" does not exist." + else + result; }; }; diff --git a/packetmix/modules/nilla-home/nixos.nix b/packetmix/modules/nilla-home/nixos.nix index 14bdd6c6..cf43ab46 100644 --- a/packetmix/modules/nilla-home/nixos.nix +++ b/packetmix/modules/nilla-home/nixos.nix @@ -37,21 +37,49 @@ in homeManager = submodule.config.home-manager; in (lib.fp.pipe [ + ( + value: + if builtins.isNull homeManager && value != [ ] then + builtins.throw "A home-manager instance is required to enable homes for the NixOS system \"${name}\", but none was provided and \"inputs.home-manager\" does not exist." + else + value + ) (lib.attrs.mapToList ( homeName: home: let homeNameParts = builtins.match "([a-z][-a-z0-9]*)(@([-A-Za-z0-9]+))?(:([-_A-Za-z0-9]+))?" homeName; username = builtins.elemAt homeNameParts 0; + homeHasHomeManager = !(builtins.isNull home.home-manager); + homeIsValidForSystem = + home ? result.${config.pkgs.stdenv.hostPlatform.system or config.pkgs.system}; in - { - inherit home homeName username; - } + if !homeHasHomeManager then + builtins.throw "You've asked for the home \"${homeName}\" to be activated in the NixOS system \"${name}\", but it needs a home-manager instance, none was provided and \"inputs.home-manager\" does not exist." + else if !homeIsValidForSystem then + builtins.throw "You've asked for the home \"${homeName}\" to be activated in the NixOS system \"${name}\", but it isn't valid for \"${ + config.pkgs.stdenv.hostPlatform.system or config.pkgs.system + }\" systems." + else + { + inherit home homeName username; + } )) + ( + values: + let + existingUsernames = builtins.filter (value: value.username != null) values; + uniqueUsernames = lib.lists.unique existingUsernames; + in + if existingUsernames != uniqueUsernames then + builtins.throw "There are multiple homes for a single user in the NixOS system \"${name}\". Please make sure you've only enabled a single home per user." + else + values + ) (builtins.map ( { home, homeName, - ... + username, }@identity: warnIf (home.home-manager != homeManager) "The home \"${homeName}\" isn't using the same home-manager input as the NixOS system \"${name}\". This may work, but is not officially supported by the Nilla Home or Nilla NixOS maintainers. Please fix this before reporting any bugs you may find." @@ -94,69 +122,4 @@ in ); }; }; - - config = { - assertions = lib.lists.flatten ( - lib.attrs.mapToList ( - name: value: - let - hasNixpkgs = !(builtins.isNull value.pkgs); - requestedHomes = value.homes != [ ]; - hasHomeManager = !(builtins.isNull value.home-manager); - in - [ - { - assertion = hasNixpkgs; - message = "A Nixpkgs instance is required for the NixOS system \"${name}\", but none was provided and \"inputs.nixpkgs\" does not exist."; - } - { - assertion = !requestedHomes || hasHomeManager; - message = "A home-manager instance is required to enable homes for the NixOS system \"${name}\", but none was provided and \"inputs.home-manager\" does not exist."; - } - (lib.attrs.mapToList ( - homeName: home: - let - homeHasHomeManager = !(builtins.isNull home.home-manager); - homeIsValidForSystem = home ? result.${value.pkgs.stdenv.hostPlatform.system}; - in - [ - { - assertion = homeHasHomeManager; - message = "You've asked for the home \"${homeName}\" to be activated in the NixOS system \"${name}\", but it needs a home-manager instance, none was provided and \"inputs.home-manager\" does not exist."; - } - { - assertion = !homeHasHomeManager || !hasNixpkgs || homeIsValidForSystem; - message = "You've asked for the home \"${homeName}\" to be activated in the NixOS system \"${name}\", but it isn't valid for \"${value.pkgs.stdenv.hostPlatform.system}\" systems."; - } - ] - ) value.homes) - ( - let - usernames = lib.attrs.mapToList ( - homeName: home: - let - homeHasHomeManager = !(builtins.isNull home.home-manager); - homeIsValidForSystem = home ? result.${value.pkgs.stdenv.hostPlatform.system}; - in - if homeHasHomeManager && hasNixpkgs && homeIsValidForSystem then - let - homeNameParts = builtins.match "([a-z][-a-z0-9]*)(@([-A-Za-z0-9]+))?(:([-_A-Za-z0-9]+))?" homeName; - username = builtins.elemAt homeNameParts 0; - in - username - else - null - ) value.homes; - existingUsernames = builtins.filter (username: username != null) usernames; - uniqueUsernames = lib.lists.unique existingUsernames; - in - { - assertion = !hasNixpkgs || (existingUsernames == uniqueUsernames); - message = "There are multiple homes for a single user in the NixOS system \"${name}\". Please make sure you've only enabled a single home per user."; - } - ) - ] - ) global.config.systems.nixos - ); - }; } diff --git a/packetmix/npins/sources.json b/packetmix/npins/sources.json index 746abaa0..17584511 100644 --- a/packetmix/npins/sources.json +++ b/packetmix/npins/sources.json @@ -412,11 +412,11 @@ "owner": "nilla-nix", "repo": "nilla" }, - "branch": "private/coded/push-nzprlvpltxyl", + "branch": "private/minion/push-swlstmwvzvkr", "submodules": false, - "revision": "2f8b8c68efc4d81637be344d1b01462291a45e05", - "url": "https://github.com/nilla-nix/nilla/archive/2f8b8c68efc4d81637be344d1b01462291a45e05.tar.gz", - "hash": "sha256-VLlP6L8uvgEjb1ZZXdc4P3NAs5PcgIjpGm8LvaObrLY=" + "revision": "1a45420c0b579aea97d834d04e6eec773a8391b1", + "url": "https://github.com/nilla-nix/nilla/archive/1a45420c0b579aea97d834d04e6eec773a8391b1.tar.gz", + "hash": "sha256-4jqikEAkh5GUKGDkGAtWRWZexN25Rzt0yIsnilhA77U=" }, "nilla-cli": { "type": "Git", @@ -432,20 +432,17 @@ "hash": "sha256-cPdYYXhCsDllVgq+gs5Wqhb41bFtKWHlkTvjOJv7its=" }, "nilla-home": { - "type": "GitRelease", + "type": "Git", "repository": { "type": "GitHub", "owner": "nilla-nix", "repo": "home" }, - "pre_releases": true, - "version_upper_bound": null, - "release_prefix": null, + "branch": "private/minion/push-ovknmuuuxzul", "submodules": false, - "version": "v0.1.1-alpha", - "revision": "8d8d783cd3ebe38246f66c027a312e5ec0914c58", - "url": "https://api.github.com/repos/nilla-nix/home/tarball/refs/tags/v0.1.1-alpha", - "hash": "sha256-34qP2aqJgvJ6rQo5vi9o65kxrxbp2dFi8S7z3B+P74g=" + "revision": "7d7189e841d70136ac0f9d8a4c024cdc0fe8605d", + "url": "https://github.com/nilla-nix/home/archive/7d7189e841d70136ac0f9d8a4c024cdc0fe8605d.tar.gz", + "hash": "sha256-LZrPz9bp3VDOpiv95MuCKIkfgRmfAkR5x4DLNDxCa+o=" }, "nilla-nixos": { "type": "Git", @@ -454,11 +451,11 @@ "owner": "nilla-nix", "repo": "nixos" }, - "branch": "main", + "branch": "private/minion/push-yxkmmnpurumu", "submodules": false, - "revision": "52c623ae89fe77de669a981c7e92b1504cd99eac", - "url": "https://github.com/nilla-nix/nixos/archive/52c623ae89fe77de669a981c7e92b1504cd99eac.tar.gz", - "hash": "sha256-7tadYU5GzOUAxo8XLC18+dk0Rj+QSORUO5cFdpqfSy4=" + "revision": "c851cfd1e9555ab2372fd4ce48e1094059eed561", + "url": "https://github.com/nilla-nix/nixos/archive/c851cfd1e9555ab2372fd4ce48e1094059eed561.tar.gz", + "hash": "sha256-Mj5DQKDql1IxXsd13zpjJBitjz0ZD6Wr7Q3ASgUFXQY=" }, "niri": { "type": "Git", @@ -541,13 +538,13 @@ "type": "Git", "repository": { "type": "Git", - "url": "https://tangled.org/@tangled.org/core" + "url": "https://tangled.sh/freshlybakedca.ke/core" }, - "branch": "master", + "branch": "private/minion/push-pyxzxvyxylmx", "submodules": false, - "revision": "3eb9cefd98d13ab9864abb2e394fc41f89ffd923", + "revision": "acc63d3522b0c9b92ef3ab9214102bedaa944faf", "url": null, - "hash": "sha256-lRTZLRcqWpVf6CzJmvg+ggp/YWWasT4u2lFKIiIopoM=" + "hash": "sha256-DwlweCkrVRga1dZY/gne7DDsFdLsQ8vlgpWegXAbrLY=" }, "treefmt-nix": { "type": "Git", diff --git a/packetmix/packages/josh/default.nix b/packetmix/packages/josh/default.nix index dc4e4b5e..35fedb7e 100644 --- a/packetmix/packages/josh/default.nix +++ b/packetmix/packages/josh/default.nix @@ -6,8 +6,8 @@ config.packages.josh = { systems = [ "x86_64-linux" ]; package = - { system, rustPlatform, ... }: - config.inputs.nixos-unstable.result.${system}.josh.overrideAttrs { + { stdenv, rustPlatform, ... }: + config.inputs.nixos-unstable.result.${stdenv.hostPlatform.system}.josh.overrideAttrs { src = config.inputs.josh.result; cargoDeps = rustPlatform.fetchCargoVendor { diff --git a/packetmix/packages/opensearch/default.nix b/packetmix/packages/opensearch/default.nix index 63ded346..84bed527 100644 --- a/packetmix/packages/opensearch/default.nix +++ b/packetmix/packages/opensearch/default.nix @@ -7,7 +7,6 @@ systems = [ "x86_64-linux" ]; package = { - system, opensearch, jdk11_headless, ... diff --git a/packetmix/systems/teal/josh.nix b/packetmix/systems/teal/josh.nix index 9bf838a6..757e8c00 100644 --- a/packetmix/systems/teal/josh.nix +++ b/packetmix/systems/teal/josh.nix @@ -10,7 +10,7 @@ ... }: let - josh = project.packages.josh.result.${pkgs.system}; + josh = project.packages.josh.result.${pkgs.stdenv.hostPlatform.system}; in { users.users.git = { -- 2.43.0