mirror of
https://gitlab.com/TECHNOFAB/coder-templates.git
synced 2025-12-12 02:00:11 +01:00
chore: initial commit
This commit is contained in:
commit
8cf73a70ef
19 changed files with 1004 additions and 0 deletions
71
nix/repo/ci.nix
Normal file
71
nix/repo/ci.nix
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{inputs, ...}: let
|
||||
inherit (inputs) pkgs cilib;
|
||||
inherit (pkgs.lib) concatStringsSep;
|
||||
in
|
||||
cilib.mkCI {
|
||||
pipelines."default" = {
|
||||
stages = ["build" "upload"];
|
||||
jobs = let
|
||||
SYSTEMS = ["aarch64-linux" "x86_64-linux"];
|
||||
TEMPLATES = ["nix-kubernetes"];
|
||||
in {
|
||||
"build" = {
|
||||
stage = "build";
|
||||
parallel.matrix = [
|
||||
{TEMPLATE = TEMPLATES;}
|
||||
];
|
||||
nix.deps = [pkgs.gnutar];
|
||||
script = [
|
||||
# sh
|
||||
''
|
||||
nix build .#''${TEMPLATE}
|
||||
install -D result templates/''${TEMPLATE}.tf.json
|
||||
tar -cf templates/''${TEMPLATE}.tar -C templates ''${TEMPLATE}.tf.json
|
||||
''
|
||||
];
|
||||
artifacts.paths = ["templates/"];
|
||||
};
|
||||
"build:image" = {
|
||||
stage = "build";
|
||||
parallel.matrix = [
|
||||
{SYSTEM = SYSTEMS;}
|
||||
];
|
||||
script = [
|
||||
# sh
|
||||
''
|
||||
nix build .#nix-coder-image --system $SYSTEM
|
||||
install -D result dist/nix-coder-image_''${SYSTEM}.tar.gz
|
||||
''
|
||||
];
|
||||
artifacts.paths = ["dist/"];
|
||||
};
|
||||
"upload" = {
|
||||
stage = "upload";
|
||||
nix.deps = [pkgs.buildah];
|
||||
needs = ["build:image"];
|
||||
before_script = [
|
||||
# sh
|
||||
''
|
||||
export REGISTRY_AUTH_FILE=''${HOME}/auth.json
|
||||
echo "$CI_REGISTRY_PASSWORD" | buildah login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
|
||||
mkdir -p /etc/containers
|
||||
echo '{"default":[{"type":"insecureAcceptAnything"}]}' > /etc/containers/policy.json
|
||||
mkdir -p /var/tmp
|
||||
''
|
||||
];
|
||||
script = [
|
||||
# sh
|
||||
''
|
||||
buildah manifest create localhost/nix-coder-image
|
||||
${concatStringsSep "\n" (map (
|
||||
sys: "buildah manifest add localhost/nix-coder-image docker-archive:dist/nix-coder-image_${sys}.tar.gz"
|
||||
)
|
||||
SYSTEMS)}
|
||||
buildah manifest push --all localhost/nix-coder-image \
|
||||
docker://''${CI_REGISTRY_IMAGE}/nix-coder-image:$CI_COMMIT_SHORT_SHA
|
||||
''
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
23
nix/repo/devShells.nix
Normal file
23
nix/repo/devShells.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
inputs,
|
||||
cell,
|
||||
...
|
||||
}: let
|
||||
inherit (inputs) pkgs devshell treefmt soonix;
|
||||
inherit (cell) ci;
|
||||
in {
|
||||
default = devshell.mkShell {
|
||||
imports = [
|
||||
soonix.devshellModule
|
||||
];
|
||||
packages = [
|
||||
(treefmt.mkWrapper pkgs {
|
||||
programs = {
|
||||
alejandra.enable = true;
|
||||
mdformat.enable = true;
|
||||
};
|
||||
})
|
||||
];
|
||||
soonix.hooks.ci = ci.soonix;
|
||||
};
|
||||
}
|
||||
82
nix/repo/flake.lock
generated
Normal file
82
nix/repo/flake.lock
generated
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
{
|
||||
"nodes": {
|
||||
"devshell-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1758204313,
|
||||
"narHash": "sha256-ainbY0Oajb1HMdvy+A8QxF/P5qwcbEzJGEY5pzKdDdc=",
|
||||
"owner": "rensa-nix",
|
||||
"repo": "devshell",
|
||||
"rev": "7d0c4bc78d9f017a739b0c7eb2f4e563118353e6",
|
||||
"type": "gitlab"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "rensa-nix",
|
||||
"repo": "devshell",
|
||||
"type": "gitlab"
|
||||
}
|
||||
},
|
||||
"nix-gitlab-ci-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1763066668,
|
||||
"narHash": "sha256-mcNiuWf5R0qS7Be4EFAxPStl3SSYPhg4PSPAXgjKJj0=",
|
||||
"owner": "TECHNOFAB",
|
||||
"repo": "nix-gitlab-ci",
|
||||
"rev": "524bdf9cdcfb8008c08d7e54a95992ebf05331d5",
|
||||
"type": "gitlab"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "TECHNOFAB",
|
||||
"ref": "3.0.1",
|
||||
"repo": "nix-gitlab-ci",
|
||||
"type": "gitlab"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"devshell-lib": "devshell-lib",
|
||||
"nix-gitlab-ci-lib": "nix-gitlab-ci-lib",
|
||||
"soonix-lib": "soonix-lib",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"soonix-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1758615778,
|
||||
"narHash": "sha256-tggru+siXlLcLUjHtMojkJJWTS/8I3gm8nhnlz+qrTo=",
|
||||
"owner": "TECHNOFAB",
|
||||
"repo": "soonix",
|
||||
"rev": "e04b71c07413251dcb52036b4a51c6c7c0dca2ad",
|
||||
"type": "gitlab"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "TECHNOFAB",
|
||||
"repo": "soonix",
|
||||
"type": "gitlab"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1762410071,
|
||||
"narHash": "sha256-aF5fvoZeoXNPxT0bejFUBXeUjXfHLSL7g+mjR/p5TEg=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "97a30861b13c3731a84e09405414398fbf3e109f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
19
nix/repo/flake.nix
Normal file
19
nix/repo/flake.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
inputs = {
|
||||
devshell-lib.url = "gitlab:rensa-nix/devshell?dir=lib";
|
||||
soonix-lib.url = "gitlab:TECHNOFAB/soonix?dir=lib";
|
||||
nix-gitlab-ci-lib.url = "gitlab:TECHNOFAB/nix-gitlab-ci/3.0.1?dir=lib";
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
outputs = i:
|
||||
i
|
||||
// {
|
||||
devshell = i.devshell-lib.lib {inherit (i.parent) pkgs;};
|
||||
soonix = i.soonix-lib.lib {inherit (i.parent) pkgs;};
|
||||
cilib = i.nix-gitlab-ci-lib.lib {inherit (i.parent) pkgs;};
|
||||
treefmt = import i.treefmt-nix;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue