From f18943de293cacfb4f0362f92ab6c4b0463d8057 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 11 Jan 2022 21:08:03 +0100 Subject: tv stardict: import from niveum 2aa19c2 --- tv/2configs/stardict.nix | 265 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 tv/2configs/stardict.nix diff --git a/tv/2configs/stardict.nix b/tv/2configs/stardict.nix new file mode 100644 index 00000000..be63b2fb --- /dev/null +++ b/tv/2configs/stardict.nix @@ -0,0 +1,265 @@ +{ config, pkgs, lib, ... }: +let + classicsDictionaries = { + Pape = pkgs.fetchzip { + url = "http://tovotu.de/data/stardict/pape_gr-de.zip"; + sha256 = "1kmbdjqinrcxkc6jdyyrq5rl2wzhnrychyynnh91yhrjwjxlh44k"; + }; + Woodhouse = pkgs.fetchzip { + url = "https://c.krebsco.de/Woodhouse.zip"; + sha256 = "1dvnc2679yb048q2f3hr2h34acvhan0n3iir6h9ajlrdzz48mlkq"; + stripRoot = false; + }; + LSJ = pkgs.fetchzip { + url = "https://github.com/nikita-moor/latin-dictionary/releases/download/2020-02-14/LiddellScott1940-stardict.zip"; + sha256 = "13rprgd9jvnhxk9735c91xr6ywr0j5jiwkjnpm3qpvy93isyjbys"; + }; + GreekMorphology = pkgs.fetchzip { + url = "https://github.com/latin-dict/Morphologia-Graeca/releases/download/v0.5/morphology-mobile-goldendict.oxia.zip"; + sha256 = "0m75cppjjjmvv18cs7yh9f4p7ckqzxfznnndgkiw3yrfd50k8p96"; + }; + Frisk = pkgs.fetchzip { + url = "https://github.com/latin-dict/Frisk1960/releases/download/v1.1/Frisk1960-stardict.zip"; + sha256 = "1rk5a3n3fpfdcmg4bc5945m88s6ldxql8cjn4jqs33rgklh7n046"; + }; + Georges-De-Lat = pkgs.fetchzip { + url = "http://tovotu.de/data/stardict/georges_de-lat.zip"; + sha256 = "1gx4vv64bi9lxw2zgd861j469jvw4f2hhfwy1gglb12id8r7rdrl"; + }; + Georges-Lat-De = pkgs.fetchzip { # TODO find out why this does not work with sdcv + url = "http://tovotu.de/data/stardict/georges_lat-de.zip"; + sha256 = "0cc5xipn60anxvq8z2mw53d4gi1k92wbrj9m4ws3g9rh87fmkvgz"; + }; + LewisShort = pkgs.fetchzip { + url = "https://github.com/latin-dict/LewisShort1879/releases/download/v1.3/LewisShort1879-stardict.zip"; + sha256 = "1y3ans47iv8bzzb1paimdqvcid8ms04ikjbqy3iw077i2js3qbjk"; + }; + DoederleinSynonymes = pkgs.fetchzip { + url = "https://github.com/latin-dict/Doederlein1874/releases/download/v1.1/Doederlein1875-stardict.zip"; + sha256 = "0mhik7gjxl8ncr9g5z2l4pfk60k1c5n0gc1w0cnp2x1v6lqvb57h"; + }; + }; + + englishGermanDictionaries = { + Etymonline = pkgs.fetchzip { + url = "http://tovotu.de/data/stardict/etymonline.zip"; + sha256 = "1bjja3n3layfd08xa1r0a6375dxh5zi6hlv7chkhgnx800cx7hxn"; + }; + Roget = builtins.fetchTarball { + url = "http://download.huzheng.org/bigdict/stardict-Roget_s_II_The_New_Thesaurus_3th_Ed-2.4.2.tar.bz2"; + sha256 = "1szyny9497bpyyccf9l5kr3bnw0wvl4cnsd0n1zscxpyzlsrqqbz"; + }; + JargonFile = builtins.fetchTarball { + url = "http://download.huzheng.org/dict.org/stardict-dictd-jargon-2.4.2.tar.bz2"; + sha256 = "096phar9qpmm0fnaqv5nz8x9lpxwnfj78g4vjfcfyd7kqp7iqla4"; + }; + Oxford-Collocations = builtins.fetchTarball { + url = "http://download.huzheng.org/bigdict/stardict-Oxford_Collocations_Dictionary_2nd_Ed-2.4.2.tar.bz2"; + sha256 = "1zkfs0zxkcn21z2lhcabrs77v4ma9hpv7qm119hpyi1d8ajcw07q"; + }; + Langenscheidt-Deu-En = builtins.fetchTarball { + url = "http://download.huzheng.org/babylon/german/stardict-Handw_rterbuch_Deutsch_Englisc-2.4.2.tar.bz2"; + sha256 = "12q9i5azq7ylyrpb6jqbaf1rxalc3kzcwjvbinvb0yabdxb80y30"; + }; + Langenscheidt-En-Deu = builtins.fetchTarball { + url = "http://download.huzheng.org/babylon/german/stardict-Handw_rterbuch_Englisch_Deutsc-2.4.2.tar.bz2"; + sha256 = "087b05h155j5ldshfgx91pz81h6ijq2zaqjirg7ma8ig3l96zb59"; + }; + Duden_Das_Fremdworterbuch = builtins.fetchTarball { + url = "http://download.huzheng.org/babylon/german/stardict-Duden_Das_Fremdworterbuch-2.4.2.tar.bz2"; + sha256 = "1zrcay54ccl031s6dvjwsah5slhanmjab87d81rxlcy8fx0xd8wq"; + }; + Duden_De_De = builtins.fetchTarball { + url = "http://download.huzheng.org/babylon/german/stardict-Duden_De_De-2.4.2.tar.bz2"; + sha256 = "1fhay04w5aaj83axfmla2ql34nb60gb05dgv0k94ig7p8x4yxxlf"; + }; + ConciseOED = builtins.fetchTarball { + url = "http://download.huzheng.org/bigdict/stardict-Concise_Oxford_English_Dictionary-2.4.2.tar.bz2"; + sha256 = "19kpcxbhqzpmhi94mp48nalgmsh6s7rsx1gb4kwkhirp2pbjcyl7"; + }; + # Duden_Rechtschreibung = builtins.fetchTarball { + # url = "http://download.huzheng.org/babylon/german/stardict-Duden_Rechtschreibung-2.4.2.tar.bz2"; + # sha256 = "0xiprb45s88w62rn8rlbjrsagbiliay9hszsiy20glwabf6zsfji"; + # }; + Duden_Synonym = builtins.fetchTarball { + url = "http://download.huzheng.org/babylon/german/stardict-Duden_Synonym-2.4.2.tar.bz2"; + sha256 = "0cx086zvb86bmz7i8vnsch4cj4fb0cp165g4hig4982zakj6f2jd"; + }; + # Duden = builtins.fetchTarball { + # url = "http://download.huzheng.org/de/stardict-duden-2.4.2.tar.bz2"; + # sha256 = "049i4ynfqqxykv1nlkyks94mvn14s22qdax5gg7hx1ks5y4xw64j"; + # }; + # FreeOnlineDictionaryOfComputing = builtins.fetchTarball { + # url = "http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_foldoc-2.4.2.tar.bz2"; + # sha256 = "1lw2i8dzxpx929cpgvv0x366dnh4drr10wzqmrhcd0kvwglqawgm"; + # }; + }; + + sanskritDictionaries = { + BoehtlingkRoth = pkgs.fetchzip { + url = "https://c.krebsco.de/Bohtlingk-and-Roth-Grosses-Petersburger-Worterbuch.zip"; + sha256 = "13414a8rgd7hd5ffar6nl68nk3ys60wjkgb7m11hp0ahaasmf6ly"; + stripRoot = false; + }; + MonierWilliams = pkgs.fetchzip { + url = "https://c.krebsco.de/mw-cologne.zip"; + sha256 = "0p99ybxwxmmd94hf035hvm2hhnfy84av7qq79xf28bh2rbx6s9ng"; + stripRoot = false; + }; + MonierWilliamsEnglish = pkgs.fetchzip { + url = "https://c.krebsco.de/mw-english-sanskrit.zip"; + sha256 = "09a61hhii4b1m2fkrlh4rm2xnlgwrllh84iypbc6wyj00w9jkl3x"; + stripRoot = false; + }; + }; + makeStardictDataDir = dicts: pkgs.linkFarm "dictionaries" (lib.mapAttrsToList (name: path: { inherit name path; }) dicts); + + sdcvPager = pkgs.writeDash "sdcvPager" '' + export PATH=${lib.makeBinPath [pkgs.gnused pkgs.ncurses]} + sed " + s! style=\"color: #...\"!!g; + s!\([^<>]*\)!\1!g; + s!]*>!!g; + s!!!g; + s!\([^<>]*\)!\1 !g; + s!\([^<>]*\)!$(tput sitm)\2$(tput sgr0)!g; + s!\([^<>]*\)!\1!g; + s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0)!g; + s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0)!g; + s!]*>\([^<>]*\)!$(tput sitm)\1$(tput sgr0)!g; + s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0) !g; + s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0) !g; + s!\([^<>]*\)!$(tput setaf 3)\1$(tput sgr0)!g; + s!\([^<>]*\)!$(tput bold)\1$(tput sgr0)\t!g; + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!$(tput sitm)!g + s!]*>!$(tput sgr0)!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!!!g + s!]*>!$(tput setaf 245)!g + s!]*>!$(tput sgr0)!g + s/
/$(tput bold)/g; + s:
:$(tput sgr0):g; + s/
/\n/g; + s:
::g; + s/<[bB]>/$(tput bold)/g; + s::$(tput sgr0):g; + s:<[bB][rR]\s*/\?>:\n:g; + s:<[iI]>:$(tput sitm):g; + s::$(tput sgr0):g; + s:<[uU]>:$(tput smul):g; + s::$(tput sgr0):g; + s:]*>::g; + s:::g; + s!\([^<>]*\)!$(tput bold)\1$(tput sgr0)!g; + s!\([^<>]*\)!\2!g + s#
\(.*\)
#\\1#g; + s:\([^<>]*\):$(tput setaf 3)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 4)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 1)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 5)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput bold)\1$(tput sgr0):g + s:\([^<>]*\):$(tput setaf 3)\1$(tput sgr0):g + s:':':g + s:<:<:g + s:>:>:g + s:\([^<>]*\):$(tput setaf 2)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 2)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 4)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput bold)\\1$(tput sgr0):g; + s:]*>:ː:g; + s:]*>::g; + s!!!g + s!]*>!!g + s!!!g + s!]*>!!g + s!]*>!!g + s!\([^<>]*\)!$(tput setaf 245)\1$(tput sgr0)!g + s!]*>!!g + s! +! !g; + s!
!\n\n&!g + s!]*>!!g + s!]*>!!g + s!!!g # unbalanced in Frisk + s!^\s*[0-9])!$(tput setaf 5)&$(tput sgr0)!g + s#^\(-->.*\)\$#$(tput bold)\1$(tput sgr0)# + " + ''; +in +{ + # https://github.com/latin-dict/Georges1910/releases/download/v1.0/Georges1910-stardict.zip + # https://github.com/nikita-moor/latin-dictionary/releases/download/2020-02-14/LiddellScott1940-stardict.zip + # http://download.huzheng.org/bigdict/stardict-Cambridge_Dictionary_of_American_Idioms-2.4.2.tar.bz2 + # http://download.huzheng.org/bigdict/stardict-Concise_Oxford_Thesaurus_2nd_Ed-2.4.2.tar.bz2 + # http://download.huzheng.org/bigdict/stardict-Urban_Dictionary_P1-2.4.2.tar.bz2 + # http://download.huzheng.org/bigdict/stardict-Urban_Dictionary_P2-2.4.2.tar.bz2 + environment.etc.stardict.source = toString (makeStardictDataDir (classicsDictionaries // { + Crum = builtins.fetchTarball { + url = "http://download.huzheng.org/misc/stardict-Coptic-English_all_dialects-2.4.2.tar.bz2"; + sha256 = "1fi281mb9yzv40wjsdapi8fzpa7x2yscz582lv2qnss9g8zzzzr9"; + }; + LingvoGermanRussian = builtins.fetchTarball { + url = "http://download.huzheng.org/lingvo/stardict-GR-LingvoUniversal-2.4.2.tar.bz2"; + sha256 = "0p353gs2z4vj70hqsdhffjaaw3a4zlmcs46flipmf35lm5wmaj0g"; + }; + LingvoRussianGerman = builtins.fetchTarball { + url = "http://download.huzheng.org/lingvo/stardict-RG-LingvoUniversal-2.4.2.tar.bz2"; + sha256 = "03f9wdmkgpjifpms7dyh10ma29wf3ka1j3zlp1av0cybhdldk2a8"; + }; + SmithBiographyMythology = pkgs.fetchzip { + url = "https://github.com/latin-dict/Smith1873/releases/download/v1.0/Smith1873-stardict.zip"; + sha256 = "01h5fxacp2m60xir8kzslkfy772vs3vmz07zhdwfhcwdaxif2af2"; + }; + SmithAntiquities = pkgs.fetchzip { + url = "https://github.com/latin-dict/Smith1890/releases/download/v1.0/Smith1890-stardict.zip"; + sha256 = "0vpsv62p2lrzmgys4d1swpnc6lqhdi7rxwkj2ngy3lz5dk3fysyb"; + }; + OED1 = builtins.fetchTarball { + url = "http://download.huzheng.org/bigdict/stardict-Oxford_English_Dictionary_2nd_Ed._P1-2.4.2.tar.bz2"; + sha256 = "0i5vv1rv44yfwyf9bfbdrb9brzhhpvz2jnh39fv8hh107nkv2vcf"; + }; + OED2 = builtins.fetchTarball { + url = "http://download.huzheng.org/bigdict/stardict-Oxford_English_Dictionary_2nd_Ed._P2-2.4.2.tar.bz2"; + sha256 = "1pk234pbq4pk55d8sjk0pp9j5sajm82f8804kf2xm2x5p387q1rg"; + }; + } // sanskritDictionaries // englishGermanDictionaries)); + + environment.variables = { + SDCV_PAGER = toString sdcvPager; + }; + + home-manager.users.me = { + home.file.".goldendict/config".text = import { + path = "/etc/stardict"; + inherit pkgs; + }; + }; + + environment.systemPackages = [ + pkgs.goldendict + (pkgs.writers.writeDashBin "sd-classics" ''${pkgs.sdcv}/bin/sdcv --data-dir ${makeStardictDataDir classicsDictionaries} "$@"'') + (pkgs.writers.writeDashBin "sd-sanskrit" ''${pkgs.sdcv}/bin/sdcv --data-dir ${makeStardictDataDir sanskritDictionaries} "$@"'') + (pkgs.writers.writeDashBin "sd" ''${pkgs.sdcv}/bin/sdcv --data-dir ${makeStardictDataDir englishGermanDictionaries} "$@"'') + ]; +} -- cgit v1.2.3 From 987dc311b437b0f82afa05f8f58a6b64fc9f2666 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 11 Jan 2022 21:25:13 +0100 Subject: tv stardict: turn into pkg --- tv/2configs/stardict.nix | 265 ----------------------------------- tv/5pkgs/simple/stardict/default.nix | 225 +++++++++++++++++++++++++++++ 2 files changed, 225 insertions(+), 265 deletions(-) delete mode 100644 tv/2configs/stardict.nix create mode 100644 tv/5pkgs/simple/stardict/default.nix diff --git a/tv/2configs/stardict.nix b/tv/2configs/stardict.nix deleted file mode 100644 index be63b2fb..00000000 --- a/tv/2configs/stardict.nix +++ /dev/null @@ -1,265 +0,0 @@ -{ config, pkgs, lib, ... }: -let - classicsDictionaries = { - Pape = pkgs.fetchzip { - url = "http://tovotu.de/data/stardict/pape_gr-de.zip"; - sha256 = "1kmbdjqinrcxkc6jdyyrq5rl2wzhnrychyynnh91yhrjwjxlh44k"; - }; - Woodhouse = pkgs.fetchzip { - url = "https://c.krebsco.de/Woodhouse.zip"; - sha256 = "1dvnc2679yb048q2f3hr2h34acvhan0n3iir6h9ajlrdzz48mlkq"; - stripRoot = false; - }; - LSJ = pkgs.fetchzip { - url = "https://github.com/nikita-moor/latin-dictionary/releases/download/2020-02-14/LiddellScott1940-stardict.zip"; - sha256 = "13rprgd9jvnhxk9735c91xr6ywr0j5jiwkjnpm3qpvy93isyjbys"; - }; - GreekMorphology = pkgs.fetchzip { - url = "https://github.com/latin-dict/Morphologia-Graeca/releases/download/v0.5/morphology-mobile-goldendict.oxia.zip"; - sha256 = "0m75cppjjjmvv18cs7yh9f4p7ckqzxfznnndgkiw3yrfd50k8p96"; - }; - Frisk = pkgs.fetchzip { - url = "https://github.com/latin-dict/Frisk1960/releases/download/v1.1/Frisk1960-stardict.zip"; - sha256 = "1rk5a3n3fpfdcmg4bc5945m88s6ldxql8cjn4jqs33rgklh7n046"; - }; - Georges-De-Lat = pkgs.fetchzip { - url = "http://tovotu.de/data/stardict/georges_de-lat.zip"; - sha256 = "1gx4vv64bi9lxw2zgd861j469jvw4f2hhfwy1gglb12id8r7rdrl"; - }; - Georges-Lat-De = pkgs.fetchzip { # TODO find out why this does not work with sdcv - url = "http://tovotu.de/data/stardict/georges_lat-de.zip"; - sha256 = "0cc5xipn60anxvq8z2mw53d4gi1k92wbrj9m4ws3g9rh87fmkvgz"; - }; - LewisShort = pkgs.fetchzip { - url = "https://github.com/latin-dict/LewisShort1879/releases/download/v1.3/LewisShort1879-stardict.zip"; - sha256 = "1y3ans47iv8bzzb1paimdqvcid8ms04ikjbqy3iw077i2js3qbjk"; - }; - DoederleinSynonymes = pkgs.fetchzip { - url = "https://github.com/latin-dict/Doederlein1874/releases/download/v1.1/Doederlein1875-stardict.zip"; - sha256 = "0mhik7gjxl8ncr9g5z2l4pfk60k1c5n0gc1w0cnp2x1v6lqvb57h"; - }; - }; - - englishGermanDictionaries = { - Etymonline = pkgs.fetchzip { - url = "http://tovotu.de/data/stardict/etymonline.zip"; - sha256 = "1bjja3n3layfd08xa1r0a6375dxh5zi6hlv7chkhgnx800cx7hxn"; - }; - Roget = builtins.fetchTarball { - url = "http://download.huzheng.org/bigdict/stardict-Roget_s_II_The_New_Thesaurus_3th_Ed-2.4.2.tar.bz2"; - sha256 = "1szyny9497bpyyccf9l5kr3bnw0wvl4cnsd0n1zscxpyzlsrqqbz"; - }; - JargonFile = builtins.fetchTarball { - url = "http://download.huzheng.org/dict.org/stardict-dictd-jargon-2.4.2.tar.bz2"; - sha256 = "096phar9qpmm0fnaqv5nz8x9lpxwnfj78g4vjfcfyd7kqp7iqla4"; - }; - Oxford-Collocations = builtins.fetchTarball { - url = "http://download.huzheng.org/bigdict/stardict-Oxford_Collocations_Dictionary_2nd_Ed-2.4.2.tar.bz2"; - sha256 = "1zkfs0zxkcn21z2lhcabrs77v4ma9hpv7qm119hpyi1d8ajcw07q"; - }; - Langenscheidt-Deu-En = builtins.fetchTarball { - url = "http://download.huzheng.org/babylon/german/stardict-Handw_rterbuch_Deutsch_Englisc-2.4.2.tar.bz2"; - sha256 = "12q9i5azq7ylyrpb6jqbaf1rxalc3kzcwjvbinvb0yabdxb80y30"; - }; - Langenscheidt-En-Deu = builtins.fetchTarball { - url = "http://download.huzheng.org/babylon/german/stardict-Handw_rterbuch_Englisch_Deutsc-2.4.2.tar.bz2"; - sha256 = "087b05h155j5ldshfgx91pz81h6ijq2zaqjirg7ma8ig3l96zb59"; - }; - Duden_Das_Fremdworterbuch = builtins.fetchTarball { - url = "http://download.huzheng.org/babylon/german/stardict-Duden_Das_Fremdworterbuch-2.4.2.tar.bz2"; - sha256 = "1zrcay54ccl031s6dvjwsah5slhanmjab87d81rxlcy8fx0xd8wq"; - }; - Duden_De_De = builtins.fetchTarball { - url = "http://download.huzheng.org/babylon/german/stardict-Duden_De_De-2.4.2.tar.bz2"; - sha256 = "1fhay04w5aaj83axfmla2ql34nb60gb05dgv0k94ig7p8x4yxxlf"; - }; - ConciseOED = builtins.fetchTarball { - url = "http://download.huzheng.org/bigdict/stardict-Concise_Oxford_English_Dictionary-2.4.2.tar.bz2"; - sha256 = "19kpcxbhqzpmhi94mp48nalgmsh6s7rsx1gb4kwkhirp2pbjcyl7"; - }; - # Duden_Rechtschreibung = builtins.fetchTarball { - # url = "http://download.huzheng.org/babylon/german/stardict-Duden_Rechtschreibung-2.4.2.tar.bz2"; - # sha256 = "0xiprb45s88w62rn8rlbjrsagbiliay9hszsiy20glwabf6zsfji"; - # }; - Duden_Synonym = builtins.fetchTarball { - url = "http://download.huzheng.org/babylon/german/stardict-Duden_Synonym-2.4.2.tar.bz2"; - sha256 = "0cx086zvb86bmz7i8vnsch4cj4fb0cp165g4hig4982zakj6f2jd"; - }; - # Duden = builtins.fetchTarball { - # url = "http://download.huzheng.org/de/stardict-duden-2.4.2.tar.bz2"; - # sha256 = "049i4ynfqqxykv1nlkyks94mvn14s22qdax5gg7hx1ks5y4xw64j"; - # }; - # FreeOnlineDictionaryOfComputing = builtins.fetchTarball { - # url = "http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_foldoc-2.4.2.tar.bz2"; - # sha256 = "1lw2i8dzxpx929cpgvv0x366dnh4drr10wzqmrhcd0kvwglqawgm"; - # }; - }; - - sanskritDictionaries = { - BoehtlingkRoth = pkgs.fetchzip { - url = "https://c.krebsco.de/Bohtlingk-and-Roth-Grosses-Petersburger-Worterbuch.zip"; - sha256 = "13414a8rgd7hd5ffar6nl68nk3ys60wjkgb7m11hp0ahaasmf6ly"; - stripRoot = false; - }; - MonierWilliams = pkgs.fetchzip { - url = "https://c.krebsco.de/mw-cologne.zip"; - sha256 = "0p99ybxwxmmd94hf035hvm2hhnfy84av7qq79xf28bh2rbx6s9ng"; - stripRoot = false; - }; - MonierWilliamsEnglish = pkgs.fetchzip { - url = "https://c.krebsco.de/mw-english-sanskrit.zip"; - sha256 = "09a61hhii4b1m2fkrlh4rm2xnlgwrllh84iypbc6wyj00w9jkl3x"; - stripRoot = false; - }; - }; - makeStardictDataDir = dicts: pkgs.linkFarm "dictionaries" (lib.mapAttrsToList (name: path: { inherit name path; }) dicts); - - sdcvPager = pkgs.writeDash "sdcvPager" '' - export PATH=${lib.makeBinPath [pkgs.gnused pkgs.ncurses]} - sed " - s! style=\"color: #...\"!!g; - s!\([^<>]*\)!\1!g; - s!]*>!!g; - s!!!g; - s!\([^<>]*\)!\1 !g; - s!\([^<>]*\)!$(tput sitm)\2$(tput sgr0)!g; - s!\([^<>]*\)!\1!g; - s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0)!g; - s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0)!g; - s!]*>\([^<>]*\)!$(tput sitm)\1$(tput sgr0)!g; - s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0) !g; - s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0) !g; - s!\([^<>]*\)!$(tput setaf 3)\1$(tput sgr0)!g; - s!\([^<>]*\)!$(tput bold)\1$(tput sgr0)\t!g; - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!]*>!$(tput sitm)!g - s!]*>!$(tput sgr0)!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!!!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!]*>!!g - s!!!g - s!]*>!$(tput setaf 245)!g - s!]*>!$(tput sgr0)!g - s/
/$(tput bold)/g; - s:
:$(tput sgr0):g; - s/
/\n/g; - s:
::g; - s/<[bB]>/$(tput bold)/g; - s::$(tput sgr0):g; - s:<[bB][rR]\s*/\?>:\n:g; - s:<[iI]>:$(tput sitm):g; - s::$(tput sgr0):g; - s:<[uU]>:$(tput smul):g; - s::$(tput sgr0):g; - s:]*>::g; - s:::g; - s!\([^<>]*\)!$(tput bold)\1$(tput sgr0)!g; - s!\([^<>]*\)!\2!g - s#
\(.*\)
#\\1#g; - s:\([^<>]*\):$(tput setaf 3)\\1$(tput sgr0):g; - s:\([^<>]*\):$(tput setaf 4)\\1$(tput sgr0):g; - s:\([^<>]*\):$(tput setaf 1)\\1$(tput sgr0):g; - s:\([^<>]*\):$(tput setaf 5)\\1$(tput sgr0):g; - s:\([^<>]*\):$(tput bold)\1$(tput sgr0):g - s:\([^<>]*\):$(tput setaf 3)\1$(tput sgr0):g - s:':':g - s:<:<:g - s:>:>:g - s:\([^<>]*\):$(tput setaf 2)\\1$(tput sgr0):g; - s:\([^<>]*\):$(tput setaf 2)\\1$(tput sgr0):g; - s:\([^<>]*\):$(tput setaf 4)\\1$(tput sgr0):g; - s:\([^<>]*\):$(tput bold)\\1$(tput sgr0):g; - s:]*>:ː:g; - s:]*>::g; - s!!!g - s!]*>!!g - s!!!g - s!]*>!!g - s!]*>!!g - s!\([^<>]*\)!$(tput setaf 245)\1$(tput sgr0)!g - s!]*>!!g - s! +! !g; - s!
!\n\n&!g - s!]*>!!g - s!]*>!!g - s!!!g # unbalanced in Frisk - s!^\s*[0-9])!$(tput setaf 5)&$(tput sgr0)!g - s#^\(-->.*\)\$#$(tput bold)\1$(tput sgr0)# - " - ''; -in -{ - # https://github.com/latin-dict/Georges1910/releases/download/v1.0/Georges1910-stardict.zip - # https://github.com/nikita-moor/latin-dictionary/releases/download/2020-02-14/LiddellScott1940-stardict.zip - # http://download.huzheng.org/bigdict/stardict-Cambridge_Dictionary_of_American_Idioms-2.4.2.tar.bz2 - # http://download.huzheng.org/bigdict/stardict-Concise_Oxford_Thesaurus_2nd_Ed-2.4.2.tar.bz2 - # http://download.huzheng.org/bigdict/stardict-Urban_Dictionary_P1-2.4.2.tar.bz2 - # http://download.huzheng.org/bigdict/stardict-Urban_Dictionary_P2-2.4.2.tar.bz2 - environment.etc.stardict.source = toString (makeStardictDataDir (classicsDictionaries // { - Crum = builtins.fetchTarball { - url = "http://download.huzheng.org/misc/stardict-Coptic-English_all_dialects-2.4.2.tar.bz2"; - sha256 = "1fi281mb9yzv40wjsdapi8fzpa7x2yscz582lv2qnss9g8zzzzr9"; - }; - LingvoGermanRussian = builtins.fetchTarball { - url = "http://download.huzheng.org/lingvo/stardict-GR-LingvoUniversal-2.4.2.tar.bz2"; - sha256 = "0p353gs2z4vj70hqsdhffjaaw3a4zlmcs46flipmf35lm5wmaj0g"; - }; - LingvoRussianGerman = builtins.fetchTarball { - url = "http://download.huzheng.org/lingvo/stardict-RG-LingvoUniversal-2.4.2.tar.bz2"; - sha256 = "03f9wdmkgpjifpms7dyh10ma29wf3ka1j3zlp1av0cybhdldk2a8"; - }; - SmithBiographyMythology = pkgs.fetchzip { - url = "https://github.com/latin-dict/Smith1873/releases/download/v1.0/Smith1873-stardict.zip"; - sha256 = "01h5fxacp2m60xir8kzslkfy772vs3vmz07zhdwfhcwdaxif2af2"; - }; - SmithAntiquities = pkgs.fetchzip { - url = "https://github.com/latin-dict/Smith1890/releases/download/v1.0/Smith1890-stardict.zip"; - sha256 = "0vpsv62p2lrzmgys4d1swpnc6lqhdi7rxwkj2ngy3lz5dk3fysyb"; - }; - OED1 = builtins.fetchTarball { - url = "http://download.huzheng.org/bigdict/stardict-Oxford_English_Dictionary_2nd_Ed._P1-2.4.2.tar.bz2"; - sha256 = "0i5vv1rv44yfwyf9bfbdrb9brzhhpvz2jnh39fv8hh107nkv2vcf"; - }; - OED2 = builtins.fetchTarball { - url = "http://download.huzheng.org/bigdict/stardict-Oxford_English_Dictionary_2nd_Ed._P2-2.4.2.tar.bz2"; - sha256 = "1pk234pbq4pk55d8sjk0pp9j5sajm82f8804kf2xm2x5p387q1rg"; - }; - } // sanskritDictionaries // englishGermanDictionaries)); - - environment.variables = { - SDCV_PAGER = toString sdcvPager; - }; - - home-manager.users.me = { - home.file.".goldendict/config".text = import { - path = "/etc/stardict"; - inherit pkgs; - }; - }; - - environment.systemPackages = [ - pkgs.goldendict - (pkgs.writers.writeDashBin "sd-classics" ''${pkgs.sdcv}/bin/sdcv --data-dir ${makeStardictDataDir classicsDictionaries} "$@"'') - (pkgs.writers.writeDashBin "sd-sanskrit" ''${pkgs.sdcv}/bin/sdcv --data-dir ${makeStardictDataDir sanskritDictionaries} "$@"'') - (pkgs.writers.writeDashBin "sd" ''${pkgs.sdcv}/bin/sdcv --data-dir ${makeStardictDataDir englishGermanDictionaries} "$@"'') - ]; -} diff --git a/tv/5pkgs/simple/stardict/default.nix b/tv/5pkgs/simple/stardict/default.nix new file mode 100644 index 00000000..e835caed --- /dev/null +++ b/tv/5pkgs/simple/stardict/default.nix @@ -0,0 +1,225 @@ +{ lib, pkgs }: +let + classicsDictionaries = { + Pape = pkgs.fetchzip { + url = "http://tovotu.de/data/stardict/pape_gr-de.zip"; + sha256 = "1kmbdjqinrcxkc6jdyyrq5rl2wzhnrychyynnh91yhrjwjxlh44k"; + }; + Woodhouse = pkgs.fetchzip { + url = "https://c.krebsco.de/Woodhouse.zip"; + sha256 = "1dvnc2679yb048q2f3hr2h34acvhan0n3iir6h9ajlrdzz48mlkq"; + stripRoot = false; + }; + LSJ = pkgs.fetchzip { + url = "https://github.com/nikita-moor/latin-dictionary/releases/download/2020-02-14/LiddellScott1940-stardict.zip"; + sha256 = "13rprgd9jvnhxk9735c91xr6ywr0j5jiwkjnpm3qpvy93isyjbys"; + }; + GreekMorphology = pkgs.fetchzip { + url = "https://github.com/latin-dict/Morphologia-Graeca/releases/download/v0.5/morphology-mobile-goldendict.oxia.zip"; + sha256 = "0m75cppjjjmvv18cs7yh9f4p7ckqzxfznnndgkiw3yrfd50k8p96"; + }; + Frisk = pkgs.fetchzip { + url = "https://github.com/latin-dict/Frisk1960/releases/download/v1.1/Frisk1960-stardict.zip"; + sha256 = "1rk5a3n3fpfdcmg4bc5945m88s6ldxql8cjn4jqs33rgklh7n046"; + }; + Georges-De-Lat = pkgs.fetchzip { + url = "http://tovotu.de/data/stardict/georges_de-lat.zip"; + sha256 = "1gx4vv64bi9lxw2zgd861j469jvw4f2hhfwy1gglb12id8r7rdrl"; + }; + Georges-Lat-De = pkgs.fetchzip { # TODO find out why this does not work with sdcv + url = "http://tovotu.de/data/stardict/georges_lat-de.zip"; + sha256 = "0cc5xipn60anxvq8z2mw53d4gi1k92wbrj9m4ws3g9rh87fmkvgz"; + }; + LewisShort = pkgs.fetchzip { + url = "https://github.com/latin-dict/LewisShort1879/releases/download/v1.3/LewisShort1879-stardict.zip"; + sha256 = "1y3ans47iv8bzzb1paimdqvcid8ms04ikjbqy3iw077i2js3qbjk"; + }; + DoederleinSynonymes = pkgs.fetchzip { + url = "https://github.com/latin-dict/Doederlein1874/releases/download/v1.1/Doederlein1875-stardict.zip"; + sha256 = "0mhik7gjxl8ncr9g5z2l4pfk60k1c5n0gc1w0cnp2x1v6lqvb57h"; + }; + }; + + englishGermanDictionaries = { + Etymonline = pkgs.fetchzip { + url = "http://tovotu.de/data/stardict/etymonline.zip"; + sha256 = "1bjja3n3layfd08xa1r0a6375dxh5zi6hlv7chkhgnx800cx7hxn"; + }; + Roget = builtins.fetchTarball { + url = "http://download.huzheng.org/bigdict/stardict-Roget_s_II_The_New_Thesaurus_3th_Ed-2.4.2.tar.bz2"; + sha256 = "1szyny9497bpyyccf9l5kr3bnw0wvl4cnsd0n1zscxpyzlsrqqbz"; + }; + JargonFile = builtins.fetchTarball { + url = "http://download.huzheng.org/dict.org/stardict-dictd-jargon-2.4.2.tar.bz2"; + sha256 = "096phar9qpmm0fnaqv5nz8x9lpxwnfj78g4vjfcfyd7kqp7iqla4"; + }; + Oxford-Collocations = builtins.fetchTarball { + url = "http://download.huzheng.org/bigdict/stardict-Oxford_Collocations_Dictionary_2nd_Ed-2.4.2.tar.bz2"; + sha256 = "1zkfs0zxkcn21z2lhcabrs77v4ma9hpv7qm119hpyi1d8ajcw07q"; + }; + Langenscheidt-Deu-En = builtins.fetchTarball { + url = "http://download.huzheng.org/babylon/german/stardict-Handw_rterbuch_Deutsch_Englisc-2.4.2.tar.bz2"; + sha256 = "12q9i5azq7ylyrpb6jqbaf1rxalc3kzcwjvbinvb0yabdxb80y30"; + }; + Langenscheidt-En-Deu = builtins.fetchTarball { + url = "http://download.huzheng.org/babylon/german/stardict-Handw_rterbuch_Englisch_Deutsc-2.4.2.tar.bz2"; + sha256 = "087b05h155j5ldshfgx91pz81h6ijq2zaqjirg7ma8ig3l96zb59"; + }; + Duden_Das_Fremdworterbuch = builtins.fetchTarball { + url = "http://download.huzheng.org/babylon/german/stardict-Duden_Das_Fremdworterbuch-2.4.2.tar.bz2"; + sha256 = "1zrcay54ccl031s6dvjwsah5slhanmjab87d81rxlcy8fx0xd8wq"; + }; + Duden_De_De = builtins.fetchTarball { + url = "http://download.huzheng.org/babylon/german/stardict-Duden_De_De-2.4.2.tar.bz2"; + sha256 = "1fhay04w5aaj83axfmla2ql34nb60gb05dgv0k94ig7p8x4yxxlf"; + }; + ConciseOED = builtins.fetchTarball { + url = "http://download.huzheng.org/bigdict/stardict-Concise_Oxford_English_Dictionary-2.4.2.tar.bz2"; + sha256 = "19kpcxbhqzpmhi94mp48nalgmsh6s7rsx1gb4kwkhirp2pbjcyl7"; + }; + # Duden_Rechtschreibung = builtins.fetchTarball { + # url = "http://download.huzheng.org/babylon/german/stardict-Duden_Rechtschreibung-2.4.2.tar.bz2"; + # sha256 = "0xiprb45s88w62rn8rlbjrsagbiliay9hszsiy20glwabf6zsfji"; + # }; + Duden_Synonym = builtins.fetchTarball { + url = "http://download.huzheng.org/babylon/german/stardict-Duden_Synonym-2.4.2.tar.bz2"; + sha256 = "0cx086zvb86bmz7i8vnsch4cj4fb0cp165g4hig4982zakj6f2jd"; + }; + # Duden = builtins.fetchTarball { + # url = "http://download.huzheng.org/de/stardict-duden-2.4.2.tar.bz2"; + # sha256 = "049i4ynfqqxykv1nlkyks94mvn14s22qdax5gg7hx1ks5y4xw64j"; + # }; + # FreeOnlineDictionaryOfComputing = builtins.fetchTarball { + # url = "http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_foldoc-2.4.2.tar.bz2"; + # sha256 = "1lw2i8dzxpx929cpgvv0x366dnh4drr10wzqmrhcd0kvwglqawgm"; + # }; + }; + + sanskritDictionaries = { + BoehtlingkRoth = pkgs.fetchzip { + url = "https://c.krebsco.de/Bohtlingk-and-Roth-Grosses-Petersburger-Worterbuch.zip"; + sha256 = "13414a8rgd7hd5ffar6nl68nk3ys60wjkgb7m11hp0ahaasmf6ly"; + stripRoot = false; + }; + MonierWilliams = pkgs.fetchzip { + url = "https://c.krebsco.de/mw-cologne.zip"; + sha256 = "0p99ybxwxmmd94hf035hvm2hhnfy84av7qq79xf28bh2rbx6s9ng"; + stripRoot = false; + }; + MonierWilliamsEnglish = pkgs.fetchzip { + url = "https://c.krebsco.de/mw-english-sanskrit.zip"; + sha256 = "09a61hhii4b1m2fkrlh4rm2xnlgwrllh84iypbc6wyj00w9jkl3x"; + stripRoot = false; + }; + }; + makeStardictDataDir = dicts: pkgs.linkFarm "dictionaries" (lib.mapAttrsToList (name: path: { inherit name path; }) dicts); + + sdcvPager = pkgs.writeDash "sdcvPager" '' + export PATH=${lib.makeBinPath [pkgs.gnused pkgs.ncurses]} + sed " + s! style=\"color: #...\"!!g; + s!\([^<>]*\)!\1!g; + s!]*>!!g; + s!!!g; + s!\([^<>]*\)!\1 !g; + s!\([^<>]*\)!$(tput sitm)\2$(tput sgr0)!g; + s!\([^<>]*\)!\1!g; + s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0)!g; + s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0)!g; + s!]*>\([^<>]*\)!$(tput sitm)\1$(tput sgr0)!g; + s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0) !g; + s!\([^<>]*\)!$(tput sitm)\1$(tput sgr0) !g; + s!\([^<>]*\)!$(tput setaf 3)\1$(tput sgr0)!g; + s!\([^<>]*\)!$(tput bold)\1$(tput sgr0)\t!g; + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!$(tput sitm)!g + s!]*>!$(tput sgr0)!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!]*>!!g + s!!!g + s!]*>!$(tput setaf 245)!g + s!]*>!$(tput sgr0)!g + s/
/$(tput bold)/g; + s:
:$(tput sgr0):g; + s/
/\n/g; + s:
::g; + s/<[bB]>/$(tput bold)/g; + s::$(tput sgr0):g; + s:<[bB][rR]\s*/\?>:\n:g; + s:<[iI]>:$(tput sitm):g; + s::$(tput sgr0):g; + s:<[uU]>:$(tput smul):g; + s::$(tput sgr0):g; + s:]*>::g; + s:::g; + s!\([^<>]*\)!$(tput bold)\1$(tput sgr0)!g; + s!\([^<>]*\)!\2!g + s#
\(.*\)
#\\1#g; + s:\([^<>]*\):$(tput setaf 3)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 4)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 1)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 5)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput bold)\1$(tput sgr0):g + s:\([^<>]*\):$(tput setaf 3)\1$(tput sgr0):g + s:':':g + s:<:<:g + s:>:>:g + s:\([^<>]*\):$(tput setaf 2)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 2)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput setaf 4)\\1$(tput sgr0):g; + s:\([^<>]*\):$(tput bold)\\1$(tput sgr0):g; + s:]*>:ː:g; + s:]*>::g; + s!!!g + s!]*>!!g + s!!!g + s!]*>!!g + s!]*>!!g + s!\([^<>]*\)!$(tput setaf 245)\1$(tput sgr0)!g + s!]*>!!g + s! +! !g; + s!
!\n\n&!g + s!]*>!!g + s!]*>!!g + s!!!g # unbalanced in Frisk + s!^\s*[0-9])!$(tput setaf 5)&$(tput sgr0)!g + s#^\(-->.*\)\$#$(tput bold)\1$(tput sgr0)# + " + ''; + + mkDictBin = name: dicts: + pkgs.writers.writeDashBin name '' + set -efu + export SDCV_PAGER=${toString sdcvPager} + exec ${pkgs.sdcv}/bin/sdcv --data-dir ${makeStardictDataDir dicts} "$@" + ''; +in + +pkgs.symlinkJoin { + name = "stardict"; + paths = [ + (mkDictBin "sd-classics" classicsDictionaries) + (mkDictBin "sd-sanskrit" sanskritDictionaries) + (mkDictBin "sd" englishGermanDictionaries) + ]; +} -- cgit v1.2.3 From 43a3f5f69d9515527d484c8b417de625970e4fd2 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 11 Jan 2022 21:38:08 +0100 Subject: tv stardict: add swahili --- tv/5pkgs/simple/stardict/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tv/5pkgs/simple/stardict/default.nix b/tv/5pkgs/simple/stardict/default.nix index e835caed..2135cc05 100644 --- a/tv/5pkgs/simple/stardict/default.nix +++ b/tv/5pkgs/simple/stardict/default.nix @@ -112,6 +112,15 @@ let stripRoot = false; }; }; + + swahiliDictionaries = { + vickio = pkgs.fetchzip { + url = "http://swahili.vickio.net/files/Swahili-English.zip"; + sha256 = "0m6wkwc83fcim43ijn17lcsda4clkra587gxaz6m59qd0yfwzakw"; + stripRoot = false; + }; + }; + makeStardictDataDir = dicts: pkgs.linkFarm "dictionaries" (lib.mapAttrsToList (name: path: { inherit name path; }) dicts); sdcvPager = pkgs.writeDash "sdcvPager" '' @@ -220,6 +229,7 @@ pkgs.symlinkJoin { paths = [ (mkDictBin "sd-classics" classicsDictionaries) (mkDictBin "sd-sanskrit" sanskritDictionaries) + (mkDictBin "sd-swahili" swahiliDictionaries) (mkDictBin "sd" englishGermanDictionaries) ]; } -- cgit v1.2.3 From 6e8972efe65d0dc5246b368643f4969b33a10dc8 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 11 Jan 2022 22:20:21 +0100 Subject: tv xmonad: pactl -> amixer This reverts commit 08849bbb4e731a4b655fa2456bad6925e7a70e8d, kind of. --- tv/5pkgs/haskell/xmonad-tv/src/main.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tv/5pkgs/haskell/xmonad-tv/src/main.hs b/tv/5pkgs/haskell/xmonad-tv/src/main.hs index e720981a..cf0c0f53 100644 --- a/tv/5pkgs/haskell/xmonad-tv/src/main.hs +++ b/tv/5pkgs/haskell/xmonad-tv/src/main.hs @@ -205,12 +205,12 @@ myKeys conf = Map.fromList $ _4CM = _4 .|. _C .|. _M _4SM = _4 .|. _S .|. _M - pactl args = forkFile {-pkg:pulseaudio-}"pactl" args Nothing + amixer args = forkFile {-pkg:alsaUtils-}"amixer" args Nothing pavucontrol args = forkFile {-pkg-}"pavucontrol" args Nothing - audioLowerVolume = pactl ["--", "set-sink-volume", "@DEFAULT_SINK@", "-5%"] - audioRaiseVolume = pactl ["--", "set-sink-volume", "@DEFAULT_SINK@", "+5%"] - audioMute = pactl ["--", "set-sink-mute", "@DEFAULT_SINK@", "toggle"] + audioLowerVolume = amixer ["-q", "sset", "Master", "5%-"] + audioRaiseVolume = amixer ["-q", "sset", "Master", "5%+"] + audioMute = amixer ["-q", "sset", "Master", "toggle"] resetLayout = setLayout $ XMonad.layoutHook conf -- cgit v1.2.3 From 82ab279a8248b458c4360e333e1b588936267e0e Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 12 Jan 2022 14:56:56 +0100 Subject: tv xsessions: init --- tv/2configs/xsessions/default.nix | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tv/2configs/xsessions/default.nix diff --git a/tv/2configs/xsessions/default.nix b/tv/2configs/xsessions/default.nix new file mode 100644 index 00000000..f7e9be4a --- /dev/null +++ b/tv/2configs/xsessions/default.nix @@ -0,0 +1,4 @@ +{ + imports = [ + ]; +} -- cgit v1.2.3 From 2868b43e81ceb7fb6135659b90867bb8fc58ad0e Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 12 Jan 2022 14:57:08 +0100 Subject: tv xsessions: add user urxvtd socket and service --- tv/2configs/xsessions/default.nix | 1 + tv/2configs/xsessions/urxvtd.nix | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 tv/2configs/xsessions/urxvtd.nix diff --git a/tv/2configs/xsessions/default.nix b/tv/2configs/xsessions/default.nix index f7e9be4a..384c9c5e 100644 --- a/tv/2configs/xsessions/default.nix +++ b/tv/2configs/xsessions/default.nix @@ -1,4 +1,5 @@ { imports = [ + ./urxvtd.nix ]; } diff --git a/tv/2configs/xsessions/urxvtd.nix b/tv/2configs/xsessions/urxvtd.nix new file mode 100644 index 00000000..de16a634 --- /dev/null +++ b/tv/2configs/xsessions/urxvtd.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: { + systemd.user.sockets.urxvtd = { + wantedBy = [ "sockets.target" ]; + socketConfig.ListenStream = "%t/urxvtd"; + }; + systemd.user.services.urxvtd = { + restartIfChanged = false; + environment = { + RXVT_SOCKET = "%t/urxvtd"; + }; + serviceConfig = { + ExecStart = "${pkgs.rxvt_unicode}/bin/urxvtd"; + }; + }; +} -- cgit v1.2.3 From 47807e3ebcc9c1103ff8ec939062a48ba68b524c Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 12 Jan 2022 14:59:14 +0100 Subject: tv xu: use xsessions --- tv/1systems/xu/config.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/tv/1systems/xu/config.nix b/tv/1systems/xu/config.nix index 90d90ef3..05c5c11b 100644 --- a/tv/1systems/xu/config.nix +++ b/tv/1systems/xu/config.nix @@ -20,6 +20,7 @@ with import ; + { environment.systemPackages = with pkgs; [ -- cgit v1.2.3 From 33139d656369b74798bccb99360e72321fd6855e Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 12 Jan 2022 15:00:13 +0100 Subject: tv bu: use xsessions --- tv/1systems/bu/config.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/tv/1systems/bu/config.nix b/tv/1systems/bu/config.nix index 69c5848f..11cdac39 100644 --- a/tv/1systems/bu/config.nix +++ b/tv/1systems/bu/config.nix @@ -10,6 +10,7 @@ in { + ]; environment.homeBinInPath = true; -- cgit v1.2.3 From 61afd178952038883f40d3684d82754515221469 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 12 Jan 2022 15:01:14 +0100 Subject: tv au: use xsessions --- tv/1systems/au/config.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/tv/1systems/au/config.nix b/tv/1systems/au/config.nix index d9ba5391..2521059b 100644 --- a/tv/1systems/au/config.nix +++ b/tv/1systems/au/config.nix @@ -5,6 +5,7 @@ + ]; krebs.build.host = config.krebs.hosts.au; -- cgit v1.2.3 From c5c0caa4c12ca366f2afd00521d4d392a4b0d181 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 24 Jan 2022 19:10:19 +0100 Subject: tv: add org.freedesktop.machine1.host-shell --- tv/3modules/default.nix | 1 + .../org.freedesktop.machine1.host-shell.nix | 28 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tv/3modules/org.freedesktop.machine1.host-shell.nix diff --git a/tv/3modules/default.nix b/tv/3modules/default.nix index 9f2f8e60..b6b4faa5 100644 --- a/tv/3modules/default.nix +++ b/tv/3modules/default.nix @@ -8,6 +8,7 @@ ./hw.nix ./im.nix ./iptables.nix + ./org.freedesktop.machine1.host-shell.nix ./slock.nix ./x0vncserver.nix ./Xresources.nix diff --git a/tv/3modules/org.freedesktop.machine1.host-shell.nix b/tv/3modules/org.freedesktop.machine1.host-shell.nix new file mode 100644 index 00000000..e1a5323d --- /dev/null +++ b/tv/3modules/org.freedesktop.machine1.host-shell.nix @@ -0,0 +1,28 @@ +{ config, ... }: let lib = import ../../lib; in { + options.org.freedesktop.machine1.host-shell.access = lib.mkOption { + default = {}; + type = + lib.types.addCheck + (lib.types.attrsOf (lib.types.attrsOf lib.types.bool)) + (x: + lib.all + lib.types.username.check + (lib.concatLists + (lib.mapAttrsToList + (name: value: [name] ++ lib.attrNames value) + x))); + }; + config.security.polkit.extraConfig = let + cfg = config.org.freedesktop.machine1.host-shell; + enable = cfg.access != {}; + in lib.optionalString enable /* js */ '' + polkit.addRule(function () { + var access = ${lib.toJSON cfg.access}; + return function(action, subject) { + if (action.id === "org.freedesktop.machine1.host-shell" + && (access[subject.user]||{})[action.lookup("user")]) + return polkit.Result.YES; + } + }()); + ''; +} -- cgit v1.2.3 From f4e35a731286d9ce733e3b18ba7d284ada58f76e Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 26 Jan 2022 12:48:24 +0100 Subject: krebs.setuid: add support for capabilities --- krebs/3modules/setuid.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/krebs/3modules/setuid.nix b/krebs/3modules/setuid.nix index 64fedb91..6ad2f126 100644 --- a/krebs/3modules/setuid.nix +++ b/krebs/3modules/setuid.nix @@ -30,6 +30,10 @@ with import ; }; apply = toString; }; + capabilities = mkOption { + default = []; + type = types.listOf types.str; + }; owner = mkOption { default = "root"; type = types.enum (attrNames users); @@ -67,6 +71,9 @@ with import ; cp ${src} ${dst} chown ${cfg.owner}.${cfg.group} ${dst} chmod ${cfg.mode} ${dst} + ${optionalString (cfg.capabilities != []) /* sh */ '' + ${pkgs.libcap.out}/bin/setcap ${concatMapStringsSep "," shell.escape cfg.capabilities} ${dst} + ''} ''; })); }; -- cgit v1.2.3 From 10891882ab4787c958e3473d595a7f8ce9551dcf Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 27 Jan 2022 05:37:06 +0100 Subject: krebs.setuid: mark activate string as sh --- krebs/3modules/setuid.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/krebs/3modules/setuid.nix b/krebs/3modules/setuid.nix index 6ad2f126..11c5e9d7 100644 --- a/krebs/3modules/setuid.nix +++ b/krebs/3modules/setuid.nix @@ -66,7 +66,7 @@ with import ; inherit (cfg) envp filename; }; dst = "${cfg.wrapperDir}/${cfg.name}"; - in '' + in /* sh */ '' mkdir -p ${cfg.wrapperDir} cp ${src} ${dst} chown ${cfg.owner}.${cfg.group} ${dst} -- cgit v1.2.3 From ad6f0cd9014e13478a622786b9643970bae1c90a Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 27 Jan 2022 05:37:32 +0100 Subject: krebs.setuid: remove security.wrappers's cruft --- krebs/3modules/setuid.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/krebs/3modules/setuid.nix b/krebs/3modules/setuid.nix index 11c5e9d7..b141c7de 100644 --- a/krebs/3modules/setuid.nix +++ b/krebs/3modules/setuid.nix @@ -80,7 +80,12 @@ with import ; imp = { system.activationScripts."krebs.setuid" = stringAfter [ "wrappers" ] - (concatMapStringsSep "\n" (getAttr "activate") (attrValues config.krebs.setuid)); + (concatMapStringsSep "\n" + (cfg: /* sh */ '' + ${cfg.activate} + rm -f ${cfg.wrapperDir}/${cfg.name}.real + '') + (attrValues config.krebs.setuid)); }; in out -- cgit v1.2.3