commit b887bc4863b5a8982a714229f58ab247e64c0221 Author: Kristian Krsnik Date: Thu Aug 17 16:16:17 2023 +0200 initial commit diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bcba48a --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +# Generated files by hugo +/public/ +/resources/_gen/ +/assets/jsconfig.json +hugo_stats.json + +# Temporary lock file while building +/.hugo_build.lock + +# Nix +.direnv/ +/result +/themes/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..5d99f1c --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Deploying to nginx webserver + +```nix + +``` diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..00e77bd --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,6 @@ +--- +title: "{{ replace .Name "-" " " | title }}" +date: {{ .Date }} +draft: true +--- + diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..b1fcc40 --- /dev/null +++ b/config.toml @@ -0,0 +1,5 @@ +baseURL = 'http://example.org/' +languageCode = 'en-us' +title = 'My New Hugo Site' + +theme = 'nostyleplease' \ No newline at end of file diff --git a/content/posts/my-first-post.md b/content/posts/my-first-post.md new file mode 100644 index 0000000..ed918c0 --- /dev/null +++ b/content/posts/my-first-post.md @@ -0,0 +1,7 @@ +--- +title: "My First Post" +date: 2023-08-17T15:49:41+02:00 +draft: true +--- + +# This is a test \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a0e2871 --- /dev/null +++ b/flake.lock @@ -0,0 +1,78 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1692207601, + "narHash": "sha256-tfPGNKQcJT1cvT6ufqO/7ydYNL6mcJClvzbrzhKjB80=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b30c68669df77d981ce4aefd6b9d378563f6fc4e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nostyleplease": { + "flake": false, + "locked": { + "lastModified": 1682750457, + "narHash": "sha256-ks98fcijlwIn8dA9SF/gNMQ5kYmI816gGhfPDpU+18Y=", + "owner": "Masellum", + "repo": "hugo-theme-nostyleplease", + "rev": "1f0773883f3454c3154585a3458c039775415b79", + "type": "github" + }, + "original": { + "owner": "Masellum", + "repo": "hugo-theme-nostyleplease", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "nostyleplease": "nostyleplease" + } + }, + "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..66577af --- /dev/null +++ b/flake.nix @@ -0,0 +1,58 @@ +{ + description = "A very basic flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; + flake-utils.url = "github:numtide/flake-utils"; + nostyleplease = { + url = "github:Masellum/hugo-theme-nostyleplease"; + flake = false; + }; + }; + + outputs = { + self, + nixpkgs, + flake-utils, + nostyleplease, + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = nixpkgs.legacyPackages.${system}; + in { + packages.default = pkgs.stdenv.mkDerivation { + name = "blog"; + + meta = with pkgs.lib; { + description = "Kristian's personal blog"; + platforms = platforms.all; + }; + + # Exclude themes and public folder from build sources + src = builtins.filterSource (path: type: + !(type + == "directory" + && (baseNameOf path == "themes" || baseNameOf path == "public"))) + ./.; + + # Link theme to themes folder and build + buildPhase = '' + mkdir -p themes + ln -s ${nostyleplease} themes/nostyleplease + ${pkgs.hugo}/bin/hugo --minify + ''; + + installPhase = '' + cp -r public $out + ''; + }; + + devShells.default = pkgs.mkShellNoCC { + packages = with pkgs; [hugo]; + # Link theme to themes folder + shellHook = '' + mkdir -p themes + ln -sf ${nostyleplease} themes/nostyleplease + ''; + }; + }); +}