馃寪 My personal website, written in Haskell and Sass skiletro.com
personal-website website portfolio haskell ssg
at master 85 lines 2.4 kB view raw
1{ 2 inputs = { 3 nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 4 flake-parts.url = "github:hercules-ci/flake-parts"; 5 haskell-flake.url = "github:srid/haskell-flake"; # https://community.flake.parts/haskell-flake 6 treefmt-nix.url = "github:numtide/treefmt-nix"; 7 }; 8 outputs = 9 inputs@{ 10 self, 11 flake-parts, 12 ... 13 }: 14 flake-parts.lib.mkFlake { inherit inputs; } { 15 systems = [ 16 "x86_64-linux" 17 "aarch64-linux" 18 "aarch64-darwin" 19 ]; 20 imports = [ 21 inputs.haskell-flake.flakeModule 22 inputs.treefmt-nix.flakeModule 23 ]; 24 25 perSystem = 26 { 27 self', 28 pkgs, 29 lib, 30 ... 31 }: 32 { 33 packages.default = pkgs.stdenvNoCC.mkDerivation { 34 name = "website"; 35 src = ./src; 36 37 GIT_REVISION = if (self ? shortRev) then self.shortRev else "dirty"; 38 # LANG and LOCALE_ARCHIVE are fixes pulled from the community: 39 # https://github.com/jaspervdj/hakyll/issues/614#issuecomment-411520691 40 # https://github.com/NixOS/nix/issues/318#issuecomment-52986702 41 # https://github.com/MaxDaten/brutal-recipes/blob/source/default.nix#L24 42 LANG = "en_GB.UTF-8"; 43 LOCALE_ARCHIVE = pkgs.lib.optionalString ( 44 pkgs.buildPlatform.libc == "glibc" 45 ) "${pkgs.glibcLocales}/lib/locale/locale-archive"; 46 47 buildPhase = '' 48 ${lib.getExe self'.packages.ssg} build --verbose 49 ''; 50 51 installPhase = '' 52 mkdir -p $out/dist 53 cp -a _site/. $out/dist 54 ''; 55 }; 56 57 haskellProjects.default = { 58 projectRoot = ./ssg; 59 devShell = { 60 enable = true; 61 tools = hp: { inherit (hp) hakyll; }; 62 hlsCheck.enable = true; 63 mkShellArgs = { 64 buildInputs = with pkgs; [ 65 just 66 sass 67 ]; 68 shellHook = "just -l -u"; 69 }; 70 }; 71 }; 72 73 treefmt = { 74 flakeCheck = true; 75 programs = { 76 nixfmt.enable = true; 77 deadnix.enable = true; 78 just.enable = true; 79 prettier.enable = true; 80 stylish-haskell.enable = true; 81 }; 82 }; 83 }; 84 }; 85}