-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
78 lines (76 loc) · 2.76 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
};
outputs = { nixpkgs, ... }:
let
forEachSystem = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
in
{
packages = forEachSystem (system:
let
pkgs = import nixpkgs { inherit system; };
lib = nixpkgs.lib;
in {
xos-buildkite-image =
let nixosSystem = lib.nixosSystem {
inherit system;
modules = [
({ modulesPath, config, ... }: {
imports = [
"${modulesPath}/virtualisation/docker-image.nix"
"${modulesPath}/installer/cd-dvd/channel.nix"
];
fileSystems = {
"/".fsType = "tmpfs";
};
boot.loader.external = {
enable = true;
installHook = "${pkgs.coreutils}/bin/true";
};
nix.enable = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
users.users.buildkite = {
isNormalUser = true;
extraGroups = [];
password = "";
uid = 2000;
shell = pkgs.bash;
};
users.groups.buildkite.gid = config.users.users.buildkite.uid;
environment.systemPackages = with pkgs; [
buildkite-agent buildkite-cli gh bashInteractive git-repo git jdk21
ccache ninja
util-linux coreutils findutils procps cacert nix nix-bundle iana-etc
];
system.stateVersion = "24.11";
})
];
};
in nixosSystem.config.system.build.tarball;
/*pkgs.dockerTools.buildLayeredImage {
name = "xos-buildkite";
tag = "15.2.0";
/*enableFakechroot = true;
fakeRootCommands = ''
#!${pkgs.runtimeShell}
${pkgs.dockerTools.shadowSetup}
groupadd -g 2000 buildkite
useradd -m -s /bin/bash -u 2000 -g 2000 buildkite
usermod -a -G nix-users buildkite
'';
contents = with pkgs; [
buildkite-agent buildkite-cli gh bash git-repo git jdk21
ccache ninja
util-linux coreutils findutils procps
nix-bundle nix iana-etc openssl
];
config = { Cmd = [ "bash" "-ec" "nix-daemon & runuser -u buildkite -g buildkite -G nix-users -- env buildkite-agent start & wait -n; exit $?"]; };
* /
contents = [ nixosSystem.config.system.build.tarball ];
config = { Cmd = [ "/init" ]; };
};*/
}
);
};
}