colmena: initial commit

This commit is contained in:
Fiscal Velvet Poet 2022-07-19 14:05:08 +10:00
parent 813214d706
commit a8b9f9a12d
Signed by: fiscalvelvetpoet
GPG key ID: D8EBFD58B023BD47
7 changed files with 138 additions and 44 deletions

View file

@ -1,10 +1,10 @@
JFDIC Ops JFDIC Ops
========= =========
NixOps_ deployment configuration for `JFDI Collective`_ services. Colmena_ deployment configuration for `JFDI Collective`_ services.
The canonical home for this repo is The canonical home for this repo is
https://source.jfdic.org/jfdic/jfdic-ops https://source.jfdic.org/jfdic/jfdic-ops
.. _NixOps: https://nixos.org/nixops .. _Colmena: https://colmena.cli.rs/
.. _JFDI Collective: https://jfdic.org/ .. _JFDI Collective: https://jfdic.org/

19
default.nix Normal file
View file

@ -0,0 +1,19 @@
{
sources ? import ./nix/sources.nix,
system ? builtins.currentSystem,
crossSystem ? null,
config ? {},
alejandraUnstable ? (import sources.nixpkgsUnstable {}).alejandra,
} @ args:
with import ./nix args; {
shell = mkShell {
buildInputs = [
alejandraUnstable # The Uncompromising Nix Code Formatter
colmena
niv
treefmt # one CLI to format the code tree
];
NIX_PATH = "nixpkgs=${sources.nixpkgs}";
NIXOPS_DEPLOYMENT = "${globals.deploymentName}";
};
}

View file

