Skip to content

Commit

Permalink
Merge branch 'master' into feature/klipper-nix
Browse files Browse the repository at this point in the history
  • Loading branch information
truelecter committed Sep 2, 2023
2 parents be31ca8 + 89bab8b commit ab3e805
Show file tree
Hide file tree
Showing 63 changed files with 752 additions and 406 deletions.
50 changes: 6 additions & 44 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ env:
# CIRRUS_SHELL: "/bin/bash"

common_task_template: &REGULAR_TASK_TEMPLATE
timeout_in: 120m
only_if: "changesInclude('.cirrus.yml', 'flake.{nix,lock}', 'cells/**', '.ci/*')"
# auto_cancellation: "$CIRRUS_BRANCH != 'master' || $CIRRUS_BRANCH == 'master'"
timeout_in: 60m
only_if: $CIRRUS_BRANCH == 'master' || $CIRRUS_PR != ''

common_scripts_template: &REGULAR_SCRIPTS_TEMPLATE
# TODO add cache?
Expand All @@ -28,45 +27,6 @@ common_scripts_template: &REGULAR_SCRIPTS_TEMPLATE

cachix_background_script: cachix watch-store --compression-method xz --compression-level 9 --jobs 2 truelecter


linux_task:
<< : *REGULAR_TASK_TEMPLATE

name: Build NixOS x86_64 systems

env:
NIXOS_HOST: nonexisting
USER: "root"
HOME: "/root"
PATH: "$HOME/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/per-user/$USER/profile/bin:$PATH"

container:
image: nixos/nix:2.15.0
cpu: 4
memory: 8G

<< : *REGULAR_SCRIPTS_TEMPLATE

build_script:
- $NIX build ".#nixosConfigurations.$NIXOS_HOST.config.system.build.toplevel"
- $NIX develop --command "menu"
# for cachix to finish uploading things
- sleep 60

matrix:
- name: Build nas
env:
NIXOS_HOST: nixos-nas
- name: Build depsos
env:
NIXOS_HOST: nixos-depsos
- name: Build hyperos
env:
NIXOS_HOST: nixos-hyperos
- name: Build tl-wsl
env:
NIXOS_HOST: wsl-tl-wsl

linux_aarch64_task:
<< : *REGULAR_TASK_TEMPLATE

Expand All @@ -80,8 +40,10 @@ linux_aarch64_task:

arm_container:
image: nixos/nix:2.15.0
cpu: 4
memory: 8G
cpu: 8
memory: 32G
# try to overcome https://github.com/cirruslabs/cirrus-ci-docs/discussions/1225
use_in_memory_disk: true

<< : *REGULAR_SCRIPTS_TEMPLATE

Expand Down
2 changes: 2 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ repository:
has_wiki: false
name: hive
private: false
topics: nix, nixos, hive, flake, flakes, nix-flake, nix-flakes, haumea, colmena,
std
52 changes: 52 additions & 0 deletions .github/workflows/build-x86.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build x86
on:
push:
workflow_dispatch:

jobs:
build_system:
runs-on: ubuntu-latest
strategy:
matrix:
host:
- nixos-nas
- nixos-depsos
- nixos-hyperos
- wsl-tl-wsl
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-23.05
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
with:
name: truelecter
extraPullNames: cuda-maintainers, mic92, nix-community, nrdxp
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Build system configuration
run: |
nix build ".#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel"
build_shell:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Nix
uses: cachix/install-nix-action@v20
with:
nix_path: nixpkgs=channel:nixos-23.05
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
with:
name: truelecter
extraPullNames: cuda-maintainers, mic92, nix-community, nrdxp
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Build shell
run: |
nix develop --command "menu"
2 changes: 1 addition & 1 deletion .github/workflows/flake-lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
schedule:
- cron: "0 0 * * 6" # At 00:00 on Saturday

# TODO: Add nvfetcher
jobs:
lockfile:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -34,6 +33,7 @@ jobs:
commit-msg: "deps(flake-lock): Updated flake.lock"
pr-title: "[Automated] Update 'flake.lock' and sources"
branch: "auto/upgrade-dependencies"
token: ${{ secrets.PR_WF_ENABLED_TOKEN }}
pr-labels: |
dependencies
automated
19 changes: 7 additions & 12 deletions cells/common/commonProfiles.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
{
inputs,
cell,
}: let
inherit (inputs) nixpkgs std haumea nixos;
l = nixpkgs.lib // builtins;
in
haumea.lib.load {
src = ./profiles;
# loader = haumea.lib.loaders.path;
transformer = haumea.lib.transformers.liftDefault;
}:
cell.lib.importProfiles {
src = ./profiles;

inputs = {
inherit cell inputs;
};
}
inputs = {
inherit cell inputs;
};
}
69 changes: 69 additions & 0 deletions cells/common/lib.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
inputs,
cell,
}: let
inherit (inputs) haumea;

