Unable to create package from flake and have it show up in /run/current-system/sw/bin

Hi Everyone-

I’m trying to get a package I’ve created from a flake to show up in /run/current-system/sw/bin using environment.systemPackages, but the symlink does not show up. I have a bash script and package resticctl that’s a wrapper for the backup program restic. My main flake.nix calls the restic.nix module. I can get the package to build and show up in /nix/store, but can’t get the symlink to be created in /run/current-system/sw/bin. Any thoughts?

Here’s how I’m trying to do it:

{
  description = "Main system flake";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    gitea-resticctl.url = "git+https://my-gitea-instance/resticctl";
  };

  outputs = inputs@{ self, nixpkgs, gitea-resticctl }:
  let
    system = "x86_64-linux";
    pkgs-resticctl = gitea-resticctl;
  in
  {
    nixosConfigurations =
    {
      laptop = nixpkgs.lib.nixosSystem {
        inherit system;
        specialArgs = { inherit pkgs-resticctl; };
        modules = [
          ./configuration.nix
          ./restic.nix
        ];
      };
    };
  };
}

In my restic.nix I have pkgs-resticctl in environment.systemPackages:

{ pkgs, pkgs-resticctl, ... }:

{
  environment.systemPackages = [
    pkgs.restic
    pkgs.scponly
    pkgs-resticctl
  ];
}

This is my resticctl flake:

{
  description = "A wrapper for the restic backup application";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, flake-utils }:
  let system = "x86_64-linux";
  in
  {
    packages.${system} = {
      resticctl = nixpkgs.legacyPackages.${system}.callPackage ./pkgs/resticctl {};
      default = self.packages.${system}.resticctl;
    };
  };
}
# pkgs/resticctl/default.nix
{ stdenv }:

stdenv.mkDerivation {
  pname = "resticctl";
  src = ../../src;
  version = "1.0";

  installPhase = ''
    mkdir -p $out/bin
    cp -rv $src/resticctl $out/bin
  '';
}

pkgs-resticctl is the entire flake, not the package within it. Try

environment.systemPackages = [
  pkgs.restic
  pkgs.scponly
  pkgs-resticctl.packages.x86_64-linux.resticctl
];

(Instead of hardcoding x86_64-linux you can also use pkgs.stdenv.hostPlatform.system)

Yes, that worked!! Thank you so much!