From 963cd58c8684f23a1ea21e48179c968b56a4e96d Mon Sep 17 00:00:00 2001 From: ibizaman Date: Sun, 27 Jul 2025 21:58:45 +0200 Subject: [PATCH] fix patchNixpkgs function --- demo/homeassistant/README.md | 8 ++++---- demo/homeassistant/flake.nix | 5 ++--- demo/nextcloud/flake.nix | 7 +++---- flake.nix | 8 ++++++-- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/demo/homeassistant/README.md b/demo/homeassistant/README.md index 5c223af..f5f4a43 100644 --- a/demo/homeassistant/README.md +++ b/demo/homeassistant/README.md @@ -29,7 +29,7 @@ first time. ### Deploy with nixos-rebuild {#demo-homeassistant-deploy-nixosrebuild} Assuming your current working directory is the one where this Readme file is located, the one-liner -command which builds and starts the VM configured to run Self Host Blocks' Nextcloud is: +command which builds and starts the VM configured to run Self Host Blocks' Home-Assistant is: ```nix rm nixos.qcow2; \ @@ -42,7 +42,7 @@ This will deploy the `basic` demo. If you want to deploy the `ldap` demo, use th uris. You can even test the demos from any directory without cloning this repository by using the GitHub -uri like `github:ibizaman/selfhostblocks?path=demo/nextcloud` +uri like `github:ibizaman/selfhostblocks?path=demo/home-assistant` It is very important to remove leftover `nixos.qcow2` files, if any. @@ -112,7 +112,7 @@ ssh -F ssh_config example @@ -142,7 +142,7 @@ And that's the end of the demo diff --git a/demo/homeassistant/flake.nix b/demo/homeassistant/flake.nix index 1f8b27a..94004aa 100644 --- a/demo/homeassistant/flake.nix +++ b/demo/homeassistant/flake.nix @@ -10,7 +10,6 @@ let system = "x86_64-linux"; nixpkgs' = selfhostblocks.lib.${system}.patchedNixpkgs; - nixosSystem' = import "${nixpkgs'}/nixos/lib/eval-config.nix"; basic = { config, ... }: { imports = [ @@ -93,7 +92,7 @@ in { nixosConfigurations = { - basic = nixosSystem' { + basic = nixpkgs'.lib.nixosSystem { system = "x86_64-linux"; modules = [ basic @@ -101,7 +100,7 @@ ]; }; - ldap = nixosSystem' { + ldap = nixpkgs'.lib.nixosSystem { system = "x86_64-linux"; modules = [ basic diff --git a/demo/nextcloud/flake.nix b/demo/nextcloud/flake.nix index 9cb7aaa..87e1554 100644 --- a/demo/nextcloud/flake.nix +++ b/demo/nextcloud/flake.nix @@ -10,7 +10,6 @@ let system = "x86_64-linux"; nixpkgs' = selfhostblocks.lib.${system}.patchedNixpkgs; - nixosSystem' = import "${nixpkgs'}/nixos/lib/eval-config.nix"; basic = { config, ... }: { imports = [ @@ -160,14 +159,14 @@ in { nixosConfigurations = { - basic = nixosSystem' { + basic = nixpkgs'.lib.nixosSystem { system = "x86_64-linux"; modules = [ sopsConfig basic ]; }; - ldap = nixosSystem' { + ldap = nixpkgs'.lib.nixosSystem { system = "x86_64-linux"; modules = [ sopsConfig @@ -175,7 +174,7 @@ ldap ]; }; - sso = nixosSystem' { + sso = nixpkgs'.lib.nixosSystem { system = "x86_64-linux"; modules = [ sopsConfig diff --git a/flake.nix b/flake.nix index 23cf69c..5f47957 100644 --- a/flake.nix +++ b/flake.nix @@ -26,15 +26,19 @@ # hash = "sha256-hoLrqV7XtR1hP/m0rV9hjYUBtrSjay0qcPUYlKKuVWk="; # }) ]; + + # The .src attribute is important to get back to the top-level + # and be able to access the .lib attribute. patchNixpkgs = { nixpkgs, patches, system, - }: nixpkgs.legacyPackages.${system}.applyPatches { + }: (nixpkgs.legacyPackages.${system}.applyPatches { name = "nixpkgs-patched"; src = nixpkgs; inherit patches; - }; + }).src; + patchedNixpkgs = (patchNixpkgs { nixpkgs = inputs.nixpkgs; patches = shbPatches;