Skip to content

Commit

Permalink
feat ✨: add colmena
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Hang <vhvictorhang@gmail.com>
  • Loading branch information
Banh-Canh committed Oct 4, 2024
1 parent 1882db9 commit a3d4735
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 23 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/build-gojo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build Gojo
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout code
uses: actions/checkout@v3
- name: Get Nixpkgs revision for nixfmt
run: |
# This should not be a URL, because it would allow PRs to run arbitrary code in CI!
url=$(jq -r .pins.nixpkgs.url npins/sources.json)
echo "url=$url" >> "$GITHUB_ENV"
- uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27
with:
nix_path: nixpkgs=${{ env.url }}
- uses: cachix/cachix-action@v15
with:
name: didactiklabs
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Create /etc/nixos and copy hardware config
run: |
sudo mkdir -p /etc/nixos
sudo sh -c 'cat > /etc/nixos/hardware-configuration.nix <<EOF
{
fileSystems."/" = {
device = "/dev/disk/by-uuid/dummy";
fsType = "ext4";
};
}
EOF'
- name: Build
run: nix-build '<nixpkgs/nixos>' -A config.system.build.toplevel -I nixos-config=profiles/gojo/configuration.nix
- name: Push
# if: github.ref == 'refs/heads/main'
run: |
cachix push didactiklabs ./result
17 changes: 12 additions & 5 deletions base.nix
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,17 @@ in
};
# Configure console keymap
console.keyMap = "fr";
# Allow unfree packages
nixpkgs.config = {
allowUnfreePredicate = pkg: true;
allowUnfree = true;
};
nix = {
package = pkgs.lix;
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
optimise = {
automatic = true;
dates = [ "03:45" ];
};
settings = {
nix-path = [
"nixpkgs=${sources.nixpkgs}"
Expand All @@ -125,6 +130,8 @@ in
"root"
"@wheel"
];
substituters = [ "https://didactiklabs.cachix.org" ];
trusted-public-keys = [ "didactiklabs.cachix.org-1:HYJV+l+6uSwJIAm4wdqVP/TuclEptn6oI2dzLqHq88k=" ];
};
};
# SSH Agent
Expand Down
33 changes: 33 additions & 0 deletions hive.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
let
sources = import ./npins;
pkgs = import sources.nixpkgs {
config = {
allowUnfree = true;
allowUnfreePredicate = true;
};
};
createConfiguration = parent: {
networking.hostName = parent.hostName;
deployment = {
buildOnTarget = true;
# Allow local deployment with `colmena apply-local`
allowLocalDeployment = true;
targetUser = builtins.getEnv "USER";
targetHost = parent.host;
};
imports = [ ./profiles/${parent.hostName}/configuration.nix ];
};
in
{
meta = {
nixpkgs = pkgs;
};
gojo = createConfiguration {
hostName = "gojo";
host = "10.207.7.2";
};
frieren = createConfiguration {
hostName = "frieren";
host = "10.254.0.5";
};
}
24 changes: 12 additions & 12 deletions npins/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"pre_releases": false,
"version_upper_bound": null,
"release_prefix": null,
"version": "v1.16.1",
"revision": "c6fd7cb26d664a0b5aa51c1c9ab6257ce76151ab",
"url": "https://api.github.com/repos/cilium/cilium/tarball/v1.16.1",
"hash": "0n36j668fwclmln1haqfch6p59plp3ss1xsbzp50848hn84cf6dy"
"version": "v1.16.2",
"revision": "1ce8bef46b406bc71b648361feb27363241592e9",
"url": "https://api.github.com/repos/cilium/cilium/tarball/v1.16.2",
"hash": "07s1pqly3pm06crcdqgaz1vl4fy85594smf59w5nj36xpgszpqal"
},
"home-manager": {
"type": "Git",
Expand All @@ -23,9 +23,9 @@
"repo": "home-manager"
},
"branch": "release-24.05",
"revision": "e1391fb22e18a36f57e6999c7a9f966dc80ac073",
"url": "https://github.com/nix-community/home-manager/archive/e1391fb22e18a36f57e6999c7a9f966dc80ac073.tar.gz",
"hash": "0c83di08nhkzq0cwc3v7aax3x8y5m7qahyzxppinzwxi3r8fnjq3"
"revision": "2f23fa308a7c067e52dfcc30a0758f47043ec176",
"url": "https://github.com/nix-community/home-manager/archive/2f23fa308a7c067e52dfcc30a0758f47043ec176.tar.gz",
"hash": "00wp0s9b5nm5rsbwpc1wzfrkyxxmqjwsc1kcibjdbfkh69arcpsn"
},
"nixbook": {
"type": "Git",
Expand All @@ -35,15 +35,15 @@
"repo": "nixbook"
},
"branch": "main",
"revision": "c44898d99d6495ad0d1269a2055c58b96d8b8013",
"url": "https://github.com/didactiklabs/nixbook/archive/c44898d99d6495ad0d1269a2055c58b96d8b8013.tar.gz",
"hash": "033zyb15fkwra3y64bh2by8fsqcfcxsa5adv8hf0smcq6p091b4v"
"revision": "a0daceecf757698fc189d9745396d7238f4d802b",
"url": "https://github.com/didactiklabs/nixbook/archive/a0daceecf757698fc189d9745396d7238f4d802b.tar.gz",
"hash": "1hv50br4k8sli5skc8fnh9wwqh2qhfla1fwxvbpq1ld9fn9wm90k"
},
"nixpkgs": {
"type": "Channel",
"name": "nixos-24.05",
"url": "https://releases.nixos.org/nixos/24.05/nixos-24.05.4469.6e99f2a27d60/nixexprs.tar.xz",
"hash": "103wiavbv2m4lkfz517javswjp6xyhhy60v1x083qb0dzw05xzap"
"url": "https://releases.nixos.org/nixos/24.05/nixos-24.05.5438.5966581aa04b/nixexprs.tar.xz",
"hash": "1s9rqd7i9yxx3y9mm3if10pj46ak09ygflbbm3cvw96vys2jxjaq"
}
},
"version": 3
Expand Down
7 changes: 5 additions & 2 deletions profiles/frieren/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
args@{ ... }:
args:
let
# Get the current directory's name
currentDir = builtins.toString ./.;
hostname = builtins.baseNameOf currentDir;
# Import the base configuration with the dynamic hostname
base = import ../../base.nix (args // { inherit hostname; });
hostname = "frieren";
in
base
7 changes: 5 additions & 2 deletions profiles/generic/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
args@{ ... }:
args:
let
# Get the current directory's name
currentDir = builtins.toString ./.;
hostname = builtins.baseNameOf currentDir;
# Import the base configuration with the dynamic hostname
base = import ../../base.nix (args // { inherit hostname; });
hostname = "generic";
in
base
7 changes: 5 additions & 2 deletions profiles/gojo/configuration.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
args@{ ... }:
args:
let
# Get the current directory's name
currentDir = builtins.toString ./.;
hostname = builtins.baseNameOf currentDir;
# Import the base configuration with the dynamic hostname
base = import ../../base.nix (args // { inherit hostname; });
hostname = "gojo";
in
base

0 comments on commit a3d4735

Please sign in to comment.