defaultNixpkgs = import inputs.nixpkgs {inherit (inputs.nixpkgs) system;};
in rec {
importProfiles = {
inputs ? {},
src,
}:
haumea.lib.load {
inherit src inputs;

transformer = haumea.lib.transformers.liftDefault;
};

importModules = {src}:
haumea.lib.load {
inherit src;
loader = haumea.lib.loaders.path;
};

combineModules = {src}: _: {
imports = builtins.attrValues (
importModules {
inherit src;
}
);
};

# TODO: pass nixpkgs as well, implicit bee module
importSystemConfigurations = {
src,
suites,
profiles,
userProfiles,
lib,
inputs,
overlays ? {},
}:
haumea.lib.load {
inherit src;
transformer = haumea.lib.transformers.liftDefault;
inputs = {
inherit suites profiles userProfiles lib inputs overlays;
};
};

importPackages = {
nixpkgs ? defaultNixpkgs,
sources ? null,
extraArguments ? {},
packages,
}: let
sources' = nixpkgs.callPackage sources {};
in
nixpkgs.lib.mapAttrs (
_: v: nixpkgs.callPackage v (extraArguments // {sources = sources';})
)
(
haumea.lib.load {
src = packages;

loader = haumea.lib.loaders.path;
}
);
}
8 changes: 6 additions & 2 deletions cells/common/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ in {
inherit
(latest)
android-tools
vscodium
vscode
alejandra
rnix-lsp
nil
Expand All @@ -29,10 +29,14 @@ in {
kubectl
kubernetes-helmPlugins
direnv
nvfetcher
amazon-ecr-credential-helper
dive
act
#

tailscale
ffmpeg_5-full
;

nvfetcher = inputs.nvfetcher.packages.default;
}
22 changes: 6 additions & 16 deletions cells/common/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,10 @@
inputs,
cell,
}: let
inherit (inputs) haumea latest;

nixpkgs = import latest {inherit (inputs.nixpkgs) system;};

l = nixpkgs.lib // builtins;

sources = nixpkgs.callPackage ./sources/generated.nix {};
inherit (inputs) latest nixpkgs;
in
l.mapAttrs (
_: v: nixpkgs.callPackage v {inherit sources;}
)
(
haumea.lib.load {
src = ./packages;
loader = haumea.lib.loaders.path;
}
)
cell.lib.importPackages {
nixpkgs = import latest {inherit (nixpkgs) system;};
sources = ./sources/generated.nix;
packages = ./packages;
}
14 changes: 6 additions & 8 deletions cells/common/profiles/core.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ in {
};

nix = {
settings = {
settings = let
GB = 1024 * 1024 * 1024;
in {
# Prevents impurities in builds
sandbox = true;

Expand All @@ -101,6 +103,9 @@ in {
experimental-features = ["flakes" "nix-command"];
fallback = true;
warn-dirty = false;

# Some free space
min-free = lib.mkDefault (5 * GB);
};

# Improve nix store disk usage
Expand All @@ -109,13 +114,6 @@ in {
options = "--delete-older-than 7d";
};

# Generally useful nix option defaults
extraOptions = let
GB = 1024 * 1024 * 1024;
in ''
min-free = ${toString (5 * GB)}
'';

nixPath = [
"nixpkgs=flake:nixos"
"home-manager=flake:home"
Expand Down
8 changes: 4 additions & 4 deletions cells/common/sources/generated.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"s5cmd": {
"cargoLocks": null,
"date": "2023-07-06",
"date": "2023-08-23",
"extract": null,
"name": "s5cmd",
"passthru": null,
Expand All @@ -13,11 +13,11 @@
"name": null,
"owner": "peak",
"repo": "s5cmd",
"rev": "bb3723b224ef53e073429a974d2d69fdcd56cf83",
"sha256": "sha256-xwhpFpHbL/7UrA/tLa82q/aIXusbEeiFFr3AOAPrAO0=",
"rev": "10e4ccf4b9421c2063d301ebc8987064994e3c17",
"sha256": "sha256-h62p5kOk09KQ4ksoiFs/0JuSAn4TAGmBb/xHb/8JObM=",
"type": "github"
},
"version": "bb3723b224ef53e073429a974d2d69fdcd56cf83"
"version": "10e4ccf4b9421c2063d301ebc8987064994e3c17"
},
"tfenv": {
"cargoLocks": null,
Expand Down
8 changes: 4 additions & 4 deletions cells/common/sources/generated.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
{
s5cmd = {
pname = "s5cmd";
version = "bb3723b224ef53e073429a974d2d69fdcd56cf83";
version = "10e4ccf4b9421c2063d301ebc8987064994e3c17";
src = fetchFromGitHub {
owner = "peak";
repo = "s5cmd";
rev = "bb3723b224ef53e073429a974d2d69fdcd56cf83";
rev = "10e4ccf4b9421c2063d301ebc8987064994e3c17";
fetchSubmodules = false;
sha256 = "sha256-xwhpFpHbL/7UrA/tLa82q/aIXusbEeiFFr3AOAPrAO0=";
sha256 = "sha256-h62p5kOk09KQ4ksoiFs/0JuSAn4TAGmBb/xHb/8JObM=";
};
date = "2023-07-06";
date = "2023-08-23";
};
tfenv = {
pname = "tfenv";
Expand Down
Loading

0 comments on commit ab3e805

Please sign in to comment.