From d683509a0f412d080ffddde7e67bdf0ccd1f17f1 Mon Sep 17 00:00:00 2001 From: Jacob Janzen Date: Sat, 28 Sep 2024 01:43:09 -0500 Subject: makefile works for nixos --- Makefile | 25 ++++++++++++++++++++++ common/.config/emacs/feed.el.org | 38 --------------------------------- common/.config/emacs/feed.org.org | 38 +++++++++++++++++++++++++++++++++ extract_src.py | 29 +++++++++++++++++++++++++ nixos/.flake/flake.lock | 6 +++--- nixos/.flake/home/programs/core.nix.org | 1 + nixos/.flake/system/desktop.nix.org | 2 ++ 7 files changed, 98 insertions(+), 41 deletions(-) create mode 100644 Makefile delete mode 100644 common/.config/emacs/feed.el.org create mode 100644 common/.config/emacs/feed.org.org create mode 100644 extract_src.py diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8ee9c11 --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +.PHONY: install update rollback + +SRCDIR = ./nixos +DSTDIR = $(HOME)/quarantine + +SOURCES := $(shell find -L $(SRCDIR)/ -type f) +CONFIGS := $(subst $(SRCDIR)/,$(DSTDIR)/,$(SOURCES:%.org=%)) + +all: update + +update: install + nix flake update $(DSTDIR)/.flake + cp $(DSTDIR)/.flake/flake.lock $(SRCDIR)/.flake + sudo nixos-rebuild switch --flake $(DSTDIR)/.flake + +install: $(CONFIGS) + sudo nixos-rebuild switch --flake $(DSTDIR)/.flake + +$(DSTDIR)/%: $(SRCDIR)/%.org + mkdir -p $(dir $@) + python3 ./extract_src.py $< $@ + +$(DSTDIR)/%: $(SRCDIR)/% + mkdir -p $(dir $@) + cp $< $@ diff --git a/common/.config/emacs/feed.el.org b/common/.config/emacs/feed.el.org deleted file mode 100644 index d93d32e..0000000 --- a/common/.config/emacs/feed.el.org +++ /dev/null @@ -1,38 +0,0 @@ -#+title: Emacs RSS Feed - -#+begin_src org :tangle ~/.config/emacs/feed.org :mkdirp yes - ,* Blogs - :PROPERTIES: - :ID: elfeed - :END: - ,** Journalism :journalism: - ,*** [[https://waxy.org/feed/][Waxy.org]] - ,*** [[https://pluralistic.net/feed/][Cory Doctorow]] :technology:software:fiction: - ,** Computer Science :cs: - ,*** [[https://a.exozy.me/index.xml][Some Random Website]] :math:algorithms:fiction: - ,** Technology :technology: - ,*** [[https://ciechanow.ski/atom.xml][Bartosz Ciechanowshki]] - ,*** [[https://www.citationneeded.news/rss/][Citation Needed]] - ,*** [[https://www.lilysthings.org/blog/rss.xml][The Cool Blog]] - ,** Software :software: - ,*** [[https://ersei.net/en/blog.atom][Ersei]] - ,*** [[https://lilysthings.org/blog/rss.xml][Lily's Things]] - ,*** [[https://ntietz.com/atom.xml][Technically a Blog]] - ,*** [[https://alexwlchan.net/atom.xml][Alex Chan]] - ,*** [[https://eaton-works.com/feed.atom][Eaton Works]] :hacking: - ,*** [[https://computer.rip/rss.xml][Computer's Are Bad]] :technology: - ,*** [[https://mark.stosberg.com/rss/][Mark Stosberg]] :biking: - ,*** [[https://maia.crimew.gay/feed.xml][Maia Crimew]] :internet:hacking: - ,*** [[https://drewdevault.com/blog/index.xml][Drew DeVault]] - ,** Comics :comic: - ,*** [[https://xkcd.com/atom.xml][XKCD]] - ,** People I know - ,*** [[https://www.weavingwatersexpedition.com/news?format=rss][Weaving Waters Expedition]] :journalism: - ,*** [[https://pinkish.bearblog.dev/feed/][Pinkish]] :software: - ,*** [[https://jjanzen.ca/rss.xml][Me]] :software:review: - ,** Internet Infrastructure :internet:software: - ,*** [[https://daniel.haxx.se/blog/feed/][cURL]] - ,*** [[https://blog.archive.org/feed/][Archive.org]] - ,** Reviews :review: - ,*** [[https://mountainofink.com/?format=rss][Mountain of Ink]] -#+end_src diff --git a/common/.config/emacs/feed.org.org b/common/.config/emacs/feed.org.org new file mode 100644 index 0000000..d93d32e --- /dev/null +++ b/common/.config/emacs/feed.org.org @@ -0,0 +1,38 @@ +#+title: Emacs RSS Feed + +#+begin_src org :tangle ~/.config/emacs/feed.org :mkdirp yes + ,* Blogs + :PROPERTIES: + :ID: elfeed + :END: + ,** Journalism :journalism: + ,*** [[https://waxy.org/feed/][Waxy.org]] + ,*** [[https://pluralistic.net/feed/][Cory Doctorow]] :technology:software:fiction: + ,** Computer Science :cs: + ,*** [[https://a.exozy.me/index.xml][Some Random Website]] :math:algorithms:fiction: + ,** Technology :technology: + ,*** [[https://ciechanow.ski/atom.xml][Bartosz Ciechanowshki]] + ,*** [[https://www.citationneeded.news/rss/][Citation Needed]] + ,*** [[https://www.lilysthings.org/blog/rss.xml][The Cool Blog]] + ,** Software :software: + ,*** [[https://ersei.net/en/blog.atom][Ersei]] + ,*** [[https://lilysthings.org/blog/rss.xml][Lily's Things]] + ,*** [[https://ntietz.com/atom.xml][Technically a Blog]] + ,*** [[https://alexwlchan.net/atom.xml][Alex Chan]] + ,*** [[https://eaton-works.com/feed.atom][Eaton Works]] :hacking: + ,*** [[https://computer.rip/rss.xml][Computer's Are Bad]] :technology: + ,*** [[https://mark.stosberg.com/rss/][Mark Stosberg]] :biking: + ,*** [[https://maia.crimew.gay/feed.xml][Maia Crimew]] :internet:hacking: + ,*** [[https://drewdevault.com/blog/index.xml][Drew DeVault]] + ,** Comics :comic: + ,*** [[https://xkcd.com/atom.xml][XKCD]] + ,** People I know + ,*** [[https://www.weavingwatersexpedition.com/news?format=rss][Weaving Waters Expedition]] :journalism: + ,*** [[https://pinkish.bearblog.dev/feed/][Pinkish]] :software: + ,*** [[https://jjanzen.ca/rss.xml][Me]] :software:review: + ,** Internet Infrastructure :internet:software: + ,*** [[https://daniel.haxx.se/blog/feed/][cURL]] + ,*** [[https://blog.archive.org/feed/][Archive.org]] + ,** Reviews :review: + ,*** [[https://mountainofink.com/?format=rss][Mountain of Ink]] +#+end_src diff --git a/extract_src.py b/extract_src.py new file mode 100644 index 0000000..665c4c4 --- /dev/null +++ b/extract_src.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 + +import sys +import re + +with open(sys.argv[1], "r") as inp: + with open(sys.argv[2], "w") as out: + in_src = False + startp = re.compile(r"^\s*#\+begin_src .* :tangle") + endp = re.compile(r"^\s*#\+end_src") + quoted = re.compile(r"^\s*,(\*|,\*|#\+)") + + lines = inp.readlines() + curr = [] + min_spaces = -1 + for line in lines: + if startp.match(line): + in_src = True + elif endp.match(line): + in_src = False + for l in curr: + out.write(l[min_spaces:]) + curr = [] + min_spaces = -1 + elif in_src: + spaces = len(line) - len(line.lstrip()) + if min_spaces == -1 or min_spaces > spaces: + min_spaces = spaces + curr.append(re.sub(r"^(\s*),(\*|,\*|#\+|,#\+)", r"\1\2", line)) diff --git a/nixos/.flake/flake.lock b/nixos/.flake/flake.lock index 055d415..bca97b8 100644 --- a/nixos/.flake/flake.lock +++ b/nixos/.flake/flake.lock @@ -35,11 +35,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1727122398, - "narHash": "sha256-o8VBeCWHBxGd4kVMceIayf5GApqTavJbTa44Xcg5Rrk=", + "lastModified": 1727348695, + "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "30439d93eb8b19861ccbe3e581abf97bdc91b093", + "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784", "type": "github" }, "original": { diff --git a/nixos/.flake/home/programs/core.nix.org b/nixos/.flake/home/programs/core.nix.org index 3bf0fab..e42b91f 100644 --- a/nixos/.flake/home/programs/core.nix.org +++ b/nixos/.flake/home/programs/core.nix.org @@ -37,6 +37,7 @@ This is the core of my program configuration. This file installs programs that d prismlauncher # minecraft protonvpn-gui python3 + python312Packages.python-lsp-server swaybg texliveFull unzip diff --git a/nixos/.flake/system/desktop.nix.org b/nixos/.flake/system/desktop.nix.org index fbe4206..1f8293b 100644 --- a/nixos/.flake/system/desktop.nix.org +++ b/nixos/.flake/system/desktop.nix.org @@ -20,7 +20,9 @@ Install necessary packages for the desktop. git greetd.tuigreet kitty + gnumake neovim + python3 wget ]; #+end_src -- cgit v1.2.3