From 6694f9cf8a2d52b29c6caf6a170f80f140488c06 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Thu, 29 Jun 2023 23:38:13 +0200 Subject: [PATCH] Test workflow (v12) --- .forgejo/workflows/deploy-dgnum.yaml | 6 +----- default.nix | 10 ++++++++++ flake.lock | 17 +++++++++++++++++ flake.nix | 9 +++++++-- site/default.nix | 8 ++++++-- ssg/default.nix | 10 +++++++--- 6 files changed, 48 insertions(+), 12 deletions(-) create mode 100644 default.nix diff --git a/.forgejo/workflows/deploy-dgnum.yaml b/.forgejo/workflows/deploy-dgnum.yaml index 0fb098b..00ae98b 100644 --- a/.forgejo/workflows/deploy-dgnum.yaml +++ b/.forgejo/workflows/deploy-dgnum.yaml @@ -17,11 +17,7 @@ jobs: - name: Build website run: | - printenv HOME - export HOME=$(pwd) - nix --extra-experimental-features nix-command \ - --extra-experimental-features flakes \ - build dgnum.eu + nix-build dgnum.eu - name: Clone dgnum.eu uses: actions/checkout@v3 diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..2cccff2 --- /dev/null +++ b/default.nix @@ -0,0 +1,10 @@ +(import + ( + let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + } + ) + { src = ./.; } +).defaultNix diff --git a/flake.lock b/flake.lock index 8ea3b48..474c1c7 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,21 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -35,6 +51,7 @@ }, "root": { "inputs": { + "flake-compat": "flake-compat", "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } diff --git a/flake.nix b/flake.nix index 81da4dc..3453526 100644 --- a/flake.nix +++ b/flake.nix @@ -4,15 +4,20 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; }; - outputs = { self, nixpkgs, flake-utils }: + outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; ssg = pkgs.callPackage ./ssg { }; defaultInputs = with pkgs; [ nixfmt shellcheck ]; - in { + in + { formatter = pkgs.nixfmt; devShells = { diff --git a/site/default.nix b/site/default.nix index 5b29c49..851be7b 100644 --- a/site/default.nix +++ b/site/default.nix @@ -1,6 +1,10 @@ -{ glibcLocales, nix-gitignore, ssg, stdenv }: +{ glibcLocales +, nix-gitignore +, ssg +, mkDerivation +}: -stdenv.mkDerivation { +mkDerivation { name = "dgnum.eu"; version = "0.1.0"; srcs = nix-gitignore.gitignoreSourcePure ../.gitignore ./.; diff --git a/ssg/default.nix b/ssg/default.nix index b524484..b32229a 100644 --- a/ssg/default.nix +++ b/ssg/default.nix @@ -1,4 +1,8 @@ -{ haskellPackages, locale, nix-gitignore }: +{ haskellPackages +, nix-gitignore +}: -let srcs = nix-gitignore.gitignoreSourcePure ../.gitignore ./.; -in haskellPackages.callCabal2nix "ssg" srcs { } +haskellPackages.callCabal2nix + "ssg" + (nix-gitignore.gitignoreSourcePure ../.gitignore ./.) +{ }