Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI

on:
pull_request:
branches:
- main
- master

jobs:
check-base:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Build base image
run: docker build ./images/base

check-nix:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Install Nix
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes

- name: Cache Nix store
uses: actions/cache@v4
with:
path: |
/nix/store
~/.cache/nix
key: nix-${{ runner.os }}-${{ hashFiles('images/nix/flake.lock') }}
restore-keys: |
nix-${{ runner.os }}-

- name: Generate flake.lock if missing
run: |
if [ ! -f images/nix/flake.lock ]; then
nix flake lock ./images/nix
fi

- name: Build nix image
run: nix build ./images/nix#dockerImage

check-devops:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Build devops image
run: docker build ./images/devops --build-arg BASE_IMAGE=ubuntu:noble
14 changes: 6 additions & 8 deletions images/nix/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ auth sufficient pam_rootok.so
password requisite pam_unix.so nullok yescrypt
session required pam_unix.so
'')
# Base sudoers file — required for sudo to run and load drop-ins
(writeTextDir "etc/sudoers" ''
root ALL=(ALL:ALL) ALL
@includedir /etc/sudoers.d
'')
];

# Nix configuration with flakes enabled
Expand Down Expand Up @@ -211,10 +206,13 @@ eval "$(direnv hook bash)"
# nixpkgs deliberately strips it from the Nix store; fakeroot
# records the permission and tar --hard-dereference preserves
# it in the Docker layer.
chmod 4755 ./nix/store/*-sudo-*/bin/sudo
chmod 4755 ./bin/sudo

# Ensure sudoers files have correct ownership and permissions
# (sudo refuses to run if these are group/world writable)
# Replace the sudo package's default /etc/sudoers with our own.
# symlinkJoin keeps the sudo package's version (which may not
# include @includedir), so we overwrite it here.
rm -f ./etc/sudoers
printf '%s\n' 'root ALL=(ALL:ALL) ALL' '@includedir /etc/sudoers.d' > ./etc/sudoers
chmod 0440 ./etc/sudoers
chown 0:0 ./etc/sudoers
chmod 0440 ./etc/sudoers.d/nopasswd
Expand Down
Loading