simplify nix setup

This commit is contained in:
Paul-Nicolas Madelaine 2024-12-16 20:57:40 +01:00
parent 57193c2990
commit dc4c9b3be0
4 changed files with 21 additions and 114 deletions

View file

@ -8,7 +8,7 @@ jobs:
steps: steps:
- uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/nix-installer-action@main
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- run: nix build - run: nix-build
- uses: actions/upload-pages-artifact@v3 - uses: actions/upload-pages-artifact@v3
with: with:
path: result/ path: result/

20
default.nix Normal file
View file

@ -0,0 +1,20 @@
{
system ? builtins.currentSystem,
pkgs ? import (builtins.fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/56c0d09b76608a7fa28127a37d81d9003e46acf6.tar.gz";
}) { inherit system; },
papermod ? pkgs.fetchFromGitHub {
owner = "adityatelange";
repo = "hugo-papermod";
rev = "master";
hash = "sha256-Dv/QnYYG5KTQro95kzwgQeOS0nO2HyfBoSou5AsCFAI=";
},
}:
pkgs.stdenv.mkDerivation {
name = "website";
src = ./.;
postPatch = "mkdir themes && cp -r ${papermod} themes/papermod";
nativeBuildInputs = [ pkgs.hugo ];
buildPhase = "hugo";
installPhase = "cp -r public $out";
}

View file

@ -1,77 +0,0 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1725867797,
"narHash": "sha256-DW6NHvXHrWFUa0TY4TCf+M8uFIRhmV9H3smBZ2Pu7pk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "cb97dfe6c051011be9cb13cd33103c907d9b2107",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"papermod": {
"flake": false,
"locked": {
"lastModified": 1723905772,
"narHash": "sha256-iKKAAR5ipeimIgC137tbpkWlwIzNDAcPPKNLwdhW1CI=",
"owner": "adityatelange",
"repo": "hugo-papermod",
"rev": "58c4841c26325eaa788d9b13e65d5dfc95d9367c",
"type": "github"
},
"original": {
"owner": "adityatelange",
"repo": "hugo-papermod",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"papermod": "papermod"
}
},
"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
}

View file

@ -1,36 +0,0 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
papermod = {
url = "github:adityatelange/hugo-papermod";
flake = false;
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
papermod,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
website = pkgs.stdenv.mkDerivation {
name = "website";
src = ./.;
postPatch = "mkdir themes && cp -r ${papermod} themes/papermod";
nativeBuildInputs = [ pkgs.hugo ];
buildPhase = "hugo";
installPhase = "cp -r public $out";
};
in
{
packages.default = website;
devShells.default = pkgs.mkShell { packages = [ pkgs.hugo ]; };
}
);
}