[Git][reproducible-builds/reproducible-website][master] flake: improvements and update
Pol Dellaiera (@drupol)
gitlab at salsa.debian.org
Thu Sep 19 08:57:45 UTC 2024
Pol Dellaiera pushed to branch master at Reproducible Builds / reproducible-website
Commits:
971bc843 by Pol Dellaiera at 2024-09-19T10:57:36+02:00
flake: improvements and update
- - - - -
2 changed files:
- flake.lock
- flake.nix
Changes:
=====================================
flake.lock
=====================================
@@ -5,25 +5,26 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
- "lastModified": 1709336216,
- "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=",
+ "lastModified": 1726153070,
+ "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=",
"owner": "hercules-ci",
"repo": "flake-parts",
- "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2",
+ "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a",
"type": "github"
},
"original": {
- "id": "flake-parts",
- "type": "indirect"
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "type": "github"
}
},
"nixpkgs": {
"locked": {
- "lastModified": 1711655175,
- "narHash": "sha256-1xiaYhC3ul4y+i3eicYxeERk8ZkrNjLkrFSb/UW36Zw=",
+ "lastModified": 1726583932,
+ "narHash": "sha256-zACxiQx8knB3F8+Ze+1BpiYrI+CbhxyWpcSID9kVhkQ=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "64c81edb4b97a51c5bbc54c191763ac71a6517ee",
+ "rev": "658e7223191d2598641d50ee4e898126768fe847",
"type": "github"
},
"original": {
@@ -35,20 +36,14 @@
},
"nixpkgs-lib": {
"locked": {
- "dir": "lib",
- "lastModified": 1709237383,
- "narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=",
- "owner": "NixOS",
- "repo": "nixpkgs",
- "rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8",
- "type": "github"
+ "lastModified": 1725233747,
+ "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=",
+ "type": "tarball",
+ "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz"
},
"original": {
- "dir": "lib",
- "owner": "NixOS",
- "ref": "nixos-unstable",
- "repo": "nixpkgs",
- "type": "github"
+ "type": "tarball",
+ "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz"
}
},
"root": {
=====================================
flake.nix
=====================================
@@ -1,114 +1,141 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
+ flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";
};
- outputs = inputs @ { self, flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } {
- systems = import inputs.systems;
+ outputs =
+ inputs@{ 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 = ./.;
+ perSystem =
+ {
+ self',
+ pkgs,
+ 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.stdenvNoCC.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"
+ nativeBuildInputs = [
+ pkgs.gitMinimal
+ ];
- git add .
- git commit -am "nix build commit"
- '';
+ # 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"
- 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
- '';
+ git add .
+ git commit -am "nix build commit"
+ '';
- buildInputs = [
- pkgs.git
- pkgs.perl536Packages.Po4a
- pkgs.which
- python3
- ruby
- ];
+ postPatch = ''
+ substituteInPlace bin/i18n.sh \
+ --replace-fail "#!/bin/bash" "#!${pkgs.runtimeShell}"
+ substituteInPlace bin/contributors.py \
+ --replace-fail "#!/usr/bin/env python3" "#!${lib.getExe python3}"
+ '';
- installPhase = ''
- runHook preInstall
+ buildInputs = [
+ pkgs.git
+ pkgs.perl536Packages.Po4a
+ pkgs.which
+ python3
+ ruby
+ ];
- mkdir -p $out
- cp -ar _site/* $out/
+ installPhase = ''
+ runHook preInstall
- runHook postInstall
- '';
- };
- };
+ mkdir -p $out
+ cp -ar _site/* $out/
- apps = {
- default =
- let
- caddyFile = pkgs.writeText "Caddyfile" ''
- :4000 {
- root * ${self'.packages.default}
- log
- encode gzip
- file_server
- }
+ runHook postInstall
'';
- 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
- ''));
+ apps = {
+ # Runs a Caddy server to serve the static site
+ 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}
+ ''
+ )
+ );
+ };
+
+ # Runs the Jekyll server only
+ serve = {
+ type = "app";
+ program = (
+ lib.getExe (
+ pkgs.writeScriptBin "start-static-server" ''
+ #!${pkgs.runtimeShell}
+ ${lib.getExe jekyll} serve --host
+ ''
+ )
+ );
+ };
+
+ # Runs the Jekyll server with live reload, only for development
+ devserver = {
+ 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.pandoc
- pkgs.gnumake
- pkgs.perl536Packages.Po4a
- pkgs.which
- jekyll
- python3
- ruby
- ];
+ devShells = {
+ default = pkgs.stdenvNoCC.mkDerivation {
+ name = "devshell";
+ buildInputs = [
+ pkgs.pandoc
+ pkgs.gnumake
+ pkgs.perl536Packages.Po4a
+ pkgs.which
+ jekyll
+ python3
+ ruby
+ ];
+ };
};
};
- };
- };
+ };
}
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/-/commit/971bc8437f49ce77323953e7d1db18596881e254
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/-/commit/971bc8437f49ce77323953e7d1db18596881e254
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/20240919/030c5309/attachment.htm>
More information about the rb-commits
mailing list