1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-09-21 13:57:31 +02: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 committed by Mikilio
parent 5553c93889
commit dbded8d0ec
No known key found for this signature in database
GPG key ID: 5B2F1A890CF33F3F

View file

@ -258,6 +258,9 @@ function doInit() {
withFlake=1 withFlake=1
fi fi
local homeManagerUrl="github:nix-community/home-manager"
local nixpkgsUrl="github:nixos/nixpkgs/nixos-unstable"
while (( $# > 0 )); do while (( $# > 0 )); do
local opt="$1" local opt="$1"
shift shift
@ -269,6 +272,14 @@ function doInit() {
--switch) --switch)
switch=1 switch=1
;; ;;
--home-manager-url)
homeManagerUrl="$1"
shift
;;
--nixpkgs-url)
nixpkgsUrl="$1"
shift
;;
-*) -*)
_iError "%s: unknown option '%s'" "$0" "$opt" >&2 _iError "%s: unknown option '%s'" "$0" "$opt" >&2
exit 1 exit 1
@ -419,9 +430,9 @@ EOF
inputs = { inputs = {
# Specify the source of Home Manager and Nixpkgs. # Specify the source of Home Manager and Nixpkgs.
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "$nixpkgsUrl";
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "$homeManagerUrl";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };