From 80b91c08121e4d9d557962bcf2ae7b9c2e2c0b4b Mon Sep 17 00:00:00 2001 From: Sam Estep Date: Sun, 11 Jan 2026 12:46:15 -0500 Subject: [PATCH 1/2] Extend Docker setup to support ARM --- .github/workflows/build.yml | 11 +++++++-- .github/workflows/update.yml | 18 +++++++++++--- Dockerfile | 13 +++++----- README.md | 4 ++-- {docker/codex => codex}/config.toml | 0 {docker => docker-arm}/home-manager/home.nix | 12 ++++------ docker-x86/home-manager/home.nix | 25 ++++++++++++++++++++ flake.nix | 12 +++++++++- 8 files changed, 73 insertions(+), 22 deletions(-) rename {docker/codex => codex}/config.toml (100%) rename {docker => docker-arm}/home-manager/home.nix (70%) create mode 100644 docker-x86/home-manager/home.nix diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 601af00..7587ccd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,9 +27,16 @@ jobs: - uses: actions/checkout@v6 - run: nix build --print-build-logs .#homeConfigurations.samueles.activationPackage - hm-docker: + hm-docker-x86: runs-on: ubuntu-24.04 steps: - uses: cachix/install-nix-action@v31 - uses: actions/checkout@v6 - - run: nix build --print-build-logs .#homeConfigurations.agent.activationPackage + - run: nix build --print-build-logs .#homeConfigurations.agent-amd64.activationPackage + + hm-docker-arm: + runs-on: ubuntu-24.04-arm + steps: + - uses: cachix/install-nix-action@v31 + - uses: actions/checkout@v6 + - run: nix build --print-build-logs .#homeConfigurations.agent-arm64.activationPackage diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 0cb5625..55da4d7 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -55,7 +55,7 @@ jobs: name: flake.lock - run: nix build --print-build-logs .#homeConfigurations.samueles.activationPackage - hm-docker: + hm-docker-x86: needs: lock runs-on: ubuntu-24.04 steps: @@ -64,7 +64,18 @@ jobs: - uses: actions/download-artifact@v7 with: name: flake.lock - - run: nix build --print-build-logs .#homeConfigurations.agent.activationPackage + - run: nix build --print-build-logs .#homeConfigurations.agent-amd64.activationPackage + + hm-docker-arm: + needs: lock + runs-on: ubuntu-24.04-arm + steps: + - uses: cachix/install-nix-action@v31 + - uses: actions/checkout@v6 + - uses: actions/download-artifact@v7 + with: + name: flake.lock + - run: nix build --print-build-logs .#homeConfigurations.agent-arm64.activationPackage pr: needs: @@ -72,7 +83,8 @@ jobs: - nixos - hm-nixos - hm-macos - - hm-docker + - hm-docker-x86 + - hm-docker-arm runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 diff --git a/Dockerfile b/Dockerfile index 9e74ac2..a3605fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,18 @@ FROM ubuntu +ARG TARGETARCH RUN apt-get update \ && apt-get upgrade -y \ && apt-get install -y curl git sudo xz-utils -RUN useradd -m -s /bin/bash agent \ - && usermod -aG sudo agent \ +RUN useradd -m -s /bin/bash agent-${TARGETARCH} \ + && usermod -aG sudo agent-${TARGETARCH} \ && mkdir -m 0755 /nix \ - && chown agent /nix -USER agent + && chown agent-${TARGETARCH} /nix +USER agent-${TARGETARCH} RUN curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install | sh -s -- --no-daemon \ && mkdir -p ~/.config/nix \ && echo 'experimental-features = nix-command flakes' > ~/.config/nix/nix.conf -ENV USER=agent -ENV PATH=/home/agent/.nix-profile/bin:$PATH +ENV USER=agent-${TARGETARCH} +ENV PATH=/home/agent-${TARGETARCH}/.nix-profile/bin:$PATH RUN git clone https://github.com/samestep/env.git ~/github/samestep/env \ && ln -fsT ~/github/samestep/env ~/.config/home-manager \ && nix run ~/github/samestep/env#home-manager -- init --switch -b backup diff --git a/README.md b/README.md index 5aad07d..fe83c7b 100644 --- a/README.md +++ b/README.md @@ -72,9 +72,9 @@ ln -fsT ~/github/samestep/env ~/.config/home-manager nix run ~/github/samestep/env#home-manager -- init --switch --impure ``` -## [Docker](docker) +## Docker ([x86](docker-x86) and [ARM](docker-arm)) -This repo also contains a dedicated Home Manager config for use in an x86 Ubuntu Docker container; for instance: +This repo also contains dedicated Home Manager configs for use in an Ubuntu Docker container; for instance: ```sh docker build . -t agent diff --git a/docker/codex/config.toml b/codex/config.toml similarity index 100% rename from docker/codex/config.toml rename to codex/config.toml diff --git a/docker/home-manager/home.nix b/docker-arm/home-manager/home.nix similarity index 70% rename from docker/home-manager/home.nix rename to docker-arm/home-manager/home.nix index c0f1cbe..c5c95b5 100644 --- a/docker/home-manager/home.nix +++ b/docker-arm/home-manager/home.nix @@ -1,8 +1,4 @@ -{ - config, - pkgs, - ... -}: +{ config, pkgs, ... }: let util = import ../../util.nix { inherit config pkgs; }; in @@ -13,13 +9,13 @@ in # # https://nix-community.github.io/home-manager/release-notes.xhtml stateVersion = "25.11"; - username = "agent"; - homeDirectory = "/home/agent"; + username = "agent-arm64"; + homeDirectory = "/home/agent-arm64"; packages = util.packages; file = util.file // { - ".codex/config.toml" = util.symlink "docker/codex/config.toml"; + ".codex/config.toml" = util.symlink "codex/config.toml"; }; }; diff --git a/docker-x86/home-manager/home.nix b/docker-x86/home-manager/home.nix new file mode 100644 index 0000000..d447c7f --- /dev/null +++ b/docker-x86/home-manager/home.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: +let + util = import ../../util.nix { inherit config pkgs; }; +in +{ + nixpkgs = util.nixpkgs; + + home = { + # # https://nix-community.github.io/home-manager/release-notes.xhtml + stateVersion = "25.11"; + + username = "agent-amd64"; + homeDirectory = "/home/agent-amd64"; + + packages = util.packages; + + file = util.file // { + ".codex/config.toml" = util.symlink "codex/config.toml"; + }; + }; + + programs = util.programs // { + bash.enable = true; # Necessary for aliases and Starship to work. + }; +} diff --git a/flake.nix b/flake.nix index c5ce7ac..9d29917 100644 --- a/flake.nix +++ b/flake.nix @@ -102,7 +102,7 @@ }; modules = [ ./ubuntu/home-manager/home.nix ]; }; - "agent" = home-manager.lib.homeManagerConfiguration { + "agent-amd64" = home-manager.lib.homeManagerConfiguration { pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ @@ -112,6 +112,16 @@ }; modules = [ ./docker/home-manager/home.nix ]; }; + "agent-arm64" = home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { + system = "aarch64-linux"; + overlays = [ + npc.overlays.default + moss.overlays.default + ]; + }; + modules = [ ./docker/home-manager/home.nix ]; + }; }; devShells = let From 46f47239645b8f7b7cba9f6e106c78256964f4ec Mon Sep 17 00:00:00 2001 From: Sam Estep Date: Sun, 11 Jan 2026 12:48:37 -0500 Subject: [PATCH 2/2] Fix paths --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 9d29917..514c3cf 100644 --- a/flake.nix +++ b/flake.nix @@ -110,7 +110,7 @@ moss.overlays.default ]; }; - modules = [ ./docker/home-manager/home.nix ]; + modules = [ ./docker-x86/home-manager/home.nix ]; }; "agent-arm64" = home-manager.lib.homeManagerConfiguration { pkgs = import nixpkgs { @@ -120,7 +120,7 @@ moss.overlays.default ]; }; - modules = [ ./docker/home-manager/home.nix ]; + modules = [ ./docker-arm/home-manager/home.nix ]; }; }; devShells =