Gitlab CI support added, in order to pre-cache build results in Minio.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
stages:
|
||||
- eval
|
||||
- build
|
||||
|
||||
default:
|
||||
tags:
|
||||
- nix
|
||||
|
||||
"Evaluate for builds":
|
||||
stage: eval
|
||||
artifacts:
|
||||
paths:
|
||||
- gitlab-ci-continue.yml
|
||||
script: nix run ".#gen-build" > gitlab-ci-continue.yml
|
||||
|
||||
"Trigger builds":
|
||||
stage: build
|
||||
trigger:
|
||||
include:
|
||||
- artifact: gitlab-ci-continue.yml
|
||||
job: "Evaluate for builds"
|
||||
variables:
|
||||
PARENT_PIPELINE_ID: $CI_PIPELINE_ID
|
||||
@@ -66,7 +66,7 @@
|
||||
top.agenix.overlays.default
|
||||
local_overlay
|
||||
packages_overlay
|
||||
top.nurpkgs.overlay
|
||||
top.nurpkgs.overlays.default
|
||||
top.vsext.overlays.default
|
||||
];
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{ pkgs, config, ... }:
|
||||
|
||||
{
|
||||
virtualisation.podman.enable = true;
|
||||
@@ -28,7 +28,7 @@
|
||||
"zwave_js"
|
||||
];
|
||||
customComponents = with pkgs.home-assistant-custom-components; [
|
||||
pkgs.python3.pkgs.daikinone
|
||||
config.services.home-assistant.package.python.pkgs.daikinone
|
||||
nest_protect
|
||||
smartthinq-sensors
|
||||
];
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
pulse.enable = true;
|
||||
wireplumber.enable = true;
|
||||
};
|
||||
pulseaudio.enable = false; # This conflicts with pipewire
|
||||
locate.enable = true;
|
||||
xserver.videoDrivers = [ "nvidia" ];
|
||||
};
|
||||
@@ -117,7 +118,6 @@
|
||||
nvidiaSettings = true;
|
||||
open = true;
|
||||
};
|
||||
pulseaudio.enable = false; # This conflicts with pipewire
|
||||
system76 = {
|
||||
firmware-daemon.enable = true;
|
||||
#kernel-modules.enable = true;
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ in
|
||||
("vfio-pci.ids=" + (lib.concatStringsSep "," passthru))
|
||||
];
|
||||
};
|
||||
hardware.opengl.enable = true;
|
||||
hardware.graphics.enable = true;
|
||||
|
||||
services.gitlab-runner = {
|
||||
enable = true;
|
||||
|
||||
+2
-1
@@ -10,9 +10,10 @@ in
|
||||
aacs = c ./aacs.nix { };
|
||||
brew = c ./homebrew.nix { };
|
||||
create_ssl = c ./create_ssl.nix { };
|
||||
gen-build = c ./gen-build { };
|
||||
hms = c ./hms { };
|
||||
inject-darwin = c ./inject-darwin.nix { };
|
||||
inject = c ./inject.nix { };
|
||||
hms = c ./hms { };
|
||||
qemu-hook = c ./qemu-hook.nix { };
|
||||
setup-ssh = c ./setup-ssh { };
|
||||
upgrade-pg-cluster = c ./upgrade-pg-cluster.nix { };
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
buildGoModule,
|
||||
}:
|
||||
let
|
||||
src = ./.;
|
||||
in
|
||||
buildGoModule {
|
||||
inherit src;
|
||||
name = "gen-build";
|
||||
|
||||
vendorHash = "sha256-g+yaVIx4jxpAQ/+WrGKxhVeliYx7nLQe/zsGpxV4Fn4=";
|
||||
|
||||
meta.mainProgram = "main";
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
type NixFlakeOutput struct {
|
||||
Apps map[string]interface{} `json:"apps"`
|
||||
Checks map[string]interface{} `json:"checks"`
|
||||
DarwinConfigurations ArchTypes `json:"darwinConfigurations"`
|
||||
DevShells map[string]interface{} `json:"devShells"`
|
||||
HomeConfigurations map[string]interface{} `json:"homeConfigurations"`
|
||||
NixosConfigurations map[string]interface{} `json:"nixosConfigurations"`
|
||||
Packages ArchTypes `json:"packages"`
|
||||
}
|
||||
|
||||
type ArchTypes struct {
|
||||
X86_64 map[string]map[string]string `json:"x86_64-linux"`
|
||||
Aarch64 map[string]map[string]string `json:"aarch64-linux"`
|
||||
DarwinX86 map[string]map[string]string `json:"x86_64-darwin"`
|
||||
DarwinArm map[string]map[string]string `json:"aarch64-darwin"`
|
||||
}
|
||||
|
||||
func GetNixFlakeOutput() (*NixFlakeOutput, error) {
|
||||
cmd := exec.Command("nix", "flake", "show", "--json")
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var flakeOutput NixFlakeOutput
|
||||
err = json.Unmarshal(output, &flakeOutput)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &flakeOutput, nil
|
||||
}
|
||||
|
||||
type GitlabCIJob struct {
|
||||
Stage string `json:"stage"`
|
||||
Tags []string `json:"tags"`
|
||||
Script []string `json:"script"`
|
||||
}
|
||||
|
||||
func NewGitlabCIJob(target string) GitlabCIJob {
|
||||
return GitlabCIJob{
|
||||
Stage: "build",
|
||||
Tags: []string{"nix"},
|
||||
Script: []string{
|
||||
"nix build -L '.#" + target + "'",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
flakeOutput, err := GetNixFlakeOutput()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Some boilerplate that Go requires us to have
|
||||
pipeline := make(map[string]interface{})
|
||||
pipeline["stages"] = []string{"build"}
|
||||
pipeline["Run flake check"] = GitlabCIJob{
|
||||
Stage: "build",
|
||||
Tags: []string{"nix"},
|
||||
Script: []string{
|
||||
"nix flake check --no-build",
|
||||
},
|
||||
}
|
||||
// Since this is kinda a one-off thing, I can use this directly
|
||||
// homeConfigurations are treated like they are not known as a
|
||||
// flake output type. Therefore, it just informs you that it is
|
||||
// part of the output, but does not evaluate deeper to tell you
|
||||
// what the name of it is. I will just do this manually for now.
|
||||
pipeline["Build Home config "] = NewGitlabCIJob("homeConfigurations.\"gregory.hellings\".activationPackage")
|
||||
|
||||
if flakeOutput.Apps != nil {
|
||||
for appName := range flakeOutput.Apps {
|
||||
pipeline[appName] = NewGitlabCIJob("apps." + appName)
|
||||
}
|
||||
}
|
||||
|
||||
if flakeOutput.Packages.X86_64 != nil {
|
||||
for pkgName := range flakeOutput.Packages.X86_64 {
|
||||
if flakeOutput.Packages.X86_64[pkgName]["type"] == "derivation" {
|
||||
pipeline["Build package "+pkgName] = NewGitlabCIJob("packages.x86_64-linux." + pkgName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if flakeOutput.NixosConfigurations != nil {
|
||||
for configName := range flakeOutput.NixosConfigurations {
|
||||
pipeline["Build NixOS config "+configName] = NewGitlabCIJob("nixosConfigurations." + configName + ".config.system.build.toplevel")
|
||||
}
|
||||
}
|
||||
|
||||
yamlData, err := yaml.Marshal(pipeline)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Printf("%s\n", yamlData)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
module main
|
||||
|
||||
go 1.23.4
|
||||
|
||||
require gopkg.in/yaml.v3 v3.0.1
|
||||
@@ -0,0 +1,4 @@
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
Reference in New Issue
Block a user