Skip to content
selubiPublic

About

My machine configurations as code

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

machine

Usage Guide

Applying machine settings to a fresh machine

  1. Install a nix distribution in your system and enable flakes. The snippet below will install Determinate Nix which have flakes pre-enabled.

    curl -fsSL https://install.determinate.systems/nix | sh -s -- install
  2. Determine which target you want to use, and run below (the example below will use the selubi@selupc target). This may take a while.

    nix run github:nix-community/home-manager -- switch --flake github:selubi/machine#selubi@selupc

Thats literally it! The only dependency needed here is curl, sh and internet access.

Updating machine to latest config

Any machine bootstrapped from this repo will have the nxm command available. Running it will automatically pull the latest configuration from the main branch of this repository for the current target and apply it:

nxm

This command is defined in ./modules/home/modules/nh.nix.

The current target can also be checked via NXM_TARGET environment variable.

Available targets

The available targets are formatted as userName@machineName, where machineName matches the attribute keys defined under globalConfig.machines, and userName matches attribute keys of globalConfig.machines.users.

Here is an example. If the globalConfig looks like this:

{
  machines = {
    selupc = {
      system = "x86_64-linux";
      users.selubi.homeConfiguration = [ ... ];
      users.guest.homeConfiguration = [ ... ];
    };
    selumacbook = {
      system = "aarch64-darwin";
      users.selubi.homeConfiguration = [ ... ];
    };
  };
}

Then:

selubi@selupc
guest@selupc
selubi@selumacbook

are all valid targets.

Things to explore

  • devshells
  • Managing secrets
  • flake-parts
  • google drive via rclone
  • nixos
    • 1password system auth & shell integration

Command cheat sheet

Update flake and switch to the new system

nxm -u

References

Shout out to these resources on helping me build this setup:

About

My machine configurations as code

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages