From dbded8d0ec5d253e894cde3806f1fae7c022b39c Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Mon, 12 Feb 2024 23:40:15 +0100 Subject: [PATCH] home-manager: overrideable URLs in generated flake When using the `init` sub-command, it is now possible to set the Home Manager and Nixpkgs input URLs. Note, for now these options are considered experimental. --- home-manager/home-manager | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/home-manager/home-manager b/home-manager/home-manager index ba3b8d98e..ddcd7a810 100644 --- a/home-manager/home-manager +++ b/home-manager/home-manager @@ -258,6 +258,9 @@ function doInit() { withFlake=1 fi + local homeManagerUrl="github:nix-community/home-manager" + local nixpkgsUrl="github:nixos/nixpkgs/nixos-unstable" + while (( $# > 0 )); do local opt="$1" shift @@ -269,6 +272,14 @@ function doInit() { --switch) switch=1 ;; + --home-manager-url) + homeManagerUrl="$1" + shift + ;; + --nixpkgs-url) + nixpkgsUrl="$1" + shift + ;; -*) _iError "%s: unknown option '%s'" "$0" "$opt" >&2 exit 1 @@ -419,9 +430,9 @@ EOF inputs = { # Specify the source of Home Manager and Nixpkgs. - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs.url = "$nixpkgsUrl"; home-manager = { - url = "github:nix-community/home-manager"; + url = "$homeManagerUrl"; inputs.nixpkgs.follows = "nixpkgs"; }; };