Shared ModulesΒΆ

Much of the code running on both macOS and Linux (NixOS) is found here.

LayoutΒΆ

.
β”œβ”€β”€ config                 # Config files not written in Nix
β”‚Β Β  β”œβ”€β”€ emacs/             # Emacs configuration
β”‚Β Β  β”œβ”€β”€ vscode/            # VSCode configuration
β”‚Β Β  β”œβ”€β”€ gcp-ssh-script.sh  # WezTerm configuration
β”‚Β Β  β”œβ”€β”€ starship.toml      # Starship configuration
β”‚Β Β  └── wezterm.lua        # WezTerm configuration
β”œβ”€β”€ cachix                 # Defines Cachix, a global cache for builds
β”œβ”€β”€ files.nix              # Non-Nix, static configuration files (immutable by default, option for mutable)
β”œβ”€β”€ mutable.nix            # Adds options to home.file to make files mutable
β”œβ”€β”€ packages.nix           # List of shared packages
└── programs.nix           # Main shared configuration for most programs

DetailsΒΆ

UtilitiesΒΆ

  • cachix defines substituters, which are additional stores from which Nix can obtain objects rather than building them from source. This enables faster builds, and you typically won’t need to modify this file. For more documentation, refer to the Nix Reference Manual.

  • mutable.nix is adapted from this gist. It adds two flags to home.file = { }:

    • mutable = true; β€” allows the created or symlinked file to be modified.

    • force = true; β€” required if mutable = true;.

      An example of its usage can be found in modules/darwin/files.nix to define VSCode keybindings and settings, which must be mutable since VSCode will override them when new keybindings are defined. See config/vscode for more details.

Core ConfigurationΒΆ

This structure is very similar to the modules/darwin config and the modules/linux config. Here, you define any files, packages, and program settings that should be shared between your Linux and Darwin configurations. In fact, most of your shared configuration will reside here.

  • In files.nix, specify files that should be pre-created or symlinked. By default, files are immutable to guarantee reproducibility, but if you require some files to be mutable (such as VSCode keybindings), this is possible thanks to mutable.nix.

  • In packages.nix, define any packages you may need across systems.

  • In programs.nix, define settings specific to the programs you use. Examples include configuration for git, zsh, or vim.

    • Any specific options for programs are handled through home-manager. You can find available options in the Home Manager Option Search

External configurationΒΆ

Additional configuration for some programs can be found in config/ directory.