diff options
| -rw-r--r-- | chaski/services/bahnhof-name.nix | 7 | ||||
| -rw-r--r-- | common/desktop.nix | 3 | ||||
| -rw-r--r-- | flora/configuration.nix | 2 | ||||
| -rw-r--r-- | flora/services/blog.nix | 9 | ||||
| -rw-r--r-- | home/home.nix | 1 | ||||
| -rw-r--r-- | home/newsboat-public.nix | 12 | ||||
| -rw-r--r-- | home/packages.nix | 5 | ||||
| -rw-r--r-- | inputs.nix | 25 | ||||
| -rw-r--r-- | npins/default.nix | 158 | ||||
| -rw-r--r-- | npins/sources.json | 188 | ||||
| -rw-r--r-- | pkgs/bookwyrm.nix | 142 | ||||
| -rw-r--r-- | pkgs/bookwyrm/default.nix | 93 | ||||
| -rw-r--r-- | pkgs/bookwyrm/unwrapped.nix | 81 | ||||
| -rw-r--r-- | pkgs/overlay.nix | 39 |
14 files changed, 506 insertions, 259 deletions
diff --git a/chaski/services/bahnhof-name.nix b/chaski/services/bahnhof-name.nix index 7360372..69d54cc 100644 --- a/chaski/services/bahnhof-name.nix +++ b/chaski/services/bahnhof-name.nix @@ -19,8 +19,13 @@ enableACME = true; forceSSL = true; locations."/".proxyPass = "http://localhost:8080"; + extraConfig = '' + proxy_set_header X-Forwarded-Host $host; + ''; }; in builtins.listToAttrs (map (name: { inherit name; value = vhost; }) ["bahnhof.name" "ril100.bahnhof.name" - "ds100.bahnhof.name" "leitpunkt.bahnhof.name"]); + "ds100.bahnhof.name" "leitpunkt.bahnhof.name" + "rnv.bahnhof.name" + ]); } diff --git a/common/desktop.nix b/common/desktop.nix index d3812b2..e570579 100644 --- a/common/desktop.nix +++ b/common/desktop.nix @@ -86,7 +86,8 @@ noto-fonts-cjk-sans noto-fonts-cjk-serif noto-fonts-emoji - ]; + ] ++ (with lib.attrsets; + builtins.filter isDerivation (attrValues pkgs.nerd-fonts)); xdg.portal.wlr.enable = true; diff --git a/flora/configuration.nix b/flora/configuration.nix index 40cd3a5..11d5a31 100644 --- a/flora/configuration.nix +++ b/flora/configuration.nix @@ -11,7 +11,7 @@ ./services/trainspotter.nix ./services/element.nix ./services/ntfy.nix - ./services/murmur.nix + # ./services/murmur.nix ./services/monit.nix ]; diff --git a/flora/services/blog.nix b/flora/services/blog.nix index e8335b1..e77cc7c 100644 --- a/flora/services/blog.nix +++ b/flora/services/blog.nix @@ -39,7 +39,14 @@ in services.nginx.virtualHosts."stuebinm.eu" = { enableACME = true; forceSSL = true; - locations."/".root = import inputs.blog { inherit pkgs; }; + locations."/".root = (import inputs.blog { inherit pkgs; }).overrideAttrs (old: { + buildInputs = old.buildInputs ++ [ pkgs.exiftool pkgs.libxml2 ]; + + doCheck = true; + checkPhase = '' + xmllint _site/rss.xml + ''; + }); locations."/bookshelf/".alias = "${gtfsBooks.outPath}/"; }; } diff --git a/home/home.nix b/home/home.nix index e743f2a..2157528 100644 --- a/home/home.nix +++ b/home/home.nix @@ -297,6 +297,7 @@ macro 5 ${mkMpv "five"} macro f set browser "${pkgs.xdg-utils}/bin/xdg-open %u >/dev/null 2>&1 &" ; open-in-browser ; set browser "${config.programs.newsboat.browser} %u" macro d set browser "kitty @launch --type tab fish -c 'fetchpdf %u'" ; open-in-browser ; set browser "${config.programs.newsboat.browser} %u" + macro V set browser "firefox --private-window %u >/dev/null 2>&1 &" ; open-in-browser ; set browser "${config.programs.newsboat.browser} %u" bind-key j down bind-key k up diff --git a/home/newsboat-public.nix b/home/newsboat-public.nix index 7d94c32..bd334fb 100644 --- a/home/newsboat-public.nix +++ b/home/newsboat-public.nix @@ -219,6 +219,11 @@ with import ./newsboat-lib.nix; (btag "https://antonia.is/rss.xml" "friends") (btag "https://ancientalexandra.weebly.com/3/feed" "hist") (btag "https://github.com/bookwyrm-social/bookwyrm/releases.atom" "comp") + (btag "https://rachelbythebay.com/w/atom.xml" "comp") + (btag "https://xn--gckvb8fzb.com/index.xml" "comp") + (btag "https://blog.aada.cat/index.xml" "friends") + (btag "https://jonworth.eu/feed/" "trains") + (btag "https://vulpinecitrus.info/blog/atom.xml" "comp") # paper (btag "http://arxiv.org/rss/cs.PL" "paper") @@ -231,8 +236,6 @@ with import ./newsboat-lib.nix; (ytag "UCXuqSBlHAE6Xw-yeJA0Tunw" "tech") # Linus Tech Tips (ytag "UCBa659QWEk1AI4Tg--mrJ2A" "stuff") # Tom Scott (ytag "UCtGG8ucQgEJPeUPhJZ4M4jA" "stuff") # Rare Earth - (ytag "UCwRH985XgMYXQ6NxXDo8npw" "stuff") # Kurzgesagt de - (ytag "UCsXVk37bltHxD1rDPwtNM8Q" "stuff") # Kurzgesagt en (ytag "UC9GwQ_SGeq7Nrn4NQfwVoRA" "climate") # Students for Future (ytag "UCN29LJGZ8FY30ysxdTnDsaw" "stuff") # Die Filmanalyse (ytag "UCv1WDP5EiipMQ__C4Cg6aow" "pol") # Tilo Jung @@ -241,8 +244,6 @@ with import ./newsboat-lib.nix; (ytag "UCncTjqw75krp9j_wRRh5Gvw" "writing") # World Building Notes (ytag "UCPlJ-KlPelfnwq0GHSeSpGQ" "talks") # It's all about Math (ytag "UCmrWzKsW9IGU2l6a_MGJ3dw" "ling") # LangTime Studio - (ytag "UCXl0Zbk8_rvjyLwAR-Xh9pQ" "maths") # Insights into Mathematics (Wildberger) - (ytag "UCPjHlmSGP-rMg5PR-PyaJug" "chaos") # Henk Rijckaert (ytag "UC3XTzVzaHQEd30rQbuvCtTQ" "latenight") # Last Week Tonight (ytag "UCSju5G2aFaWMqn-_0YBtq5A" "maths") # Standupmaths (ytag "UC2PA-AKmVpU6NKCGtZq_rKQ" "left") # Philosophy Tube @@ -305,8 +306,7 @@ with import ./newsboat-lib.nix; (podcast "https://feed.podbean.com/lingfieldnotes/feed.xml") (podcast "https://dasklima.podigee.io/feed/mp3") (podcast "https://www.haecksen.org/podcast/rss") - (podcast "https://www.ndr.de/nachrichten/info/podcast4684.xml") - + (music "https://feeds.soundcloud.com/users/soundcloud%3Ausers%3A39508706/sounds.rss") ] diff --git a/home/packages.nix b/home/packages.nix index 15aeeca..2bdee84 100644 --- a/home/packages.nix +++ b/home/packages.nix @@ -2,11 +2,9 @@ let isabelle = import "${inputs.playground.outPath}/isabelle-nix-fhsenv" { inherit pkgs; }; - fonts = with lib.attrsets; - builtins.filter isDerivation (attrValues pkgs.nerd-fonts); in { - home.packages = with pkgs; fonts ++ [ + home.packages = with pkgs; [ emacs-pgtk emacs-all-the-icons-fonts julia-mono @@ -32,6 +30,7 @@ in wineWowPackages.full sops xdg-utils exiftool mercurial darcs git-annex-remote-remarkable2 git-who rlwrap + inputs.ocaml-forester.legacyPackages.${system}.forester # graphical utils kitty # gnss things @@ -65,5 +65,30 @@ let lix-overlay = import "${sources.lix-nixos-module}/overlay.nix" { lix = sources.lix // { rev = sources.lix.revision; }; }; + + + ###### Forester stuff + + flake-compat = import sources.flake-compat; + + # currently unused + opam2json = callFlake "opam2json" { + nixpkgs = nixpkgs-flake; + }; + # opam-nix does not want to be called like this; i do not know why + # opam-nix = callFlake "opam-nix"{ + # inherit (sources) opam-repository opam-overlays mirage-opam-overlays; + # inherit (inputs) flake-utils opam2json flake-compat; + # nixpkgs = nixpkgs-unstable-flake; + # }; + # so i gave up an use the flake-compat'd version instead, which uses an + # old nixpkgs pin i cannot easily change ... + opam-nix = (flake-compat { src = sources.opam-nix.outPath; }).defaultNix; + + ocaml-forester = callFlake "ocaml-forester" { + nixpkgs = nixpkgs-flake; + inherit (inputs) opam-nix flake-utils; + inherit (sources) opam-repository; + }; }; in inputs diff --git a/npins/default.nix b/npins/default.nix index 891db57..8955703 100644 --- a/npins/default.nix +++ b/npins/default.nix @@ -1,64 +1,148 @@ +/* + This file is provided under the MIT licence: + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ # Generated by npins. Do not modify; will be overwritten regularly let - requireFile = { sha256, hashMode ? "recursive" }: - builtins.derivation { - name = "source"; - outputHashMode = hashMode; - outputHashAlgo = "sha256"; - outputHash = sha256; - preferLocalBuild = true; - allowSubstitutes = false; - builder = "builtins:fetchurl"; - system = "builtin"; # builtins.currentSystem; - }; - data = builtins.fromJSON (builtins.readFile ./sources.json); version = data.version; - mkSource = spec: - assert spec ? type; let + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 + range = + first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 + stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); + + # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 + stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); + concatMapStrings = f: list: concatStrings (map f list); + concatStrings = builtins.concatStringsSep ""; + + # If the environment variable NPINS_OVERRIDE_${name} is set, then use + # the path directly as opposed to the fetched source. + # (Taken from Niv for compatibility) + mayOverride = + name: path: + let + envVarName = "NPINS_OVERRIDE_${saneName}"; + saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name; + ersatz = builtins.getEnv envVarName; + in + if ersatz == "" then + path + else + # this turns the string into an actual Nix path (for both absolute and + # relative paths) + builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" ( + if builtins.substring 0 1 ersatz == "/" then + /. + ersatz + else + /. + builtins.getEnv "PWD" + "/${ersatz}" + ); + + mkSource = + name: spec: + assert spec ? type; + let path = - if spec.type == "Git" then mkGitSource spec - else if spec.type == "GitRelease" then mkGitSource spec - else if spec.type == "PyPi" then mkPyPiSource spec - else if spec.type == "Channel" then mkChannelSource spec - else builtins.throw "Unknown source type ${spec.type}"; + if spec.type == "Git" then + mkGitSource spec + else if spec.type == "GitRelease" then + mkGitSource spec + else if spec.type == "PyPi" then + mkPyPiSource spec + else if spec.type == "Channel" then + mkChannelSource spec + else if spec.type == "Tarball" then + mkTarballSource spec + else + builtins.throw "Unknown source type ${spec.type}"; in - spec // { outPath = path; }; + spec // { outPath = mayOverride name path; }; - mkGitSource = { repository, revision, url ? null, hash, ... }: + mkGitSource = + { + repository, + revision, + url ? null, + submodules, + hash, + branch ? null, + ... + }: assert repository ? type; # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository # In the latter case, there we will always be an url to the tarball - if url != null then - (builtins.fetchTarball { + if url != null && !submodules then + builtins.fetchTarball { inherit url; sha256 = hash; # FIXME: check nix version & use SRI hashes - }) - else assert repository.type == "Git"; + } + else let - cached = requireFile { sha256 = hash; }; - fetched = builtins.fetchGit { - url = repository.url; - rev = revision; - }; - in if builtins.pathExists (builtins.unsafeDiscardStringContext cached.outPath) - then cached.outPath - else builtins.trace "npins: re-fetching source ${repository.url}" fetched.outPath; + url = + if repository.type == "Git" then + repository.url + else if repository.type == "GitHub" then + "https://github.com/${repository.owner}/${repository.repo}.git" + else if repository.type == "GitLab" then + "${repository.server}/${repository.repo_path}.git" + else + throw "Unrecognized repository type ${repository.type}"; + urlToName = + url: rev: + let + matched = builtins.match "^.*/([^/]*)(\\.git)?$" url; + + short = builtins.substring 0 7 rev; + + appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else ""; + in + "${if matched == null then "source" else builtins.head matched}${appendShort}"; + name = urlToName url revision; + in + builtins.fetchGit ({ + rev = revision; + inherit name; + # hash = hash; + inherit url submodules; + } // (if branch != null then { + ref = "refs/heads/${branch}"; + } else {})); - mkPyPiSource = { url, hash, ... }: + mkPyPiSource = + { url, hash, ... }: builtins.fetchurl { inherit url; sha256 = hash; }; - mkChannelSource = { url, hash, ... }: + mkChannelSource = + { url, hash, ... }: builtins.fetchTarball { inherit url; sha256 = hash; }; + + mkTarballSource = + { + url, + locked_url ? url, + hash, + ... + }: + builtins.fetchTarball { + url = locked_url; + sha256 = hash; + }; in -if version == 3 then - builtins.mapAttrs (_: mkSource) data.pins +if version == 5 then + builtins.mapAttrs mkSource data.pins else throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`" diff --git a/npins/sources.json b/npins/sources.json index 1401114..94f72f0 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -8,9 +8,10 @@ "repo": "ai.robots.txt" }, "branch": "main", - "revision": "093ab81d789528bb5d89c2d2c708b8f157e3b795", - "url": "https://github.com/ai-robots-txt/ai.robots.txt/archive/093ab81d789528bb5d89c2d2c708b8f157e3b795.tar.gz", - "hash": "0c5gzprgdik0f8436bcfjiz14hnajcmi4gl83cfv6499pkgqycpf" + "submodules": false, + "revision": "8b8bf9da5d11095dcb5dafe07e757ff5c4439b94", + "url": "https://github.com/ai-robots-txt/ai.robots.txt/archive/8b8bf9da5d11095dcb5dafe07e757ff5c4439b94.tar.gz", + "hash": "1aiq7b1njziwfrnp1h0n62mqgsfggqf55grkp5mblgg78xgzxrxb" }, "almanac": { "type": "Git", @@ -19,6 +20,7 @@ "url": "https://stuebinm.eu/git/forks/almanac" }, "branch": "master", + "submodules": false, "revision": "cdd82b013777324f146c4961b866154a9287110b", "url": null, "hash": "0804k1zcnyhfdgjxmpgyg9l537j6p4ajrjgzz9svxka6acc1l85h" @@ -29,10 +31,11 @@ "type": "Git", "url": "https://stuebinm.eu/git/bahnhof.name" }, - "branch": "main", - "revision": "2dd565d546ef7cba05846e90d79ae4a15a193f41", + "branch": "rnv", + "submodules": false, + "revision": "38ea5267c448f7c3d228477479a2dd66e57d4688", "url": null, - "hash": "137wq0hj9j4wikq401mz577a7r5cmfzfxyf4wv1ncxy450l4lrsh" + "hash": "0bl87zbh4jpw25h7bk6mkh0789ppbpa13zqxlm59r4wfp1nz8yii" }, "blog": { "type": "Git", @@ -41,9 +44,10 @@ "url": "ssh://cgit/~/blog" }, "branch": "main", - "revision": "99f88a9b675838f08e711a73a1bd5b6c80d66d31", + "submodules": false, + "revision": "61d865b1cb837f059bcd0b215d6f83ae33393e32", "url": null, - "hash": "1dnkz5vsbn8f924crhqp97xfkamypai1mqmbj867kwv0bvs036gb" + "hash": "0076rfb3fzb8j9mbi0xlv1fx8l0v9rvba6gfn6xydds75ahmf0bj" }, "deploy-rs": { "type": "Git", @@ -52,10 +56,27 @@ "url": "https://stuebinm.eu/git/forks/deploy-rs" }, "branch": "nom-flag", + "submodules": false, "revision": "9001480e03ab8c957716e2bf164bbde605472399", "url": null, "hash": "1iiplqa731ldha728xk2fi36n87p20hnzf35g21jli1dlknw388f" }, + "flake-compat": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "edolstra", + "repo": "flake-compat" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "v1.1.0", + "revision": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "url": "https://api.github.com/repos/edolstra/flake-compat/tarball/v1.1.0", + "hash": "19d2z6xsvpxm184m41qrpi1bplilwipgnzv9jy17fgw421785q1m" + }, "flake-utils": { "type": "GitRelease", "repository": { @@ -66,6 +87,7 @@ "pre_releases": false, "version_upper_bound": null, "release_prefix": null, + "submodules": false, "version": "v1.0.0", "revision": "04c1b180862888302ddfb2e3ad9eaa63afc60cf8", "url": "https://api.github.com/repos/numtide/flake-utils/tarball/v1.0.0", @@ -78,6 +100,7 @@ "url": "https://stuebinm.eu/git/forks/gtfs-books" }, "branch": "main", + "submodules": false, "revision": "2a9d4fcf48b872aef1343f71dfddf44946fd8eb5", "url": null, "hash": "077xjxaisjqcnqwjpq8cfg34y27cv5aidvzwv4d5736rz9v96bak" @@ -90,9 +113,10 @@ "repo": "home-manager" }, "branch": "release-25.05", - "revision": "83665c39fa688bd6a1f7c43cf7997a70f6a109f9", - "url": "https://github.com/nix-community/home-manager/archive/83665c39fa688bd6a1f7c43cf7997a70f6a109f9.tar.gz", - "hash": "06kpj2mgfd3b0sip93k12ls00vn48ghxn3xg8705cfyn321m380r" + "submodules": false, + "revision": "44831a7eaba4360fb81f2acc5ea6de5fde90aaa3", + "url": "https://github.com/nix-community/home-manager/archive/44831a7eaba4360fb81f2acc5ea6de5fde90aaa3.tar.gz", + "hash": "07pk5m6mxi666dclaxdwf7xrinifv01vvgxn49bjr8rsbh31syaq" }, "isabelle-utils": { "type": "Git", @@ -101,6 +125,7 @@ "url": "https://stuebinm.eu/git/isabelle-utils" }, "branch": "master", + "submodules": false, "revision": "e7427d5c67c0a90c369adecb4b0c65c043cb2e34", "url": null, "hash": "129pizyyvxg7lzgk9pqn48a7brhyh5fv7vwzrs7wnhkp30hrpjq2" @@ -112,9 +137,10 @@ "url": "https://git.lix.systems/lix-project/lix.git" }, "branch": "main", - "revision": "8525345fd192a552e777bd37689154ad8e05b3e0", + "submodules": false, + "revision": "a99842e0af7cb8a1b6adb2cddbbe6a63b1e9ee4d", "url": null, - "hash": "1pfzczc7kd7sr3w3igfh3fp8mlf7p5sg0lwa84hwkpsahss2lkas" + "hash": "0vsgz2r95f4whvrmghgqsg2xy1mc4mj6jwd2zrlyr9iivcwi1pw1" }, "lix-nixos-module": { "type": "Git", @@ -123,9 +149,23 @@ "url": "https://git.lix.systems/lix-project/nixos-module.git" }, "branch": "main", - "revision": "3c23c6ae2aecc1f76ae7993efe1a78b5316f0700", + "submodules": false, + "revision": "6c95c0b6f73f831226453fc6905c216ab634c30f", "url": null, - "hash": "1yv1d45jgfzjxcg23m2qwis5rxx2v45vfid8b0lm1sl6p66h4hpc" + "hash": "0lgfg939gfn4yifyib7f88gvcl4y8p7jjvq5k6ia8q68lw240wsy" + }, + "mirage-opam-overlays": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "dune-universe", + "repo": "mirage-opam-overlays" + }, + "branch": "main", + "submodules": false, + "revision": "eddcd1bc7e035392596b603d23dde67a88e6f6bc", + "url": "https://github.com/dune-universe/mirage-opam-overlays/archive/eddcd1bc7e035392596b603d23dde67a88e6f6bc.tar.gz", + "hash": "09cwhnnmphicm4j6figds2ckagbnypdmcqmbgcszjn6zzll5fymx" }, "nixos-mailserver": { "type": "Git", @@ -135,9 +175,10 @@ "server": "https://gitlab.com/" }, "branch": "master", - "revision": "53007af63fade28853408370c4c600a63dd97f41", - "url": "https://gitlab.com/api/v4/projects/simple-nixos-mailserver%2Fnixos-mailserver/repository/archive.tar.gz?sha=53007af63fade28853408370c4c600a63dd97f41", - "hash": "0jpp086m839dz6xh6kw5r8iq0cm4nd691zixzy6z11c4z2vf8v85" + "submodules": false, + "revision": "1ccd57f177539ed8c207b893c3f9798d88f87d2e", + "url": "https://gitlab.com/api/v4/projects/simple-nixos-mailserver%2Fnixos-mailserver/repository/archive.tar.gz?sha=1ccd57f177539ed8c207b893c3f9798d88f87d2e", + "hash": "1dvgzzzdl60k7cq067id01p40c3nqvfqw34m8gi7qhx3j6aw6knk" }, "nixpkgs": { "type": "Git", @@ -147,9 +188,10 @@ "repo": "nixpkgs" }, "branch": "nixos-25.05", - "revision": "7c43f080a7f28b2774f3b3f43234ca11661bf334", - "url": "https://github.com/NixOS/nixpkgs/archive/7c43f080a7f28b2774f3b3f43234ca11661bf334.tar.gz", - "hash": "0bxirhx43mw728lkvbdc6yg0s51islfkqgihdvnzvi0klr23d9xf" + "submodules": false, + "revision": "00d2457e2f608b4be6fe8b470b0a36816324b0ae", + "url": "https://github.com/NixOS/nixpkgs/archive/00d2457e2f608b4be6fe8b470b0a36816324b0ae.tar.gz", + "hash": "10h8yz4x1iacrp1bsih2kmpn1chaxwpmqrpy1lysrb8p9hfwacp1" }, "nixpkgs-unstable": { "type": "Git", @@ -159,9 +201,10 @@ "repo": "nixpkgs" }, "branch": "nixpkgs-unstable", - "revision": "ad331efcaf680eb1c838cb339472399ea7b3cdab", - "url": "https://github.com/NixOS/nixpkgs/archive/ad331efcaf680eb1c838cb339472399ea7b3cdab.tar.gz", - "hash": "020zxgs9k0573j1xjwybyhb0228k4wljjhmax3vr4ih8dl1d3a9d" + "submodules": false, + "revision": "a672be65651c80d3f592a89b3945466584a22069", + "url": "https://github.com/NixOS/nixpkgs/archive/a672be65651c80d3f592a89b3945466584a22069.tar.gz", + "hash": "1p2g7g9vlpv14xz6rrlb8i6w8sxki8i35m15phjiwfrqaf6x508i" }, "ntfy-matrix-bot": { "type": "Git", @@ -170,10 +213,84 @@ "url": "https://stuebinm.eu/git/ntfy-matrix-bot" }, "branch": "main", + "submodules": false, "revision": "c4bedb1756c96db3f7d01feedc6587f7b0c3dc0f", "url": null, "hash": "1kq34zk7k6rg9k8frvx51hl1ldqqbfgvhm9f827b5a4c0rx28dah" }, + "ocaml-forester": { + "type": "GitRelease", + "repository": { + "type": "Git", + "url": "https://git.sr.ht/~jonsterling/ocaml-forester" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "5.0", + "revision": "5ceee0e7d20febc0552caad0f71aa01750574d43", + "url": null, + "hash": "1ajajlg1yksk666mp5xf0ipy0c2r4pz650mrcprm45rf76xxjmj9" + }, + "opam-nix": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "tweag", + "repo": "opam-nix" + }, + "branch": "main", + "submodules": false, + "revision": "98ca8f4401e996aeac38b6f14bf3a82d85b7add7", + "url": "https://github.com/tweag/opam-nix/archive/98ca8f4401e996aeac38b6f14bf3a82d85b7add7.tar.gz", + "hash": "0iwxpacx7dzqyvnilsy54bzaf23f5yvmm155qkw3i6yxygav2xvm" + }, + "opam-overlays": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "dune-universe", + "repo": "opam-overlays" + }, + "branch": "master", + "submodules": false, + "revision": "d5c12f6d5c7909e6119a82bc4aba682ac3110b2d", + "url": "https://github.com/dune-universe/opam-overlays/archive/d5c12f6d5c7909e6119a82bc4aba682ac3110b2d.tar.gz", + "hash": "199qrblnd9mblr8l815wibmc147qinyvkqqi2gjmby76g3aw1h4x" + }, + "opam-repository": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "ocaml", + "repo": "opam-repository" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "1.2.0", + "revision": "62aabc825803c9dbf126488219524e68d74cd41c", + "url": "https://api.github.com/repos/ocaml/opam-repository/tarball/1.2.0", + "hash": "1rk665nzczykyxxs7c7kp2hgy49sn3alvcw15n7gsxm9qyxw0agz" + }, + "opam2json": { + "type": "GitRelease", + "repository": { + "type": "GitHub", + "owner": "tweag", + "repo": "opam2json" + }, + "pre_releases": false, + "version_upper_bound": null, + "release_prefix": null, + "submodules": false, + "version": "v0.4", + "revision": "562752a30aaff8985890ef5a2049a82247fc4b0f", + "url": "https://api.github.com/repos/tweag/opam2json/tarball/v0.4", + "hash": "00z4iqyl1x27nhkn89y771jl0iyqi2kfk8mq55nh0m798xnxz5g6" + }, "playground": { "type": "Git", "repository": { @@ -181,6 +298,7 @@ "url": "https://stuebinm.eu/git/playground" }, "branch": "master", + "submodules": false, "revision": "19144f12772063b1c6f00ad186dabbf53ea25985", "url": null, "hash": "1ss0n237f0dmw0akw2q0qp8nvnijcg35f9qgy3i27m4ib3gl4ybk" @@ -193,9 +311,10 @@ "repo": "rust-overlay" }, "branch": "master", - "revision": "9c8ea175cf9af29edbcff121512e44092a8f37e4", - "url": "https://github.com/oxalica/rust-overlay/archive/9c8ea175cf9af29edbcff121512e44092a8f37e4.tar.gz", - "hash": "0q36wkmg1m05fiy66fjzvjri4kpm502rw07bmp9jylpnlc62x5f7" + "submodules": false, + "revision": "7ed7e8c74be95906275805db68201e74e9904f07", + "url": "https://github.com/oxalica/rust-overlay/archive/7ed7e8c74be95906275805db68201e74e9904f07.tar.gz", + "hash": "1iqg073ara6z5mzzwz12zb20swq8lbjkgy0k4bc170g6bh03vmjx" }, "showrt": { "type": "Git", @@ -204,6 +323,7 @@ "url": "https://stuebinm.eu/git/showrt" }, "branch": "main", + "submodules": false, "revision": "7de36af3c6ffcc25832a6ff2303ba6c4c1101de5", "url": null, "hash": "09shk9b3969gmbmh8mavgss6f90zb51rsfby5n1d924agxzl93d6" @@ -216,6 +336,7 @@ "server": "https://gitlab.com/" }, "branch": "nixos-24.05", + "submodules": false, "revision": "636b82f4175e3f6b1e80d2189bb0469e2ae01a55", "url": "https://gitlab.com/api/v4/projects/simple-nixos-mailserver%2Fnixos-mailserver/repository/archive.tar.gz?sha=636b82f4175e3f6b1e80d2189bb0469e2ae01a55", "hash": "08zdidja5kdqgskynxsmcd8skh1b7cfl9ijjy9pak4b5h3aw2iqv" @@ -228,9 +349,10 @@ "repo": "sops-nix" }, "branch": "master", - "revision": "8d215e1c981be3aa37e47aeabd4e61bb069548fd", - "url": "https://github.com/Mic92/sops-nix/archive/8d215e1c981be3aa37e47aeabd4e61bb069548fd.tar.gz", - "hash": "1jkkjrzz9zmhfkc31v1lsslg8p62r7sjrj4z13c2ghhmdmgfa1ll" + "submodules": false, + "revision": "aeb517262102f13683d7a191c7e496b34df8d24c", + "url": "https://github.com/Mic92/sops-nix/archive/aeb517262102f13683d7a191c7e496b34df8d24c.tar.gz", + "hash": "1pra1yavc8xhgvl53jji8w3f9d8j5shgkfzwav69wyg429n8rlcb" }, "traveltext": { "type": "Git", @@ -239,6 +361,7 @@ "url": "https://stuebinm.eu/git/traveltext" }, "branch": "main", + "submodules": false, "revision": "d876202506621eb76012c12cbb0e91fd2bb0ada0", "url": null, "hash": "0886l3r4fnnd6pc699n9l7kzh1y00y6bbdalab90gjqccviwv9cd" @@ -250,10 +373,11 @@ "url": "https://stuebinm.eu/git/forks/uplcg" }, "branch": "main", + "submodules": false, "revision": "b61c0b191578d6ed39a6038cca7b436764a1f9f1", "url": null, "hash": "0675z5gvw0chx3hrr7bpiqxiwcykxhgw8qws17yazi071i8jgl29" } }, - "version": 3 -}
\ No newline at end of file + "version": 5 +} diff --git a/pkgs/bookwyrm.nix b/pkgs/bookwyrm.nix deleted file mode 100644 index 92764ce..0000000 --- a/pkgs/bookwyrm.nix +++ /dev/null @@ -1,142 +0,0 @@ -{ lib -, fetchFromGitHub -, python -, writeShellScriptBin -, writeText -, settings ? { } -}: - -let - # set some dummy values to make the package build - settingsWithDefaults = { - DOMAIN = "localhost"; - DEBUG = false; - USE_HTTPS = false; - EMAIL = "your@email.here"; - PGPORT = 5432; - POSTGRES_USER = "bookwyrm"; - POSTGRES_DB = "bookwyrm"; - POSTGRES_HOST = "localhost"; - REDIS_ACTIVITY_HOST = "localhost"; - REDIS_ACTIVITY_PORT = 6379; - REDIS_BROKER_HOST = "localhost"; - REDIS_BROKER_PORT = 6379; - EMAIL_HOST = "smtp.example.com"; - EMAIL_PORT = 587; - EMAIL_HOST_USER = "mail@example.org"; - EMAIL_HOST_PASSWORD = "blub"; - MEDIA_ROOT = "/var/lib/bookwyrm/images"; - } // settings; - - # toShellVar produces "" for false, which bookwyrm rejects - toDjangoVar = name: value: lib.toShellVar name - (if value == false then "false" else - (if value == true then "true" else value)); - - envfile = writeText "bookwyrm.env" - (lib.strings.concatLines - (lib.mapAttrsToList toDjangoVar settingsWithDefaults)); - - bookwyrm = python.pkgs.buildPythonApplication rec { - pname = "bookwyrm"; - version = "0.7.5"; - - format = "other"; - - src = fetchFromGitHub { - owner = "bookwyrm-social"; - repo = "bookwyrm"; - rev = "refs/tags/v${version}"; - hash = "sha256-/oak9dEB2rR2z8b9oXVQ6+F2H7s0F5hVxmAlPdpaA0w="; - }; - - propagatedBuildInputs = with python.pkgs; [ - aiohttp - bleach - celery - colorthief - django - django-celery-beat - bw-file-resubmit - django-compressor - django-imagekit - django-model-utils - django-sass-processor - django-csp - django-oauth-toolkit - django-storages - django-pgtrigger - s3-tar - environs - flower - gunicorn - libsass - markdown - packaging - pillow - psycopg2 - pycryptodome - dateutil - redis - requests - responses - pytz - boto3 - django-storages - django-redis - opentelemetry-api - opentelemetry-exporter-otlp-proto-grpc - # opentelemetry-instrumentation-celery - opentelemetry-instrumentation-django - # opentelemetry-instrumentation-pyscopg2 - opentelemetry-sdk - protobuf - pyotp - qrcode - grpcio - ]; - - postBuild = '' - ln -s ${envfile} .env - # needed for the python settings.py file to not fail, but not - # used during the commands executed below, so this is safe - export SECRET_KEY=fnord - - substituteInPlace contrib/systemd/* \ - --replace /opt/bookwyrm/venv/bin/gunicorn ${lib.getExe python.pkgs.gunicorn} \ - --replace /opt/bookwyrm/venv/bin/celery ${lib.getExe' python.pkgs.celery "celery"} \ - --replace /opt/bookwyrm $out - - sed -i /BindPath/d contrib/systemd/* - - python manage.py compile_themes - python manage.py collectstatic --no-input - ''; - - postInstall = '' - mkdir -p $out/lib/systemd/system - cp -r * .env $out - cp -r contrib/systemd/* $out/lib/systemd/system - ''; - - passthru = { - pythonPath = python.pkgs.makePythonPath propagatedBuildInputs; - gunicorn = python.pkgs.gunicorn; - celery = python.pkgs.celery; - manage = environmentFile: writeShellScriptBin "bookwyrm-manage.py" '' - set -a - ${if environmentFile != null - then "source ${environmentFile}" - else ""} - export PYTHONPATH=${passthru.pythonPath} - cd ${bookwyrm.outPath} - exec ${bookwyrm.outPath}/manage.py "$@" - ''; - }; - - # hacky hacky hack - shellHook = '' - export PYTHONPATH=${passthru.pythonPath} - ''; - }; -in bookwyrm diff --git a/pkgs/bookwyrm/default.nix b/pkgs/bookwyrm/default.nix new file mode 100644 index 0000000..6e0756b --- /dev/null +++ b/pkgs/bookwyrm/default.nix @@ -0,0 +1,93 @@ +{ lib +, stdenvNoCC +, writeShellScriptBin +, writeText +, source-han-sans-vf-ttf +, bookwyrm-unwrapped +, settings ? { } +}: + +let + # set some dummy values to make the package build + settingsWithDefaults = { + DOMAIN = "localhost"; + DEBUG = false; + EMAIL = "your@email.here"; + PGPORT = 5432; + POSTGRES_USER = "bookwyrm"; + POSTGRES_DB = "bookwyrm"; + POSTGRES_HOST = "localhost"; + REDIS_ACTIVITY_HOST = "localhost"; + REDIS_ACTIVITY_PORT = 6379; + REDIS_BROKER_HOST = "localhost"; + REDIS_BROKER_PORT = 6379; + EMAIL_HOST = "smtp.example.com"; + EMAIL_PORT = 587; + EMAIL_HOST_USER = "mail@example.org"; + EMAIL_HOST_PASSWORD = "blub"; + MEDIA_ROOT = "/var/lib/bookwyrm/images"; + } // settings; + + # toShellVar produces "" for false, which bookwyrm rejects + toDjangoVar = name: value: lib.toShellVar name + (if value == false then "false" else + (if value == true then "true" else value)); + + envfile = writeText "bookwyrm.env" + (lib.strings.concatLines + (lib.mapAttrsToList toDjangoVar settingsWithDefaults)); + +in stdenvNoCC.mkDerivation (finalAttrs: { + pname = "bookwyrm"; + inherit (bookwyrm-unwrapped) version; + src = bookwyrm-unwrapped; + + dontConfigure = true; + + buildPhase = '' + runHook preBuild + + ln -s ${envfile} .env + # needed for the python settings.py file to not fail, but not + # used during the commands executed below, so this is safe + export SECRET_KEY=fnord + + export PYTHONPATH=${bookwyrm-unwrapped.pythonPath} + ./manage.py compile_themes + ./manage.py collectstatic --no-input + + ln -s ${source-han-sans-vf-ttf}/share/fonts/variable/SourceHanSans-VF.ttf.ttc static/fonts/source_han_sans/ + + substituteInPlace contrib/systemd/* \ + --replace /opt/bookwyrm/venv/bin/gunicorn ${lib.getExe bookwyrm-unwrapped.gunicorn} \ + --replace /opt/bookwyrm/venv/bin/celery ${lib.getExe' bookwyrm-unwrapped.celery "celery"} \ + --replace /opt/bookwyrm $out + + sed -i /BindPath/d contrib/systemd/* + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/lib/systemd/system + cp -r * .env $out + cp -r contrib/systemd/* $out/lib/systemd/system + + runHook postInstall + ''; + + passthru = rec { + inherit (bookwyrm-unwrapped) celery gunicorn pythonPath; + manage = environmentFile: writeShellScriptBin "bookwyrm-manage.py" '' + set -a + ${if environmentFile != null + then "source ${environmentFile}" + else ""} + export PYTHONPATH=${pythonPath} + cd ${finalAttrs.finalPackage.outPath} + exec ${finalAttrs.finalPackage.outPath}/manage.py "$@" + ''; + }; +}) diff --git a/pkgs/bookwyrm/unwrapped.nix b/pkgs/bookwyrm/unwrapped.nix new file mode 100644 index 0000000..dce4279 --- /dev/null +++ b/pkgs/bookwyrm/unwrapped.nix @@ -0,0 +1,81 @@ +{ lib +, fetchFromGitHub +, python +}: + +python.pkgs.buildPythonApplication rec { + pname = "bookwyrm-unwrapped"; + version = "0.8.0"; + + format = "other"; + + src = fetchFromGitHub { + owner = "bookwyrm-social"; + repo = "bookwyrm"; + rev = "refs/tags/v${version}"; + hash = "sha256-juJLl6yN/u5Tx9j2rgT6d+92U4QAqhxG/LFZlIQtFxA="; + }; + + propagatedBuildInputs = with python.pkgs; [ + aiohttp + bleach + celery + colorthief + django + django-celery-beat + bw-file-resubmit + django-compressor + django-imagekit + django-model-utils + django-sass-processor + django-csp + django-oauth-toolkit + django-storages + django-pgtrigger + s3-tar + environs + flower + gunicorn + libsass + markdown + packaging + pillow + psycopg + pycryptodome + dateutil + redis + requests + responses + pytz + boto3 + django-storages + django-redis + opentelemetry-api + opentelemetry-exporter-otlp-proto-grpc + # opentelemetry-instrumentation-celery + opentelemetry-instrumentation-django + # opentelemetry-instrumentation-pyscopg2 + opentelemetry-sdk + protobuf + pyotp + qrcode + grpcio + ua-parser + ]; + + postInstall = '' + mkdir $out + cp -r * $out + ''; + + passthru = { + pythonPath = python.pkgs.makePythonPath propagatedBuildInputs; + gunicorn = python.pkgs.gunicorn; + celery = python.pkgs.celery; + }; + + # hacky hacky hack + shellHook = '' + export PYTHONPATH=${passthru.pythonPath} + ''; +} diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix index e981f8f..a3a58a7 100644 --- a/pkgs/overlay.nix +++ b/pkgs/overlay.nix @@ -53,39 +53,6 @@ in cargoLock.lockFile = "${src}/Cargo.lock"; }; - mergiraf = self.rustPlatform.buildRustPackage rec { - pname = "mergiraf"; - version = "git"; - src = self.fetchgit { - url = "https://codeberg.org/mergiraf/mergiraf"; - rev = "v0.2.0"; - hash = "sha256-egtX2daCbPXi5rX2OxbEZA/VI9R4HMj5LRKbUEBFo+E="; - }; - # TODO: probably unnecessary once we are on nixpkgs 24.11; earlier version - # hardcode --frozen here, but cargo wants --offline. - # the postBuild hook is necessary to set up things for the install hook - buildPhase = '' - cargo build -j $NIX_BUILD_CORES \ - --target x86_64-unknown-linux-gnu \ - --release \ - --offline - - runHook postBuild - ''; - # no idea why this didn't work with either test or build inputs .. - preCheck = '' - export PATH=$PATH:${self.gitMinimal}/bin - ''; - cargoLock = { - lockFile = "${src}/Cargo.lock"; - outputHashes = { - "tree-sitter-go-0.23.1" = "sha256-elPqkvVYs0vADOuN/umDteWP5hqcXhQAoSkqYDtTxaU="; - "tree-sitter-xml-0.7.0" = "sha256-RTWvOUAs3Uql9DKsP1jf9FZZHaZORE40GXd+6g6RQZw="; - "tree-sitter-yaml-0.6.1" = "sha256-gS+SjOnGl/86U9VV/y1ca7naYIe7DAOvOv++jCRLTKo="; - }; - }; - }; - rustex = rustPlatform.buildRustPackage rec { pname = "rustex"; version = "git"; @@ -255,7 +222,7 @@ in owner = "sinclairtarget"; repo = "git-who"; rev = "v${version}"; - hash = "sha256-H6RbmkM8/n0HDMI3auz6YyEn/vsfXWk5ig+pBhZG3nI="; + hash = "sha256-W3PDD0Gp9KStfa3+Wf2n8oxC5sp+YI/G5I3ukTg7H6k="; # submodules contain test data and have ssh urls, hence this absurdity fetchSubmodules = true; leaveDotGit = true; @@ -281,9 +248,11 @@ in #### packaged mostly as shitpost / to play around with #### - bookwyrm = (self.callPackage ./bookwyrm.nix { + bookwyrm = self.callPackage ./bookwyrm {}; + bookwyrm-unwrapped = (self.callPackage ./bookwyrm/unwrapped.nix { python = super.python312.override ({ packageOverrides = self: super: { + django = self.django_5; django-sass-processor = self.callPackage ./python/django-sass-processor.nix {}; django-imagekit = self.callPackage ./python/django-imagekit.nix {}; django-pgtrigger = self.callPackage ./python/django-pgtrigger.nix {}; |
