diff --git a/flake.lock b/flake.lock index 8df3b14..04ee96b 100644 --- a/flake.lock +++ b/flake.lock @@ -21,17 +21,16 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1617561707, - "narHash": "sha256-mQ05xYziJutQIi4pHfI1QbOq6EvrfN6GcvM/hM9sSV0=", - "ref": "master", - "rev": "2570dcc47d42d959221480156196d0a22086f00b", - "revCount": 19, - "type": "git", - "url": "https://gitea.redalder.org/Magic_RB/NixNG" + "lastModified": 1619975252, + "narHash": "sha256-Amx08/6MpMPLkqAukuIDjjxXdoAaZ/ruD88b3oC+Zbw=", + "path": "/nix/store/qq21z50yf6aqbccrz3qxp3alqka5ddbw-source", + "rev": "f3929584d72e2b741e243d4439a2874011b6d994", + "revCount": 61, + "type": "path" }, "original": { - "type": "git", - "url": "https://gitea.redalder.org/Magic_RB/NixNG" + "id": "nixng", + "type": "indirect" } }, "nixpkgs": { diff --git a/flake.nix b/flake.nix index a9f8c28..8d4b229 100644 --- a/flake.nix +++ b/flake.nix @@ -9,11 +9,6 @@ url = "github:hniksic/emacs-htmlize"; flake = false; }; - - nixng = { - url = "git+https://gitea.redalder.org/Magic_RB/NixNG"; - flake = true; - }; }; outputs = { self, nixpkgs, nixng, org-thtml, emacs-htmlize, ... }@inputs: @@ -21,122 +16,36 @@ supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ]; forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system); - websiteBase = pkgs: - pkgs.stdenv.mkDerivation { - name = "magic_rb-website"; - version = "0.1"; - src = ./.; - nativeBuildInputs = [ pkgs.emacs ]; - - buildPhase = '' - cp ${org-thtml}/ox-thtml.el ./ox-thtml.el - cp ${emacs-htmlize}/htmlize.el ./htmlize.el - mkdir tmp && export HOME=$(pwd)/tmp - emacs --script ./make.el - - find public_html -name 'sitemap.*' -exec rm {} \; - ''; - - installPhase = '' - mkdir -p $out - cp -r public_html/* $out - ''; - }; in { - website = forAllSystems (system: + + website = pkgs: + pkgs.stdenv.mkDerivation { + name = "magic_rb-website"; + version = "0.1"; + src = ./.; + nativeBuildInputs = [ pkgs.emacs ]; + + buildPhase = '' + cp ${org-thtml}/ox-thtml.el ./ox-thtml.el + cp ${emacs-htmlize}/htmlize.el ./htmlize.el + mkdir tmp && export HOME=$(pwd)/tmp + emacs --script ./make.el + + find public_html -name 'sitemap.*' -exec rm {} \; + ''; + + installPhase = '' + mkdir -p $out + cp -r public_html/* $out + ''; + }; + + defaultPackage = forAllSystems (system: let pkgs = import nixpkgs { inherit system; }; in - websiteBase pkgs + self.website pkgs ); - - websiteImage = (nixng.lib "x86_64-linux").makeSystem { - system = "x86_64-linux"; - name = "website"; - config = ({ pkgs, options, ... }: { - runit = { - enable = true; - isContainer = true; - }; - init.services.apache2 = { - ensureSomething.link."documentRoot" = { - src = "${websiteBase pkgs}"; - dst = "/var/www"; - }; - }; - users.users."www-data" = { - uid = 1001; - group = "www-data"; - }; - users.groups."www-data" = { - gid = 1001; - }; - services.apache2 = { - enable = true; - configuration = [ - { - LoadModule = [ - [ "mpm_event_module" "modules/mod_mpm_event.so" ] - [ "log_config_module" "modules/mod_log_config.so" ] - [ "unixd_module" "modules/mod_unixd.so" ] - [ "authz_core_module" "modules/mod_authz_core.so" ] - [ "dir_module" "modules/mod_dir.so" ] - [ "mime_module" "modules/mod_mime.so" ] - ]; - } - { - Listen = "0.0.0.0:80"; - - ServerRoot = "/var/www"; - ServerName = "blowhole"; - PidFile = "/httpd.pid"; - - User = "www-data"; - Group = "www-data"; - - DocumentRoot = "/var/www"; - } - - { - ErrorLog = "/dev/stderr"; - TransferLog = "/dev/stdout"; - - LogLevel = "info"; - } - - { - AddType = [ - [ "image/svg+xml" "svg" "svgz" ] - ]; - AddEncoding = [ "gzip" "svgz" ]; - - TypesConfig = "${pkgs.apacheHttpd}/conf/mime.types"; - } - - { - Directory = { - "/" = { - Require = [ "all" "denied" ]; - Options = "SymlinksIfOwnerMatch"; - }; - }; - - VirtualHost = { - "*:80" = { - Directory = { - "/var/www" = { - Require = [ "all" "granted" ]; - Options = [ "-Indexes" "+FollowSymlinks" ]; - DirectoryIndex = "index.html"; - }; - }; - }; - }; - } - ]; - }; - }); - }; }; }