🏗️ set up the core structure
|
@ -1,6 +1 @@
|
|||
[tech.ingolf-wagner.de](https://tech.ingolf-wagner.de) source code.
|
||||
|
||||
```
|
||||
nix run # to run local server
|
||||
nix run ".#publish" # to publish site
|
||||
```
|
||||
[tech.ingolf-wagner.de](https://tech.ingolf-wagner.de) source code.
|
161
Rakefile
|
@ -1,161 +0,0 @@
|
|||
|
||||
#
|
||||
# configuration
|
||||
#
|
||||
|
||||
@viewer = "feh" # just comment out if you don't want the viewr task
|
||||
|
||||
#
|
||||
# default task
|
||||
#
|
||||
|
||||
desc "create all files"
|
||||
task :all
|
||||
task :default => :all
|
||||
|
||||
#
|
||||
# tasks I need for all files
|
||||
#
|
||||
|
||||
def rest_tasks(name, file, png_file, svg_file)
|
||||
|
||||
desc "generate all files for ./#{file}"
|
||||
task name => png_file
|
||||
task name => svg_file
|
||||
|
||||
if @viewer
|
||||
|
||||
show_name = "view_#{name}"
|
||||
desc "#{@viewer} ./#{png_file}"
|
||||
task show_name => png_file do
|
||||
sh "#{@viewer} #{png_file}"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
# append tasks to default task
|
||||
task :all => png_file
|
||||
task :all => svg_file
|
||||
|
||||
end
|
||||
|
||||
#
|
||||
# tasks for blockdiag files
|
||||
#
|
||||
Dir['src/images/**/*.diag'].each do |diag_file|
|
||||
|
||||
name = diag_file[0..-6]
|
||||
svg_file = "#{name}.svg"
|
||||
png_file = "#{name}.png"
|
||||
|
||||
|
||||
task svg_file do
|
||||
sh "blockdiag -Tsvg -o #{name}.svg #{diag_file}"
|
||||
end
|
||||
|
||||
task png_file do
|
||||
sh "blockdiag --no-transparency -Tpng -o #{name}.png #{diag_file}"
|
||||
end
|
||||
|
||||
rest_tasks(name, diag_file, png_file, svg_file)
|
||||
|
||||
end
|
||||
|
||||
#
|
||||
# tasks for nwdiag files
|
||||
#
|
||||
Dir['src/images/**/*.nwdiag'].each do |diag_file|
|
||||
|
||||
name = diag_file[0..-8]
|
||||
svg_file = "#{name}.svg"
|
||||
png_file = "#{name}.png"
|
||||
|
||||
|
||||
task svg_file do
|
||||
sh "nwdiag -Tsvg -o #{name}.svg #{diag_file}"
|
||||
end
|
||||
|
||||
task png_file do
|
||||
sh "nwdiag --no-transparency -Tpng -o #{name}.png #{diag_file}"
|
||||
end
|
||||
|
||||
rest_tasks(name, diag_file, png_file, svg_file)
|
||||
|
||||
end
|
||||
|
||||
#
|
||||
# tasks for seqdiag files
|
||||
#
|
||||
Dir['src/images/**/*.seqdiag'].each do |diag_file|
|
||||
|
||||
name = diag_file[0..-9]
|
||||
svg_file = "#{name}.svg"
|
||||
png_file = "#{name}.png"
|
||||
|
||||
|
||||
task svg_file do
|
||||
sh "seqdiag -Tsvg -o #{name}.svg #{diag_file}"
|
||||
end
|
||||
|
||||
task png_file do
|
||||
sh "seqdiag --no-transparency -Tpng -o #{name}.png #{diag_file}"
|
||||
end
|
||||
|
||||
rest_tasks(name, diag_file, png_file, svg_file)
|
||||
|
||||
end
|
||||
|
||||
#
|
||||
# tasks for actdiag files
|
||||
#
|
||||
Dir['src/images/**/*.actdiag'].each do |diag_file|
|
||||
|
||||
name = diag_file[0..-9]
|
||||
svg_file = "#{name}.svg"
|
||||
png_file = "#{name}.png"
|
||||
|
||||
|
||||
task svg_file do
|
||||
sh "actdiag -Tsvg -o #{name}.svg #{diag_file}"
|
||||
end
|
||||
|
||||
task png_file do
|
||||
sh "actdiag --no-transparency -Tpng -o #{name}.png #{diag_file}"
|
||||
end
|
||||
|
||||
rest_tasks(name, diag_file, png_file, svg_file)
|
||||
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# hugo server
|
||||
#
|
||||
desc "start the hugo server"
|
||||
task :run_server => [:build_css] do
|
||||
sh "hugo serve"
|
||||
end
|
||||
|
||||
|
||||
#
|
||||
# publish
|
||||
#
|
||||
desc "publish"
|
||||
task :publish => [:all] do
|
||||
sh "./publish.ion"
|
||||
end
|
||||
|
||||
desc "preview"
|
||||
task :preview => [:all] do
|
||||
sh "./preview.ion"
|
||||
end
|
||||
|
||||
|
||||
|
||||
desc "build css"
|
||||
task :build_css do
|
||||
sh "lessc src/lessc/page/main.less static/css/main.css"
|
||||
sh "lessc src/lessc/remark/main-light.less static/css/remark-light.css"
|
||||
sh "lessc src/lessc/remark/main-dark.less static/css/remark-dark.css"
|
||||
end
|
||||
task :all => :build_css
|
|
@ -5,13 +5,13 @@ vars:
|
|||
SERVER_PATH: /srv/www/tech
|
||||
|
||||
tasks:
|
||||
server:
|
||||
serve:
|
||||
deps: [assets]
|
||||
cmds: ["hugo serve"]
|
||||
cmds: ["zola serve"]
|
||||
|
||||
build:
|
||||
deps: [assets]
|
||||
cmds: ["hugo"]
|
||||
cmds: ["zola"]
|
||||
|
||||
assets:
|
||||
deps: [css]
|
||||
|
|
16
config.toml
Normal file
|
@ -0,0 +1,16 @@
|
|||
# The URL the site will be built for
|
||||
base_url = "https://tech.ingolf-wagner.de"
|
||||
|
||||
# Whether to automatically compile all Sass files in the sass directory
|
||||
compile_sass = false
|
||||
|
||||
# Whether to build a search index to be used later on by a JavaScript library
|
||||
build_search_index = true
|
||||
|
||||
[markdown]
|
||||
# Whether to do syntax highlighting
|
||||
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Zola
|
||||
highlight_code = true
|
||||
|
||||
[extra]
|
||||
# Put all your custom variables here
|
|
@ -1,3 +1,4 @@
|
|||
# old delete if not needed anymore
|
||||
baseURL: "http://tech.ingolf-wagner.de"
|
||||
languageCode: "en-us"
|
||||
title: "Techblog - Ingolf Wagner"
|
||||
|
|
|
@ -1,14 +1,3 @@
|
|||
---
|
||||
title: "tech"
|
||||
date: 2018-09-28T21:43:24+02:00
|
||||
---
|
||||
|
||||
Hey here are some articles about technical issues.
|
||||
Most of them are about
|
||||
[NixOS](https://nixos.org) topics,
|
||||
because it is the Operation System of my choice.
|
||||
|
||||
If you are interested in more output of me please visit
|
||||
["my other page"](https://ingolf-wagner.de).
|
||||
|
||||
## Featured
|
||||
+++
|
||||
template = "index.html"
|
||||
+++
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: About me
|
||||
---
|
||||
+++
|
||||
title = "About me"
|
||||
template = "page.html"
|
||||
+++
|
||||
|
||||
I'm a freelancing Mathematician, Full Stack Developer and DevOps Engineer.
|
||||
[NixOS](https://nixos.org) is my Operating System of choice.
|
11
content/nixos/index.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
+++
|
||||
title = "NixOS Articles"
|
||||
template = "page.html"
|
||||
page_template = "page.html"
|
||||
+++
|
||||
|
||||
Hey here are some articles about technical issues.
|
||||
Most of them are about
|
||||
[NixOS](https://nixos.org)
|
||||
related topics,
|
||||
because it is the OS of my choice.
|
|
@ -1,16 +1,9 @@
|
|||
---
|
||||
title: "vsketch and NixOS"
|
||||
date: 2023-07-09T15:26:24+02:00
|
||||
tags:
|
||||
- NixOS
|
||||
- Plotting
|
||||
- vsketch
|
||||
summary: >
|
||||
Adventures with vsketch, axidraw and NixOS.
|
||||
---
|
||||
|
||||
|
||||
# vsketch and NixOS
|
||||
+++
|
||||
title = "vsketch and NixOS"
|
||||
date = 2023-07-09T15:26:24+02:00
|
||||
tags = [ "NixOS","Plotting","vsketch"]
|
||||
summary = "Adventures with vsketch, axidraw and NixOS."
|
||||
+++
|
||||
|
||||
I like to plotter. I like to draw pictures with my [axidraw](https://axidraw.com/) and ogle with the [terrapen](https://terrapen.xyz/products/terrapen-a2-pen-plotter) .
|
||||
|
||||
|
@ -36,7 +29,7 @@ in the repositories `.envrc` file.
|
|||
|
||||
In the `shell.nix` I simple define a all packages I need and override the `steam-run` binary to add some package. Getting to this point, was a bit fiddly, but once it works, it works :D This is my `shell.nix`
|
||||
|
||||
```text-plain
|
||||
```nix
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
pkgs.mkShell {
|
||||
buildInputs =
|
||||
|
@ -76,7 +69,7 @@ pkgs.mkShell {
|
|||
|
||||
Now `pipenv` has all needed dependencies for it's thing to do. But we need to set up `pipenv` itself as well, of course. Here is my `Pipfile`:
|
||||
|
||||
```text-plain
|
||||
```toml
|
||||
[[source]]
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
|
@ -95,7 +88,7 @@ python_full_version = "3.10.11"
|
|||
|
||||
Now I can run
|
||||
|
||||
```text-plain
|
||||
```shell
|
||||
pipenv install
|
||||
```
|
||||
|
||||
|
@ -106,7 +99,7 @@ My first sketch
|
|||
|
||||
After running
|
||||
|
||||
```text-plain
|
||||
```shell
|
||||
vsk init SimpleRings
|
||||
```
|
||||
|
||||
|
@ -116,7 +109,7 @@ I'm amazed how fast my development cycle was. I could instantly see results, and
|
|||
|
||||
Here is my first script + some screenshots and photos of the results:
|
||||
|
||||
```text-plain
|
||||
```python
|
||||
import vsketch
|
||||
|
||||
class SimpleRingsSketch(vsketch.SketchClass):
|
||||
|
|
Before Width: | Height: | Size: 4 MiB After Width: | Height: | Size: 4 MiB |
Before Width: | Height: | Size: 4 MiB After Width: | Height: | Size: 4 MiB |
Before Width: | Height: | Size: 4.2 MiB After Width: | Height: | Size: 4.2 MiB |
Before Width: | Height: | Size: 3.6 MiB After Width: | Height: | Size: 3.6 MiB |
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 4.4 MiB |
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
Before Width: | Height: | Size: 3.8 MiB After Width: | Height: | Size: 3.8 MiB |
Before Width: | Height: | Size: 3.6 MiB After Width: | Height: | Size: 3.6 MiB |
Before Width: | Height: | Size: 4 MiB After Width: | Height: | Size: 4 MiB |
Before Width: | Height: | Size: 3.3 MiB After Width: | Height: | Size: 3.3 MiB |
Before Width: | Height: | Size: 4.1 MiB After Width: | Height: | Size: 4.1 MiB |
Before Width: | Height: | Size: 3.8 MiB After Width: | Height: | Size: 3.8 MiB |
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 4.4 MiB |
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.7 MiB |
Before Width: | Height: | Size: 3.2 MiB After Width: | Height: | Size: 3.2 MiB |
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
Before Width: | Height: | Size: 2.8 MiB After Width: | Height: | Size: 2.8 MiB |
Before Width: | Height: | Size: 3.3 MiB After Width: | Height: | Size: 3.3 MiB |
Before Width: | Height: | Size: 3.6 MiB After Width: | Height: | Size: 3.6 MiB |
Before Width: | Height: | Size: 3.2 MiB After Width: | Height: | Size: 3.2 MiB |
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 4.4 MiB |
Before Width: | Height: | Size: 3.2 MiB After Width: | Height: | Size: 3.2 MiB |
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
Before Width: | Height: | Size: 4.3 MiB After Width: | Height: | Size: 4.3 MiB |
Before Width: | Height: | Size: 4.4 MiB After Width: | Height: | Size: 4.4 MiB |
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.7 MiB |
Before Width: | Height: | Size: 3.1 MiB After Width: | Height: | Size: 3.1 MiB |
Before Width: | Height: | Size: 5.7 MiB After Width: | Height: | Size: 5.7 MiB |
Before Width: | Height: | Size: 2.9 MiB After Width: | Height: | Size: 2.9 MiB |
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 2.4 MiB |
Before Width: | Height: | Size: 2.7 MiB After Width: | Height: | Size: 2.7 MiB |
Before Width: | Height: | Size: 4.1 MiB After Width: | Height: | Size: 4.1 MiB |
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.7 MiB |
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.7 MiB |
Before Width: | Height: | Size: 3.8 MiB After Width: | Height: | Size: 3.8 MiB |
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
Before Width: | Height: | Size: 3.7 MiB After Width: | Height: | Size: 3.7 MiB |
Before Width: | Height: | Size: 5.7 MiB After Width: | Height: | Size: 5.7 MiB |
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
Before Width: | Height: | Size: 3.5 MiB After Width: | Height: | Size: 3.5 MiB |
Before Width: | Height: | Size: 3.3 MiB After Width: | Height: | Size: 3.3 MiB |
Before Width: | Height: | Size: 3 MiB After Width: | Height: | Size: 3 MiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 83 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
BIN
content_asdf/nixos/vsketch-and-NixOS/images/plot01.jpg
Normal file
After Width: | Height: | Size: 199 KiB |
BIN
content_asdf/nixos/vsketch-and-NixOS/images/plot02.jpg
Normal file
After Width: | Height: | Size: 210 KiB |
BIN
content_asdf/nixos/vsketch-and-NixOS/images/screenshot.png
Normal file
After Width: | Height: | Size: 193 KiB |
174
content_asdf/nixos/vsketch-and-NixOS/index.md
Normal file
|
@ -0,0 +1,174 @@
|
|||
---
|
||||
title: "vsketch and NixOS"
|
||||
date: 2023-07-09T15:26:24+02:00
|
||||
tags:
|
||||
- NixOS
|
||||
- Plotting
|
||||
- vsketch
|
||||
summary: >
|
||||
Adventures with vsketch, axidraw and NixOS.
|
||||
---
|
||||
|
||||
|
||||
# vsketch and NixOS
|
||||
|
||||
I like to plotter. I like to draw pictures with my [axidraw](https://axidraw.com/) and ogle with the [terrapen](https://terrapen.xyz/products/terrapen-a2-pen-plotter) .
|
||||
|
||||
I had a few tries using [vsketch](https://vsketch.readthedocs.io/en/latest/) in [NixOS](https://nixos.org) but because I don't know much about Python and never had enough time to dig into it,
|
||||
I never made [vsketch](https://vsketch.readthedocs.io/en/latest/) work under NixOS. Same holds for the [axidraw cli](https://axidraw.com/doc/cli_api/#introduction).
|
||||
|
||||
But lately I got introduced to [pipenv](https://pipenv.pypa.io/en/latest/) which made everything possible and very easy.
|
||||
|
||||
Setup
|
||||
-----
|
||||
|
||||
I simple use a combination of `direnv` `shell.nix` , `steam-run` and `pipenv` to make everything work.
|
||||
|
||||
### shell.nix
|
||||
|
||||
The shell nix is called by `direnv` simply by putting
|
||||
|
||||
```text-plain
|
||||
use nix
|
||||
```
|
||||
|
||||
in the repositories `.envrc` file.
|
||||
|
||||
In the `shell.nix` I simple define a all packages I need and override the `steam-run` binary to add some package. Getting to this point, was a bit fiddly, but once it works, it works :D This is my `shell.nix`
|
||||
|
||||
```text-plain
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
pkgs.mkShell {
|
||||
buildInputs =
|
||||
let
|
||||
steamrun = (pkgs.steam.override {
|
||||
extraPkgs = pkgs: [
|
||||
(pkgs.python3.withPackages (ps: with ps; [
|
||||
matplotlib
|
||||
pyside6
|
||||
setuptools
|
||||
scikitlearn
|
||||
toml
|
||||
]))
|
||||
pkgs.qt6.qtbase
|
||||
];
|
||||
extraLibraries = pkgs: [ pkgs.libkrb5 ];
|
||||
}).run;
|
||||
in
|
||||
[
|
||||
(pkgs.writers.writeDashBin "vsk" ''
|
||||
${steamrun}/bin/steam-run pipenv run vsk "$@"
|
||||
'')
|
||||
(pkgs.writers.writeDashBin "axicli" ''
|
||||
${steamrun}/bin/steam-run pipenv run axicli "$@"
|
||||
'')
|
||||
(pkgs.writers.writeDashBin "python" ''
|
||||
${steamrun}/bin/steam-run ${pkgs.pipenv}/bin/pipenv run python "$@"
|
||||
'')
|
||||
(pkgs.writers.writeDashBin "pipenv" ''
|
||||
${steamrun}/bin/steam-run ${pkgs.pipenv}/bin/pipenv "$@"
|
||||
'')
|
||||
];
|
||||
}
|
||||
```
|
||||
|
||||
### Pipenv
|
||||
|
||||
Now `pipenv` has all needed dependencies for it's thing to do. But we need to set up `pipenv` itself as well, of course. Here is my `Pipfile`:
|
||||
|
||||
```text-plain
|
||||
[[source]]
|
||||
url = "https://pypi.org/simple"
|
||||
verify_ssl = true
|
||||
name = "pypi"
|
||||
|
||||
[packages]
|
||||
vsketch = {editable = true, git = "https://github.com/abey79/vsketch"}
|
||||
axicli = {file = "https://cdn.evilmadscientist.com/dl/ad/public/AxiDraw_API.zip" }
|
||||
|
||||
[dev-packages]
|
||||
|
||||
[requires]
|
||||
python_version = "3.10"
|
||||
python_full_version = "3.10.11"
|
||||
```
|
||||
|
||||
Now I can run
|
||||
|
||||
```text-plain
|
||||
pipenv install
|
||||
```
|
||||
|
||||
and magically the shell command `vsk` (which is defined in the `shell.nix`) works like charm.
|
||||
|
||||
My first sketch
|
||||
---------------
|
||||
|
||||
After running
|
||||
|
||||
```text-plain
|
||||
vsk init SimpleRings
|
||||
```
|
||||
|
||||
I could instantly start fiddling around with the code.
|
||||
|
||||
I'm amazed how fast my development cycle was. I could instantly see results, and play around with seed and parameters. And once I liked something. I can just hit **Like** and it will be saved as svg.
|
||||
|
||||
Here is my first script + some screenshots and photos of the results:
|
||||
|
||||
```text-plain
|
||||
import vsketch
|
||||
|
||||
class SimpleRingsSketch(vsketch.SketchClass):
|
||||
amount = vsketch.Param(3)
|
||||
space = vsketch.Param(30, min_value=10)
|
||||
min_radius = vsketch.Param(30, min_value=1)
|
||||
base_rotation = vsketch.Param(1)
|
||||
show_rings = vsketch.Param(True)
|
||||
show_rings_randomly = vsketch.Param(True)
|
||||
show_lines = vsketch.Param(True)
|
||||
|
||||
def draw(self, vsk: vsketch.Vsketch) -> None:
|
||||
vsk.size("a4", landscape=False)
|
||||
|
||||
# vsk.scale("mm")
|
||||
# height and width are in pixels (not mm)
|
||||
max_radius = min(vsk.height / 2, vsk.width / 2) - self.space
|
||||
|
||||
for i in range(self.amount):
|
||||
radius = vsk.random(self.min_radius, max_radius)
|
||||
amount_of_lines = int(vsk.random(1, radius))
|
||||
line_length = vsk.random(1, 20)
|
||||
circle_line_height = vsk.random(1, line_length)
|
||||
|
||||
# vsk.random() consumes the seed, so we have to consume it in every step, other changing the
|
||||
# options would result in different results in the other routines.
|
||||
if vsk.random(0, 1) > 0.5 or not self.show_rings_randomly:
|
||||
if self.show_rings:
|
||||
vsk.circle(0, 0, radius - circle_line_height, mode="radius")
|
||||
|
||||
if not self.show_lines:
|
||||
continue
|
||||
vsk.rotate(self.base_rotation, degrees=True)
|
||||
with vsk.pushMatrix():
|
||||
angle = 360.0 / amount_of_lines
|
||||
for j in range(0, amount_of_lines):
|
||||
vsk.rotate(angle, degrees=True)
|
||||
vsk.line(0, radius, 0, radius - line_length)
|
||||
|
||||
def finalize(self, vsk: vsketch.Vsketch) -> None:
|
||||
vsk.vpype("linemerge linesimplify reloop linesort")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
SimpleRingsSketch.display()
|
||||
```
|
||||
|
||||
{{< card >}}
|
||||
{{<figure src="./images/screenshot.png" width=100% >}}
|
||||
{{< /card >}}
|
||||
|
||||
{{< card >}}
|
||||
{{<figure src="./images/plot01.jpg" width=100% >}}
|
||||
{{<figure src="./images/plot02.jpg" width=100% >}}
|
||||
{{< /card >}}
|
67
flake.lock
|
@ -1,39 +1,76 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"lastModified": 1725024810,
|
||||
"narHash": "sha256-ODYRm8zHfLTH3soTFWE452ydPYz2iTvr9T8ftDMUQ3E=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "af510d4a62d071ea13925ce41c95e3dec816c01d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1666171135,
|
||||
"narHash": "sha256-+0AIbPDd24ZVjZgFobJH3uuJuyLVZjiH0oQNb01hyWE=",
|
||||
"owner": "nixos",
|
||||
"lastModified": 1725103162,
|
||||
"narHash": "sha256-Ym04C5+qovuQDYL/rKWSR+WESseQBbNAe5DsXNx5trY=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5720791e7fcdcc89834732e11848d73151356966",
|
||||
"rev": "12228ff1752d7b7624a54e9c1af4b222b3c1073b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1722555339,
|
||||
"narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=",
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1724833132,
|
||||
"narHash": "sha256-F4djBvyNRAXGusJiNYInqR6zIMI3rvlp6WiKwsRISos=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "3ffd842a5f50f435d3e603312eefa4790db46af5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
67
flake.nix
|
@ -1,48 +1,27 @@
|
|||
{
|
||||
description = "my website";
|
||||
description = "Description for the project";
|
||||
|
||||
inputs.nixpkgs.url = "github:nixos/nixpkgs";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
inputs = {
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
(flake-utils.lib.eachDefaultSystem (system:
|
||||
let pkgs = nixpkgs.legacyPackages.${system};
|
||||
in {
|
||||
|
||||
# nix develop
|
||||
devShell = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [ hugo lessc rake go-task feh ion inotify-tools ];
|
||||
};
|
||||
|
||||
# nix run
|
||||
apps.default = self.apps.${system}.server;
|
||||
|
||||
# nix run ".#server"
|
||||
apps.server = {
|
||||
type = "app";
|
||||
program = toString (pkgs.writers.writeBash "server" ''
|
||||
set -e
|
||||
set -o pipefail
|
||||
PATH=${
|
||||
pkgs.lib.makeBinPath [ pkgs.lessc pkgs.go-task pkgs.ion pkgs.hugo ]
|
||||
}
|
||||
task server
|
||||
'');
|
||||
};
|
||||
|
||||
# nix run ".#publish"
|
||||
apps.publish = {
|
||||
type = "app";
|
||||
program = toString (pkgs.writers.writeBash "publish" ''
|
||||
set -e
|
||||
set -o pipefail
|
||||
PATH=${
|
||||
pkgs.lib.makeBinPath [ pkgs.lessc pkgs.go-task pkgs.ion pkgs.hugo pkgs.rsync pkgs.openssh ]
|
||||
}
|
||||
task publish
|
||||
''
|
||||
);
|
||||
};
|
||||
|
||||
}));
|
||||
outputs =
|
||||
inputs@{ flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [
|
||||
./nix/formatter.nix
|
||||
./nix/devshells.nix
|
||||
];
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
];
|
||||
flake = {
|
||||
# The usual flake attributes can be defined here, including system-
|
||||
# agnostic ones like nixosModule and system-enumerating ones, although
|
||||
# those are more easily expressed in perSystem.
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
39
nix/devshells.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
_: {
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
self',
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
{
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
packages = [
|
||||
|
||||
pkgs.blockdiag
|
||||
pkgs.nwdiag
|
||||
pkgs.seqdiag
|
||||
pkgs.actdiag
|
||||
|
||||
pkgs.lessc
|
||||
|
||||
pkgs.pandoc
|
||||
|
||||
pkgs.go-task
|
||||
|
||||
pkgs.zola
|
||||
pkgs.sass
|
||||
#(pkgs.writers.writeBashBin "publish" ''
|
||||
# ${getExe pkgs.go-task} publish
|
||||
#'')
|
||||
(pkgs.writers.writeBashBin "serve" ''
|
||||
${getExe pkgs.go-task} serve
|
||||
'')
|
||||
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
14
nix/formatter.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
imports = [ inputs.treefmt-nix.flakeModule ];
|
||||
|
||||
perSystem = _: {
|
||||
treefmt = {
|
||||
# https://flake.parts/options/treefmt-nix < for all options
|
||||
projectRootFile = ".git/config";
|
||||
programs.nixfmt.enable = true;
|
||||
#programs.prettier.enable = true;
|
||||
#programs.prettier.includes = [ "*.md" ];
|
||||
};
|
||||
};
|
||||
}
|
29
preview.ion
|
@ -1,29 +0,0 @@
|
|||
#!/usr/bin/env ion
|
||||
|
||||
set -e
|
||||
|
||||
let server = sputnik.private
|
||||
let server_path = /srv/www/tech_preview
|
||||
let syncfolder = sync
|
||||
|
||||
echo
|
||||
echo "create page"
|
||||
echo
|
||||
hugo
|
||||
|
||||
echo
|
||||
echo "copy stuff"
|
||||
echo
|
||||
rsync \
|
||||
--recursive \
|
||||
--compress \
|
||||
--checksum \
|
||||
--verbose \
|
||||
--human-readable \
|
||||
--partial --progress \
|
||||
--protect-args \
|
||||
--delete-after \
|
||||
public/ $server:$server_path/
|
||||
|
||||
|
||||
|
29
publish.ion
|
@ -1,29 +0,0 @@
|
|||
#!/usr/bin/env ion
|
||||
|
||||
set -e
|
||||
|
||||
let server = sputnik.private
|
||||
let server_path = /srv/www/tech
|
||||
let syncfolder = sync
|
||||
|
||||
echo
|
||||
echo "create page"
|
||||
echo
|
||||
hugo
|
||||
|
||||
echo
|
||||
echo "copy stuff"
|
||||
echo
|
||||
rsync \
|
||||
--recursive \
|
||||
--compress \
|
||||
--checksum \
|
||||
--verbose \
|
||||
--human-readable \
|
||||
--partial --progress \
|
||||
--protect-args \
|
||||
--delete-after \
|
||||
public/ $server:$server_path/
|
||||
|
||||
|
||||
|
25
shell.nix
|
@ -1,25 +0,0 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
pkgs.mkShell {
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
hugo
|
||||
|
||||
blockdiag
|
||||
nwdiag
|
||||
seqdiag
|
||||
actdiag
|
||||
|
||||
lessc
|
||||
|
||||
rake
|
||||
feh
|
||||
|
||||
ion
|
||||
inotify-tools
|
||||
|
||||
pandoc
|
||||
|
||||
go-task
|
||||
];
|
||||
|
||||
}
|
58
templates/base.html
Normal file
|
@ -0,0 +1,58 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Tech-Blog</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- navigation-->
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-lg bg-body-tertiary">
|
||||
<div class="container-xxl">
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse"
|
||||
data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="/">Main</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">Articles</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">Art</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#">Slides</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="/about/">About</a>
|
||||
</li>
|
||||
</ul>
|
||||
<!-- <form class="d-flex" role="search">-->
|
||||
<!-- <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">-->
|
||||
<!-- <button class="btn btn-outline-success" type="submit">Search</button>-->
|
||||
<!-- </form>-->
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<div class="container-xxl">
|
||||
{% block content %} {% endblock %}
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
|
||||
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
|
||||
crossorigin="anonymous"></script>
|
||||
</html>
|
12
templates/index.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1 class="display-6"> Techblog </h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="/nixos">nixos</a></li>
|
||||
<li><a href="/nixos/vsketch-and-nixos/">vsketch</a></li>
|
||||
</ul>
|
||||
|
||||
{% endblock content %}
|
9
templates/page.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>{{ page.title | safe }}</h1>
|
||||
|
||||
{{ page.content | safe }}
|
||||
|
||||
{% endblock content %}
|