Skip to content

Commit 1896a8c

Browse files
committed
nixosConfigurations: add ci-vm
Add a VM for using `act` to test GitHub workflows. https://github.com/nektos/act
1 parent d88024c commit 1896a8c

File tree

4 files changed

+99
-0
lines changed

4 files changed

+99
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ result/
33
.pre-commit-config.yaml
44
*.otf
55

6+
# VM
7+
nixos.qcow2
8+
69
# Python
710
__pycache__
811

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
hydraJobs = import ./hydra-jobs inputs;
2626
legacyPackages = import ./legacy-packages inputs;
2727
library = import ./library inputs;
28+
nixosConfigurations = import ./nixos-configurations inputs;
2829
overlays = import ./overlays inputs;
2930
packages = import ./packages inputs;
3031
};
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
lib,
3+
modulesPath,
4+
pkgs,
5+
...
6+
}:
7+
8+
let
9+
10+
inherit (lib.modules)
11+
mkMerge
12+
;
13+
14+
in
15+
16+
{
17+
imports = [
18+
(modulesPath + "/profiles/qemu-guest.nix")
19+
(modulesPath + "/profiles/minimal.nix")
20+
];
21+
22+
config = mkMerge [
23+
24+
{
25+
26+
# Needed to make nix flake check happy
27+
system.stateVersion = "25.05";
28+
nixpkgs.hostPlatform = "x86_64-linux";
29+
fileSystems = {
30+
"/".device = "/dev/hda1";
31+
};
32+
33+
boot.loader.systemd-boot.enable = true;
34+
boot.loader.efi.canTouchEfiVariables = true;
35+
36+
# Configure networking
37+
networking.useDHCP = true;
38+
39+
# Create user "test"
40+
users.users.test.isNormalUser = true;
41+
users.users.test.initialPassword = "test";
42+
users.users.test.extraGroups = [ "wheel" ];
43+
44+
# Enable passwordless ‘sudo’ for the "test" user
45+
services.getty.autologinUser = "test";
46+
security.sudo.wheelNeedsPassword = false;
47+
48+
# Make VM output to the terminal instead of a separate window
49+
virtualisation.vmVariant.virtualisation.graphics = false;
50+
51+
}
52+
53+
{
54+
# Setup environment for act
55+
environment.systemPackages = with pkgs; [
56+
act
57+
git
58+
vim
59+
];
60+
virtualisation.docker.enable = true;
61+
virtualisation.vmVariant.virtualisation.diskSize = 8192;
62+
virtualisation.vmVariant.virtualisation.memorySize = 2048;
63+
virtualisation.vmVariant.virtualisation.cores = 4;
64+
users.users.test.extraGroups = [ "docker" ];
65+
}
66+
67+
];
68+
}

nixos-configurations/default.nix

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
inputs:
2+
3+
let
4+
5+
inherit (inputs.nixpkgs)
6+
lib
7+
;
8+
9+
inherit (lib)
10+
nixosSystem
11+
;
12+
13+
inherit (lib.attrsets)
14+
filterAttrs
15+
mapAttrs
16+
;
17+
18+
in
19+
20+
mapAttrs (
21+
configurationDir: _:
22+
nixosSystem {
23+
modules = [
24+
./${configurationDir}/configuration.nix
25+
];
26+
}
27+
) (filterAttrs (_: fileType: fileType == "directory") (builtins.readDir ./.))

0 commit comments

Comments
 (0)