1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 03:29:45 +01:00

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.
This commit is contained in:
Robert Helgesson 2024-02-12 23:40:15 +01:00
parent 354643e6c1
commit 7889bfb475
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED

View file

@ -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";
};
};