@ -32,6 +32,42 @@
"ref": "consensus", "ref": "consensus",
"type": "git", "type": "git",
"url": "https://source.jfdic.org/JFDIC/jfdic-web/" "url": "https://source.jfdic.org/JFDIC/jfdic-web/"
"colmena": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs",
"stable": "stable",
"utils": "utils"
},
"locked": {
"lastModified": 1651093858,
"narHash": "sha256-aGpMiY9pS2616AfAVWA87tULKatDYF2kCKxwYstK8V0=",
"owner": "zhaofengli",
"repo": "colmena",
"rev": "fbefc48d8951347b30ef87e223be6075769810ff",
"type": "github"
},
"original": {
"owner": "zhaofengli",
"ref": "v0.3.0",
"repo": "colmena",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
} }
}, },
"lowdown-src": { "lowdown-src": {
@ -53,7 +89,7 @@
"nix": { "nix": {
"inputs": { "inputs": {
"lowdown-src": "lowdown-src", "lowdown-src": "lowdown-src",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs_2",
"nixpkgs-regression": "nixpkgs-regression" "nixpkgs-regression": "nixpkgs-regression"
}, },
"locked": { "locked": {
@ -71,38 +107,18 @@
"type": "github" "type": "github"
} }
}, },
"nixops": {
"inputs": {
"nixpkgs": "nixpkgs_2",
"utils": "utils"
},
"locked": {
"lastModified": 1657388807,
"narHash": "sha256-MtTM5KUHIDqnY254chIOp00EmsbYsXR3mXrnbbY4wg0=",
"owner": "NixOS",
"repo": "nixops",
"rev": "dcafae5258773dc0fbdd31b425f1ad3fb59173fe",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "master",
"repo": "nixops",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1657693803, "lastModified": 1656372800,
"narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=", "narHash": "sha256-1u9SDLXvKix/QejNb2sY2J2QZXnbe/14MnLtn+ln9j0=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "365e1b3a859281cf11b94f87231adeabbdd878a2", "rev": "020c74014b9e2fa905bb4059c979965816cd9118",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-22.05-small", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -141,16 +157,16 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1656753965, "lastModified": 1657693803,
"narHash": "sha256-BCrB3l0qpJokOnIVc3g2lHiGhnjUi0MoXiw6t1o8H1E=", "narHash": "sha256-G++2CJ9u0E7NNTAi9n5G8TdDmGJXcIjkJ3NF8cetQB8=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0ea7a8f1b939d74e5df8af9a8f7342097cdf69eb", "rev": "365e1b3a859281cf11b94f87231adeabbdd878a2",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-unstable", "ref": "nixos-22.05-small",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -192,8 +208,8 @@
"inputs": { "inputs": {
"hakyll-skeleton": "hakyll-skeleton", "hakyll-skeleton": "hakyll-skeleton",
"jfdic-web": "jfdic-web", "jfdic-web": "jfdic-web",
"colmena": "colmena",
"nix": "nix", "nix": "nix",
"nixops": "nixops",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",
"nixpkgsUnstable": "nixpkgsUnstable", "nixpkgsUnstable": "nixpkgsUnstable",
"resrok-web": "resrok-web", "resrok-web": "resrok-web",
@ -201,13 +217,29 @@
"voc-web": "voc-web" "voc-web": "voc-web"
} }
}, },
"stable": {
"locked": {
"lastModified": 1656782578,
"narHash": "sha256-1eMCBEqJplPotTo/SZ/t5HU6Sf2I8qKlZi9MX7jv9fw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "573603b7fdb9feb0eb8efc16ee18a015c667ab1b",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-21.11",
"repo": "nixpkgs",
"type": "github"
}
},
"utils": { "utils": {
"locked": { "locked": {
"lastModified": 1634851050, "lastModified": 1653893745,
"narHash": "sha256-N83GlSGPJJdcqhUxSCS/WwW5pksYf3VP1M13cDRTSVA=", "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "c91f3de5adaf1de973b797ef7485e441a65b8935", "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -15,14 +15,14 @@
url = git+https://source.jfdic.org/resrok/resrok-web/?ref=consensus; url = git+https://source.jfdic.org/resrok/resrok-web/?ref=consensus;
}; };
nix.url = "github:NixOS/nix/?ref=2.10.3"; nix.url = "github:NixOS/nix/?ref=2.10.3";
nixops.url = github:NixOS/nixops/?ref=master; nixpkgs.url = github:NixOS/nixpkgs/?ref=nixos-22.05;
nixpkgs.url = github:NixOS/nixpkgs/?ref=nixos-22.11;
nixpkgsUnstable.url = github:NixOS/nixpkgs/?ref=nixos-unstable; nixpkgsUnstable.url = github:NixOS/nixpkgs/?ref=nixos-unstable;
utils.url = "github:numtide/flake-utils"; utils.url = "github:numtide/flake-utils";
voc-web = { voc-web = {
flake = false; flake = false;
url = git+https://source.jfdic.org/voc/voc-web/?ref=consensus; url = git+https://source.jfdic.org/voc/voc-web/?ref=consensus;
}; };
colmena.url = github:zhaofengli/colmena/?ref=v0.3.0;
}; };
outputs = {...} @ args: import ./outputs.nix args; outputs = {...} @ args: import ./outputs.nix args;

30
nixos/configurations.nix Normal file
View file

@ -0,0 +1,30 @@
{
self,
nixpkgs,
inputs,
nix,
...
}: let
nixosSystem = nixpkgs.lib.makeOverridable nixpkgs.lib.nixosSystem;
customModules = import ../modules/modules-list.nix;
baseModules = [
# make flake inputs accessiable in NixOS
{_module.args.inputs = inputs;}
{
imports = [
({pkgs, ...}: {
nix.nixPath = [
"nixpkgs=${pkgs.path}"
];
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
documentation.info.enable = false;
})
];
}
];
defaultModules = baseModules ++ customModules;
in {
toscano = import ./hosts/toscano.nix;
}

View file

@ -2,8 +2,8 @@
self, self,
hakyll-skeleton, hakyll-skeleton,
jfdic-web, jfdic-web,
colmena,
nix, nix,
nixops,
nixpkgs, nixpkgs,
nixpkgsUnstable, nixpkgsUnstable,
resrok-web, resrok-web,
@ -12,15 +12,14 @@
... ...
} @ inputs: } @ inputs:
(utils.lib.eachDefaultSystem (system: let (utils.lib.eachDefaultSystem (system: let
pkgs = pkgs = nixpkgs.legacyPackages."${system}";
nixpkgs.legacyPackages."${system}";
in { in {
devShell = devShell =
pkgs.callPackage pkgs.callPackage
./shell.nix { ./shell.nix {
inherit (colmena.packages."${pkgs.system}") colmena;
inherit (nix.packages."${pkgs.system}") nix; inherit (nix.packages."${pkgs.system}") nix;
inherit (nixpkgsUnstable.legacyPackages."${pkgs.system}") alejandra; inherit (nixpkgsUnstable.legacyPackages."${pkgs.system}") alejandra;
nixops = nixops.defaultPackage."${pkgs.system}";
}; };
})) }))
// { // {
@ -39,5 +38,19 @@ in {
imports = [./profiles/host_common.nix]; imports = [./profiles/host_common.nix];
}; };
toscano = import ./hosts/toscano.nix; toscano = import ./hosts/toscano.nix;
colmena = {
meta = {
description = "jfdic-ops deployment";
name = "jfdic-ops";
nixpkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [];
};
};
nixosConfigurations = import ./nixos/configurations.nix (inputs
// {
inherit inputs;
});
};
}; };
} }

View file

@ -2,15 +2,15 @@
pkgs ? import <nixpkgs> {}, pkgs ? import <nixpkgs> {},
alejandra, alejandra,
mkShell, mkShell,
nixops, colmena,
nix, nix,
}: }:
with pkgs; with pkgs;
mkShell { mkShell {
buildInputs = [ buildInputs = [
alejandra # The Uncompromising Nix Code Formatter alejandra # The Uncompromising Nix Code Formatter
nixops colmena # simple, stateless NixOS deployment tool
nix nix # Powerful package manager, makes packaging reliable & reproducible
tea # Gitea official CLI client tea # Gitea official CLI client
treefmt # one CLI to format the code tree treefmt # one CLI to format the code tree
]; ];