[Git][reproducible-builds/reproducible-website][master] flake: add Nix flake files
Chris Lamb (@lamby)
gitlab at salsa.debian.org
Tue Oct 17 10:57:40 UTC 2023
Chris Lamb pushed to branch master at Reproducible Builds / reproducible-website
Commits:
0c1a61eb by Pol Dellaiera at 2023-10-14T10:27:17+02:00
flake: add Nix flake files
- - - - -
2 changed files:
- + flake.lock
- + flake.nix
Changes:
=====================================
flake.lock
=====================================
@@ -0,0 +1,79 @@
+{
+ "nodes": {
+ "flake-parts": {
+ "inputs": {
+ "nixpkgs-lib": "nixpkgs-lib"
+ },
+ "locked": {
+ "lastModified": 1696343447,
+ "narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4",
+ "type": "github"
+ },
+ "original": {
+ "id": "flake-parts",
+ "type": "indirect"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1697009197,
+ "narHash": "sha256-viVRhBTFT8fPJTb1N3brQIpFZnttmwo3JVKNuWRVc3s=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "01441e14af5e29c9d27ace398e6dd0b293e25a54",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-lib": {
+ "locked": {
+ "dir": "lib",
+ "lastModified": 1696019113,
+ "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a",
+ "type": "github"
+ },
+ "original": {
+ "dir": "lib",
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-parts": "flake-parts",
+ "nixpkgs": "nixpkgs",
+ "systems": "systems"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
=====================================
flake.nix
=====================================
@@ -0,0 +1,113 @@
+{
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ systems.url = "github:nix-systems/default";
+ };
+
+ outputs = inputs @ { self, flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } {
+ systems = import inputs.systems;
+
+ perSystem = { config, self', inputs', pkgs, system, lib, ... }:
+ let
+ jekyll = pkgs.jekyll.override ({ withOptionalDependencies = true; });
+ ruby = (pkgs.ruby.withPackages (ps: [ jekyll ]));
+ python3 = pkgs.python3.withPackages (p: [ p.pyyaml ]);
+ in
+ {
+ packages = {
+ default = pkgs.stdenv.mkDerivation {
+ name = "reproducible-website";
+ src = ./.;
+
+ # This step should not be mandatory, the script contributors.py
+ # should not get the contributors from git.
+ # Without this preConfigure phase, the script will fail.
+ preConfigure = ''
+ git init
+ git config user.email "you at example.com"
+ git config user.name "Nix build"
+
+ git add .
+ git commit -am "nix build commit"
+ '';
+
+ postPatch = ''
+ substituteInPlace bin/i18n.sh \
+ --replace "#!/bin/bash" "#!${pkgs.runtimeShell}"
+ substituteInPlace bin/contributors.py \
+ --replace "#!/usr/bin/env python3" "#!${lib.getExe python3}"
+ cat bin/contributors.py
+ '';
+
+ buildInputs = [
+ pkgs.git
+ pkgs.perl536Packages.Po4a
+ pkgs.which
+ python3
+ ruby
+ ];
+
+ installPhase = ''
+ runHook preInstall
+
+ mkdir -p $out
+ cp -ar _site/* $out/
+
+ runHook postInstall
+ '';
+ };
+ };
+
+ apps = {
+ default =
+ let
+ caddyFile = pkgs.writeText "Caddyfile" ''
+ :4000 {
+ root * ${self'.packages.default}
+ log
+ encode gzip
+ file_server
+ }
+ '';
+ in
+ {
+ type = "app";
+ program = (lib.getExe (pkgs.writeScriptBin "start-static-site" ''
+ #!${pkgs.runtimeShell}
+ ${lib.getExe pkgs.caddy} run --adapter caddyfile --config ${caddyFile}
+ ''));
+ };
+
+ devserver = {
+ type = "app";
+ program = (lib.getExe (pkgs.writeScriptBin "start-static-server" ''
+ #!${pkgs.runtimeShell}
+ ${lib.getExe jekyll} serve --host
+ ''));
+ };
+
+ serve = {
+ type = "app";
+ program = (lib.getExe (pkgs.writeScriptBin "start-live-reload-site" ''
+ #!${pkgs.runtimeShell}
+ ${lib.getExe jekyll} serve --watch --livereload --incremental --host
+ ''));
+ };
+ };
+
+ devShells = {
+ default = pkgs.stdenvNoCC.mkDerivation {
+ name = "devshell";
+ buildInputs = [
+ pkgs.gnumake
+ pkgs.perl536Packages.Po4a
+ pkgs.which
+ jekyll
+ python3
+ ruby
+ ];
+ };
+ };
+ };
+ };
+}
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/-/commit/0c1a61eb6f8dfa1585ce413de61c8bc9356eeaed
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/-/commit/0c1a61eb6f8dfa1585ce413de61c8bc9356eeaed
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20231017/52a14491/attachment.htm>
More information about the rb-commits
mailing list