diff options
Diffstat (limited to '')
| -rw-r--r-- | chaski/services/bahnhof-name.nix | 7 | ||||
| -rw-r--r-- | common/desktop.nix | 9 | ||||
| -rw-r--r-- | default.nix | 9 | ||||
| -rw-r--r-- | flora/configuration.nix | 2 | ||||
| -rw-r--r-- | flora/services/blog.nix | 9 | ||||
| -rw-r--r-- | flora/services/cgit.nix | 8 | ||||
| -rw-r--r-- | flora/services/mail.nix | 2 | ||||
| -rw-r--r-- | flora/services/monit.nix | 16 | ||||
| -rw-r--r-- | home/home-minimal.nix | 36 | ||||
| -rw-r--r-- | home/home.nix | 23 | ||||
| -rw-r--r-- | home/newsboat-public.nix | 13 | ||||
| -rw-r--r-- | home/packages-minimal.nix | 2 | ||||
| -rw-r--r-- | home/packages.nix | 20 | ||||
| -rw-r--r-- | inputs.nix | 27 | ||||
| -rw-r--r-- | npins/default.nix | 158 | ||||
| -rw-r--r-- | npins/sources.json | 209 | ||||
| -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/default.nix | 2 | ||||
| -rw-r--r-- | pkgs/overlay.nix | 110 | ||||
| -rw-r--r-- | pkgs/plover/default.nix | 5 | ||||
| -rw-r--r-- | pkgs/plover/plover-dev.nix | 73 | ||||
| -rw-r--r-- | pkgs/plover/plover-stroke.nix | 39 | ||||
| -rw-r--r-- | pkgs/plover/plover.nix | 96 | ||||
| -rw-r--r-- | pkgs/plover/rtf_tokenize.nix | 33 |
26 files changed, 873 insertions, 351 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..9341b83 100644 --- a/common/desktop.nix +++ b/common/desktop.nix @@ -59,10 +59,10 @@ enable = true; settings = { default_session = { - command = "${pkgs.greetd.tuigreet}/bin/tuigreet -tr --asterisks --cmd 'hikari -c ~/hikari.conf'"; + command = "${pkgs.tuigreet}/bin/tuigreet -tr --asterisks --cmd 'hikari -c ~/hikari.conf'"; user = "stuebinm"; }; - terminal.vt = 2; + # terminal.vt = 2; }; }; @@ -85,8 +85,9 @@ noto-fonts noto-fonts-cjk-sans noto-fonts-cjk-serif - noto-fonts-emoji - ]; + noto-fonts-color-emoji + ] ++ (with lib.attrsets; + builtins.filter isDerivation (attrValues pkgs.nerd-fonts)); xdg.portal.wlr.enable = true; diff --git a/default.nix b/default.nix index 55e130e..04342c3 100644 --- a/default.nix +++ b/default.nix @@ -46,15 +46,6 @@ let deploy.nodes = { chaski = deploy-vps "chaski"; flora = deploy-vps "flora"; - parsons = { - hostname = "parsons"; - profiles.home = { - user = "stuebinm"; - sshUser = "stuebinm"; - path = inputs.deploy-rs.lib.x86_64-linux.activate.home-manager - self.homeConfigurations.stuebinm-minimal; - }; - }; abbenay = { hostname = "abbenay"; profiles.system = { 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/flora/services/cgit.nix b/flora/services/cgit.nix index b846ad4..5ee8103 100644 --- a/flora/services/cgit.nix +++ b/flora/services/cgit.nix @@ -2,7 +2,13 @@ let cgitconf = '' - source-filter=${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py + source-filter=${pkgs.writeScript ''highlighter'' '' + if [[ $1 == *.thy ]]; then + ${pkgs.isabelle-utils}/bin/isabelle2unicode | ${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py "$1" + else + ${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py "$1" + fi + ''} about-filter=${pkgs.cgit}/lib/cgit/filters/about-formatting.sh cache-size=1000 logo=/git/cgit.png diff --git a/flora/services/mail.nix b/flora/services/mail.nix index 523c32d..0ee8418 100644 --- a/flora/services/mail.nix +++ b/flora/services/mail.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, inputs, ... }: { - imports = [ inputs.simple-nixos-mailserver ]; + imports = [ inputs.nixos-mailserver ]; sops.secrets."mail/hashedPassword" = {}; diff --git a/flora/services/monit.nix b/flora/services/monit.nix index 19e7e88..cc5f3c4 100644 --- a/flora/services/monit.nix +++ b/flora/services/monit.nix @@ -30,23 +30,11 @@ if failed port 443 with protocol https then alert - check host hacc-uffd with address login.infra4future.de - if failed port 443 with protocol https - then alert - - check host hacc-onlyoffice with address onlyoffice.infra4future.de - if failed port 443 with protocol https and status 302 - then alert - - check host hacc-mattermost with address mattermost.infra4future.de - if failed port 443 with protocol https - then alert - - check host hacc-nextcloud with address cloud.infra4future.de + check host nobelium with address colorspace.club if failed port 443 with protocol https then alert - check host nobelium with address colorspace.club + check host billy with address preprint.books.exposed if failed port 443 with protocol https then alert ''; diff --git a/home/home-minimal.nix b/home/home-minimal.nix index cfeb2b2..98ba513 100644 --- a/home/home-minimal.nix +++ b/home/home-minimal.nix @@ -119,16 +119,17 @@ programs.git = { enable = true; - package = pkgs.gitAndTools.gitFull; - userEmail = "stuebinm@disroot.org"; - userName = "stuebinm"; + package = pkgs.gitFull; signing = { # signByDefault = true; key = "0x8FBE8AAD32FA12B7"; }; - extraConfig = { + settings = { + user.email = "stuebinm@disroot.org"; + user.name = "stuebinm"; + log.showSignature = true; init.defaultBranch = "main"; merge.conflictStyle = "zdiff3"; @@ -145,6 +146,11 @@ colorMoved = "plain"; mnemoicPrefix = true; renames = true; + + "isabelle" = { + binary = true; + textconv = "isabelle2unicode"; + }; }; alias = { @@ -176,21 +182,23 @@ "*.cpp merge=mergiraf" "*.hpp merge=mergiraf" "*.cs merge=mergiraf" + "*.thy diff=isabelle" ]; # diff-so-fancy.enable = true; # difftastic.enable = true; - delta = { - enable = false; - options = { - decorations = { - commit-decoration-style = "bold yellow"; - file-decoration-style = "bold blue"; - file-style = "bold yellow"; - }; - features = "decorations line-numbers navigate"; - whitespace-error-style = "22 reverse"; + }; + + programs.delta = { + enable = false; + options = { + decorations = { + commit-decoration-style = "bold yellow"; + file-decoration-style = "bold blue"; + file-style = "bold yellow"; }; + features = "decorations line-numbers navigate"; + whitespace-error-style = "22 reverse"; }; }; diff --git a/home/home.nix b/home/home.nix index e743f2a..15df8de 100644 --- a/home/home.nix +++ b/home/home.nix @@ -26,22 +26,8 @@ programs.mu.enable = true; accounts.email = { - accounts.hacc = { - address = "stuebinm@hacc.space"; - imap.host = "mail.hacc.space"; - mbsync = { - enable = true; - create = "maildir"; - }; - msmtp.enable = true; - mu.enable = true; - primary = true; - realName = "stuebinm"; - smtp.host = "mail.hacc.space"; - userName = "stuebinm@hacc.space"; - passwordCommand = "secret-tool lookup mail hacc"; - }; accounts.disroot = { + primary = true; address = "stuebinm@disroot.org"; imap.host = "disroot.org"; mbsync = { @@ -297,6 +283,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 @@ -324,12 +311,6 @@ hetznerlogin = match: {user = "root"; identityFile = keydir + "/hetzner.pub";} // match; vpslogin = hostname: hetznerlogin {inherit hostname;}; in { - "parsons" = { - hostname = "parsons.hacc.space"; - port = 62954; - user = "stuebinm"; - identityFile = keydir + "/id_ed25519"; - }; "flora" = vpslogin "flora.stuebinm.eu"; "chaski" = vpslogin "chaski.stuebinm.eu"; "cgit" = vpslogin "flora.stuebinm.eu" // {user = "git";}; diff --git a/home/newsboat-public.nix b/home/newsboat-public.nix index 7d94c32..7da942b 100644 --- a/home/newsboat-public.nix +++ b/home/newsboat-public.nix @@ -17,7 +17,6 @@ with import ./newsboat-lib.nix; (jtag "https://decorrespondent.nl/feed/v1/publications" "pol") (jtag "https://solar.lowtechmagazine.com/feeds/all-en.atom.xml" "tech") (btag "https://www.omgubuntu.co.uk/feed" "tech") - (ntag "https://git.infra4future.de/hacc/haccfiles.rss" "git") (ntag "https://liputenpo.org/feed" "tok") (ntag "https://matrix.org/atom.xml" "matrix") (ntag "https://press.nmbs.be/feed" "trains") @@ -219,6 +218,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 +235,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 +243,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 +305,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-minimal.nix b/home/packages-minimal.nix index b1121ac..20eb6df 100644 --- a/home/packages-minimal.nix +++ b/home/packages-minimal.nix @@ -16,7 +16,7 @@ # nix tools nixpkgs-review nix-top nix-diff nix-tree # git - gitAndTools.gitAnnex git-bug git-appraise mergiraf + git-annex git-bug git-appraise mergiraf # other things gauche # html, js & co diff --git a/home/packages.nix b/home/packages.nix index 15aeeca..236b5b6 100644 --- a/home/packages.nix +++ b/home/packages.nix @@ -2,17 +2,17 @@ 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 + river-classic swaybg swaylock + plover-dev # internet apps & clients firefox keepassxc mumble lynx offpunk - openconnect tdesktop monolith magic-wormhole-rs + openconnect telegram-desktop monolith magic-wormhole-rs dino # graphics & audio audacity blender darktable ffmpeg-full @@ -20,7 +20,7 @@ in gst_all_1.gstreamer vimiv-qt # LaTeX & documents xournalpp pandoc zathura pdfpc - poppler_utils typst rustex + poppler-utils typst rustex (texlive.combine { inherit (texlive) scheme-full; pkgFilter = pkg: lib.elem pkg.tlType [ "run" "bin" "doc" ]; @@ -28,10 +28,11 @@ in # general cli utils almanac libnotify grim slurp (zbar.override { enableVideo = false; withXorg = false; }) wl-clipboard showrt - kijetesantakaluotokieni mpc_cli dufs progress hledger + kijetesantakaluotokieni mpc dufs progress hledger wineWowPackages.full sops xdg-utils exiftool - mercurial darcs git-annex-remote-remarkable2 git-who + mercurial darcs git-annex-remote-remarkable2 # git-who rlwrap + inputs.ocaml-forester.legacyPackages.${system}.forester # graphical utils kitty # gnss things @@ -48,7 +49,7 @@ in # other functional things racket dhall dune_2 ocamlPackages.utop ocamlPackages.ocp-indent ocamlPackages.merlin ocaml gauche - (agda.withPackages (p: [ p.standard-library p.cubical ])) + (agda.withPackages (p: [ p.standard-library p.cubical p.agda-categories ])) # html, js & co jq ijq html-tidy nodePackages.stylelint nodePackages.js-beautify zola @@ -64,7 +65,8 @@ in # nix things npins nix-output-monitor direnv # isabelle - (isabelle.mkEnv "isabelle-env" "fish") isabat + # (isabelle.mkEnv "isabelle-env" "fish") + isabat isabelle-utils (import inputs.traveltext { inherit pkgs; }) ]; @@ -60,10 +60,35 @@ let sops-nix = import "${sources.sops-nix}/modules/sops"; - simple-nixos-mailserver = import sources.simple-nixos-mailserver; + nixos-mailserver = import sources.nixos-mailserver; 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..3a74c0a 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": "aa8519ec107d7cfa29b03005c9176708e1269965", + "url": "https://github.com/ai-robots-txt/ai.robots.txt/archive/aa8519ec107d7cfa29b03005c9176708e1269965.tar.gz", + "hash": "01injirgqzzhd7sqarhlf54b994b70c7f8g88xrkqsy4gs0vzx9v" }, "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": "83031c010be0ed73f45ba5975d16cb05a1638ff1", "url": null, - "hash": "137wq0hj9j4wikq401mz577a7r5cmfzfxyf4wv1ncxy450l4lrsh" + "hash": "19kfjrndg5xvspwqljgsiyadi4fjnq99zfpr9k6bnx3z2g2m1rk8" }, "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" @@ -89,10 +112,11 @@ "owner": "nix-community", "repo": "home-manager" }, - "branch": "release-25.05", - "revision": "83665c39fa688bd6a1f7c43cf7997a70f6a109f9", - "url": "https://github.com/nix-community/home-manager/archive/83665c39fa688bd6a1f7c43cf7997a70f6a109f9.tar.gz", - "hash": "06kpj2mgfd3b0sip93k12ls00vn48ghxn3xg8705cfyn321m380r" + "branch": "release-25.11", + "submodules": false, + "revision": "0d782ee42c86b196acff08acfbf41bb7d13eed5b", + "url": "https://github.com/nix-community/home-manager/archive/0d782ee42c86b196acff08acfbf41bb7d13eed5b.tar.gz", + "hash": "1kqxy6r4ahnbazmpa4pncdp62najdikdaw8hvrv8nl6qxvbmf9fy" }, "isabelle-utils": { "type": "Git", @@ -101,9 +125,10 @@ "url": "https://stuebinm.eu/git/isabelle-utils" }, "branch": "master", - "revision": "e7427d5c67c0a90c369adecb4b0c65c043cb2e34", + "submodules": false, + "revision": "a44e60333135d9c10b1a0579693ea4c7a655fb05", "url": null, - "hash": "129pizyyvxg7lzgk9pqn48a7brhyh5fv7vwzrs7wnhkp30hrpjq2" + "hash": "1rksv96izbzcpg74lbix9lw3rxjcy1hs1f4kd8xf4nzclq439931" }, "lix": { "type": "Git", @@ -112,9 +137,10 @@ "url": "https://git.lix.systems/lix-project/lix.git" }, "branch": "main", - "revision": "8525345fd192a552e777bd37689154ad8e05b3e0", + "submodules": false, + "revision": "95ac829cf361035d8d8ee46eb3540d21f7bac842", "url": null, - "hash": "1pfzczc7kd7sr3w3igfh3fp8mlf7p5sg0lwa84hwkpsahss2lkas" + "hash": "0ncnlyyhbrk24xvjzv3wlab50qx3pqqfsrp06a5088rq355kpilc" }, "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": "1688100bba140492658d597f6b307c327f35c780", "url": null, - "hash": "1yv1d45jgfzjxcg23m2qwis5rxx2v45vfid8b0lm1sl6p66h4hpc" + "hash": "0pyzj0rdq62fz2i06ldwf9ridp195p6vvsp8yb1pii8h2q81v9lp" + }, + "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", @@ -134,10 +174,11 @@ "repo_path": "simple-nixos-mailserver/nixos-mailserver", "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" + "branch": "nixos-25.11", + "submodules": false, + "revision": "23f0a53ca6e58e61e1ea2b86791c69b79c91656d", + "url": "https://gitlab.com/api/v4/projects/simple-nixos-mailserver%2Fnixos-mailserver/repository/archive.tar.gz?sha=23f0a53ca6e58e61e1ea2b86791c69b79c91656d", + "hash": "0pqc7bay9v360x2b7irqaz4ly63gp4z859cgg5c04imknv0pwjqw" }, "nixpkgs": { "type": "Git", @@ -146,10 +187,11 @@ "owner": "NixOS", "repo": "nixpkgs" }, - "branch": "nixos-25.05", - "revision": "7c43f080a7f28b2774f3b3f43234ca11661bf334", - "url": "https://github.com/NixOS/nixpkgs/archive/7c43f080a7f28b2774f3b3f43234ca11661bf334.tar.gz", - "hash": "0bxirhx43mw728lkvbdc6yg0s51islfkqgihdvnzvi0klr23d9xf" + "branch": "nixos-25.11", + "submodules": false, + "revision": "23d72dabcb3b12469f57b37170fcbc1789bd7457", + "url": "https://github.com/NixOS/nixpkgs/archive/23d72dabcb3b12469f57b37170fcbc1789bd7457.tar.gz", + "hash": "0dhpsdghgajfkbq8d00p9x4nbnzgl4wmkz7h77zvgc3h40ylk4yg" }, "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": "fef9403a3e4d31b0a23f0bacebbec52c248fbb51", + "url": "https://github.com/NixOS/nixpkgs/archive/fef9403a3e4d31b0a23f0bacebbec52c248fbb51.tar.gz", + "hash": "1fzknmnvbfj8bxkw7bqcyjvxy3v2vz11vkp3r8nwihmrf6wnlpd4" }, "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": "1f373ef8c4cc1237a74c681b47bbdbdf7ab185a6", + "url": "https://github.com/tweag/opam-nix/archive/1f373ef8c4cc1237a74c681b47bbdbdf7ab185a6.tar.gz", + "hash": "1n1xzxrzypxr7wr3ij0yf13fsrx6xac9jd3m06pk4d2icpq0lmrv" + }, + "opam-overlays": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "dune-universe", + "repo": "opam-overlays" + }, + "branch": "master", + "submodules": false, + "revision": "12731a6f86d7c452a94c72106fa9d3327988582d", + "url": "https://github.com/dune-universe/opam-overlays/archive/12731a6f86d7c452a94c72106fa9d3327988582d.tar.gz", + "hash": "0zhgcn5j5aygxqkzsfdsfafw17pr9f2fcs7175kiwyrfj2wzsdmn" + }, + "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": "11a396520bf911e4ed01e78e11633d3fc63b350e", + "url": "https://github.com/oxalica/rust-overlay/archive/11a396520bf911e4ed01e78e11633d3fc63b350e.tar.gz", + "hash": "1wxy14xdw29z144vmp90iai8k5zq3ppq5p1bvbvnnbbg9kx5z4mf" }, "showrt": { "type": "Git", @@ -204,22 +323,11 @@ "url": "https://stuebinm.eu/git/showrt" }, "branch": "main", + "submodules": false, "revision": "7de36af3c6ffcc25832a6ff2303ba6c4c1101de5", "url": null, "hash": "09shk9b3969gmbmh8mavgss6f90zb51rsfby5n1d924agxzl93d6" }, - "simple-nixos-mailserver": { - "type": "Git", - "repository": { - "type": "GitLab", - "repo_path": "simple-nixos-mailserver/nixos-mailserver", - "server": "https://gitlab.com/" - }, - "branch": "nixos-24.05", - "revision": "636b82f4175e3f6b1e80d2189bb0469e2ae01a55", - "url": "https://gitlab.com/api/v4/projects/simple-nixos-mailserver%2Fnixos-mailserver/repository/archive.tar.gz?sha=636b82f4175e3f6b1e80d2189bb0469e2ae01a55", - "hash": "08zdidja5kdqgskynxsmcd8skh1b7cfl9ijjy9pak4b5h3aw2iqv" - }, "sops-nix": { "type": "Git", "repository": { @@ -228,9 +336,10 @@ "repo": "sops-nix" }, "branch": "master", - "revision": "8d215e1c981be3aa37e47aeabd4e61bb069548fd", - "url": "https://github.com/Mic92/sops-nix/archive/8d215e1c981be3aa37e47aeabd4e61bb069548fd.tar.gz", - "hash": "1jkkjrzz9zmhfkc31v1lsslg8p62r7sjrj4z13c2ghhmdmgfa1ll" + "submodules": false, + "revision": "d6e0e666048a5395d6ea4283143b7c9ac704720d", + "url": "https://github.com/Mic92/sops-nix/archive/d6e0e666048a5395d6ea4283143b7c9ac704720d.tar.gz", + "hash": "0f2l5w6af84skfmy051s5727n2wc3bq2fvdjf34jkliyi7jdgfy5" }, "traveltext": { "type": "Git", @@ -239,6 +348,7 @@ "url": "https://stuebinm.eu/git/traveltext" }, "branch": "main", + "submodules": false, "revision": "d876202506621eb76012c12cbb0e91fd2bb0ada0", "url": null, "hash": "0886l3r4fnnd6pc699n9l7kzh1y00y6bbdalab90gjqccviwv9cd" @@ -250,10 +360,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/default.nix b/pkgs/default.nix index 9e4b3b4..ce35fc2 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -7,7 +7,7 @@ travelynx crs-tracker crs-php bahnhof-name matrix-to hikari_unstable heartwood radicle-interface radicle-tui inweb nomsring bookwyrm mollysocket git-annex-remote-remarkable2 - ntfy-matrix-bot transport_validator mergiraf git-who; + ntfy-matrix-bot transport_validator mergiraf git-who plover plover-dev; pkgs = nixpkgs; } diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix index e981f8f..f76496e 100644 --- a/pkgs/overlay.nix +++ b/pkgs/overlay.nix @@ -26,6 +26,27 @@ in cargoLock.lockFile = "${src.outPath}/Cargo.lock"; }) { }; + + #### taken from nixpkgs PRs + + + plover = self.python3Packages.callPackage ./plover/plover.nix { + inherit (self.libsForQt5) wrapQtAppsHook; + pyqt = self.python3Packages.pyqt5; + }; + + plover-dev = self.python3Packages.callPackage ./plover/plover-dev.nix { + inherit (self.qt6) wrapQtAppsHook qtbase; + pyqt = self.python3Packages.pyside6; + }; + + plover-stroke = self.python3Packages.callPackage ./plover/plover-stroke.nix { }; + + + rtf-tokenize = self.python3Packages.callPackage ./plover/rtf_tokenize.nix { }; + + + #### packages which are actually in use somewhere #### galmon-core = self.callPackage ./galmon.nix {}; @@ -53,39 +74,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"; @@ -198,10 +186,56 @@ in overrides = self': super': with self.haskell.lib; { fuzzyfind = unmarkBroken (doJailbreak super'.fuzzyfind); fuzzyset = unmarkBroken (doJailbreak super'.fuzzyset); + rustls = self.haskellPackages.callPackage + ({ mkDerivation, async, base, bytestring, containers + , derive-storable, directory, filepath, hedgehog, lib, mtl, network + , process, resourcet, stm, tasty, tasty-hedgehog + , tasty-hunit, temporary, text, transformers + }: + mkDerivation { + pname = "rustls"; + version = "0.2.2.0"; + sha256 = "3c610437b4fb8b6ae86e6d3bebca8c15631b0d793d925ab5eeebb88b8ac77371"; + libraryHaskellDepends = [ + base bytestring containers derive-storable mtl network resourcet + text transformers + ]; + libraryPkgconfigDepends = [ self.rustls-ffi ]; + testHaskellDepends = [ + async base bytestring containers directory filepath hedgehog + process resourcet stm tasty tasty-hedgehog tasty-hunit temporary + text transformers + ]; + homepage = "https://github.com/amesgen/hs-rustls/tree/main/rustls"; + description = "TLS bindings for Rustls"; + license = lib.licenses.cc0; + doCheck = false; + }) {}; + http-client-rustls = self'.callPackage + ({ mkDerivation, base, bytestring, directory, filepath, http-client + , http-types, lib, network, port-utils, process, resourcet, rustls + , tasty, tasty-hunit, temporary, text + }: + mkDerivation { + pname = "http-client-rustls"; + version = "0.0.2.0"; + sha256 = "05505bf77e3d967b01187ffb55ea6c3f658ba446aeffeccdac16cbb6960d940d"; + libraryHaskellDepends = [ + base bytestring http-client network resourcet rustls text + ]; + testHaskellDepends = [ + base bytestring directory filepath http-client http-types network + port-utils process rustls tasty tasty-hunit temporary + ]; + homepage = "https://github.com/amesgen/hs-rustls/tree/main/http-client-rustls"; + description = "http-client TLS backend using Rustls"; + license = lib.licenses.cc0; + doCheck = false; + }) {}; }; }); pkg = { mkDerivation, base, bytestring, cassava, containers - , fuzzyfind, fuzzyset, http-client, http-client-openssl, http-types + , fuzzyfind, fuzzyset, http-client, http-client-rustls, http-types , lib, stm, text, time, vector, wai, wai-extra, warp }: mkDerivation { @@ -212,7 +246,7 @@ in isExecutable = true; executableHaskellDepends = [ base bytestring cassava containers fuzzyfind fuzzyset http-client - http-client-openssl http-types stm text time vector wai wai-extra + http-client-rustls http-types stm text time vector wai wai-extra warp ]; jailbreak = true; @@ -255,7 +289,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 +315,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 {}; diff --git a/pkgs/plover/default.nix b/pkgs/plover/default.nix new file mode 100644 index 0000000..865d469 --- /dev/null +++ b/pkgs/plover/default.nix @@ -0,0 +1,5 @@ +{ config, lib, pkgs, ... }: + +{ + +} diff --git a/pkgs/plover/plover-dev.nix b/pkgs/plover/plover-dev.nix new file mode 100644 index 0000000..c39ee14 --- /dev/null +++ b/pkgs/plover/plover-dev.nix @@ -0,0 +1,73 @@ +{ + lib, + fetchFromGitHub, + writeShellScriptBin, + plover, + python3Packages, + pkginfo, + packaging, + psutil, + pygments, + readme-renderer, + requests-cache, + requests-futures, + # Qt + pyqt, + qtbase, + wrapQtAppsHook, +}: + +(plover.override { + inherit wrapQtAppsHook pyqt; +}).overridePythonAttrs + (oldAttrs: rec { + version = "5.0.0.dev2"; + + src = fetchFromGitHub { + owner = "openstenoproject"; + repo = "plover"; + tag = "v${version}"; + hash = "sha256-PZwxVrdQPhgbj+YmWZIUETngeJGs6IQty0hY43tLQO0="; + }; + + pyproject = true; + + # pythonRelaxDeps seemingly doesn't work here + postPatch = oldAttrs.postPatch + '' + sed -i /PySide6-Essentials/d pyproject.toml + + substituteInPlace pyproject.toml \ + --replace-fail "setuptools>=79.0.0" "setuptools" + ''; + + build-system = oldAttrs.build-system ++ [ + # Replacement for missing pyside6-essentials tools, + # workaround for https://github.com/NixOS/nixpkgs/issues/277849. + # Ideally this would be solved in pyside6 itself but I spent four + # hours trying to untangle its build system before giving up. If + # anyone wants to spend the time fixing it feel free to request + # me (@Pandapip1) as a reviewer. + (writeShellScriptBin "pyside6-uic" '' + exec ${qtbase}/libexec/uic -g python "$@" + '') + (writeShellScriptBin "pyside6-rcc" '' + exec ${qtbase}/libexec/rcc -g python "$@" + '') + ]; + + dependencies = + oldAttrs.dependencies + ++ [ + packaging + pkginfo + psutil + pygments + qtbase + readme-renderer + requests-cache + requests-futures + ] + ++ readme-renderer.optional-dependencies.md; + + meta.description = oldAttrs.meta.description + " (Development version)"; + }) diff --git a/pkgs/plover/plover-stroke.nix b/pkgs/plover/plover-stroke.nix new file mode 100644 index 0000000..62da352 --- /dev/null +++ b/pkgs/plover/plover-stroke.nix @@ -0,0 +1,39 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + pytestCheckHook, + pytest-qt, + pyside6, +}: + +buildPythonPackage rec { + pname = "plover-stroke"; + version = "1.1.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "openstenoproject"; + repo = "plover_stroke"; + tag = version; + hash = "sha256-A75OMzmEn0VmDAvmQCp6/7uptxzwWJTwsih3kWlYioA="; + }; + + build-system = [ setuptools ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-qt + pyside6 + ]; + + pythonImportsCheck = [ "plover_stroke" ]; + + meta = { + description = "Helper class for working with steno strokes"; + homepage = "https://github.com/openstenoproject/plover_stroke"; + license = lib.licenses.gpl2Plus; # https://github.com/openstenoproject/plover_stroke/issues/4 + maintainers = with lib.maintainers; [ pandapip1 ]; + }; +} diff --git a/pkgs/plover/plover.nix b/pkgs/plover/plover.nix new file mode 100644 index 0000000..17c106c --- /dev/null +++ b/pkgs/plover/plover.nix @@ -0,0 +1,96 @@ +{ + lib, + config, + stdenv, + plover, + buildPythonPackage, + fetchFromGitHub, + fetchpatch, + versionCheckHook, + appdirs, + babel, + evdev, + mock, + pyserial, + pytestCheckHook, + pytest-qt, + plover-stroke, + rtf-tokenize, + setuptools, + wcwidth, + wheel, + xlib, + # Qt dependencies + pyqt, + wrapQtAppsHook, +}: + +buildPythonPackage rec { + pname = "plover"; + version = "4.0.2"; + pyproject = true; + + src = fetchFromGitHub { + owner = "openstenoproject"; + repo = "plover"; + tag = "v${version}"; + hash = "sha256-VpQT25bl8yPG4J9IwLkhSkBt31Y8BgPJdwa88WlreA8="; + }; + + postPatch = '' + sed -i 's/,<77//g' pyproject.toml # pythonRelaxDepsHook doesn't work for this for some reason + ''; + + build-system = [ + babel + setuptools + pyqt + wheel + ]; + dependencies = [ + appdirs + evdev + pyqt + pyserial + plover-stroke + rtf-tokenize + setuptools + wcwidth + xlib + ]; + nativeBuildInputs = [ + wrapQtAppsHook + ]; + + nativeCheckInputs = [ + pytestCheckHook + versionCheckHook + pytest-qt + mock + ]; + + # Segfaults?! + disabledTestPaths = [ "test/gui_qt/test_dictionaries_widget.py" ]; + + preFixup = '' + makeWrapperArgs+=("''${qtWrapperArgs[@]}") + ''; + + dontWrapQtApps = true; + + pythonImportsCheck = [ "plover" ]; + + meta = { + description = "OpenSteno Plover stenography software"; + homepage = "https://www.openstenoproject.org/plover/"; + mainProgram = "plover"; + maintainers = with lib.maintainers; [ + twey + kovirobi + pandapip1 + ]; + license = lib.licenses.gpl2Plus; + platforms = lib.platforms.unix; + broken = stdenv.hostPlatform.isDarwin; + }; +} diff --git a/pkgs/plover/rtf_tokenize.nix b/pkgs/plover/rtf_tokenize.nix new file mode 100644 index 0000000..805845f --- /dev/null +++ b/pkgs/plover/rtf_tokenize.nix @@ -0,0 +1,33 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "rtf-tokenize"; + version = "1.0.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "openstenoproject"; + repo = "rtf_tokenize"; + tag = version; + hash = "sha256-zwD2sRYTY1Kmm/Ag2hps9VRdUyQoi4zKtDPR+F52t9A="; + }; + + build-system = [ setuptools ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + pythonImportsCheck = [ "rtf_tokenize" ]; + + meta = { + description = "Simple RTF tokenizer package for Python"; + homepage = "https://github.com/openstenoproject/rtf_tokenize"; + license = lib.licenses.gpl2Plus; # https://github.com/openstenoproject/rtf_tokenize/issues/1 + maintainers = with lib.maintainers; [ pandapip1 ]; + }; +} |
