about summary refs log tree commit diff
path: root/pkgs/by-name/ho/home-manager/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/ho/home-manager/package.nix')
-rw-r--r--pkgs/by-name/ho/home-manager/package.nix95
1 files changed, 95 insertions, 0 deletions
diff --git a/pkgs/by-name/ho/home-manager/package.nix b/pkgs/by-name/ho/home-manager/package.nix
new file mode 100644
index 000000000000..dce820175938
--- /dev/null
+++ b/pkgs/by-name/ho/home-manager/package.nix
@@ -0,0 +1,95 @@
+{ lib
+, bash
+, coreutils
+, fetchFromGitHub
+, findutils
+, gettext
+, gnused
+, installShellFiles
+, less
+, ncurses
+, nixos-option
+, stdenvNoCC
+, unixtools
+, unstableGitUpdater
+}:
+
+stdenvNoCC.mkDerivation (finalAttrs: {
+  pname = "home-manager";
+  version = "0-unstable-2024-02-24";
+
+  src = fetchFromGitHub {
+    name = "home-manager-source";
+    owner = "nix-community";
+    repo = "home-manager";
+    rev = "4ee704cb13a5a7645436f400b9acc89a67b9c08a";
+    hash = "sha256-MSbxtF3RThI8ANs/G4o1zIqF5/XlShHvwjl9Ws0QAbI=";
+  };
+
+  nativeBuildInputs = [
+    gettext
+    installShellFiles
+  ];
+
+  dontConfigure = true;
+  dontBuild = true;
+
+  installPhase = ''
+    runHook preInstall
+
+    install -D -m755 home-manager/home-manager $out/bin/home-manager
+    install -D -m755 lib/bash/home-manager.sh $out/share/bash/home-manager.sh
+
+    installShellCompletion --bash --name home-manager.bash home-manager/completion.bash
+    installShellCompletion --fish --name home-manager.fish home-manager/completion.fish
+    installShellCompletion --zsh --name _home-manager home-manager/completion.zsh
+
+    for pofile in home-manager/po/*.po; do
+      lang="''${pofile##*/}"
+      lang="''${lang%%.*}"
+      mkdir -p "$out/share/locale/$lang/LC_MESSAGES"
+      msgfmt -o "$out/share/locale/$lang/LC_MESSAGES/home-manager.mo" "$pofile"
+    done
+
+    runHook postInstall
+  '';
+
+  postFixup = ''
+    substituteInPlace $out/bin/home-manager \
+      --subst-var-by bash "${bash}" \
+      --subst-var-by DEP_PATH "${
+        lib.makeBinPath [
+          coreutils
+          findutils
+          gettext
+          gnused
+          less
+          ncurses
+          nixos-option
+          unixtools.hostname
+        ]
+      }" \
+      --subst-var-by HOME_MANAGER_LIB '${placeholder "out"}/share/bash/home-manager.sh' \
+      --subst-var-by HOME_MANAGER_PATH "${finalAttrs.src}" \
+      --subst-var-by OUT '${placeholder "out"}'
+  '';
+
+  passthru.updateScript = unstableGitUpdater {
+    url = "https://github.com/nix-community/home-manager/";
+  };
+
+  meta = {
+    homepage = "https://nix-community.github.io/home-manager/";
+    description = "A Nix-based user environment configurator";
+    longDescription = ''
+      The Home-Manager project provides a basic system for managing a user
+      environment using the Nix package manager together with the Nix libraries
+      found in Nixpkgs. It allows declarative configuration of user specific
+      (non global) packages and dotfiles.
+    '';
+    license = lib.licenses.mit;
+    mainProgram = "home-manager";
+    maintainers = with lib.maintainers; [ AndersonTorres ];
+    platforms = lib.platforms.unix;
+  };
+})