From 25e2237aa4fe12c2daafa666c28f15ff564bcf9f Mon Sep 17 00:00:00 2001 From: Skyler Grey Date: Fri, 2 Jan 2026 11:23:10 +0000 Subject: [PATCH] do-not-merge: fix eval warnings Change-Id: wlvkpzlyptuqmwoovpwrsqquskyzmzts --- packetmix/inputs.nix | 5 +- packetmix/modules/nilla-home/home.nix | 7 -- packetmix/modules/nilla-home/homes-type.nix | 8 +- packetmix/modules/nilla-home/nixos.nix | 100 ++++++-------------- packetmix/npins/sources.json | 41 ++++---- packetmix/overlays/hard-fail-system.nix | 3 + 6 files changed, 69 insertions(+), 95 deletions(-) create mode 100644 packetmix/overlays/hard-fail-system.nix diff --git a/packetmix/inputs.nix b/packetmix/inputs.nix index 0f3b921b..74af69d6 100644 --- a/packetmix/inputs.nix +++ b/packetmix/inputs.nix @@ -6,7 +6,10 @@ let pins = import ./npins; settings = { - nixpkgs.configuration.allowUnfree = true; + nixpkgs.configuration = { + allowUnfree = true; + overlays = [ ./overlays/hard-fail-system.nix ]; + }; "nixos-24.11" = settings.nixpkgs; nixos-unstable = settings.nixpkgs; }; 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..5e7698dc 100644 --- a/packetmix/modules/nilla-home/nixos.nix +++ b/packetmix/modules/nilla-home/nixos.nix @@ -37,21 +37,48 @@ 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 +121,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..463ba877 100644 --- a/packetmix/npins/sources.json +++ b/packetmix/npins/sources.json @@ -280,6 +280,18 @@ "url": "https://api.github.com/repos/9001/copyparty/tarball/refs/tags/v1.19.20", "hash": "sha256-/Wm8hZvdGfYWdTOF+dgTPX8DGuSKLhGw4qC4crf1dAo=" }, + "core": { + "type": "Git", + "repository": { + "type": "Git", + "url": "https://tangled.sh/freshlybakedca.ke/core" + }, + "branch": "private/minion/push-pyxzxvyxylmx", + "submodules": false, + "revision": "acc63d3522b0c9b92ef3ab9214102bedaa944faf", + "url": null, + "hash": "sha256-DwlweCkrVRga1dZY/gne7DDsFdLsQ8vlgpWegXAbrLY=" + }, "headscale": { "type": "Git", "repository": { @@ -412,11 +424,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 +444,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 +463,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", diff --git a/packetmix/overlays/hard-fail-system.nix b/packetmix/overlays/hard-fail-system.nix new file mode 100644 index 00000000..58de351a --- /dev/null +++ b/packetmix/overlays/hard-fail-system.nix @@ -0,0 +1,3 @@ +final: prev: { + system = builtins.throw "'system' has been renamed to/replaced by 'stdenv.hostPlatform.system'"; +} -- 2.43.0