diff --git a/.gitignore b/.gitignore index a7f1e60..9891f15 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,5 @@ theme/*.min.* theme/favicon.* theme/favicon-ex.png !theme/favicon.svg + +result diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..8f51b7f --- /dev/null +++ b/default.nix @@ -0,0 +1,28 @@ +{ + pkgs, + lib, + deps, +}: +pkgs.stdenv.mkDerivation rec { + pname = "tilde"; + version = "1.0.3"; + + src = pkgs.fetchFromGitea { + domain = "gitea.com"; + owner = "tasiaiso"; + repo = "tilde"; + rev = "c77da9adf1b863ddcf0080c8d88e4d29064eead0"; + hash = "sha256-VxFRK6BofVifa5JeWUUNI8j92IVXO5yAnUOMF5bMkVA="; + }; + + nativeBuildInputs = deps; + + buildPhase = '' + make + ''; + + installPhase = '' + mkdir -p $out/ + cp -r site/ $out/ + ''; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..5894125 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "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": 1718208800, + "narHash": "sha256-US1tAChvPxT52RV8GksWZS415tTS7PV42KTc2PNDBmc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "cc54fb41d13736e92229c21627ea4f22199fee6b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..22f2f77 --- /dev/null +++ b/flake.nix @@ -0,0 +1,46 @@ +{ + description = "My website."; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs { + inherit system; + }; + + deps = with pkgs; [ + nodejs_22 # EOL: 2027-04-30 + python312 # EOL: 2028-10-31 + python312Packages.mkdocs + python312Packages.mkdocs-minify + python312Packages.csscompressor + python312Packages.htmlmin # htmlmin --keep-optional-attribute-quotes theme/favicon.svg theme/favicon.min.svg + rubyPackages_3_3.haml # Ruby EOL: 2027-03-31 + rubyPackages_3_3.redcarpet + inkscape + imagemagick + ]; + in rec + { + # Nix formatter, run using `$ nix fmt` + formatter = pkgs.alejandra; + + # Exports the tildefriends package + # Build with `$ nix build` + packages.default = pkgs.callPackage ./default.nix {inherit deps;}; + + # Creates a shell with the necessary dependencies + # Enter using `$ nix develop` + devShell = pkgs.mkShell { + buildInputs = deps; + }; + }); +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 9020212..0000000 --- a/shell.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs ? import {} }: -pkgs.mkShell{ - nativeBuildInputs = with pkgs; [ - nodejs_20 # EOL: 2026-04 - python310 # EOL: 2026 - python310Packages.mkdocs - python310Packages.mkdocs-minify - python310Packages.csscompressor - python310Packages.htmlmin # htmlmin --keep-optional-attribute-quotes theme/favicon.svg theme/favicon.min.svg - rubyPackages.haml - rubyPackages.redcarpet - inkscape - imagemagick - ]; -}