From de5a0ba39fb9da7eec81f1f59d07af67ec4a9233 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Sat, 14 May 2022 17:06:27 +0200 Subject: [PATCH] feat: Add a flake --- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 21 +++++++++++++++++++++ pgp-sign.py | 2 ++ pkgs/shared-assets.nix | 28 ++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 pkgs/shared-assets.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..7dfb79e --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1638239011, + "narHash": "sha256-AjhmbT4UBlJWqxY0ea8a6GU2C2HdKUREkG43oRr3TZg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a7ecde854aee5c4c7cd6177f54a99d2c1ff28a31", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "21.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..47068a5 --- /dev/null +++ b/flake.nix @@ -0,0 +1,21 @@ +{ + description = "The website hosted at https://polynom.me"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/21.11"; + }; + + outputs = { + self, + nixpkgs + }: let + supportedSystems = [ "x86_64-linux" ]; + forAllSystems = nixpkgs.lib.attrsets.genAttrs supportedSystems; + in { + packages = forAllSystems (system: let + pkgs = import nixpkgs { inherit system; }; + in { + default = pkgs.callPackage ./pkgs/shared-assets.nix {}; + }); + }; +} diff --git a/pgp-sign.py b/pgp-sign.py index 97b5256..f133f04 100644 --- a/pgp-sign.py +++ b/pgp-sign.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + import re import sys import subprocess diff --git a/pkgs/shared-assets.nix b/pkgs/shared-assets.nix new file mode 100644 index 0000000..ea6ffc8 --- /dev/null +++ b/pkgs/shared-assets.nix @@ -0,0 +1,28 @@ +{ + lib, stdenv +, python3 # for makesite.py and pgp-sign.py +}: + +stdenv.mkDerivation { + pname = "shared-assets"; + version = "202205120-01"; + + src = ../.; + + propagatedBuildInputs = [ python3 python3.pkgs.markdown ]; + + installPhase = '' + mkdir -p $out/bin + cp -v makesite.py pgp-sign.py $out/bin + cp -vr assets/ $out/ + ''; + + doCheck = false; + + meta = with lib; { + description = "Shared assets for polynom.me web pages"; + homepage = "https://git.polynom.me/polynom.me/shared-assets"; + maintainers = []; + license = licenses.gpl3; + }; +}