Skip to content

Commit

Permalink
ci: Use om init --test
Browse files Browse the repository at this point in the history
  • Loading branch information
srid committed Oct 9, 2024
1 parent c35944c commit f8ce617
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 34 deletions.
36 changes: 2 additions & 34 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,7 @@ jobs:
- name: om ci
run: om ci --extra-access-tokens "github.com=${{ secrets.GITHUB_TOKEN }}" run --systems "${{ matrix.system }}"

# Make sure that the templates at least build after initialized
# TODO: Ideally, we want to let `omnix` run these tests
# https://github.com/juspay/omnix/issues/282
- name: home-manager test
- name: om init tests
run: |
CONF=${{ runner.temp }}/home-manager && mkdir $CONF
om init .#home -o $CONF \
--non-interactive \
--params '{"username": "srid", "git-name": "Srid", "git-email": "srid@srid.ca", "neovim": true}'
set -x
nix build ${CONF}#homeConfigurations.srid.activationPackage
ls -l ./result/home-path/bin/git
ls -l ./result/home-path/bin/nvim
ls -l ./result/home-files/.config/git/config
om init --test .
- name: NixOS test
if: matrix.system == 'x86_64-linux'
run: |
CONF=${{ runner.temp }}/nixos && mkdir $CONF
om init .#nixos -o $CONF \
--non-interactive \
--params '{"hostname": "example", "username": "srid", "git-name": "Srid", "git-email": "srid@srid.ca"}'
set -x
nix build ${CONF}#nixosConfigurations.example.config.system.build.toplevel
type -f ./result/etc/profiles/per-user/srid/bin/git
- name: nix-darwin test
if: matrix.system == 'aarch64-darwin' || matrix.system == 'x86_64-darwin'
run: |
CONF=${{ runner.temp }}/darwin && mkdir $CONF
om init .#darwin -o $CONF \
--non-interactive \
--params '{"hostname": "example", "username": "srid", "git-name": "Srid", "git-email": "srid@srid.ca"}'
set -x
nix build ${CONF}#darwinConfigurations.example.config.system.build.toplevel
type -f ./result/etc/profiles/per-user/srid/bin/git
28 changes: 28 additions & 0 deletions modules/flake-parts/template.nix
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,20 @@
placeholder = "example";
}
] ++ om.templates.home.params;
tests = {
default = {
systems = [ "x86_64-linux" "aarch64-linux" ];
params = om.templates.home.tests.default.params // {
hostname = "example";
};
asserts = {
source = { };
packages."nixosConfigurations.example.config.system.build.toplevel" = {
"etc/profiles/per-user/john/bin/git" = true;
};
};
};
};
};

darwin = {
Expand All @@ -179,6 +193,20 @@
placeholder = "example";
}
] ++ om.templates.home.params;
tests = {
default = {
systems = [ "x86_64-darwin" "aarch64-darwin" ];
params = om.templates.home.tests.default.params // {
hostname = "example";
};
asserts = {
source = { };
packages."darwinConfigurations.example.config.system.build.toplevel" = {
"etc/profiles/per-user/john/bin/git" = true;
};
};
};
};
};
};
};
Expand Down

0 comments on commit f8ce617

Please sign in to comment.