summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.lock46
-rw-r--r--flake.nix118
-rw-r--r--site.nix6
3 files changed, 99 insertions, 71 deletions
diff --git a/flake.lock b/flake.lock
index 94bba45..f5ff82b 100644
--- a/flake.lock
+++ b/flake.lock
@@ -1,20 +1,20 @@
{
"nodes": {
- "flake-utils": {
+ "flake-parts": {
"inputs": {
- "systems": "systems"
+ "nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
- "lastModified": 1731533236,
- "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
- "owner": "numtide",
- "repo": "flake-utils",
- "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
+ "lastModified": 1763759067,
+ "narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
+ "rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0",
"type": "github"
},
"original": {
- "owner": "numtide",
- "repo": "flake-utils",
+ "owner": "hercules-ci",
+ "repo": "flake-parts",
"type": "github"
}
},
@@ -34,26 +34,26 @@
"type": "github"
}
},
- "root": {
- "inputs": {
- "flake-utils": "flake-utils",
- "nixpkgs": "nixpkgs"
- }
- },
- "systems": {
+ "nixpkgs-lib": {
"locked": {
- "lastModified": 1681028828,
- "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
- "owner": "nix-systems",
- "repo": "default",
- "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "lastModified": 1761765539,
+ "narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=",
+ "owner": "nix-community",
+ "repo": "nixpkgs.lib",
+ "rev": "719359f4562934ae99f5443f20aa06c2ffff91fc",
"type": "github"
},
"original": {
- "owner": "nix-systems",
- "repo": "default",
+ "owner": "nix-community",
+ "repo": "nixpkgs.lib",
"type": "github"
}
+ },
+ "root": {
+ "inputs": {
+ "flake-parts": "flake-parts",
+ "nixpkgs": "nixpkgs"
+ }
}
},
"root": "root",
diff --git a/flake.nix b/flake.nix
index f14ee0d..2bde98d 100644
--- a/flake.nix
+++ b/flake.nix
@@ -3,53 +3,77 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
- flake-utils.url = "github:numtide/flake-utils";
+ flake-parts.url = "github:hercules-ci/flake-parts";
};
- outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
- flake-utils.lib.eachDefaultSystem (system:
- let
- pkgs = import nixpkgs {
- inherit system;
- config = { };
- overlays = [ ];
- };
- src = builtins.path { path = ./.; name = "blog"; };
- in rec {
- # nix develop
- devShells.default = pkgs.mkShell {
- nativeBuildInputs = with pkgs; [ ghc cabal-install lychee zlib ];
- };
-
- # nix build .
- # open ./result/srv/www.skreutz.com/index.html
- packages.default = packages.site;
-
- # nix run .#generator -- --help
- packages.generator = pkgs.haskell.lib.compose.justStaticExecutables (
- pkgs.haskellPackages.callCabal2nix "blog" src { }
- );
-
- # nix build .#site
- packages.site = pkgs.callPackage ./site.nix {
- inherit self;
- inherit (packages) generator;
- };
-
- checks.links = pkgs.stdenvNoCC.mkDerivation {
- inherit src;
- name = "offline-link-check";
- dontBuild = true;
- doCheck = true;
- nativeBuildInputs = with pkgs; [ lychee ];
- checkPhase = ''
- "${packages.generator}/bin/site" rebuild
- lychee --offline --no-progress --require-https --root-dir "$( realpath _site )" _site
- '';
- installPhase = ''
- mkdir $out
- '';
- };
- }
- );
+ outputs =
+ inputs@{
+ self,
+ nixpkgs,
+ flake-parts,
+ ...
+ }:
+ flake-parts.lib.mkFlake { inherit inputs; } {
+ systems = [
+ "x86_64-linux"
+ "aarch64-linux"
+ "x86_64-darwin"
+ "aarch64-darwin"
+ ];
+
+ perSystem =
+ { pkgs, system, ... }:
+ let
+ src = builtins.path {
+ path = ./.;
+ name = "blog";
+ };
+ in
+ rec {
+ # nix develop
+ devShells.default = pkgs.mkShell {
+ nativeBuildInputs = with pkgs; [
+ ghc
+ cabal-install
+ lychee
+ zlib
+ ];
+ };
+
+ # nix build .
+ # nix run nixpkgs#python3 -- -m http.server --directory ./result/srv/www.skreutz.com --bind 127.0.0.1 8080
+ # open http://127.0.0.1:8080/
+ packages.default = packages.site;
+
+ # nix run .#generator -- --help
+ packages.generator = pkgs.haskell.lib.compose.justStaticExecutables (
+ pkgs.haskellPackages.callCabal2nix "blog" src { }
+ );
+
+ # nix build .#site
+ packages.site = pkgs.callPackage ./site.nix {
+ inherit self;
+ inherit (packages) generator;
+ };
+
+ # nix flake check
+ checks.links = pkgs.stdenvNoCC.mkDerivation {
+ inherit src;
+ name = "offline-link-check";
+ dontBuild = true;
+ doCheck = true;
+ nativeBuildInputs = with pkgs; [ lychee ];
+ checkPhase = ''
+ "${packages.generator}/bin/site" rebuild
+ lychee --offline --no-progress --require-https --root-dir "$( realpath _site )" _site
+ '';
+ installPhase = ''
+ mkdir $out
+ '';
+ };
+
+ # nix fmt
+ formatter = pkgs.nixfmt-tree;
+ };
+ };
}
diff --git a/site.nix b/site.nix
index 5eae7d1..1988b49 100644
--- a/site.nix
+++ b/site.nix
@@ -1,4 +1,8 @@
-{ self, stdenv, generator }:
+{
+ self,
+ stdenv,
+ generator,
+}:
stdenv.mkDerivation rec {
name = "www.skreutz.com";
Generated by cgit. See skreutz.com for my tech blog and contact information.