I’ve published my updated dotfiles on github. For a long time I kept this repo private because it had some commits that had what thought might be sensitive information.

As I’ve upgraded my dotfiles to use Nix that became less and less of an issue, but the problem remained of the work-specific changes I made to make my life easier at Discord.

I’ve now refactored that out into it’s own private repo which uses this repo as an input. Which just goes to show the power of flakes…

Work Specific Configuration Link to heading

So how can you do the same thing?

  1. Create a repo for your dotfiles like I have.
    • Make it a flake
    • Make it public and on something like GitHub
  2. Create a repo for your work or context-specific environment. I used something like dotfiles-discord.
    • Also make this a flake
  3. (Once your first repo has been pushed with some outputs) In your work repo add an input to your personal dotfiles.
  4. You can now use your personal dotfiles flake outputs however you want in your work dotfiles.
    • In fact, you could use this trick for anyone else’s dotfiles out there. You don’t even have to copy paste.

Below I have some example configuration

  • I’ve modified it to roughly look like my work dotfiles look like right now
  • I use my dotfiles as my only input (and therefore rely on it for most of the basics)
  • I define a homeConfig inside the let ... in ... so everything could be in a single code snippet, but I typically put it in it’s own file and use the (import ./file.nix) { inherit dotfiles; } example.

Some things worth pointing out:

  • The URL for my dotfiles uses github:; NOT github.com: (this means use the “alias” github. It’s a feature of flakes.)
  • I pass my dotfiles into my configuration by wrapping what would normally be all that is needed.
    • The one in the let ... in ... doesn’t need it because dotfiles is in scope, but otherwise this makes it easy to access when moved into another file.
  description = "Work dotfile Configs";

  inputs = {
    dotfiles = {
      url = "github:chrisportela/dotfiles";

  outputs = { dotfiles, ... } @inputs:
      inherit (dotfiles) home-manager importPkgs forAllSystems;
      homeManagerConfig = { dotfiles }: { pkgs, lib, config, ... }: {
            imports = [
            home.username = "work";
            home.homeDirectory = "/home/work";
            home.packages = with pkgs; [

            programs.gh = {
                enableGitCredentialHelper = true;
                settings = {
                git_protocol = "https";
                prompt = "enabled";
            programs.git = {
                userEmail = "chris chrisportela com";
                ignores = [

            programs.direnv = {
                nix-direnv.enable = true;
                stdlib = (builtins.readFile ./direnvrc);

            programs.zsh.initExtra = ''
                alias push='git push --force-with-lease origin HEAD'

            programs.starship = {
                enable = lib.mkDefault true;
                enableZshIntegration = true;
    rec {
      inherit (dotfiles) devShells nixosModules;

      packages =
          "aarch64-darwin".default = homeConfigurations."chris@M1-MBP".activationPackage;
          "x86_64-linux".default = homeConfigurations."work".activationPackage;

      apps = {
        "aarch64-darwin".default = {
          type = "app";
          program = "${packages.aarch64-darwin.default}/activate";
        "x86_64-linux".default = {
          type = "app";
          program = "${packages.x86_64-linux.default}/activate";


      homeConfigurations = {
        "chris@M1-MBP" = home-manager.lib.homeManagerConfiguration {
          pkgs = importPkgs "aarch64-darwin";

          modules = [
            (homeManagerConfig { inherit dotfiles; })

        "work" = home-manager.lib.homeManagerConfiguration {
          pkgs = importPkgs "x86_64-linux";

          modules = [
            (import ./coder.nix { inherit dotfiles; })

Power of flakes Link to heading

This is a really great example of how Flakes make it so easy to compose Nix without needing to do a lot of leg work.

I’m very excited to have my dotfiles nicely seperated so I can make my work dotfiles even more fine-tuned for work while still taking advantage of any improvements I make on my personal dotfiles.

Another huge bonus is that this is not using a submodule, which is something I used in the past to do things like this.