Compare commits
2 commits
283aba0c2c
...
5e51d5f252
Author | SHA1 | Date | |
---|---|---|---|
5e51d5f252 | |||
069236027c |
3 changed files with 35 additions and 11 deletions
|
@ -58,9 +58,9 @@
|
|||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./parsons/configuration.nix
|
||||
./modules/buildinfo.nix
|
||||
sops-nix.nixosModules.sops
|
||||
{ nixpkgs.pkgs = pkgs; }
|
||||
{ environment.etc."haccfiles".source = self.outPath; }
|
||||
];
|
||||
specialArgs = {
|
||||
sources = inputs;
|
||||
|
|
30
modules/buildinfo.nix
Normal file
30
modules/buildinfo.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ config, lib, pkgs, sources, ... }:
|
||||
|
||||
let
|
||||
self = sources.self;
|
||||
slice = string: start: length: with lib;
|
||||
strings.concatStrings
|
||||
(lists.take length
|
||||
(lists.drop start
|
||||
(strings.stringToCharacters string)));
|
||||
|
||||
formatDate = date:
|
||||
let
|
||||
year = slice date 0 4;
|
||||
month = slice date 4 2;
|
||||
day = slice date 6 2;
|
||||
hour = slice date 8 2;
|
||||
minute = slice date 10 2;
|
||||
second = slice date 12 2;
|
||||
in
|
||||
"${year}-${month}-${day} ${hour}:${minute}:${second} UTC";
|
||||
in
|
||||
{
|
||||
system.nixos.label = "${config.system.nixos.release}-haccfiles-${self.shortRev or self.dirtyShortRev}";
|
||||
users.motd = ''
|
||||
Welcome to ${config.networking.hostName}, running NixOS ${config.system.nixos.release}!
|
||||
Built from haccfiles ${self.rev or self.dirtyRev}.
|
||||
Last commit was at ${formatDate self.lastModifiedDate}.
|
||||
${if self ? dirtyRev then "\nPlease remember to commit your changes.\n" else ""}
|
||||
'';
|
||||
}
|
|
@ -1,23 +1,17 @@
|
|||
{ stdenvNoCC, zola, writeScriptBin }:
|
||||
{ copyPathToStore, stdenvNoCC, zola, writeScriptBin }:
|
||||
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
name = "docs.hacc.space-static";
|
||||
|
||||
# HINT: this is cursed. Nix flakes have no optimisation to deal with ${./.},
|
||||
# so we wind up having to do this to make the symlink to content/ work.
|
||||
# (we still need to manually adjust it — but at least this way we can find
|
||||
# its target without further hoops)
|
||||
#
|
||||
# This does also mean we now copy the entire flake into the Nix store twice.
|
||||
# Yay for flakes!
|
||||
src = "${../../.}/websites/docs.hacc.space";
|
||||
src = ./.;
|
||||
content = copyPathToStore ../../docs;
|
||||
|
||||
phases = [ "buildPhase" ];
|
||||
buildInputs = [ zola ];
|
||||
buildPhase = ''
|
||||
cp -r $src/* .
|
||||
rm content
|
||||
ln -s $src/../../docs content
|
||||
ln -s $content content
|
||||
zola build --output-dir $out
|
||||
'';
|
||||
|
||||
|
|
Loading…
Reference in a new issue