/ packages / systemctl / default.nix
default.nix
 1  {
 2    lib,
 3    python3,
 4    stdenv,
 5  }:
 6  stdenv.mkDerivation {
 7    pname = "systemctl-macos";
 8    version = "1.0.0";
 9  
10    src = ./.;
11  
12    nativeBuildInputs = [ python3 ];
13  
14    installPhase = ''
15      runHook preInstall
16  
17      mkdir -p $out/bin
18      cp systemctl.py $out/bin/systemctl
19      chmod +x $out/bin/systemctl
20  
21      # Replace shebang with proper python3 path
22      substituteInPlace $out/bin/systemctl \
23        --replace "#!/usr/bin/env python3" "#!${python3}/bin/python3"
24  
25      runHook postInstall
26    '';
27  
28    meta = with lib; {
29      description = "systemctl compatibility layer for macOS using launchd";
30      longDescription = ''
31        A systemctl implementation for macOS that maps systemctl commands to their
32        launchctl equivalents. Provides familiar systemctl syntax for managing
33        launchd services on macOS.
34      '';
35      homepage = "https://github.com/Mic92/dotfiles";
36      license = licenses.mit;
37      maintainers = with maintainers; [ mic92 ];
38      platforms = platforms.darwin;
39      mainProgram = "systemctl";
40    };
41  }