diff options
author | Jacob Janzen <jacob.a.s.janzen@gmail.com> | 2024-09-28 01:43:09 -0500 |
---|---|---|
committer | Jacob Janzen <jacob.a.s.janzen@gmail.com> | 2024-09-28 01:43:09 -0500 |
commit | d683509a0f412d080ffddde7e67bdf0ccd1f17f1 (patch) | |
tree | c97ffb024e5abdd1f57fac8b9acf27c7f1f0575f | |
parent | b7e84fa6048007cda7e6c8226e28bc2db90f792a (diff) |
makefile works for nixos
-rw-r--r-- | Makefile | 25 | ||||
-rw-r--r-- | common/.config/emacs/feed.org.org (renamed from common/.config/emacs/feed.el.org) | 0 | ||||
-rw-r--r-- | extract_src.py | 29 | ||||
-rw-r--r-- | nixos/.flake/flake.lock | 6 | ||||
-rw-r--r-- | nixos/.flake/home/programs/core.nix.org | 1 | ||||
-rw-r--r-- | nixos/.flake/system/desktop.nix.org | 2 |
6 files changed, 60 insertions, 3 deletions
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.org.org index d93d32e..d93d32e 100644 --- a/common/.config/emacs/feed.el.org +++ b/common/.config/emacs/feed.org.org 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 |