├── .gitmodules ├── overlay.nix ├── pkgs ├── obs │ ├── looking-glass.nix │ ├── default.nix │ ├── shader-filter.nix │ ├── streamfx.nix │ ├── droidcam.nix │ ├── streamfx-cmake.patch │ ├── shader-filter-build.patch │ └── shader-filter-cmake.patch ├── public │ ├── bolin │ │ ├── default.nix │ │ └── bin.nix │ ├── ffr │ │ ├── default.nix │ │ └── r3-bin.nix │ ├── matrix │ │ ├── default.nix │ │ └── mx-puppet-discord │ │ │ ├── typescript.patch │ │ │ ├── generate.sh │ │ │ └── default.nix │ ├── pass │ │ ├── default.nix │ │ ├── meta.nix │ │ └── b2.nix │ ├── crates │ │ ├── cargo-call-stack-warnings.patch │ │ ├── cargo-binutils-path.patch │ │ ├── cargo-llvm-lines-features.patch │ │ ├── cargo-stack-sizes-warn.patch │ │ ├── cargo-stack-sizes-features.patch │ │ └── cargo-llvm-lines-fix-filter.patch │ ├── looking-glass │ │ ├── default.nix │ │ ├── host-windows.nix │ │ ├── client.nix │ │ ├── obs-installdir.patch │ │ ├── obs.nix │ │ ├── patches.nix │ │ └── host.nix │ ├── switch-lan-play.nix │ ├── linux │ │ ├── efifb-nobar.patch │ │ └── generate-config.patch │ ├── mdloader.nix │ ├── mdns-scan.nix │ ├── libjaylink.nix │ ├── lua-amalg.nix │ ├── zsh-completions-abduco.nix │ ├── yggdrasil-address.nix │ ├── edfbrowser │ │ ├── default.nix │ │ └── prefix.patch │ ├── konawall.nix │ ├── gst-rtsp-launch │ │ ├── default.nix │ │ └── cmake.patch │ ├── nvidia-vbios-vfio-patcher │ │ ├── default.nix │ │ └── rtx.patch │ ├── droid.nix │ ├── ryzen-smu │ │ └── ryzen-monitor-update.patch │ ├── github-label-sync │ │ └── default.nix │ ├── gst-jpegtrunc.nix │ ├── gst-protectbuffer.nix │ ├── weechat │ │ ├── urlgrab-homedir.patch │ │ ├── default.nix │ │ └── scripts.nix │ ├── i3gopher │ │ └── default.nix │ ├── paswitch.nix │ ├── nvflash.nix │ ├── glauth.nix │ ├── ddclient.nix │ ├── clip.nix │ ├── mufft.nix │ ├── default.nix │ ├── openocd-git.nix │ ├── wireplumber │ │ └── wireplumber.nix │ ├── nvidia-capture-sdk.nix │ └── firenvim-native.nix ├── urxvt │ ├── default.nix │ ├── xresources-256.nix │ └── osc-52.nix ├── python │ ├── default.nix │ ├── dht22-exporter.nix │ ├── adafruit-dht.nix │ └── pyopenssl-pyo3.patch ├── personal │ ├── i3workspaceoutput │ │ ├── default.nix │ │ └── i3workspaceoutput.sh │ ├── benc │ │ └── default.nix │ ├── winpath.nix │ ├── filebin │ │ ├── default.nix │ │ └── filebin.sh │ ├── default.nix │ ├── getquote-alphavantage.nix │ ├── openrazer-dpi.nix │ ├── emxc.nix │ └── task-blocks.nix ├── git │ ├── default.nix │ ├── git-fixup.nix │ ├── git-continue.nix │ ├── git-remote-s3.nix │ ├── git-annex-remote-b2 │ │ └── default.nix │ ├── hook-chain.nix │ └── hook-chain.sh ├── customized │ ├── mpd_clientlib-buffer.patch │ ├── ddclient-nodaemon.patch │ ├── mumble-pa-role.diff │ ├── luakit-nodoc.patch │ └── rnnoise-plugin.diff ├── zsh │ ├── vi-increment.nix │ ├── evil-registers.nix │ ├── vi-motions.nix │ ├── vi-quote.nix │ ├── ex-commands.nix │ ├── directory-marks.nix │ ├── default.nix │ ├── vim-mode.nix │ ├── git-completion.nix │ └── tab-title.nix ├── mpvScripts.nix ├── polybarScripts.nix ├── overrides.nix └── default.nix ├── .gitignore ├── overlays ├── lib.nix ├── packages.nix ├── arc.nix ├── overrides.nix ├── fetchurl.nix ├── shells.nix ├── python.nix └── default.nix ├── lib ├── overlay.nix ├── unmerged.nix ├── json.nix ├── from-yaml.nix ├── lua.nix ├── scope.nix ├── toml.nix ├── alsa.nix └── gst.nix ├── modules ├── default.nix ├── nixos │ ├── doc-warnings.nix │ ├── common-root.nix │ ├── systemd.nix │ ├── display.nix │ ├── home.nix │ ├── crypttab.nix │ ├── filebin.nix │ ├── cpuinfo.nix │ ├── polkit-systemd.nix │ ├── matrix-synapse-appservices.nix │ ├── mosh.nix │ ├── default.nix │ ├── dht22-exporter.nix │ ├── nix.nix │ ├── bindings.nix │ ├── modprobe.nix │ └── dsdt.nix ├── home │ ├── ncmpcpp.nix │ ├── xdg.nix │ ├── lorri.nix │ ├── less.nix │ ├── user.nix │ ├── rustfmt.nix │ ├── starship.nix │ ├── ssh.nix │ ├── filebin.nix │ ├── kakoune.nix │ ├── i3.nix │ ├── sshd.nix │ ├── shell.nix │ ├── offlineimap.nix │ ├── default.nix │ ├── pulsemixer.nix │ ├── bindings.nix │ ├── display.nix │ ├── mpd.nix │ ├── i3gopher.nix │ ├── watchdog.nix │ ├── git.nix │ ├── nix-path.nix │ ├── page.nix │ └── github.nix └── misc │ ├── default.nix │ ├── ssl.nix │ ├── connection.nix │ └── mutable-state.nix ├── static.nix ├── ci ├── evalnur.nix ├── build.sh ├── packages.nix ├── modules.nix ├── tests.nix └── eval.nix ├── shells └── default.nix ├── nur.nix ├── default.nix ├── flake.lock ├── flake.nix └── README.md /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /overlay.nix: -------------------------------------------------------------------------------- 1 | import ./overlays 2 | -------------------------------------------------------------------------------- /pkgs/obs/looking-glass.nix: -------------------------------------------------------------------------------- 1 | import ../public/looking-glass/obs.nix 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | result 2 | result-* 3 | /pkgs/public/base16/sources-working/ 4 | -------------------------------------------------------------------------------- /pkgs/public/bolin/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | bolin-bin = import ./bin.nix; 3 | } 4 | -------------------------------------------------------------------------------- /pkgs/public/ffr/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | ffr-r3-bin = import ./r3-bin.nix; 3 | } 4 | -------------------------------------------------------------------------------- /overlays/lib.nix: -------------------------------------------------------------------------------- 1 | self: super: { 2 | lib = super.lib.extend (import ../lib/overlay.nix); 3 | } 4 | -------------------------------------------------------------------------------- /pkgs/public/matrix/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | mx-puppet-discord-develop = import ./mx-puppet-discord; 3 | } 4 | -------------------------------------------------------------------------------- /lib/overlay.nix: -------------------------------------------------------------------------------- 1 | self: super: import ./. { 2 | inherit super; 3 | lib = self; 4 | isOverlayLib = true; 5 | } 6 | -------------------------------------------------------------------------------- /pkgs/urxvt/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | osc-52 = import ./osc-52.nix; 3 | xresources-256 = import ./xresources-256.nix; 4 | } 5 | -------------------------------------------------------------------------------- /modules/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | misc = import ./misc; 3 | nixos = import ./nixos; 4 | home-manager = import ./home; 5 | } 6 | -------------------------------------------------------------------------------- /pkgs/public/pass/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | pass-extension-meta = import ./meta.nix; 3 | pass-extension-arc-b2 = import ./b2.nix; 4 | } 5 | -------------------------------------------------------------------------------- /modules/nixos/doc-warnings.nix: -------------------------------------------------------------------------------- 1 | { lib, ... }: with lib; { 2 | config.documentation.nixos.options.warningsAreErrors = mkDefault true; 3 | } 4 | -------------------------------------------------------------------------------- /static.nix: -------------------------------------------------------------------------------- 1 | { 2 | modules = import ./modules; 3 | overlays = import ./overlays; 4 | overlay = import ./overlay.nix; 5 | path = ./.; 6 | } 7 | -------------------------------------------------------------------------------- /overlays/packages.nix: -------------------------------------------------------------------------------- 1 | self: super: let 2 | arc = import ../canon.nix { inherit self super; }; 3 | in arc.super.arc.packages.extendWith super // arc.super.arc.build 4 | -------------------------------------------------------------------------------- /pkgs/python/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | adafruit-dht = import ./adafruit-dht.nix; 3 | dht22-exporter = import ./dht22-exporter.nix; 4 | weechat-matrix = import ./weechat-matrix.nix; 5 | } 6 | -------------------------------------------------------------------------------- /ci/evalnur.nix: -------------------------------------------------------------------------------- 1 | with import {}; 2 | import { 3 | name = "arc"; 4 | url = "{repo.url}"; 5 | src = "${toString ../.}/nur.nix"; 6 | inherit pkgs lib; 7 | } 8 | -------------------------------------------------------------------------------- /pkgs/public/crates/cargo-call-stack-warnings.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/main.rs b/src/main.rs 2 | --- a/src/main.rs 3 | +++ b/src/main.rs 4 | @@ -1,3 +1,1 @@ 5 | -#![deny(warnings)] 6 | - 7 | use core::{ 8 | -------------------------------------------------------------------------------- /pkgs/public/looking-glass/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | looking-glass-host = import ./host.nix; 3 | looking-glass-host-windows = import ./host-windows.nix; 4 | looking-glass-client-develop = import ./client.nix; 5 | } 6 | -------------------------------------------------------------------------------- /pkgs/obs/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | obs-shader-filter = import ./shader-filter.nix; 3 | obs-streamfx = import ./streamfx.nix; 4 | looking-glass-obs-develop = import ./looking-glass.nix; 5 | droidcam-obs_1 = import ./droidcam.nix; 6 | } 7 | -------------------------------------------------------------------------------- /ci/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CI_URL=https://github.com/arcnmx/ci/archive/allnix.tar.gz 4 | CI_URL=/home/arc/projects/arc.github/ci 5 | exec nix run -L --show-trace -f $CI_URL \ 6 | --arg config ./ci/config.nix stage.stable.test -c ci-build "$@" 7 | -------------------------------------------------------------------------------- /pkgs/personal/i3workspaceoutput/default.nix: -------------------------------------------------------------------------------- 1 | { wrapShellScriptBin, i3, jq, lib }: 2 | wrapShellScriptBin "i3workspaceoutput" ./i3workspaceoutput.sh rec { 3 | depsRuntimePath = [ i3 jq ]; 4 | 5 | meta = { 6 | platforms = lib.platforms.linux; 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /shells/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import { } 2 | , arc ? (import ../canon.nix { inherit pkgs; }) 3 | , self ? arc.pkgs 4 | , super ? arc.super.pkgs 5 | , lib ? arc.super.lib 6 | }: let 7 | shells = { 8 | }; 9 | in arc.callPackageAttrs shells { } 10 | -------------------------------------------------------------------------------- /pkgs/personal/benc/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | wrapShellScriptBin, coreutils, gnutar, 3 | gzip ? null, bzip2 ? null, lz4 ? null, xz ? null, gnupg ? null 4 | }: 5 | wrapShellScriptBin "benc" ./benc.sh { 6 | depsRuntimePath = [coreutils gnutar gnupg gzip bzip2 lz4 xz]; 7 | } 8 | -------------------------------------------------------------------------------- /pkgs/personal/winpath.nix: -------------------------------------------------------------------------------- 1 | { writeShellScriptBin, gnused }: writeShellScriptBin "winpath" '' 2 | if [[ $# -gt 0 ]]; then 3 | printf %s "$*" 4 | else 5 | cat 6 | fi | ${gnused}/bin/sed -e 's|\\|/|g' -e 's|^\([A-Za-z]\)\:/\(.*\)|/mnt/\L\1\E/\2|' 7 | '' 8 | -------------------------------------------------------------------------------- /pkgs/git/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | hook-chain = import ./hook-chain.nix; 3 | git-fixup = import ./git-fixup.nix; 4 | git-continue = import ./git-continue.nix; 5 | git-annex-remote-b2 = import ./git-annex-remote-b2; 6 | git-remote-s3 = import ./git-remote-s3.nix; 7 | } 8 | -------------------------------------------------------------------------------- /pkgs/personal/filebin/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | substituteShellScriptBin, lib, 3 | coreutils, awscli2, curl ? null 4 | }: 5 | substituteShellScriptBin "filebin" ./filebin.sh { 6 | depsRuntimePath = [coreutils awscli2 curl]; 7 | passthru.ci.skip = "awscli2 breaks often"; 8 | } 9 | -------------------------------------------------------------------------------- /pkgs/customized/mpd_clientlib-buffer.patch: -------------------------------------------------------------------------------- 1 | --- a/src/buffer.h 2 | +++ b/src/buffer.h 3 | @@ -45,7 +45,7 @@ struct mpd_buffer { 4 | unsigned read; 5 | 6 | /** the actual buffer */ 7 | - unsigned char data[4096]; 8 | + unsigned char data[32768]; 9 | }; 10 | 11 | /** 12 | 13 | -------------------------------------------------------------------------------- /overlays/arc.nix: -------------------------------------------------------------------------------- 1 | self: super: let 2 | arc = import ../canon.nix { inherit self super; isOverlay = true; }; 3 | in { 4 | arc = super.lib.recurseIntoAttrs or super.lib.id arc // { 5 | _internal = super.arc._internal or { } // super.lib.dontRecurseIntoAttrs or super.lib.id { }; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /modules/home/ncmpcpp.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: with lib; let 2 | inherit (config.services) mpd; 3 | cfg = config.programs.ncmpcpp; 4 | in { 5 | config.programs.ncmpcpp = { 6 | settings = { 7 | ncmpcpp_directory = mkOptionDefault (config.xdg.dataHome + "/ncmpcpp"); 8 | }; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /pkgs/zsh/vi-increment.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, buildZshPlugin }: buildZshPlugin rec { 2 | pname = "vi-increment"; 3 | version = "0.3"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "zsh-vi-more"; 7 | repo = pname; 8 | rev = version; 9 | sha256 = "19j8zyxqkr5rxlm985css59b3fhp148njlxq61bagsvzzac6b13d"; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /pkgs/zsh/evil-registers.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, buildZshPlugin }: buildZshPlugin rec { 2 | pname = "evil-registers"; 3 | version = "3.1"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "zsh-vi-more"; 7 | repo = pname; 8 | rev = version; 9 | sha256 = "12xbr453gckm3vknkpb5cfzbpc6qg5a4fn9h8n0xl6n41ikpx7mn"; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /pkgs/zsh/vi-motions.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, buildZshPlugin }: buildZshPlugin rec { 2 | pname = "vi-motions"; 3 | version = "0.3"; 4 | 5 | pluginName = "motions"; 6 | 7 | src = fetchFromGitHub { 8 | owner = "zsh-vi-more"; 9 | repo = pname; 10 | rev = version; 11 | sha256 = "11idlh0wbycxy0q5x6ij9wfwf8mcpx3b5w5xd9skph99pq19kics"; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /pkgs/zsh/vi-quote.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, buildZshPlugin }: buildZshPlugin rec { 2 | pname = "vi-quote"; 3 | version = "2021-01-06"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "zsh-vi-more"; 7 | repo = pname; 8 | rev = "13399086a4c31e8c0e09562ca0c4205ee4c055bd"; 9 | sha256 = "0pci93xscdch2dkrswywxi84x1f9jlh0iw060jhjg8ayvhf7xikk"; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /pkgs/zsh/ex-commands.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, buildZshPlugin }: buildZshPlugin rec { 2 | pname = "ex-commands"; 3 | version = "2021-05-25"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "zsh-vi-more"; 7 | repo = pname; 8 | rev = "53854329298afd7ba9544cac9124f95c73cc9e96"; 9 | sha256 = "1ki9l96jpac7srf3gg0wkyx5glsxqmyb8k6d1374phgk99a8gq5q"; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /pkgs/personal/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | i3workspaceoutput = import ./i3workspaceoutput; 3 | getquote-alphavantage = import ./getquote-alphavantage.nix; 4 | benc = import ./benc; 5 | filebin = import ./filebin; 6 | winpath = import ./winpath.nix; 7 | task-blocks = import ./task-blocks.nix; 8 | openrazer-dpi = import ./openrazer-dpi.nix; 9 | emxc = import ./emxc.nix; 10 | } 11 | -------------------------------------------------------------------------------- /pkgs/customized/ddclient-nodaemon.patch: -------------------------------------------------------------------------------- 1 | diff --git a/ddclient.in b/ddclient.in 2 | index 5a35d38..9d130a9 100755 3 | --- a/ddclient.in 4 | +++ b/ddclient.in 5 | @@ -1008,7 +1008,7 @@ sub main { 6 | unless exists $ipv6_strategies{lc opt('usev6')}; 7 | } 8 | 9 | - $daemon = opt('daemon'); 10 | + $daemon = 0; 11 | 12 | update_nics(); 13 | 14 | -------------------------------------------------------------------------------- /overlays/overrides.nix: -------------------------------------------------------------------------------- 1 | self: super: let 2 | arc = import ../canon.nix { inherit self super; }; 3 | _internal = super.arc._internal or { } // { 4 | overrides = { 5 | inherit super; 6 | }; 7 | }; 8 | in arc.super.arc.packages.extendWithOverrides self (super.arc._internal.overrides.super or super) // { 9 | arc = super.arc or { } // { 10 | inherit _internal; 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /modules/misc/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | display = ./display.nix; 3 | qemu = ./qemu.nix; 4 | connection = ./connection.nix; 5 | binding = ./binding.nix; 6 | ssl = ./ssl.nix; 7 | domain = ./domain.nix; 8 | mutable-state = ./mutable-state.nix; 9 | 10 | __functionArgs = { }; 11 | __functor = self: { ... }: { 12 | imports = with self; [ 13 | display 14 | qemu 15 | ]; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /lib/unmerged.nix: -------------------------------------------------------------------------------- 1 | { lib }: with lib; { 2 | types = { 3 | values = types.mkOptionType { 4 | name = "unmergedValues"; 5 | merge = loc: defs: map (def: def.value) defs; 6 | }; 7 | attrs = types.attrsOf unmerged.types.values; 8 | }; 9 | type = unmerged.types.values; 10 | freeformType = unmerged.types.attrs; 11 | 12 | merge = mkMerge; 13 | mergeAttrs = mapAttrs (_: unmerged.merge); 14 | } 15 | -------------------------------------------------------------------------------- /pkgs/public/looking-glass/host-windows.nix: -------------------------------------------------------------------------------- 1 | { extraLgArgs ? {} 2 | , callPackageWindows ? pkgsWindows.callPackage, pkgsWindows ? pkgsCross.mingwW64, pkgsCross ? {} 3 | , enableNvfbc ? false, extraNvfbcArgs ? {} 4 | , optimizeForArch ? null 5 | }: callPackageWindows ./host.nix ({ 6 | inherit enableNvfbc optimizeForArch; 7 | nvidia-capture-sdk = callPackageWindows ../nvidia-capture-sdk.nix extraNvfbcArgs; 8 | } // extraLgArgs) 9 | -------------------------------------------------------------------------------- /pkgs/zsh/directory-marks.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, buildZshPlugin }: buildZshPlugin rec { 2 | pname = "directory-marks"; 3 | version = "2020-03-14"; 4 | 5 | pluginName = "vi-directory-marks"; 6 | 7 | src = fetchFromGitHub { 8 | owner = "zsh-vi-more"; 9 | repo = pname; 10 | rev = "9dc358c84920b192e4dbb9abc077957a0982c672"; 11 | sha256 = "1hpdjgw620b30z3sqa846ynmh7znqylh5miv2ns5p15pzld8jq77"; 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /ci/packages.nix: -------------------------------------------------------------------------------- 1 | { arc }: 2 | with arc.pkgs.lib; let 3 | packages = filterAttrs filter arc.packages; 4 | packages' = mapAttrs (_: p: if !isDerivation p && isAttrs p 5 | then filterAttrs filter p 6 | else p 7 | ) packages; 8 | filter = _: pkg: (!isAttrs pkg || !isDerivation pkg) || (!(pkg.meta.broken or false) && 9 | !(pkg.meta.skip.ci or false) && 10 | pkg.meta.available or true); 11 | in builtins.attrValues packages' 12 | -------------------------------------------------------------------------------- /pkgs/public/looking-glass/client.nix: -------------------------------------------------------------------------------- 1 | { lib, looking-glass-client, looking-glass-host }: let 2 | inherit (looking-glass-client) stdenv; 3 | inherit (stdenv) hostPlatform; 4 | in looking-glass-client.overrideAttrs (old: { 5 | inherit (looking-glass-host) version src; 6 | 7 | NIX_CFLAGS_COMPILE = looking-glass-client.NIX_CFLAGS_COMPILE or [] ++ lib.optional hostPlatform.isLinux "-Wno-maybe-uninitialized"; 8 | 9 | patches = [ ]; 10 | }) 11 | -------------------------------------------------------------------------------- /pkgs/zsh/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | directory-marks = import ./directory-marks.nix; 3 | evil-registers = import ./evil-registers.nix; 4 | ex-commands = import ./ex-commands.nix; 5 | tab-title = import ./tab-title.nix; 6 | vi-increment = import ./vi-increment.nix; 7 | vi-motions = import ./vi-motions.nix; 8 | vi-quote = import ./vi-quote.nix; 9 | vim-mode = import ./vim-mode.nix; 10 | git-completion = import ./git-completion.nix; 11 | } 12 | -------------------------------------------------------------------------------- /lib/json.nix: -------------------------------------------------------------------------------- 1 | { lib }: with lib; { 2 | primitives = with types; [ bool int float str ]; 3 | types = { 4 | data = with types; oneOf [ json.types.primitive json.types.attrs json.types.list ] // { 5 | description = "json data"; 6 | }; 7 | primitive = types.nullOr (types.oneOf json.primitives); 8 | attrs = types.attrsOf json.types.data; 9 | list = types.listOf json.types.data; 10 | }; 11 | type = json.types.data; 12 | } 13 | -------------------------------------------------------------------------------- /ci/modules.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: let 2 | home = ../modules/home; 3 | nixos = ../modules/nixos; 4 | system = pkgs.nixos { 5 | boot.isContainer = true; 6 | imports = [nixos ]; 7 | home-manager.users.root = _: { 8 | imports = [home]; 9 | config.home.stateVersion = "21.05"; 10 | }; 11 | system.stateVersion = "21.05"; 12 | }; 13 | # TODO: support nix-darwin 14 | in pkgs.lib.optional pkgs.hostPlatform.isLinux system.toplevel 15 | -------------------------------------------------------------------------------- /modules/home/xdg.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: with lib; let 2 | userDirs = getAttrs [ 3 | "desktop" "documents" "download" "music" "pictures" "publicShare" "templates" "videos" 4 | ] config.xdg.userDirs; 5 | in { 6 | options.xdg.userDirs.absolute = mkOption { 7 | type = with types; attrsOf path; 8 | readOnly = true; 9 | }; 10 | 11 | config.xdg.userDirs.absolute = 12 | mapAttrs (_: replaceStrings [ "$HOME" ] [ config.home.homeDirectory ]) userDirs; 13 | } 14 | -------------------------------------------------------------------------------- /pkgs/public/switch-lan-play.nix: -------------------------------------------------------------------------------- 1 | { 2 | stdenv 3 | , fetchFromGitHub 4 | , libpcap 5 | , cmake 6 | }: stdenv.mkDerivation rec { 7 | pname = "switch-lan-play"; 8 | version = "0.2.3"; 9 | src = fetchFromGitHub { 10 | owner = "spacemeowx2"; 11 | repo = pname; 12 | rev = "v${version}"; 13 | sha256 = "04z86sayz2zm7gpiakw4appxf8nbna736rvbmifsq2fh2yw8dsvj"; 14 | fetchSubmodules = true; 15 | }; 16 | 17 | nativeBuildInputs = [ cmake ]; 18 | buildInputs = [ libpcap ]; 19 | } 20 | -------------------------------------------------------------------------------- /pkgs/public/looking-glass/obs-installdir.patch: -------------------------------------------------------------------------------- 1 | diff --git a/obs/CMakeLists.txt b/obs/CMakeLists.txt 2 | --- a/obs/CMakeLists.txt 3 | +++ b/obs/CMakeLists.txt 4 | @@ -120,7 +120,7 @@ target_link_libraries(looking-glass-obs 5 | ) 6 | 7 | install(TARGETS looking-glass-obs 8 | - LIBRARY DESTINATION ${OBS_PLUGIN_PREFIX}/${CMAKE_PROJECT_NAME}/bin/${OBS_PLUGIN_DIR} 9 | + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/obs-plugins 10 | ) 11 | 12 | feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES) 13 | -------------------------------------------------------------------------------- /nur.nix: -------------------------------------------------------------------------------- 1 | { pkgs }: let 2 | # NUR passes a dummy pkgs argument: 3 | # https://github.com/nix-community/NUR/blob/bbd92b3542d500362759f20fe72749800b54a010/lib/evalRepo.nix#L13 4 | arc = if (builtins.tryEval pkgs).success 5 | then import ./default.nix { inherit pkgs; } 6 | else let 7 | arc = import ./default.nix { }; 8 | in { 9 | inherit (arc) packages build shells lib; 10 | } // import ./static.nix; 11 | in arc // { 12 | packages = builtins.removeAttrs arc.packages [ "rustfmt-nightly" ]; 13 | } 14 | -------------------------------------------------------------------------------- /pkgs/public/linux/efifb-nobar.patch: -------------------------------------------------------------------------------- 1 | diff -ruN a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c 2 | --- a/drivers/video/fbdev/efifb.c 2018-01-28 16:20:33.000000000 -0500 3 | +++ b/drivers/video/fbdev/efifb.c 2018-02-08 20:51:28.138745549 -0500 4 | @@ -382,7 +382,7 @@ 5 | 6 | builtin_platform_driver(efifb_driver); 7 | 8 | -#if defined(CONFIG_PCI) 9 | +#if defined(CONFIG_PCI) && !defined(CONFIG_X86) 10 | 11 | static void record_efifb_bar_resource(struct pci_dev *dev, int idx, u64 offset) 12 | { 13 | -------------------------------------------------------------------------------- /pkgs/public/mdloader.nix: -------------------------------------------------------------------------------- 1 | { stdenv, lib, writeText, fetchFromGitHub }: stdenv.mkDerivation rec { 2 | pname = "mdloader"; 3 | version = "1.0.6"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "Massdrop"; 7 | repo = "mdloader"; 8 | rev = version; 9 | sha256 = "1ij0anmbaikx8vnxqgw16062hfk63lbb0h7i8582swxz7zlm457y"; 10 | }; 11 | 12 | installPhase = '' 13 | install -Dm0755 -t $out/bin build/mdloader 14 | ''; 15 | 16 | meta = { 17 | platforms = lib.platforms.linux; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /pkgs/public/mdns-scan.nix: -------------------------------------------------------------------------------- 1 | { stdenv, fetchFromGitHub, lib }: stdenv.mkDerivation rec { 2 | pname = "mdns-scan"; 3 | version = "2020-07-15"; 4 | src = fetchFromGitHub { 5 | owner = "alteholz"; 6 | repo = pname; 7 | rev = "9c307d81d82812e423664e4ebe135f429d995ac8"; 8 | sha256 = "sha256-+rbxmzHlKZVH+VDxNqzhKzPOlOZMju+KEoRVGzbXNjg="; 9 | }; 10 | 11 | installPhase = '' 12 | runHook preInstall 13 | 14 | install -Dm0755 -t $out/bin $pname 15 | 16 | runHook postInstall 17 | ''; 18 | } 19 | -------------------------------------------------------------------------------- /pkgs/git/git-fixup.nix: -------------------------------------------------------------------------------- 1 | { stdenvNoCC, fetchFromGitHub }: stdenvNoCC.mkDerivation rec { 2 | pname = "git-fixup"; 3 | version = "2021-09-19"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "arcnmx"; 7 | repo = pname; 8 | rev = "30d7b7ec18205042ad63c82ef1e082a908050903"; 9 | sha256 = "0g26y9bla50mq2gwkpax3flpqwz6p1sl42xxk8mzhx9m8nwnlp9n"; 10 | }; 11 | 12 | installPhase = '' 13 | runHook preInstall 14 | 15 | install -Dm0755 git-fixup.sh $out/bin/git-fixup 16 | 17 | runHook postInstall 18 | ''; 19 | } 20 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import { }, overlay ? false }: let 2 | overlays = import ./overlays; 3 | pkgs'cleared = if overlays.arc'internal.needsSanitation pkgs 4 | then overlays.arc'internal.sanitize pkgs 5 | else pkgs; 6 | pkgs'overlaid = pkgs'cleared.extend overlays; 7 | arc'overlaid = { 8 | inherit (pkgs'overlaid.arc) path super callPackageAttrs pkgs lib packages build shells; 9 | } // import ./static.nix; 10 | arc = if overlay 11 | then arc'overlaid 12 | else import ./canon.nix { inherit pkgs; }; 13 | in arc 14 | -------------------------------------------------------------------------------- /pkgs/git/git-continue.nix: -------------------------------------------------------------------------------- 1 | { stdenvNoCC, fetchFromGitHub }: stdenvNoCC.mkDerivation rec { 2 | pname = "git-continue"; 3 | version = "2025-08-23"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "arcnmx"; 7 | repo = pname; 8 | rev = "9c03469ff6231d7eb336bf0926b0a4df2176d6ac"; 9 | sha256 = "sha256-IfmSji2DwwJg/uYzkLGIE6mzN5CPC3o9pQ0PtTu5P0U="; 10 | }; 11 | 12 | installPhase = '' 13 | runHook preInstall 14 | 15 | install -Dm0755 git-continue.sh $out/bin/git-continue 16 | 17 | runHook postInstall 18 | ''; 19 | } 20 | -------------------------------------------------------------------------------- /pkgs/public/crates/cargo-binutils-path.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/lib.rs b/src/lib.rs 2 | index 59c77c4..31e26b5 100644 3 | --- a/src/lib.rs 4 | +++ b/src/lib.rs 5 | @@ -309,7 +309,7 @@ pub fn run(tool: Tool, matches: ArgMatches) -> Result { 6 | tool_args.extend(args); 7 | } 8 | 9 | - let mut lltool = Command::new(format!("rust-{}", tool.name())); 10 | + let mut lltool = Command::new(format!("{}", tool.name())); 11 | 12 | if tool == Tool::Objdump { 13 | let ctxt = if let Some(artifact) = &target_artifact { 14 | -------------------------------------------------------------------------------- /pkgs/personal/getquote-alphavantage.nix: -------------------------------------------------------------------------------- 1 | { wrapShellScriptBin, fetchFromGitHub, coreutils, curl, jq }: 2 | let 3 | rev = "6f426157f700fb7291aa0fd0ff74cc422b5ad9eb"; 4 | src = fetchFromGitHub { 5 | inherit rev; 6 | owner = "arcnmx"; 7 | repo = "getquote-alphavantage"; 8 | sha256 = "101fzxd64f48683zn3f43qgxi69d8ygmipb59piq7a95gwknfvsc"; 9 | }; 10 | in 11 | wrapShellScriptBin "getquote" src { 12 | depsRuntimePath = [coreutils curl jq]; 13 | name = "getquote-alphavantage-${rev}"; 14 | version = rev; 15 | source = "${src}/getquote"; 16 | } 17 | -------------------------------------------------------------------------------- /ci/tests.nix: -------------------------------------------------------------------------------- 1 | { arc, pkgs, ci }: with pkgs.lib; let 2 | tests = { 3 | overlays = let 4 | eval = import ./eval.nix { inherit pkgs; }; 5 | in ci.command { 6 | name = "overlays"; 7 | displayName = "overlay tests"; 8 | 9 | failed = attrNames (filterAttrs (_: succ: !succ) eval); 10 | 11 | command = '' 12 | if [[ -z $failed ]]; then 13 | true 14 | else 15 | echo "Failed tests: $failed" >&2 16 | exit 1 17 | fi 18 | ''; 19 | }; 20 | }; 21 | in 22 | builtins.attrValues tests 23 | -------------------------------------------------------------------------------- /pkgs/urxvt/xresources-256.nix: -------------------------------------------------------------------------------- 1 | { stdenvNoCC, fetchFromGitHub, perl }: 2 | 3 | stdenvNoCC.mkDerivation rec { 4 | pname = "urxvt-xresources-256"; 5 | version = "2017-07-17"; 6 | src = fetchFromGitHub { 7 | owner = "roliga"; 8 | repo = pname; 9 | rev = "09c3b2f156035cf73e8c81d29e0917020bae1380"; 10 | sha256 = "1y43pvyh4dnv2c8zqkhjds1rhgfz3ykxfqm4rzyyv4glv7b7jz2v"; 11 | }; 12 | 13 | dontPatchShebangs = true; 14 | #buildInputs = [ perl ]; 15 | 16 | installPhase = '' 17 | install -Dm0755 -t $out/lib/urxvt/perl xresources-256 18 | ''; 19 | } 20 | -------------------------------------------------------------------------------- /pkgs/personal/i3workspaceoutput/i3workspaceoutput.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | set -o pipefail 4 | 5 | I3_WORKSPACE="$1" 6 | I3_OUTPUT="$2" 7 | 8 | if [[ $I3_WORKSPACE == current ]]; then 9 | I3_WORKSPACE=$(i3-msg -t get_workspaces | jq -r '(.[] | select(.focused)).name') 10 | fi 11 | 12 | if [[ $I3_OUTPUT == current ]]; then 13 | I3_OUTPUT=$(i3-msg -t get_workspaces | jq -r '(.[] | select(.focused)).output') 14 | fi 15 | 16 | i3-msg -t command workspace "$I3_WORKSPACE" 17 | i3-msg -t command move workspace to output "$I3_OUTPUT" 18 | i3-msg -t command workspace "$I3_WORKSPACE" 19 | -------------------------------------------------------------------------------- /pkgs/public/libjaylink.nix: -------------------------------------------------------------------------------- 1 | { stdenv, fetchFromRepoOrCz, autoreconfHook, pkg-config, libusb1 }: stdenv.mkDerivation { 2 | pname = "libjaylink"; 3 | version = "2021-03-14"; 4 | nativeBuildInputs = [ pkg-config autoreconfHook ]; 5 | buildInputs = [ libusb1 ]; 6 | 7 | src = fetchFromRepoOrCz { 8 | #url = "git://git.zapb.de/libjaylink.git"; # appears to be down? 9 | repo = "libjaylink"; 10 | rev = "6654e2be5e7a6ae3eb9d66174f965a0db19d1172"; 11 | sha256 = "0s8x67qsl86lalc765rrwa9xr9q0qcj8ss01f8raka4rdv1iv1cp"; 12 | }; 13 | 14 | passthru.ci.skip = true; 15 | } 16 | -------------------------------------------------------------------------------- /pkgs/git/git-remote-s3.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, rustPlatform, hostPlatform, darwin ? null, lib }: rustPlatform.buildRustPackage rec { 2 | pname = "git-remote-s3"; 3 | version = "0.1.2"; 4 | src = fetchFromGitHub { 5 | owner = "bgahagan"; 6 | repo = pname; 7 | rev = "v${version}"; 8 | sha256 = "12lwirmx0c06571chbv0l6xawzl2lv2nmx1pkhfifm3wj909kms4"; 9 | }; 10 | 11 | cargoHash = "sha256-WCBDXuFAtqxGvNRzlF2v1NlA63MM0bk/KddX9VN832I="; 12 | 13 | buildInputs = lib.optional hostPlatform.isDarwin darwin.apple_sdk.frameworks.Security; 14 | 15 | doCheck = false; 16 | } 17 | -------------------------------------------------------------------------------- /pkgs/personal/openrazer-dpi.nix: -------------------------------------------------------------------------------- 1 | { writeShellScriptBin, xxd }: writeShellScriptBin "openrazer-dpi" '' 2 | set -eu 3 | 4 | if [[ -z ''${DEVPATH-} ]]; then 5 | for dev in /sys/bus/hid/drivers/razermouse/*/; do 6 | if [[ -e $dev/dpi ]]; then 7 | DEVPATH=''${dev#/sys/} 8 | break 9 | fi 10 | done 11 | fi 12 | 13 | if [[ -z ''${DEVPATH-} ]]; then 14 | echo "DEVPATH not provided" >&2 15 | exit 1 16 | fi 17 | 18 | DPI_X=$1 19 | DPI_Y=''${2-$DPI_X} 20 | printf %04x%04x "$DPI_X" "$DPI_Y" | ${xxd}/bin/xxd -r -p > /sys/$DEVPATH/dpi 21 | '' 22 | -------------------------------------------------------------------------------- /pkgs/git/git-annex-remote-b2/default.nix: -------------------------------------------------------------------------------- 1 | { buildGoModule, fetchFromGitHub, lib, hostPlatform, darwin }: buildGoModule rec { 2 | pname = "git-annex-remote-b2"; 3 | version = "2020-02-05-arc"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "arcnmx"; 7 | repo = pname; 8 | rev = "6e6b80b809d3d6e1e98517ed714d69c0531d21dc"; 9 | sha256 = "13mb3y9j1ndnlqwqn4s7x92bapbvb8dc8mg5l61kkhlb6qcrw2j4"; 10 | }; 11 | 12 | vendorHash = "sha256:1wsy55n7jcgk07siwjl7fgq9i63x05clki181rzx44r337hv93g5"; 13 | buildInputs = lib.optional hostPlatform.isDarwin darwin.apple_sdk.frameworks.Security; 14 | } 15 | -------------------------------------------------------------------------------- /overlays/fetchurl.nix: -------------------------------------------------------------------------------- 1 | self: super: let 2 | arc = import ../canon.nix { inherit self super; }; 3 | in assert ! super ? nixpkgsFetchurl; { 4 | inherit (arc.lib.overlayOverride { 5 | inherit self super; 6 | attr = "fetchurl"; 7 | withAttr = "nixFetchurl"; 8 | superAttr = "nixpkgsFetchurl"; 9 | fallback = { ... }: arc.build.nixFetchurl; 10 | }) fetchurl nixFetchurl nixpkgsFetchurl; 11 | 12 | callPackageOverrides = super.callPackageOverrides or { } // { 13 | nixFetchurl = { 14 | fetchurl = self.nixpkgsFetchurl or super.fetchurl or (throw "TODO"); 15 | }; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /pkgs/public/lua-amalg.nix: -------------------------------------------------------------------------------- 1 | { lua, fetchurl, fetchFromGitHub }: lua.pkgs.buildLuarocksPackage rec { 2 | pname = "lua-amalg"; 3 | version = "0.8"; 4 | rockspecVersion = "scm-0"; 5 | knownRockspec = fetchurl { 6 | url = "https://github.com/siffiejoe/lua-amalg/raw/v${version}/amalg-${rockspecVersion}.rockspec"; 7 | sha256 = "sha256-GcQE5ZTDjFWdj3XTbUEOWJbyOyZnDXZlyzR8PM29iwc="; 8 | }; 9 | src = fetchFromGitHub { 10 | owner = "siffiejoe"; 11 | repo = pname; 12 | rev = "v${version}"; 13 | sha256 = "1a569hrras5wm4gw5hr2i5hz899bwihz1hb31gfnd9z4dsi8wymb"; 14 | }; 15 | meta = { }; 16 | } 17 | -------------------------------------------------------------------------------- /pkgs/public/matrix/mx-puppet-discord/typescript.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/discord/patches/Actions.ts b/src/discord/patches/Actions.ts 2 | index ad4ecb5..e0caa2e 100644 3 | --- a/src/discord/patches/Actions.ts 4 | +++ b/src/discord/patches/Actions.ts 5 | @@ -31,7 +31,7 @@ abstract class ActionClass { 6 | } 7 | } 8 | // @ts-ignore 9 | -const stubActionsManager = (new Client()).actions; 10 | +const stubActionsManager = (new Client()).actions as any; 11 | const ActionsManager = stubActionsManager.constructor; 12 | const Action: typeof ActionClass = stubActionsManager.MessageCreate.__proto__.__proto__.constructor; 13 | 14 | -------------------------------------------------------------------------------- /pkgs/zsh/vim-mode.nix: -------------------------------------------------------------------------------- 1 | { buildZshPlugin, lib, fetchFromGitHub }: 2 | 3 | buildZshPlugin rec { 4 | pname = "zsh-vim-mode"; 5 | version = "2021-03-21"; 6 | 7 | src = fetchFromGitHub { 8 | owner = "softmoth"; 9 | repo = pname; 10 | rev = "1f9953b7d6f2f0a8d2cb8e8977baa48278a31eab"; 11 | sha256 = "1i79rrv22mxpk3i9i1b9ykpx8b4w93z2avck893wvmaqqic89vkb"; 12 | }; 13 | 14 | meta = with lib; { 15 | homepage = "https://github.com/softmoth/zsh-vim-mode"; 16 | description = "Friendly bindings for ZSH's vi mode"; 17 | license = licenses.mit; 18 | platforms = platforms.all; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "nixpkgs": { 4 | "locked": { 5 | "lastModified": 1756487429, 6 | "narHash": "sha256-dKmUp2Z5JS8exaYq4+2TnjzzLSyYMpCvCGaCxMAnD1I=", 7 | "owner": "NixOS", 8 | "repo": "nixpkgs", 9 | "rev": "84fddb6f4ccf28d904b0d82d1878c36f94c6b629", 10 | "type": "github" 11 | }, 12 | "original": { 13 | "id": "nixpkgs", 14 | "type": "indirect" 15 | } 16 | }, 17 | "root": { 18 | "inputs": { 19 | "nixpkgs": "nixpkgs" 20 | } 21 | } 22 | }, 23 | "root": "root", 24 | "version": 7 25 | } 26 | -------------------------------------------------------------------------------- /pkgs/python/dht22-exporter.nix: -------------------------------------------------------------------------------- 1 | { lib, stdenv, fetchFromGitHub, fetchpatch, pythonPackages, adafruit-dht ? pythonPackages.adafruit-dht }: 2 | 3 | with pythonPackages; 4 | 5 | buildPythonApplication rec { 6 | pname = "dht22_exporter"; 7 | version = "2021.09.06"; 8 | 9 | src = fetchFromGitHub { 10 | owner = "clintjedwards"; 11 | repo = pname; 12 | rev = "0be653a2c9ea3edc3cc1e59202f19c61fa809899"; 13 | sha256 = "10fsvcmnzvsrq5x5zh824zwz0mngx28b2cgrckx7zzq2rk67fnqx"; 14 | }; 15 | 16 | propagatedBuildInputs = [ 17 | adafruit-dht 18 | configargparse 19 | prometheus_client 20 | ]; 21 | } 22 | -------------------------------------------------------------------------------- /modules/home/lorri.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, lib, ... }: with lib; let 2 | cfg = config.services.lorri; 3 | in { 4 | options.services.lorri = { 5 | useNix = mkOption { 6 | type = types.bool; 7 | default = true; 8 | }; 9 | }; 10 | 11 | config = mkIf cfg.enable or false { 12 | programs.direnv = { 13 | enable = mkDefault true; 14 | stdlib = '' 15 | use_lorri() { 16 | eval "$(${pkgs.lorri}/bin/lorri direnv)" 17 | } 18 | '' + optionalString cfg.useNix '' 19 | use_nix() { 20 | use_lorri "$@" 21 | } 22 | ''; 23 | }; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /pkgs/public/zsh-completions-abduco.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, stdenvNoCC }: stdenvNoCC.mkDerivation { 2 | pname = "zsh-completions-abduco"; 3 | version = "2019-04-27"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "arcnmx"; 7 | repo = "zsh-abduco-completion"; 8 | rev = "d8df9f1343d33504d43836d02f0022c1b2b21c0b"; 9 | sha256 = "1n40c2dk7hcpf0vjj6yk0d8lvppsk2jb02wb0zwlq5r72p2pydxf"; 10 | }; 11 | 12 | skipBuild = true; 13 | 14 | installPhase = '' 15 | runHook preInstall 16 | 17 | install -Dm0755 -t $out/share/zsh/site-functions _abduco 18 | 19 | runHook postInstall 20 | ''; 21 | 22 | meta.priority = -10; 23 | } 24 | -------------------------------------------------------------------------------- /pkgs/public/yggdrasil-address.nix: -------------------------------------------------------------------------------- 1 | { lib 2 | , stdenvNoCC 3 | , fetchFromGitHub 4 | , buildGoModule 5 | , calculateYggdrasilAddress 6 | }: with lib; buildGoModule rec { 7 | pname = "yggdrasil-address"; 8 | version = "0.0.1"; 9 | 10 | src = fetchFromGitHub { 11 | owner = "arcnmx"; 12 | repo = pname; 13 | rev = "v${version}"; 14 | sha256 = "1q3174fdskhp1d8vbg3jsf41gd69g1k4k0jjvkhy374i5nx4lrnb"; 15 | }; 16 | 17 | vendorHash = "sha256:031dc5mz5j5cyh0h3r8fxfsaimxcvdh8i1gk6934lmbc1ykrvqrs"; 18 | 19 | passthru = { 20 | importWithPublicKey = pubkey: (calculateYggdrasilAddress pubkey).import; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /pkgs/public/edfbrowser/default.nix: -------------------------------------------------------------------------------- 1 | { lib, libsForQt5 }: libsForQt5.callPackage ({ mkDerivation, qmake, fetchFromGitLab }: let 2 | pname = "EDFbrowser"; 3 | version = "2.05"; 4 | in mkDerivation { 5 | inherit pname version; 6 | 7 | src = fetchFromGitLab { 8 | owner = "Teuniz"; 9 | repo = pname; 10 | rev = "v${version}"; 11 | sha256 = "sha256-ISJAWqsBYm65fiv9ju0TD2idUkmwpq21M50rNhOk5ys="; 12 | }; 13 | 14 | patches = [ 15 | ./prefix.patch 16 | ]; 17 | 18 | nativeBuildInputs = [ 19 | qmake 20 | ]; 21 | 22 | meta = { 23 | platforms = lib.platforms.linux; 24 | mainProgram = "edfbrowser"; 25 | }; 26 | }) { } 27 | -------------------------------------------------------------------------------- /pkgs/zsh/git-completion.nix: -------------------------------------------------------------------------------- 1 | { git, stdenvNoCC }: stdenvNoCC.mkDerivation { 2 | pname = "git-completion.zsh"; 3 | inherit (git) version src; 4 | 5 | dontConfigure = true; 6 | 7 | inherit git; 8 | buildPhase = '' 9 | runHook preBuild 10 | 11 | sed -i contrib/completion/git-completion.zsh \ 12 | -e "s|/usr/share/bash-completion/completions|$git/share/bash-completion/completions|" 13 | 14 | runHook postBuild 15 | ''; 16 | 17 | installPhase = '' 18 | runHook preInstall 19 | 20 | install -Dm0755 contrib/completion/git-completion.zsh $out/share/zsh/site-functions/_git 21 | 22 | runHook postInstall 23 | ''; 24 | } 25 | -------------------------------------------------------------------------------- /modules/misc/ssl.nix: -------------------------------------------------------------------------------- 1 | { lib, config, options, pkgs, name, ... }: with lib; { 2 | options = { 3 | enable = mkEnableOption "ssl" // { default = options.keyPath.isDefined; }; 4 | keyPath = mkOption { 5 | type = types.path; 6 | }; 7 | pem = mkOption { 8 | type = types.str; 9 | }; 10 | certPath = mkOption { 11 | type = types.path; 12 | default = pkgs.writeText "${config.fqdn}.pem" config.pem; 13 | }; 14 | fqdn = mkOption { 15 | type = types.str; 16 | default = name; 17 | }; 18 | fqdnAliases = mkOption { 19 | type = types.listOf types.str; 20 | default = [ ]; 21 | }; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /pkgs/public/konawall.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, rustPlatform, lib, pkg-config, openssl, libX11, libXrandr }: rustPlatform.buildRustPackage rec { 2 | pname = "konawall-rs"; 3 | version = "0.1.0"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "kittywitch"; 7 | repo = pname; 8 | rev = "aeb6688100c918f261c8b561867866e6825e2a39"; 9 | sha256 = "0srw4cy8livxqjdswdi10q79gak5jqc0mhfy9j5f8sy21w701jr0"; 10 | }; 11 | 12 | nativeBuildInputs = [ pkg-config ]; 13 | buildInputs = [ openssl libX11 libXrandr ]; 14 | 15 | meta = with lib; { 16 | platforms = platforms.linux; 17 | }; 18 | 19 | cargoHash = "sha256-whtZk+q+rC46rqqbaFaTCkyoMyfyQjyHa0EjYBNvHhM="; 20 | } 21 | -------------------------------------------------------------------------------- /modules/home/less.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: with lib; let 2 | cfg = config.programs.less; 3 | lesskey = { stdenvNoCC, less }: conf: stdenvNoCC.mkDerivation { 4 | name = "lesskey"; 5 | nativeBuildInputs = singleton less; 6 | passAsFile = singleton "conf"; 7 | inherit conf; 8 | 9 | buildCommand = '' 10 | lesskey -o $out $confPath 11 | ''; 12 | }; 13 | in { 14 | options.programs.less = { 15 | lesskey.enable = mkEnableOption "lesskey file"; 16 | }; 17 | config = mkIf (cfg.enable or false && !cfg.lesskey.enable) { 18 | home.file.".lesskey" = { 19 | target = ".less"; 20 | source = pkgs.callPackage lesskey { } cfg.keys; 21 | }; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /pkgs/customized/mumble-pa-role.diff: -------------------------------------------------------------------------------- 1 | diff --git a/src/mumble/PulseAudio.cpp b/src/mumble/PulseAudio.cpp 2 | index 5028a373a..ae7d83e48 100644 3 | --- a/src/mumble/PulseAudio.cpp 4 | +++ b/src/mumble/PulseAudio.cpp 5 | @@ -88,7 +88,7 @@ PulseAudioSystem::PulseAudioSystem() { 6 | pa_proplist_sets(proplist, PA_PROP_APPLICATION_NAME, "Mumble"); 7 | pa_proplist_sets(proplist, PA_PROP_APPLICATION_ID, "net.sourceforge.mumble.mumble"); 8 | pa_proplist_sets(proplist, PA_PROP_APPLICATION_ICON_NAME, "mumble"); 9 | - pa_proplist_sets(proplist, PA_PROP_MEDIA_ROLE, "game"); 10 | + pa_proplist_sets(proplist, PA_PROP_MEDIA_ROLE, "phone"); 11 | 12 | pacContext = pa_context_new_with_proplist(api, NULL, proplist); 13 | pa_proplist_free(proplist); 14 | -------------------------------------------------------------------------------- /pkgs/public/gst-rtsp-launch/default.nix: -------------------------------------------------------------------------------- 1 | { stdenv 2 | , fetchFromGitHub 3 | , gstreamer ? gst_all_1.gstreamer 4 | , gst-rtsp-server ? gst_all_1.gst-rtsp-server 5 | , gst-plugins-base ? gst_all_1.gst-plugins-base 6 | , gst_all_1 ? null 7 | , cmake 8 | }: stdenv.mkDerivation rec { 9 | pname = "gst-rtsp-launch"; 10 | version = "2019-12-26"; 11 | 12 | src = fetchFromGitHub { 13 | owner = "sfalexrog"; 14 | repo = "gst-rtsp-launch"; 15 | rev = "f466b3f4d3b62d847344ae0aa86531c4aec266bb"; 16 | sha256 = "07x5fkryq2r98gbhfsg14zfgb0ypplvcsjy18hsznk7q0hc96gba"; 17 | }; 18 | 19 | patches = [ ./cmake.patch ]; 20 | 21 | nativeBuildInputs = [ cmake ]; 22 | buildInputs = [ gstreamer gst-plugins-base gst-rtsp-server ]; 23 | } 24 | -------------------------------------------------------------------------------- /pkgs/public/crates/cargo-llvm-lines-features.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/main.rs b/src/main.rs 2 | index 855b4fc..0e86e71 100644 3 | --- a/src/main.rs 4 | +++ b/src/main.rs 5 | @@ -31,6 +31,15 @@ enum Opt { 6 | #[structopt(long = "bin", raw(hidden = "true"))] 7 | bin: Option, 8 | 9 | + #[structopt(long = "features", raw(hidden = "true"))] 10 | + features: Option, 11 | + 12 | + #[structopt(long = "release", raw(hidden = "true"))] 13 | + release: bool, 14 | + 15 | + #[structopt(long = "target", raw(hidden = "true"))] 16 | + target: Option, 17 | + 18 | /// Set the sort order to number of instantiations 19 | #[structopt( 20 | short = "s", 21 | -------------------------------------------------------------------------------- /pkgs/public/nvidia-vbios-vfio-patcher/default.nix: -------------------------------------------------------------------------------- 1 | { stdenvNoCC, python3, fetchFromGitHub }: stdenvNoCC.mkDerivation { 2 | pname = "nvidia-vbios-vfio-patcher"; 3 | version = "2019-02-05"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "Matoking"; 7 | repo = "NVIDIA-vBIOS-VFIO-Patcher"; 8 | rev = "d269523"; 9 | sha256 = "091zj4n8lipf0fl4avhvmjy5dd9y24sgz4lbhzvi8l407qsrq6vs"; 10 | }; 11 | 12 | patches = [ 13 | # https://github.com/Matoking/NVIDIA-vBIOS-VFIO-Patcher/pull/11#issuecomment-570853954 14 | ./rtx.patch 15 | ]; 16 | 17 | buildPhase = "true"; 18 | buildInputs = [ python3 ]; 19 | 20 | installPhase = '' 21 | install -Dm0755 nvidia_vbios_vfio_patcher.py $out/bin/nvidia_vbios_vfio_patcher 22 | ''; 23 | } 24 | -------------------------------------------------------------------------------- /overlays/shells.nix: -------------------------------------------------------------------------------- 1 | self: super: let 2 | arc = import ../canon.nix { inherit self super; }; 3 | in { 4 | inherit (arc.lib.overlayOverride { 5 | inherit self super; 6 | attr = "mkShell"; 7 | withAttr = "mkShell'"; 8 | superAttr = "nixpkgsMkShell"; 9 | fallback = { ... }: arc.build.mkShell'; 10 | }) mkShell mkShell' nixpkgsMkShell; 11 | 12 | shells = arc.super.lib.makeOrExtend super "shells" arc.shells; 13 | 14 | callPackageOverrides = super.callPackageOverrides or { } // { 15 | mkShellEnv = { 16 | mkShell = self.nixpkgsMkShell or super.mkShell or (throw "mkShell missing"); 17 | }; 18 | mkShell' = { 19 | mkShell = self.nixpkgsMkShell or super.mkShell or (throw "mkShell missing"); 20 | }; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /pkgs/public/droid.nix: -------------------------------------------------------------------------------- 1 | let 2 | version = "1.00"; 3 | fn = variant: sha256: { stdenvNoCC, fetchzip, lib }: stdenvNoCC.mkDerivation { 4 | name = "droid-sans-mono-${lib.toLower variant}-${version}"; 5 | inherit version; 6 | src = fetchzip { 7 | url = "http://www.cosmix.org/software/files/DroidSansMono${variant}.zip"; 8 | inherit sha256; 9 | }; 10 | phases = ["installPhase"]; 11 | installPhase = '' 12 | install -Dm0644 -t $out/share/fonts/truetype/ $src/DroidSansMono${variant}.ttf 13 | ''; 14 | }; 15 | in { 16 | droid-sans-mono-dotted = (fn "Dotted" "0l8icqrx6hxqrlz8kbwcynma2nrbcay8gpn1myfhr2hwc1zlp92x"); 17 | droid-sans-mono-slashed = (fn "Slashed" "1vs81lrfzd7wfhs5mp976h06nfl4ym6kl4n6pzzsp0d769891x4d"); 18 | } 19 | -------------------------------------------------------------------------------- /pkgs/public/ryzen-smu/ryzen-monitor-update.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/ryzen_monitor.c b/src/ryzen_monitor.c 2 | index d1bc2c1..e3c801f 100644 3 | --- a/src/ryzen_monitor.c 4 | +++ b/src/ryzen_monitor.c 5 | @@ -342,7 +342,7 @@ void start_pm_monitor(unsigned int force) { 6 | default: sysinfo.if_ver = 0; break; 7 | } 8 | 9 | - while(1) { 10 | + do { 11 | if (smu_read_pm_table(&obj, pm_buf, obj.pm_table_size) != SMU_Return_OK) 12 | continue; 13 | 14 | @@ -352,7 +352,7 @@ void start_pm_monitor(unsigned int force) { 15 | fflush(stdout); 16 | 17 | sleep(update_time_s); 18 | - } 19 | + } while(update_time_s); 20 | } 21 | 22 | void read_from_dumpfile(char *dumpfile, unsigned int version) { 23 | -------------------------------------------------------------------------------- /pkgs/obs/shader-filter.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, stdenv, obs-studio, ffmpeg_4, qtbase ? qt5.qtbase, qt5 ? { }, cmake, pkg-config, lib }: stdenv.mkDerivation rec { 2 | pname = "obs-shader-filter"; 3 | version = "2.3.0"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "Andersama"; 7 | repo = "obs-studio"; 8 | rev = "v${version}-shader-plugin"; 9 | sha256 = "1hp52f31mlxkp1zdgzh4b36ywn9di98agrwpi6gfs1n7hvw77hiy"; 10 | }; 11 | 12 | sourceRoot = "source/plugins/obs-shader-filter"; 13 | 14 | patches = [ 15 | ./shader-filter-build.patch 16 | ]; 17 | 18 | nativeBuildInputs = [ cmake pkg-config ]; 19 | buildInputs = [ obs-studio ffmpeg_4 qtbase ]; 20 | 21 | dontWrapQtApps = true; 22 | meta.broken = lib.versionAtLeast obs-studio.version "28"; 23 | } 24 | -------------------------------------------------------------------------------- /pkgs/zsh/tab-title.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, buildZshPlugin, fetchpatch }: buildZshPlugin rec { 2 | pname = "zsh-tab-title"; 3 | version = "2.3.1"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "trystan2k"; 7 | repo = pname; 8 | rev = "v${version}"; 9 | sha256 = "137mfwx52cg97qy3xvvnp8j5jns6hi20r39agms54rrwqyr1918f"; 10 | }; 11 | 12 | patches = [ (fetchpatch { 13 | url = "https://github.com/trystan2k/zsh-tab-title/commit/8680956adc73bec7439db693c0a54b40630c3989.patch"; 14 | sha256 = "035wiljxych4nydxkvffcb1czrxrvbw1g13qvwfafycqgdfv8zww"; 15 | }) (fetchpatch { 16 | url = "https://github.com/trystan2k/zsh-tab-title/commit/6e532a48e46ae56daec18255512dd8d0597f4aa6.patch"; 17 | sha256 = "132pmdhxnlalici6gv5sh6yrd8gxhwfrk8cbsxh768p58nainf05"; 18 | }) ]; 19 | } 20 | -------------------------------------------------------------------------------- /pkgs/public/github-label-sync/default.nix: -------------------------------------------------------------------------------- 1 | { nodeEnv, callPackage, fetchurl }: let 2 | nodePackages = callPackage ./node-packages.nix { 3 | inherit nodeEnv; 4 | }; 5 | in nodeEnv.buildNodePackage rec { 6 | inherit (nodePackages.args) name version dependencies packageName meta; 7 | reconstructLock = false; 8 | src = fetchurl { 9 | url = "https://registry.npmjs.org/${packageName}/-/${packageName}-${version}.tgz"; 10 | sha512 = "0v6qd4syh5vhgk9xmxrw9kgrj297vqp3137jf58jm9brwijb8qc8dnvzj3d60npdgk28qrjpi9cqikvcymwa7nl61gvbx5cdqc6ag64"; 11 | }; 12 | dontNpmInstall = true; 13 | 14 | postInstall = '' 15 | install -d $out/bin 16 | if [[ ! -e $out/bin/$packageName ]]; then 17 | ln -s $out/lib/node_modules/$packageName/bin/$packageName.js $out/bin/$packageName 18 | fi 19 | ''; 20 | } 21 | -------------------------------------------------------------------------------- /pkgs/git/hook-chain.nix: -------------------------------------------------------------------------------- 1 | { runCommand, wrapShellScriptBin, callPackage, lib, coreutils, git }: 2 | let 3 | hook-chain = callPackage (wrapShellScriptBin "hook-chain.sh" ./hook-chain.sh) { 4 | depsRuntimePath = [coreutils git]; 5 | }; 6 | git-hooks = [ 7 | "pre-applypatch" "pre-commit" "pre-push" "pre-rebase" 8 | "prepare-commit-msg" "update" 9 | "commit-msg" 10 | "applypath-msg" 11 | "post-update" 12 | ]; 13 | in 14 | # provides a git templateDir that calls multiple hooks from .git/hooks/$HOOK.d/* 15 | runCommand "hook-chain" { 16 | hookChainHooks = lib.concatStringsSep " " git-hooks; 17 | hookChainExec = hook-chain.exec; 18 | } '' 19 | install -d $out/hooks 20 | for f in $hookChainHooks; do 21 | ln -s $hookChainExec $out/hooks/$f 22 | install -d $out/hooks/$f.d 23 | done 24 | '' 25 | -------------------------------------------------------------------------------- /modules/home/user.nix: -------------------------------------------------------------------------------- 1 | { lib, name, nixosConfig, config, ... }: with lib; let 2 | arc'lib = import ../../lib { inherit lib; }; 3 | unmerged = lib.unmerged or arc'lib.unmerged; 4 | cfg = config.nixos; 5 | in { 6 | options.nixos = { 7 | enable = mkEnableOption "OS config" // { 8 | default = (builtins.tryEval (nixosConfig ? users.users)).value; 9 | }; 10 | hasSettings = mkOption { 11 | type = types.bool; 12 | default = cfg.enable && nixosConfig.home.os.enable or false; 13 | }; 14 | user = mkOption { 15 | type = types.nullOr types.unspecified; 16 | default = if cfg.enable 17 | then nixosConfig.users.users.${name} 18 | else null; 19 | }; 20 | settings = mkOption { 21 | type = unmerged.types.attrs; 22 | default = { }; 23 | }; 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /lib/from-yaml.nix: -------------------------------------------------------------------------------- 1 | lib: yaml: with lib; let 2 | stripLine = line: elemAt (builtins.match "([^#]*)(#.*|)" line) 0; 3 | usefulLine = line: builtins.match "[ \\t]*" line == null; 4 | parseString = token: let 5 | match = builtins.match ''([^"]+|"([^"]*)" *)'' token; 6 | in 7 | if match == null then throw ''YAML string parse failed: "${token}"'' 8 | else if elemAt match 1 != null then elemAt match 1 9 | else elemAt match 0; 10 | attrLine = line: let 11 | match = builtins.match "([^ :]+): *(.*?) *" line; 12 | in 13 | if match == null then throw ''YAML parse failed: "${line}"'' 14 | else nameValuePair (elemAt match 0) (parseString (elemAt match 1)); 15 | lines = splitString "\n" yaml; 16 | lines' = map stripLine lines; 17 | lines'' = filter usefulLine lines'; 18 | in mapListToAttrs attrLine lines'' 19 | -------------------------------------------------------------------------------- /pkgs/public/gst-jpegtrunc.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, rustPlatform, hostPlatform, pkg-config, gstreamer ? gst_all_1.gstreamer, gst_all_1 ? null }: rustPlatform.buildRustPackage rec { 2 | pname = "gst-jpegtrunc"; 3 | version = "2021-06-14"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "arcnmx"; 7 | repo = pname; 8 | rev = "6abf1997d6eabd0958e74303407d6a9543cc1977"; 9 | sha256 = "0xk36nbzahn5w5a1y2lwdmbg90s8ja6nq9a0ry5w08344lm2l47s"; 10 | }; 11 | 12 | nativeBuildInputs = [ pkg-config ]; 13 | buildInputs = [ gstreamer ]; 14 | 15 | cargoHash = "sha256-96VOWzBReeV08OjQd4LGEIXAnuJwxQk84RRc6aPqLxo="; 16 | 17 | libname = "libgstjpegtrunc" + hostPlatform.extensions.sharedLibrary; 18 | postInstall = '' 19 | mkdir -p $out/lib/gstreamer-1.0 20 | mv $out/lib/$libname $out/lib/gstreamer-1.0/ 21 | ''; 22 | } 23 | -------------------------------------------------------------------------------- /pkgs/public/gst-protectbuffer.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, rustPlatform, hostPlatform, pkg-config, gstreamer ? gst_all_1.gstreamer, gst_all_1 ? null }: rustPlatform.buildRustPackage rec { 2 | pname = "gst-protectbuffer"; 3 | version = "2021-07-23"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "arcnmx"; 7 | repo = pname; 8 | rev = "249cf36dcb412f44d8c4f47a0d3b5b5277235455"; 9 | sha256 = "11fc38mkqffrh1ykyahzf2wjycq2502f6iabgmq6mrnmk4rx25mz"; 10 | }; 11 | 12 | nativeBuildInputs = [ pkg-config ]; 13 | buildInputs = [ gstreamer ]; 14 | 15 | cargoHash = "sha256-Yvo5FYZLbasy4m/wS6kJHqVxthY+8z+1s+4bVhqkwI8="; 16 | 17 | libname = "libgstprotectbuffer" + hostPlatform.extensions.sharedLibrary; 18 | postInstall = '' 19 | mkdir -p $out/lib/gstreamer-1.0 20 | mv $out/lib/$libname $out/lib/gstreamer-1.0/ 21 | ''; 22 | } 23 | -------------------------------------------------------------------------------- /pkgs/obs/streamfx.nix: -------------------------------------------------------------------------------- 1 | { fetchFromGitHub, stdenv, obs-studio, cmake, lib, qtbase ? qt5.qtbase, qt5, ffmpeg_4 }: stdenv.mkDerivation rec { 2 | pname = "obs-streamfx"; 3 | version = "0.11.0a6"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "Xaymar"; 7 | repo = "obs-StreamFX"; 8 | rev = version; 9 | sha256 = "07vbjg69q691n39a0cbb5x3c2bsdslsh9d3i0f01z7d081w9346s"; 10 | }; 11 | 12 | patches = [ 13 | ./streamfx-cmake.patch 14 | ]; 15 | 16 | cmakeFlags = [ 17 | "-DSTRUCTURE_PACKAGEMANAGER=ON" 18 | "-DDOWNLOAD_QT=OFF" 19 | "-DVERSION=${version}" 20 | "-DENABLE_UPDATER=OFF" 21 | ]; 22 | 23 | nativeBuildInputs = [ cmake ]; 24 | buildInputs = [ obs-studio qtbase ffmpeg_4 ]; 25 | dontWrapQtApps = true; 26 | 27 | meta.broken = lib.versionOlder obs-studio.version "27" || lib.versionAtLeast obs-studio.version "28"; 28 | } 29 | -------------------------------------------------------------------------------- /pkgs/public/weechat/urlgrab-homedir.patch: -------------------------------------------------------------------------------- 1 | diff -ruN a/urlgrab.py b/urlgrab.py 2 | --- a/urlgrab.py 2018-05-11 05:25:03.000000000 -0700 3 | +++ b/urlgrab.py 2019-12-22 14:12:45.316763689 -0800 4 | @@ -298,10 +298,11 @@ 5 | "remotecmd", "string", remotecmd, "", 0, 0, 6 | remotecmd, remotecmd, 0, "", "", "", "", "", "") 7 | 8 | + urllog="%s/urls.log" % (weechat.info_get("weechat_dir", "")) 9 | self.data['url_log']=weechat.config_new_option( 10 | self.config_file, section_default, 11 | "url_log", "string", """log location""", "", 0, 0, 12 | - "~/.weechat/urls.log", "~/.weechat/urls.log", 0, "", "", "", "", "", "") 13 | + urllog, urllog, 0, "", "", "", "", "", "") 14 | 15 | self.data['time_format']=weechat.config_new_option( 16 | self.config_file, section_default, 17 | -------------------------------------------------------------------------------- /modules/nixos/common-root.nix: -------------------------------------------------------------------------------- 1 | { lib, config, options, commonRoot, ... }: with lib; { 2 | config = { 3 | ${if options ? home-manager.users then "home-manager" else null} = { 4 | sharedModules = [ 5 | commonRoot.propagate 6 | ]; 7 | }; 8 | _module.args.commonRoot = { 9 | __functor = self: other: self.getConfig == other.commonRoot.getConfig or null; 10 | getConfig = { }: config; 11 | 12 | tag = { ... }: { 13 | options = { 14 | commonRoot = mkOption { 15 | type = types.unspecified; 16 | internal = true; 17 | }; 18 | }; 19 | config = { 20 | inherit commonRoot; 21 | }; 22 | }; 23 | 24 | propagate = { ... }: { 25 | config._module.args = { 26 | inherit commonRoot; 27 | }; 28 | }; 29 | }; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /pkgs/public/matrix/mx-puppet-discord/generate.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env nix-shell 2 | #! nix-shell -i bash -p nodePackages.node2nix 3 | 4 | rev=785d0a0f8def8c7a404d3ba7dea552e1e4cb55ce 5 | u=https://gitlab.com/ruslang02/mx-puppet-discord/-/raw/$rev 6 | curl $u/package.json | 7 | sed 's|"typescript": *"\^\?3\.[^"]*"|"typescript": "^4.8.3"|' | # TODO: remove when newer typescript version pinned 8 | sed 's|\("dependencies": *{\)|\1\n"@discordjs/opus": "^0.8.0",|' >package.json 9 | 10 | node2nix \ 11 | --nodejs-14 \ 12 | --input package.json \ 13 | --output node-packages.nix \ 14 | --composition node-composition.nix \ 15 | --strip-optional-dependencies \ 16 | --registry https://registry.npmjs.org \ 17 | --registry https://gitlab.com/api/v4/packages/npm \ 18 | --registry-scope '@mx-puppet' 19 | 20 | rm -f package.json package-lock.json node-composition.nix node-env.nix 21 | -------------------------------------------------------------------------------- /pkgs/git/hook-chain.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | shopt -s nullglob 4 | 5 | HOOK=$(basename $0) 6 | 7 | case "$HOOK" in 8 | pre-push) 9 | STDIN=$(cat -) 10 | ;; 11 | *) 12 | STDIN= 13 | ;; 14 | esac 15 | 16 | if [[ -z "${GIT_DIR-}" ]]; then 17 | GIT_DIR="$(git rev-parse --git-dir)" 18 | fi 19 | 20 | HOOK_DIR="$GIT_DIR/hooks/$HOOK.d" 21 | EXIT_CODE=0 22 | 23 | if [[ -d "$HOOK_DIR" ]]; then 24 | for hook in "$HOOK_DIR"/*; do 25 | if [[ -x "$hook" ]]; then 26 | if [[ -n "$STDIN" ]]; then 27 | if echo $STDIN | "$hook" "$@"; then 28 | RETVAL=0 29 | else 30 | RETVAL=$? 31 | fi 32 | else 33 | if "$hook" "$@"; then 34 | RETVAL=0 35 | else 36 | RETVAL=$? 37 | fi 38 | fi 39 | 40 | if [[ "$RETVAL" != 0 && "$EXIT_CODE" = 0 ]]; then 41 | EXIT_CODE=$RETVAL 42 | fi 43 | fi 44 | done 45 | fi 46 | 47 | exit $EXIT_CODE 48 | -------------------------------------------------------------------------------- /pkgs/personal/emxc.nix: -------------------------------------------------------------------------------- 1 | { writeShellScriptBin 2 | , weechat-matrix 3 | , curl 4 | , openMode ? "xdg-open" 5 | }: let 6 | opener = { 7 | # TODO: mimeo, and more: https://wiki.archlinux.org/title/Default_applications#Resource_openers 8 | gio = "gio open"; 9 | xdg-open = "xdg-open"; 10 | }.${openMode} or (throw "unsupported openMode ${openMode}"); 11 | in writeShellScriptBin "emxc" '' 12 | set -eu 13 | 14 | if [[ $# -gt 0 ]]; then 15 | URL="$1" 16 | else 17 | echo no args specified >&2 18 | exit 1 19 | fi 20 | 21 | if [[ $# -gt 1 ]]; then 22 | OUT=$(mktemp --tmpdir --suffix=".$2" emxc.XXXXXXXXXX) 23 | else 24 | OUT=$(mktemp --tmpdir emxc.XXXXXXXXXX) 25 | fi 26 | 27 | if [[ $URL = emxc://* ]]; then 28 | ${weechat-matrix}/bin/matrix_decrypt "$URL" "$OUT" 29 | else 30 | ${curl}/bin/curl -LsSfo "$OUT" "$URL" 31 | fi 32 | ${opener} "$OUT" 33 | '' 34 | -------------------------------------------------------------------------------- /modules/home/rustfmt.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: with pkgs.lib; with lib; let 2 | cfg = config.programs.rustfmt; 3 | in { 4 | options.programs.rustfmt = { 5 | enable = mkEnableOption "rustfmt"; 6 | package = mkOption { 7 | type = types.nullOr types.package; 8 | default = pkgs.rustfmt; 9 | defaultText = "pkgs.rustfmt"; 10 | }; 11 | config = mkOption { 12 | type = types.attrs; 13 | default = {}; 14 | }; 15 | extraConfig = mkOption { 16 | type = types.lines; 17 | default = ""; 18 | }; 19 | }; 20 | 21 | config = mkIf cfg.enable { 22 | home.packages = optional (cfg.package != null) cfg.package; 23 | 24 | xdg.configFile = mkIf (cfg.config != {} || cfg.extraConfig != "") { 25 | "rustfmt/rustfmt.toml".text = '' 26 | ${toTOML cfg.config} 27 | ${cfg.extraConfig} 28 | ''; 29 | }; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /modules/home/starship.nix: -------------------------------------------------------------------------------- 1 | { config, options, lib, pkgs, ... }: with lib; let 2 | cfg = config.programs.starship; 3 | configFile = mkIf (cfg.enable && cfg.extraConfig != "") { 4 | source = mkForce (pkgs.runCommand "starship-config" { 5 | nativeBuildInputs = singleton pkgs.buildPackages.remarshal; 6 | value = builtins.toJSON cfg.settings; 7 | inherit (cfg) extraConfig; 8 | passAsFile = [ "value" "extraConfig" ]; 9 | } '' 10 | json2toml $valuePath $out 11 | cat $extraConfigPath >> $out 12 | ''); 13 | }; 14 | in { 15 | options.programs.starship = { 16 | extraConfig = mkOption { 17 | type = types.lines; 18 | default = ""; 19 | }; 20 | }; 21 | config = if options.programs.starship ? configPath then { 22 | home.file.${cfg.configPath} = configFile; 23 | } else { 24 | xdg.configFile."starship.toml" = configFile; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /pkgs/public/pass/meta.nix: -------------------------------------------------------------------------------- 1 | { stdenv 2 | , lib 3 | , fetchFromGitHub 4 | , perl 5 | }: 6 | 7 | stdenv.mkDerivation { 8 | pname = "pass-extension-meta"; 9 | version = "2019-03-11"; 10 | 11 | src = fetchFromGitHub { 12 | owner = "rjekker"; 13 | repo = "pass-extension-meta"; 14 | rev = "d5477e1"; 15 | sha256 = "0f0w0lvmmf53q2a4wblhlr9vsziyx9mm9xi80lkd8kw55lq14bhk"; 16 | }; 17 | 18 | dontBuild = true; 19 | 20 | installFlags = [ "PREFIX=$(out)" "BASHCOMPDIR=$(out)/share/bash-completion/completions" ]; 21 | 22 | inherit perl; 23 | prePatch = '' 24 | substituteInPlace src/meta.bash \ 25 | --replace "perl -l" "$perl/bin/perl -l" 26 | ''; 27 | 28 | meta = with lib; { 29 | description = "A pass extension to retrieve meta-data properties"; 30 | homepage = https://github.com/rjekker/pass-extension-meta; 31 | license = licenses.gpl3; 32 | platforms = platforms.unix; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /pkgs/public/i3gopher/default.nix: -------------------------------------------------------------------------------- 1 | { buildGoModule, fetchFromGitHub, makeWrapper, lib 2 | , i3, enableI3 ? true 3 | , sway, enableSway ? hostPlatform.isLinux 4 | , hostPlatform 5 | }: lib.drvExec "bin/i3gopher" (buildGoModule rec { 6 | pname = "i3gopher"; 7 | version = "1.1.2"; 8 | 9 | src = fetchFromGitHub { 10 | owner = "quite"; 11 | repo = "i3gopher"; 12 | rev = "v${version}"; 13 | sha256 = "sha256-H/fhIjJ2FV2diTMt1Hf9OTLLmdd5+4y9UC1Q6Fjr2OQ="; 14 | }; 15 | 16 | vendorHash = "sha256-DedUQXMA1V2vrLuUWHIABvtIaj2yeC9Uo5Xr6Mc0uvw="; 17 | 18 | nativeBuildInputs = [ makeWrapper ]; 19 | buildInputs = lib.optional enableI3 i3 ++ lib.optional enableSway sway; 20 | i3Path = lib.makeBinPath buildInputs; 21 | preFixup = '' 22 | wrapProgram $out/bin/i3gopher --prefix PATH : $i3Path 23 | ''; 24 | 25 | meta = { 26 | platforms = lib.optionals enableI3 i3.meta.platforms ++ lib.optionals enableSway sway.meta.platforms; 27 | }; 28 | }) 29 | -------------------------------------------------------------------------------- /pkgs/public/crates/cargo-stack-sizes-warn.patch: -------------------------------------------------------------------------------- 1 | From ecfff8c4f5c228d68b71a61fda73435281c5ed65 Mon Sep 17 00:00:00 2001 2 | From: Jeremy Fitzhardinge 3 | Date: Sat, 18 May 2019 15:23:15 -0700 4 | Subject: [PATCH] Don't crash on missing addresses - just print them and go on 5 | 6 | This allows stack-sizes to work on binaries where previously it was crashing. 7 | --- 8 | src/lib.rs | 2 +- 9 | 1 file changed, 1 insertion(+), 1 deletion(-) 10 | 11 | diff --git a/src/lib.rs b/src/lib.rs 12 | index c66205a..d8f0bdc 100644 13 | --- a/src/lib.rs 14 | +++ b/src/lib.rs 15 | @@ -311,7 +311,7 @@ pub fn analyze_executable(elf: &[u8]) -> Result, failure::Error> { 16 | } else if let Some(sym) = defined.get_mut(&(address & !1)) { 17 | sym.stack = Some(stack); 18 | } else { 19 | - unreachable!() 20 | + eprintln!("Address {:?} not found", address); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /modules/home/ssh.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: with lib; let 2 | cfg = config.programs.ssh; 3 | userKnownHostsFile = builtins.toFile "known_hosts" (concatStringsSep "\n" cfg.knownHosts); 4 | in { 5 | options.programs.ssh = { 6 | strictHostKeyChecking = mkOption { 7 | type = types.enum [ "yes" "ask" "accept-new" "no" ]; # off == no? 8 | default = "ask"; 9 | description = "Decide how keys are automatically added to known_hosts"; 10 | }; 11 | knownHosts = mkOption { 12 | type = types.listOf types.str; 13 | description = "SSH host keys to allow connections to"; 14 | default = []; 15 | }; 16 | }; 17 | 18 | config.programs.ssh = { 19 | extraOptionOverrides.StrictHostKeyChecking = cfg.strictHostKeyChecking; 20 | userKnownHostsFile = mkIf (length cfg.knownHosts > 0) (toString ( 21 | optional (cfg.strictHostKeyChecking != "yes") "~/.ssh/known_hosts" 22 | ++ [ userKnownHostsFile ] 23 | )); 24 | }; 25 | } 26 | -------------------------------------------------------------------------------- /modules/nixos/systemd.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: with lib; let 2 | cfg = config.systemd; 3 | watchdogReboot = if cfg.watchdog.rebootTimeout == null then "0" else cfg.watchdog.rebootTimeout; 4 | watchdogRebootDefault = "10min"; 5 | in { 6 | options.systemd = { 7 | watchdog = { 8 | enable = mkEnableOption "runtime watchdog"; 9 | timeout = mkOption { 10 | type = types.str; 11 | default = "60s"; 12 | }; 13 | rebootTimeout = mkOption { 14 | type = with types; nullOr str; 15 | default = watchdogRebootDefault; 16 | }; 17 | }; 18 | }; 19 | config = { 20 | systemd = { 21 | settings.Manager = mkMerge [ 22 | (mkIf cfg.watchdog.enable { 23 | RuntimeWatchdogSec = mkDefault cfg.watchdog.timeout; 24 | }) 25 | (mkIf (cfg.watchdog.rebootTimeout != watchdogRebootDefault) { 26 | RebootWatchdogSec = mkDefault watchdogReboot; 27 | }) 28 | ]; 29 | }; 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /modules/nixos/display.nix: -------------------------------------------------------------------------------- 1 | { lib, config, ... }: with lib; let 2 | cfg = config.hardware.display; 3 | primary = findFirst (mon: mon.primary) (throw "no displays configured") (attrValues cfg.monitors); 4 | rest = filterAttrs (_: mon: !mon.primary) cfg.monitors; 5 | nvidiaX11Enabled = elem "nvidia" config.services.xserver.videoDrivers; 6 | in { 7 | options.hardware.display = mkOption { 8 | type = types.submodule ../misc/display.nix; 9 | default = { }; 10 | }; 11 | 12 | config = { 13 | hardware.display.nvidia.enable = mkDefault ( 14 | (nvidiaX11Enabled && config.hardware.nvidia.modesetting.enable) 15 | || config.hardware.nvidia.datacenter.enable or false 16 | ); 17 | services.xserver = mkIf cfg.enable { 18 | inherit (cfg.xserver) deviceSection screenSection serverLayoutSection; 19 | inherit (primary.xserver) monitorSection; 20 | extraConfig = mkMerge (mapAttrsToList (_: mon: mon.xserver.monitorSectionRaw) rest); 21 | }; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /pkgs/personal/task-blocks.nix: -------------------------------------------------------------------------------- 1 | { lib, stdenvNoCC, fetchFromGitHub, makeWrapper, taskwarrior, jq }: with lib; let 2 | package = stdenvNoCC.mkDerivation rec { 3 | name = "task-blocks"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "arcnmx"; 7 | repo = name; 8 | rev = "189d6fc94647b7c8cab509a785edcf5bf7763f31"; 9 | sha256 = "0yw5313q5jg5bpxkvsk6jdhlx2fahm039aawlrx3f4sq88lz5qqn"; 10 | }; 11 | 12 | nativeBuildInputs = [ makeWrapper ]; 13 | buildInputs = [ taskwarrior jq ]; 14 | 15 | makeFlags = ["TASKDATA=$(out)"]; 16 | 17 | taskHooks = [ "on-exit" "on-add" "on-modify" ]; 18 | wrapperPath = makeBinPath buildInputs; 19 | preFixupPhases = ["wrapInstall"]; 20 | wrapInstall = '' 21 | for f in $taskHooks; do 22 | wrapProgram $out/hooks/$f.$name --prefix PATH : $wrapperPath 23 | done 24 | ''; 25 | 26 | passthru = listToAttrs (map (hook: nameValuePair hook "${package}/hooks/${hook}.${name}") taskHooks); 27 | }; 28 | in package 29 | -------------------------------------------------------------------------------- /pkgs/public/looking-glass/obs.nix: -------------------------------------------------------------------------------- 1 | { stdenv 2 | , fetchpatch 3 | , looking-glass-client, looking-glass-host 4 | , lib 5 | , libbfd 6 | , obs-studio, libGLU 7 | , cmake, pkg-config 8 | , enableThreading ? false 9 | , optimizeForArch ? null 10 | }: let 11 | namedPatches = import ./patches.nix { inherit fetchpatch; }; 12 | in stdenv.mkDerivation { 13 | pname = "looking-glass-obs"; 14 | inherit (looking-glass-host) src version; 15 | inherit (looking-glass-client) meta; 16 | 17 | patches = with namedPatches; [ 18 | #singlethread 19 | cmake-obs-installdir 20 | ]; 21 | 22 | nativeBuildInputs = [ cmake pkg-config ]; 23 | buildInputs = [ libbfd obs-studio libGLU ]; 24 | 25 | cmakeFlags = [ 26 | "-DOPTIMIZE_FOR_NATIVE=${if optimizeForArch == null then "OFF" else optimizeForArch}" 27 | #"-DENABLE_THREADS=${if enableThreading then "ON" else "OFF"}" 28 | "../obs" 29 | ]; 30 | 31 | hardeningDisable = [ "all" ]; 32 | 33 | passthru = { 34 | inherit namedPatches; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /modules/home/filebin.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, lib, ... }: with lib; let 2 | cfg = config.programs.filebin; 3 | arc = import ../../canon.nix { inherit pkgs; }; 4 | in { 5 | options.programs.filebin = { 6 | enable = mkEnableOption "filebin path monitor"; 7 | 8 | config = mkOption { 9 | type = types.attrsOf types.str; 10 | default = { }; 11 | }; 12 | 13 | extraConfig = mkOption { 14 | type = types.lines; 15 | default = ""; 16 | }; 17 | 18 | extraConfigFiles = mkOption { 19 | type = types.listOf types.path; 20 | default = [ ]; 21 | }; 22 | }; 23 | 24 | config = { 25 | home.packages = mkIf cfg.enable [ arc.packages.personal.filebin ]; 26 | programs.filebin.extraConfig = mkMerge (map (path: '' 27 | source ${path} 28 | '') cfg.extraConfigFiles); 29 | xdg.configFile."filebin/config".text = '' 30 | ${concatStringsSep "\n" (mapAttrsToList (k: v: "${k}=${v}") cfg.config)} 31 | ${cfg.extraConfig} 32 | ''; 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /pkgs/public/looking-glass/patches.nix: -------------------------------------------------------------------------------- 1 | { fetchpatch }: { 2 | singlethread = fetchpatch { 3 | url = "https://github.com/arcnmx/LookingGlass/commit/f654f19606219157afe03ab5c5b965a28d3169ef.patch"; 4 | sha256 = "0g532b0ckvb3rcahsmmlq3fji6zapihqzd2ch0msj0ygjzcgkabw"; 5 | }; 6 | cmake-obs-installdir = ./obs-installdir.patch; 7 | nvfbc-pointerthread = fetchpatch { 8 | url = "https://github.com/arcnmx/LookingGlass/commit/cc273ce977b9fcb12079548c91bee45d6d470cba.patch"; 9 | sha256 = "1db2lasjb6h6kp2p28whnf5r88nfr5zckwmwsa81v0chif41pdrr"; 10 | }; 11 | nvfbc-framesize = fetchpatch { 12 | url = "https://github.com/arcnmx/LookingGlass/commit/0791f3e5f01b64ca75e89700668165065d261306.patch"; 13 | sha256 = "17nb35v8yc8m28lg30smkjyckp5nrig3l1pr70yw4s3i0xn6v1mf"; 14 | }; 15 | nvfbc-scale = fetchpatch { 16 | url = "https://github.com/arcnmx/LookingGlass/commit/67c51c58f9bde8468a9fd918ab82f8f768bfb17b.patch"; 17 | sha256 = "03s0g959wpih1bndkjhi5wyfn15n6axc364gb5v9szx5xsya8p45"; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /pkgs/public/paswitch.nix: -------------------------------------------------------------------------------- 1 | { stdenv 2 | , libpulseaudio 3 | , fetchFromGitHub 4 | , hostPlatform 5 | , lib 6 | }: stdenv.mkDerivation { 7 | pname = "paswitch"; 8 | version = "2012-11-21"; 9 | buildInputs = [ libpulseaudio ]; 10 | 11 | src = fetchFromGitHub { 12 | # mirror of https://www.tablix.org/~avian/git/paswitch.git 13 | owner = "arcnmx"; 14 | repo = "paswitch"; 15 | rev = "1b900dae95068be5f72cf679c889c0c12b01091b"; 16 | sha256 = "0403rl2wpyymbxzvqj2r00sb3q4j63rhchsa1x6dkyvmdkg1xahr"; 17 | }; 18 | 19 | configurePhase = '' 20 | substituteInPlace Makefile --replace gcc '$(CC)' 21 | ''; 22 | 23 | installPhase = '' 24 | install -Dm0755 $pname $out/bin/$pname 25 | ''; 26 | 27 | meta = with lib; { 28 | homepage = "https://www.tablix.org/~avian/blog/archives/2012/06/switching_pulseaudio_output_device/"; 29 | mainProgram = "paswitch"; 30 | license = licenses.gpl3; 31 | platforms = platforms.unix; 32 | }; 33 | passthru.ci.skip = hostPlatform.isDarwin; 34 | } 35 | -------------------------------------------------------------------------------- /modules/home/kakoune.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: 2 | 3 | with lib; 4 | 5 | let 6 | cfg = config.programs.kakoune; 7 | in 8 | { 9 | options = { 10 | programs.kakoune = { 11 | colors = mkOption { 12 | type = types.listOf types.path; 13 | default = []; 14 | description = "kakoune color schemes"; 15 | }; 16 | 17 | pluginsExt = mkOption { 18 | type = types.listOf types.package; 19 | default = []; 20 | description = "kakoune plugins"; 21 | }; 22 | }; 23 | }; 24 | 25 | config = mkIf cfg.enable { 26 | xdg.configFile = listToAttrs (map (source: 27 | nameValuePair "kak/colors/${builtins.baseNameOf source}" { inherit source; } 28 | ) cfg.colors); 29 | 30 | programs.kakoune.extraConfig = let 31 | sourceString = s: if s ? kakrc then "source ${s.kakrc}" else "source ${s}"; 32 | in lib.optionalString (cfg.pluginsExt != []) '' 33 | # Plugins 34 | ${concatStringsSep "\n" (map sourceString cfg.pluginsExt)} 35 | ''; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /modules/nixos/home.nix: -------------------------------------------------------------------------------- 1 | { lib, homeSettingsWhitelist, config, options, ... }: with lib; let 2 | cfg = config.home.os; 3 | inherit (config.home-manager) users; 4 | arc'lib = import ../../lib { inherit lib; }; 5 | unmerged = lib.unmerged or arc'lib.unmerged; 6 | whitelist' = builtins.tryEval homeSettingsWhitelist; 7 | settingsWhitelist = if options.home.os ? _hasSettingsWhitelist 8 | then homeSettingsWhitelist 9 | else [ "systemd" "networking" ]; 10 | warnings = mapAttrsToList (name: user: let 11 | remaining = removeAttrs user.nixos.settings or { } settingsWhitelist; 12 | in (map (attr: "home-manager.users.${name}.nixos.settings.${attr} is not whitelisted") (attrNames remaining))) users; 13 | in { 14 | options.home.os = { 15 | enable = mkEnableOption "home-manager os integration"; 16 | }; 17 | config = genAttrs settingsWhitelist (key: optionalAttrs cfg.enable (mkMerge (mapAttrsToList (_: user: 18 | unmerged.merge user.nixos.settings.${key} or [ ] 19 | ) users))) // { 20 | warnings = flatten warnings; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /pkgs/public/weechat/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | weechat-matrix = { python3Packages, fetchFromGitHub }: with python3Packages; buildPythonApplication rec { 3 | inherit (weechat-matrix) pname version src; 4 | format = "setuptools"; 5 | 6 | propagatedBuildInputs = [ requests weechat-matrix.matrix-nio or matrix-nio ]; 7 | 8 | doCheck = false; 9 | 10 | passAsFile = [ "setup" ]; 11 | setup = '' 12 | from setuptools import setup 13 | 14 | setup( 15 | name='@pname@', 16 | version='@version@', 17 | install_requires=['requests', 'matrix-nio'], 18 | packages=[], 19 | scripts=['contrib/matrix_decrypt.py'], 20 | ) 21 | ''; 22 | 23 | postPatch = '' 24 | substituteAll $setupPath setup.py 25 | ''; 26 | 27 | postInstall = '' 28 | mv $out/bin/matrix_decrypt{.py,} 29 | 30 | install -D main.py $out/share/weechat/matrix.py 31 | ''; 32 | 33 | passthru = { 34 | scripts = [ "weechat/matrix.py" ]; 35 | pythonPath = weechat-matrix; 36 | }; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /modules/home/i3.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: with lib; let 2 | inherit (config.systemd.user) systemctlPath; 3 | sessionStart = pkgs.writeShellScript "i3-session" '' 4 | set -eu 5 | ${systemctlPath} --user set-environment I3SOCK=$(${config.xsession.windowManager.i3.package}/bin/i3 --get-socketpath) 6 | ${systemctlPath} --user start i3-session.target 7 | ''; 8 | inherit (config.xsession.windowManager.i3) enable; 9 | in { 10 | config = mkIf enable { 11 | xsession.windowManager.i3.config.startup = [ 12 | { command = "${sessionStart}"; notification = false; } 13 | ]; 14 | systemd.user.targets.i3-session = { 15 | Unit = { 16 | Description = "i3 X session"; 17 | BindsTo = [ "graphical-session.target" ]; 18 | Requisite = [ "graphical-session.target" ]; 19 | }; 20 | }; 21 | systemd.user.services.polybar = mkIf (config.services.polybar.enable && enable) { 22 | Unit.After = [ "i3-session.target" ]; 23 | Install.WantedBy = mkForce [ "i3-session.target" ]; 24 | }; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /overlays/python.nix: -------------------------------------------------------------------------------- 1 | self: super: let 2 | arc = import ../canon.nix { inherit self super; }; 3 | filterFnAttrs = fn: args: builtins.intersectAttrs (self.lib.functionArgs fn) args; 4 | pythonOverrides = builtins.removeAttrs self.pythonOverrides [ "recurseForDerivations" "extend" "__unfix__" ]; 5 | in { 6 | pythonOverlays = super.pythonOverlays or [ ] ++ [ (pself: psuper: builtins.mapAttrs (_: drv: 7 | if super.lib.isFunction drv then self.callPackage drv (filterFnAttrs drv { 8 | python = pself.python; 9 | pythonPackages = pself; 10 | pythonPackagesSuper = psuper; 11 | }) else drv 12 | ) pythonOverrides) ]; 13 | pythonOverrides = super.lib.dontRecurseIntoAttrs or super.lib.id super.pythonOverrides or { }; 14 | pythonInterpreters = builtins.mapAttrs (pyname: py: 15 | if py ? override 16 | then py.override (old: { 17 | packageOverrides = arc.super.lib.composeManyExtensions 18 | (super.lib.optional (old ? packageOverrides) old.packageOverrides ++ self.pythonOverlays); 19 | }) 20 | else py 21 | ) super.pythonInterpreters; 22 | } 23 | -------------------------------------------------------------------------------- /modules/home/sshd.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: 2 | with lib; let 3 | cfg = config.services.sshd; 4 | authorizedKeysFiles = partition (hasPrefix "/") cfg.authorizedKeys; 5 | authorizedKeysFile = pkgs.writeText "authorized_keys" (concatMapStrings (key: key + "\n") authorizedKeysFiles.wrong); 6 | activationScript = '' 7 | run install -Dm0644 ${authorizedKeysFile} ~/.ssh/authorized_keys 8 | '' + optionalString (authorizedKeysFiles.right != [ ]) '' 9 | if [[ ! -v DRY_RUN ]]; then 10 | for _sshKeyFile in ${escapeShellArgs authorizedKeysFiles.right}; do 11 | printf '%s\n' "$(cat $_sshKeyFile)" >> ~/.ssh/authorized_keys 12 | done 13 | fi 14 | ''; 15 | in { 16 | options.services.sshd = { 17 | authorizedKeys = mkOption { 18 | type = types.listOf types.str; 19 | description = "SSH public keys to allow logins from"; 20 | default = []; 21 | }; 22 | }; 23 | 24 | config.home.activation = mkIf (length cfg.authorizedKeys > 0) { 25 | sshdAuthorizedKeys = config.lib.dag.entryAfter ["writeBoundary"] activationScript; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /modules/nixos/crypttab.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: with lib; let 2 | module = { ... }: { 3 | options.crypttab = { 4 | enable = mkEnableOption "crypttab"; 5 | options = mkOption { 6 | type = with types; listOf str; 7 | default = [ "luks" ]; 8 | }; 9 | }; 10 | }; 11 | in { 12 | options.fileSystems = mkOption { 13 | type = with types; attrsOf (submodule module); 14 | }; 15 | config = { 16 | environment.etc.crypttab = let 17 | mapfs = fs: let 18 | keyFile = if fs.encrypted.keyFile != null then fs.encrypted.keyFile else "none"; 19 | line = ''${fs.encrypted.label} ${fs.encrypted.blkDev} ${keyFile} ${concatStringsSep "," fs.crypttab.options}''; 20 | in warnIf fs.encrypted.enable "both initrd encryption and crypttab are enabled for ${fs.mountPoint}" line; 21 | crypttabFilesystems = filter (fs: fs.crypttab.enable) (attrValues config.fileSystems); 22 | text = concatMapStringsSep "\n" mapfs crypttabFilesystems; 23 | in mkIf (crypttabFilesystems != [ ]) { 24 | inherit text; 25 | }; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /pkgs/public/nvflash.nix: -------------------------------------------------------------------------------- 1 | { stdenv, lib, unzip, requireFile, hostPlatform, autoPatchelfHook }: let 2 | subdir = 3 | if hostPlatform.isAarch64 then "aarch64" 4 | else if hostPlatform.isx86_64 then "x64" 5 | else if hostPlatform.isx86 then "x86" 6 | else if hostPlatform.isPowerPC or false then "ppc64" 7 | else throw "Unknown nvflash platform ${hostPlatform.config}"; 8 | in stdenv.mkDerivation rec { 9 | pname = "nvflash"; 10 | version = "5.692"; 11 | 12 | nativeBuildInputs = [ unzip autoPatchelfHook ]; 13 | 14 | src = requireFile { 15 | url = "https://www.techpowerup.com/download/nvidia-nvflash/"; 16 | name = "nvflash_${version}_linux.zip"; 17 | sha256 = "1ywpiw467pvkwy90slpfgpq2bnjvj64ji0g94cx7kx31gz5sn5dz"; 18 | }; 19 | sourceRoot = "."; 20 | 21 | buildPhase = "true"; 22 | 23 | inherit subdir; 24 | installPhase = '' 25 | install -Dm0755 -t $out/bin $subdir/nvflash 26 | ''; 27 | 28 | passthru.ci.skip = true; 29 | meta = with lib; { 30 | platforms = [ "aarch64-linux" "x86_64-linux" "i686-linux" "powerpc64-linux" ]; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /pkgs/public/crates/cargo-stack-sizes-features.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/bin/cargo-stack-sizes.rs b/src/bin/cargo-stack-sizes.rs 2 | index d228a83..e564cb6 100644 3 | --- a/src/bin/cargo-stack-sizes.rs 4 | +++ b/src/bin/cargo-stack-sizes.rs 5 | @@ -55,6 +55,13 @@ fn main() { 6 | .value_name("NAME") 7 | .help("Build only the specified example"), 8 | ) 9 | + .arg( 10 | + Arg::with_name("features") 11 | + .long("features") 12 | + .takes_value(true) 13 | + .value_name("FEATURES") 14 | + .help("Build with the specified features"), 15 | + ) 16 | .arg( 17 | Arg::with_name("release") 18 | .long("release") 19 | @@ -99,6 +106,10 @@ fn run(matches: &ArgMatches) -> Result { 20 | cargo.args(&["--target", target]); 21 | } 22 | 23 | + if let Some(features) = matches.value_of("features") { 24 | + cargo.args(&["--features", features]); 25 | + } 26 | + 27 | match artifact { 28 | Artifact::Bin(bin) => { 29 | cargo.args(&["--bin", bin]); 30 | -------------------------------------------------------------------------------- /modules/home/shell.nix: -------------------------------------------------------------------------------- 1 | { options, config, pkgs, lib, ... }: with lib; let 2 | cfg = config.home.shell; 3 | shellFunctions = lib.concatStringsSep "\n" (lib.mapAttrsToList (fn: body: '' 4 | function ${fn}() { 5 | ${body} 6 | } 7 | '') cfg.functions); 8 | in { 9 | options.home.shell = { 10 | functions = mkOption { 11 | type = types.attrsOf types.lines; 12 | default = { }; 13 | }; 14 | aliases = mkOption { 15 | type = types.attrsOf types.str; 16 | default = { }; 17 | }; 18 | }; 19 | options.programs.bash.localVariables = mkOption { 20 | type = types.attrsOf types.str; 21 | default = { }; 22 | }; 23 | 24 | config.programs.zsh = let 25 | key = if options.programs.zsh ? initContent then "initContent" else "initExtra"; 26 | in mkIf config.programs.zsh.enable { 27 | shellAliases = cfg.aliases; 28 | "${key}" = shellFunctions; 29 | }; 30 | config.programs.bash = mkIf config.programs.bash.enable { 31 | shellAliases = cfg.aliases; 32 | initExtra = '' 33 | ${config.lib.zsh.defineAll config.programs.bash.localVariables} 34 | ${shellFunctions} 35 | ''; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /pkgs/public/gst-rtsp-launch/cmake.patch: -------------------------------------------------------------------------------- 1 | diff --git a/CMakeLists.txt b/CMakeLists.txt 2 | index 913a016..65bdf59 100644 3 | --- a/CMakeLists.txt 4 | +++ b/CMakeLists.txt 5 | @@ -25,15 +25,17 @@ find_library(_LIB_GOBJECT 6 | libgobject-2.0 7 | libgobject-2.0.so 8 | ) 9 | +find_path(_INCLUDE_GST gst/gst.h 10 | + PATH_SUFFIXES gstreamer-1.0 11 | +) 12 | +find_path(_INCLUDE_GSTBASE gst/rtsp/gstrtsptransport.h 13 | + PATH_SUFFIXES gstreamer-1.0 14 | +) 15 | find_path(_INCLUDE_GSTRTSP gst/rtsp-server/rtsp-server.h 16 | - HINTS 17 | - /usr/include 18 | - /usr/include/gstreamer-1.0 19 | + PATH_SUFFIXES gstreamer-1.0 20 | ) 21 | find_path(_INCLUDE_GLIB glib.h 22 | - HINTS 23 | - /usr/include 24 | - /usr/include/glib-2.0 25 | + PATH_SUFFIXES glib-2.0 26 | ) 27 | # Terrible, terrible hack to find glibconfig (which is in /usr/lib/platform-triplet/glib-2.0/include, of all places!) 28 | if (_LIB_GLIB) 29 | @@ -78,6 +80,8 @@ target_link_libraries(GST_RTSP_SERVER INTERFACE 30 | ) 31 | target_include_directories(GST_RTSP_SERVER INTERFACE 32 | ${_INCLUDE_GSTRTSP} 33 | + ${_INCLUDE_GST} 34 | + ${_INCLUDE_GSTBASE} 35 | ${_INCLUDE_GLIB} 36 | ${_INCLUDE_GLIBCONFIG} 37 | ) 38 | -------------------------------------------------------------------------------- /pkgs/public/bolin/bin.nix: -------------------------------------------------------------------------------- 1 | { stdenvNoCC 2 | , requireFile 3 | , unzip 4 | , makeWrapper 5 | , callPackage 6 | }: stdenvNoCC.mkDerivation (attrs: { 7 | pname = "bolin-bin"; 8 | version = "2022-08-13"; 9 | 10 | src = requireFile { 11 | url = "https://bolinlang.com/download"; 12 | name = "bolin.zip"; 13 | sha256 = "97d8435805e6d31ec3ef801537d3f64afdf3d797b0348c0d1ab1880c24bd0439"; 14 | }; 15 | 16 | nativeBuildInputs = [ unzip makeWrapper ]; 17 | 18 | outputs = [ "out" "lib" ]; 19 | 20 | unpackPhase = '' 21 | runHook preUnpack 22 | 23 | unzip $src -d src 24 | sourceRoot=src 25 | 26 | runHook postUnpack 27 | ''; 28 | 29 | buildPhase = ":"; 30 | 31 | installPhase = '' 32 | runHook preInstall 33 | 34 | install -d $out/bin $lib/lib/bolin $out/share/licenses 35 | mv bolin $out/bin/ 36 | mv *.o standard $lib/lib/bolin/ 37 | mv eula.txt $out/share/licenses/bolin.txt 38 | 39 | runHook postInstall 40 | ''; 41 | 42 | wrapperCmd = '' 43 | ln -sf ${placeholder "lib"}/lib/bolin/* ./ 44 | ''; 45 | 46 | postInstall = '' 47 | wrapProgram $out/bin/bolin --run "$wrapperCmd" 48 | ''; 49 | 50 | passthru.ci.skip = true; 51 | }) 52 | -------------------------------------------------------------------------------- /lib/lua.nix: -------------------------------------------------------------------------------- 1 | { lib }: with lib; let 2 | luaTableKey = k: let 3 | needsEscape = builtins.match "[a-zA-Z_]+[a-zA-Z0-9_]*" k == null; 4 | escaped = escapedKey k; 5 | in if escaped != null then "[${escaped}]" 6 | else if needsEscape then "[${serializeString k}]" 7 | else k; 8 | escapedKey = k: if hasPrefix "__lua" k then removePrefix "__lua" k else null; 9 | escapeKey = k: "__lua${serializeExpr k}"; 10 | serializeList = list: "{" + concatMapStringsSep ", " serializeExpr list + "}"; 11 | serializeTable = attrs: "{" + concatStringsSep ", " (mapAttrsToList (k: v: "${luaTableKey k}=${serializeExpr v}") attrs) + "}"; 12 | serializeString = str: ''"'' + replaceStrings [ ''"'' "\\" "\n" ] [ ''\"'' ''\\'' ''\n'' ] str + ''"''; 13 | serializeExpr = value: 14 | if isString value then serializeString value 15 | else if isList value then serializeList value 16 | else if isAttrs value then serializeTable value 17 | else if value == true then "true" 18 | else if value == false then "false" 19 | else if value == null then "nil" 20 | else toString value; 21 | toTable = value: listToAttrs (imap1 (i: v: nameValuePair (escapeKey i) v) value); 22 | in { 23 | inherit serializeExpr escapeKey toTable; 24 | } 25 | -------------------------------------------------------------------------------- /lib/scope.nix: -------------------------------------------------------------------------------- 1 | { ... }: let 2 | # https://github.com/NixOS/nixpkgs/commit/62a6eeb1f3da0a5954ad2da54c454eb7fc1c6e5d 3 | # convert { nixpkgs = ./path; } attrsets to [ { path = ./path; prefix = "nixpkgs" } ] format 4 | nixPathList = nixPathAttrs: let 5 | nixPath = { 6 | # never really makes sense to omit ? 7 | nix = ; 8 | } // nixPathAttrs; 9 | in builtins.map (prefix: { 10 | inherit prefix; 11 | path = toString nixPath.${prefix}; 12 | }) (builtins.attrNames nixPath); 13 | 14 | # import a file with a new nixPath 15 | nixPathImport = nixPath: nixPathScopedImport nixPath { }; 16 | 17 | # import a file with a new nixPath and scope 18 | nixPathScopedImport = nixPath': newScope: let 19 | nixPath = if builtins.isAttrs nixPath' then nixPathList nixPath' else nixPath'; 20 | import = builtins.scopedImport scope; 21 | scopedImport = newScope: builtins.scopedImport (scope // newScope); 22 | scope = newScope // { 23 | inherit import scopedImport; 24 | __nixPath = nixPath; 25 | builtins = builtins // (newScope.builtins or { }) // { 26 | inherit nixPath import scopedImport; 27 | }; 28 | }; 29 | in import; 30 | in { 31 | inherit nixPathImport nixPathScopedImport nixPathList; 32 | } 33 | -------------------------------------------------------------------------------- /pkgs/public/glauth.nix: -------------------------------------------------------------------------------- 1 | { lib, git, fetchFromGitHub, buildGoModule, go-bindata }: 2 | 3 | buildGoModule rec { 4 | pname = "glauth"; 5 | version = "2.0.0"; 6 | 7 | src = fetchFromGitHub { 8 | owner = "glauth"; 9 | repo = pname; 10 | rev = "v${version}"; 11 | sha256 = "0g4a3rp7wlihn332x30hyvqb5izpcd7334fmghhvbv0pi4p7x9bf"; 12 | }; 13 | 14 | vendorHash = "sha256:0ljxpscs70w1zi1dhg0lhc31161380pfwwqrr32pyxvxc48mjj25"; 15 | 16 | nativeBuildInputs = [ go-bindata ]; 17 | 18 | ldflags = [ "-X main.LastGitTag=v${version}" "-X main.GitTagIsCommit=1" ]; 19 | 20 | preBuild = "go-bindata -pkg=assets -o=pkg/assets/bindata.go assets"; 21 | 22 | preInstall = let 23 | plugins = ["sqlite" "postgres" "mysql"]; 24 | pluginLine = plugin: ''go build -ldflags "''${ldflags[*]}" -buildmode=plugin -o $out/bin/${plugin}.so pkg/plugins/${plugin}.go pkg/plugins/basesqlhandler.go''; 25 | pluginLines = map pluginLine plugins; 26 | in lib.concatStringsSep "\n" pluginLines; 27 | 28 | doCheck = false; 29 | 30 | meta = with lib; { 31 | description = "A lightweight LDAP server for development, home use, or CI"; 32 | homepage = "https://github.com/glauth/glauth"; 33 | license = licenses.mit; 34 | platforms = platforms.unix; 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /modules/nixos/filebin.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, lib, ... }: with lib; let 2 | cfg = config.services.filebin; 3 | arc = import ../../canon.nix { inherit pkgs; }; 4 | in { 5 | options.services.filebin = { 6 | enable = mkEnableOption "filebin path monitor"; 7 | 8 | path = mkOption { 9 | type = types.path; 10 | default = "/run/filebin"; 11 | }; 12 | 13 | user = mkOption { 14 | type = types.nullOr types.str; 15 | default = null; 16 | }; 17 | 18 | notify = mkOption { 19 | type = types.bool; 20 | default = true; 21 | }; 22 | }; 23 | 24 | config = mkIf cfg.enable { 25 | systemd.services.filebin = { 26 | description = "filebin automatic uploads"; 27 | after = ["network.target"]; 28 | serviceConfig = { 29 | Type = "oneshot"; 30 | ExecStart= "${arc.packages.personal.filebin.exec} ${if cfg.notify then "-n" else ""} -d ${cfg.path}"; 31 | User = mkIf (cfg.user != null) cfg.user; 32 | }; 33 | }; 34 | systemd.paths.filebin = { 35 | description = "filebin automatic uploads"; 36 | pathConfig = { 37 | DirectoryNotEmpty = cfg.path; 38 | MakeDirectory = true; 39 | DirectoryMode = "0777"; 40 | }; 41 | wantedBy = ["multi-user.target"]; 42 | }; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /pkgs/public/ddclient.nix: -------------------------------------------------------------------------------- 1 | { lib, fetchFromGitHub, perlPackages, autoreconfHook, iproute2, perl }: 2 | 3 | perlPackages.buildPerlPackage rec { 4 | pname = "ddclient"; 5 | version = "3.10.0"; 6 | 7 | outputs = [ "out" ]; 8 | 9 | src = fetchFromGitHub { 10 | owner = "ddclient"; 11 | repo = "ddclient"; 12 | rev = "v${version}"; 13 | sha256 = "sha256-wWUkjXwVNZRJR1rXPn3IkDRi9is9vsRuNC/zq8RpB1E="; 14 | }; 15 | 16 | postPatch = '' 17 | touch Makefile.PL 18 | ''; 19 | 20 | nativeBuildInputs = [ autoreconfHook ]; 21 | 22 | buildInputs = with perlPackages; [ IOSocketINET6 IOSocketSSL JSONPP ]; 23 | 24 | installPhase = '' 25 | runHook preInstall 26 | 27 | # patch sheebang ddclient script which only exists after buildPhase 28 | preConfigure 29 | install -Dm755 ddclient $out/bin/ddclient 30 | install -Dm644 -t $out/share/doc/ddclient COP* README.* ChangeLog.md 31 | 32 | runHook postInstall 33 | ''; 34 | 35 | # TODO: run upstream tests 36 | doCheck = false; 37 | 38 | meta = with lib; { 39 | description = "Client for updating dynamic DNS service entries"; 40 | homepage = "https://ddclient.net/"; 41 | license = licenses.gpl2Plus; 42 | platforms = platforms.linux; 43 | maintainers = with maintainers; [ SuperSandro2000 ]; 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /pkgs/public/clip.nix: -------------------------------------------------------------------------------- 1 | let 2 | rev = "f5d3a1204c7e314802c1d00c7c596fdf5b8229a8"; 3 | sha256 = "17i9vrfgd7zw0ycsmw651zrjfy6kyif9bvlykrkd87m75d64cb2m"; 4 | clip = builtins.fetchTarball { 5 | url = "https://github.com/arcnmx/clip/archive/${rev}.tar.gz"; 6 | inherit sha256; 7 | }; 8 | #in import (clip + "/derivation.nix") 9 | # NUR doesn't like this IFD so inline it here instead: 10 | in { stdenvNoCC 11 | , lib 12 | , makeWrapper 13 | , coreutils 14 | , enableX11 ? stdenvNoCC.isLinux 15 | , xsel ? null 16 | , enableWayland ? stdenvNoCC.isLinux 17 | , wl-clipboard ? null 18 | , fetchFromGitHub 19 | }: with lib; 20 | 21 | assert enableX11 -> xsel != null; 22 | assert enableWayland -> wl-clipboard != null; 23 | 24 | stdenvNoCC.mkDerivation { 25 | pname = "clip"; 26 | version = "0.0.1"; # idk 27 | 28 | preferLocalBuild = true; 29 | 30 | src = fetchFromGitHub { 31 | owner = "arcnmx"; 32 | repo = "clip"; 33 | inherit rev sha256; 34 | }; 35 | 36 | nativeBuildInputs = [ makeWrapper ]; 37 | 38 | wrappedPath = makeSearchPath "bin" ([ coreutils ] 39 | ++ optional enableX11 xsel 40 | ++ optional enableWayland wl-clipboard 41 | ); 42 | 43 | installPhase = '' 44 | mkdir -p $out/bin 45 | makeWrapper clip.sh $out/bin/$pname \ 46 | --prefix PATH : $wrappedPath 47 | ''; 48 | } 49 | -------------------------------------------------------------------------------- /pkgs/customized/luakit-nodoc.patch: -------------------------------------------------------------------------------- 1 | --- a/Makefile 2 | +++ b/Makefile 3 | @@ -17,7 +17,7 @@ EXT_OBJS = $(foreach obj,$(EXT_SRCS:.c=.o),$(obj)) 4 | # Must be kept in sync with doc/docgen.ld 5 | DOC_SRCS = $(filter-out lib/markdown.lua lib/lousy/init.lua,$(shell for d in doc/luadoc lib common/clib; do find $$d -type f; done)) tests/lib.lua 6 | 7 | -all: options newline luakit luakit.1.gz luakit.so apidoc 8 | +all: options newline luakit luakit.1.gz luakit.so 9 | 10 | options: 11 | @echo luakit build options: 12 | @@ -96,10 +96,6 @@ install: all 13 | install -d $(DESTDIR)$(PREFIX)/share/luakit/ 14 | install -d $(DESTDIR)$(DOCDIR) $(DESTDIR)$(DOCDIR)/classes $(DESTDIR)$(DOCDIR)/modules $(DESTDIR)$(DOCDIR)/pages 15 | install -m644 README.md AUTHORS COPYING.GPLv3 $(DESTDIR)$(DOCDIR) 16 | - install -m644 doc/apidocs/classes/* $(DESTDIR)$(DOCDIR)/classes 17 | - install -m644 doc/apidocs/modules/* $(DESTDIR)$(DOCDIR)/modules 18 | - install -m644 doc/apidocs/pages/* $(DESTDIR)$(DOCDIR)/pages 19 | - install -m644 doc/apidocs/*.html $(DESTDIR)$(DOCDIR) 20 | install -d $(DESTDIR)$(PREFIX)/share/luakit/lib $(DESTDIR)$(PREFIX)/share/luakit/lib/lousy $(DESTDIR)$(PREFIX)/share/luakit/lib/lousy/widget 21 | install -m644 lib/*.* $(DESTDIR)$(PREFIX)/share/luakit/lib 22 | install -m644 lib/lousy/*.* $(DESTDIR)$(PREFIX)/share/luakit/lib/lousy 23 | -------------------------------------------------------------------------------- /pkgs/mpvScripts.nix: -------------------------------------------------------------------------------- 1 | { 2 | paused = { stdenvNoCC, mpv-unwrapped, lib, fetchFromGitHub }: stdenvNoCC.mkDerivation rec { 3 | pname = "paused"; 4 | version = "2021-05-29"; 5 | 6 | src = fetchFromGitHub { 7 | owner = "kittywitch"; 8 | repo = "mpvScripts"; 9 | rev = "0a41713c8413494de6b2032a5806706699c79b01"; 10 | sha256 = "0mdkdwpg8yafiwmra3qi3ni580fjvprdq7dkhklns1axdbr1p7c2"; 11 | }; 12 | 13 | dontBuild = true; 14 | dontUnpack = true; 15 | 16 | installPhase = '' 17 | install -Dm644 ${src}/paused.lua $out/share/mpv/scripts/paused.lua 18 | ''; 19 | 20 | passthru.scriptName = "paused.lua"; 21 | 22 | meta = { 23 | description = "Automatically hides and shows OSC based upon pause status"; 24 | }; 25 | }; 26 | pause-indicator = { stdenvNoCC, fetchurl }: stdenvNoCC.mkDerivation rec { 27 | pname = "mpv-pause-indicator"; 28 | version = "2018-04-28"; 29 | src = fetchurl { 30 | url = "https://gist.githubusercontent.com/torque/9dbc69543118347d2e5f43239a7e609a/raw/bd9fcfe68a4f13b655c686e5790cbd2ee9489475/pause-indicator.lua"; 31 | sha256 = "1x219m62iljxdsk18apaf1ccf4waqdwr9gilrfj64g4j6h7k1fak"; 32 | }; 33 | 34 | buildCommand = '' 35 | install -Dm644 $src $out/share/mpv/scripts/$scriptName 36 | ''; 37 | 38 | scriptName = "pause-indicator.lua"; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /pkgs/python/adafruit-dht.nix: -------------------------------------------------------------------------------- 1 | { lib, pythonPackages, hostPlatform, fetchFromGitHub, fetchpatch, platform ? null }: 2 | 3 | with pythonPackages; 4 | 5 | buildPythonPackage rec { 6 | pname = "Adafruit_DHT"; 7 | version = "1.4.1"; 8 | 9 | src = fetchFromGitHub { 10 | owner = "adafruit"; 11 | repo = "Adafruit_Python_DHT"; 12 | rev = "8f5e2c4d6ebba8836f6d31ec9a0c171948e3237d"; 13 | sha256 = "01ya0zxawslccvh8bp5j8biylhkrfz0pjdmgzji3bcsmr4742i9f"; 14 | }; 15 | 16 | patches = [ 17 | (fetchpatch { 18 | name = "fix-platform-detection.patch"; 19 | url = "https://github.com/kittywitch/Adafruit_Python_DHT/commit/71c55b3ae5f0f03b525be2cc3fb8795c376b171a.patch"; 20 | sha256 = "1iih8q9lndxqg0i83gk1ljp9dck9y6714rmcvqlycmc25zkiw3hz"; 21 | }) 22 | ]; 23 | 24 | setupPyGlobalFlags = let 25 | defaultPlatform = { 26 | "armv6l-linux" = "pi"; 27 | # For Beaglebone Black owners, platform must be explicitly provided as "bbb". 28 | "armv7l-linux" = "pi2"; 29 | "aarch64-linux" = "pi2"; 30 | }.${hostPlatform.system}; 31 | platformStr = if platform == null then defaultPlatform else platform; 32 | in lib.singleton "--force-${platformStr}"; 33 | format = "setuptools"; 34 | doCheck = false; 35 | 36 | meta = { 37 | broken = python.isPy2; 38 | platforms = [ "armv6l-linux" "armv7-linux" "aarch64-linux" ]; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /modules/home/offlineimap.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: with lib; let 2 | cfg = config.services.offlineimap; 3 | in { 4 | options.services.offlineimap = { 5 | enable = mkEnableOption "offlineimap sync"; 6 | package = mkOption { 7 | type = types.package; 8 | default = pkgs.offlineimap; 9 | defaultText = "pkgs.offlineimap"; 10 | }; 11 | period = mkOption { 12 | type = types.nullOr types.str; 13 | default = null; 14 | example = "hourly"; 15 | description = "Periodic sync only"; 16 | }; 17 | }; 18 | 19 | config.systemd.user = mkIf (cfg.enable && config.programs.offlineimap.enable) { 20 | timers.offlineimap = mkIf (cfg.period != null) { 21 | Unit = { 22 | Description = "OfflineIMAP periodic sync"; 23 | }; 24 | Timer = { 25 | OnCalendar = cfg.period; 26 | }; 27 | }; 28 | 29 | services.offlineimap = { 30 | Unit = { 31 | Description = "OfflineIMAP sync"; 32 | After = [ "network-online.target" ]; 33 | }; 34 | 35 | Install = { 36 | WantedBy = [ "default.target" ]; 37 | }; 38 | 39 | Service = { 40 | Type = "simple"; 41 | ExecStart = "${cfg.package}/bin/offlineimap -u basic" 42 | + optionalString (cfg.period != null) " -o"; 43 | RestartSec = "30"; 44 | Restart = "on-failure"; 45 | }; 46 | }; 47 | }; 48 | } 49 | -------------------------------------------------------------------------------- /pkgs/public/mufft.nix: -------------------------------------------------------------------------------- 1 | { stdenv, cmake, fetchFromGitHub }: stdenv.mkDerivation rec { 2 | pname = "muFFT"; 3 | version = "2019-02-15"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "Themaister"; 7 | repo = pname; 8 | rev = "47bb08652eab399c2c7d460abe5184857110f130"; 9 | sha256 = "0s3qk6ma10jcqf091xm7swqbccmki2phsqs1jgskplym2xr6lgkn"; 10 | }; 11 | 12 | passAsFile = [ "install" ]; 13 | install = '' 14 | set_target_properties(muFFT PROPERTIES OUTPUT_NAME mufft) 15 | set_target_properties(muFFT PROPERTIES PRIVATE_HEADER fft_internal.h) 16 | set_target_properties(muFFT PROPERTIES PUBLIC_HEADER fft.h) 17 | set(VERSION $ENV{version}) 18 | set(PREFIX $ENV{out}) 19 | configure_file( 20 | ''${PROJECT_SOURCE_DIR}/mufft.pc.in 21 | ''${PROJECT_BINARY_DIR}/mufft.pc 22 | @ONLY 23 | ) 24 | install(TARGETS muFFT 25 | LIBRARY DESTINATION ''${CMAKE_INSTALL_LIBDIR} 26 | PUBLIC_HEADER DESTINATION ''${CMAKE_INSTALL_INCLUDEDIR} 27 | ) 28 | install(FILES ''${CMAKE_CURRENT_BINARY_DIR}/mufft.pc 29 | DESTINATION ''${CMAKE_INSTALL_LIBDIR}/pkgconfig 30 | ) 31 | ''; 32 | 33 | postPatch = '' 34 | sed -i 's/muFFT STATIC/muFFT SHARED/' CMakeLists.txt 35 | cat $installPath >> CMakeLists.txt 36 | ''; 37 | 38 | nativeBuildInputs = [ 39 | cmake 40 | ]; 41 | 42 | cmakeFlags = [ 43 | "-DMUFFT_ENABLE_FFTW=OFF" 44 | ]; 45 | } 46 | -------------------------------------------------------------------------------- /pkgs/public/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | i3gopher = import ./i3gopher; 3 | glauth = import ./glauth.nix; 4 | konawall = import ./konawall.nix; 5 | paswitch = import ./paswitch.nix; 6 | clip = import ./clip.nix; 7 | nvflash = import ./nvflash.nix; 8 | nvidia-vbios-vfio-patcher = import ./nvidia-vbios-vfio-patcher; 9 | nvidia-capture-sdk = import ./nvidia-capture-sdk.nix; 10 | edfbrowser = import ./edfbrowser; 11 | mdloader = import ./mdloader.nix; 12 | muFFT = import ./mufft.nix; 13 | libjaylink = import ./libjaylink.nix; 14 | openocd-git = import ./openocd-git.nix; 15 | gst-jpegtrunc = import ./gst-jpegtrunc.nix; 16 | gst-protectbuffer = import ./gst-protectbuffer.nix; 17 | gst-rtsp-launch = import ./gst-rtsp-launch; 18 | zsh-completions-abduco = import ./zsh-completions-abduco.nix; 19 | lua-amalg = import ./lua-amalg.nix; 20 | github-label-sync = import ./github-label-sync; 21 | yggdrasil-address = import ./yggdrasil-address.nix; 22 | switch-lan-play = import ./switch-lan-play.nix; 23 | mdns-scan = import ./mdns-scan.nix; 24 | firenvim-native = import ./firenvim-native.nix; 25 | ddclient_3 = import ./ddclient.nix; 26 | } 27 | // (import ./bolin) 28 | // (import ./droid.nix) 29 | // (import ./weechat) 30 | // (import ./looking-glass) 31 | // (import ./crates) 32 | // (import ./linux) 33 | // (import ./ryzen-smu) 34 | // (import ./matrix) 35 | // (import ./pass) 36 | // (import ./ffr) 37 | // (import ../git) 38 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs = { 3 | nixpkgs = { 4 | }; 5 | }; 6 | outputs = { nixpkgs, self, ... }: let 7 | nixlib = nixpkgs.lib; 8 | forSystems = f: nixlib.genAttrs nixlib.systems.flakeExposed or nixlib.systems.supported.hydra (system: f ( 9 | import ./canon.nix { pkgs = nixpkgs.legacyPackages.${system}; } 10 | )); 11 | in { 12 | legacyPackages = forSystems (arc: arc.packages.groups // arc.build // { 13 | inherit arc; 14 | }); 15 | packages = forSystems (arc: nixlib.filterAttrs (name: package: 16 | name != "recurseForDerivations" 17 | && package.meta.available or true != false 18 | ) arc.packages.groups.toplevel); 19 | devShells = forSystems (arc: arc.shells); 20 | nixosModules = import ./modules/nixos // { 21 | default = self.nixosModules; 22 | }; 23 | homeModules = import ./modules/home // { 24 | default = self.homeModules; 25 | }; 26 | modules = import ./modules; 27 | overlays = import ./overlays // { 28 | default = self.overlays; 29 | }; 30 | lib = import ./lib { 31 | inherit (nixpkgs) lib; 32 | }; 33 | flakes.config = rec { 34 | name = "arc"; 35 | packages.namespace = [ name ]; # TODO: this is just to work around a bug, really? 36 | }; 37 | }; 38 | nixConfig = { 39 | extra-substituters = [ "https://arc.cachix.org" ]; 40 | extra-trusted-public-keys = [ "arc.cachix.org-1:DZmhclLkB6UO0rc0rBzNpwFbbaeLfyn+fYccuAy7YVY=" ]; 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /pkgs/obs/droidcam.nix: -------------------------------------------------------------------------------- 1 | { stdenv, fetchFromGitHub, obs-studio, libX11, libjpeg_turbo, libusbmuxd, ffmpeg_4, pkg-config }: stdenv.mkDerivation rec { 2 | pname = "droidcam-obs"; 3 | version = "1.2.1"; 4 | 5 | src = fetchFromGitHub { 6 | owner = "dev47apps"; 7 | repo = "droidcam-obs-plugin"; 8 | rev = version; 9 | sha256 = "15fdbkd1i1yy9nmspsi335a6yn49r9c2wxs8y4k5x5gy0hzl6031"; 10 | }; 11 | 12 | postPatch = '' 13 | sed -i \ 14 | -e 's/ -1 && ${jsArray user.systemd.verbs}.indexOf(action.lookup("verb")) > -1) { 39 | return polkit.Result.YES; 40 | } 41 | } 42 | }) 43 | '') cfg.users); 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /modules/nixos/matrix-synapse-appservices.nix: -------------------------------------------------------------------------------- 1 | { lib, pkgs, config, ... }: with lib; let 2 | cfg = config.services.matrix-synapse.appservices; 3 | inherit (import ./matrix-common.nix { inherit lib pkgs; }) registrationModule; 4 | appservices = attrValues cfg; 5 | enabledAppservices = filter (cfg: cfg.enable) appservices; 6 | localAppservices = filterAttrs (_: appservice: appservice.enable) config.services.matrix-appservices or { }; 7 | enable = cfg != { }; 8 | appserviceModule = { name, ... }: { 9 | imports = [ registrationModule ]; 10 | options = { 11 | enable = mkEnableOption "appservice ${name}" // { 12 | default = true; 13 | }; 14 | }; 15 | config = { 16 | configuration = { 17 | name = "matrix-synapse-${name}"; 18 | combinedPath = "/run/matrix-synapse/${name}.yaml"; 19 | }; 20 | }; 21 | }; 22 | appserviceType = types.submodule appserviceModule; 23 | in { 24 | options.services.matrix-synapse.appservices = mkOption { 25 | type = with types; attrsOf appserviceType; 26 | default = { }; 27 | }; 28 | config = { 29 | services.matrix-synapse = { 30 | settings.app_service_config_files = mkIf enable (map (cfg: cfg.configuration.path) enabledAppservices); 31 | appservices = mapAttrs (_: appservice: appservice.registration.set) localAppservices; 32 | }; 33 | systemd.services.matrix-synapse = mkIf (config.services.matrix-synapse.enable && enable) { 34 | serviceConfig = { 35 | RuntimeDirectory = "matrix-synapse"; 36 | }; 37 | preStart = mkMerge (map (appservice: '' 38 | ${appservice.configuration.out.generate} 39 | '') enabledAppservices); 40 | }; 41 | }; 42 | } 43 | -------------------------------------------------------------------------------- /pkgs/public/wireplumber/wireplumber.nix: -------------------------------------------------------------------------------- 1 | { stdenv 2 | , fetchFromGitLab 3 | , lib 4 | , meson, ninja 5 | , gobject-introspection ? null 6 | , lua5_3 ? null 7 | , lua5_4 ? null 8 | , pkg-config 9 | , glib 10 | , elogind 11 | , pipewire 12 | , systemd 13 | , python3 14 | , doxygen 15 | , enableIntrospection ? stdenv.hostPlatform == stdenv.buildPlatform 16 | , enableDocs ? false 17 | }@args: with lib; let 18 | mesonFeature = v: if v then "enabled" else "disabled"; 19 | mesonBool = v: if v then "true" else "false"; 20 | lua = args.lua5_4 or lua5_3; 21 | python = python3.withPackages (p: with p; [ 22 | lxml 23 | ] ++ optionals enableDocs [ 24 | sphinx sphinx_rtd_theme breathe 25 | ]); 26 | in stdenv.mkDerivation rec { 27 | pname = "wireplumber"; 28 | version = "0.4.4"; 29 | 30 | src = fetchFromGitLab { 31 | domain = "gitlab.freedesktop.org"; 32 | owner = "pipewire"; 33 | repo = pname; 34 | rev = version; 35 | sha256 = "0vr84xlnwlhrfq9l13rxh8cb8s389wlyafvi6bah444acmpx1lwv"; 36 | }; 37 | 38 | outputs = [ "out" "dev" ] ++ optional enableDocs "doc"; 39 | 40 | nativeBuildInputs = [ meson ninja pkg-config python doxygen ] 41 | ++ optional enableIntrospection gobject-introspection; 42 | 43 | buildInputs = [ lua glib pipewire systemd elogind ]; 44 | 45 | mesonFlags = [ 46 | "-Dintrospection=${mesonFeature enableIntrospection}" 47 | "-Dsystem-lua=${mesonBool (lua != null)}" 48 | "-Ddoc=${mesonFeature enableDocs}" 49 | "-Dsystemd-user-unit-dir=${placeholder "out"}/lib/systemd/user" 50 | "-Dsystemd-system-unit-dir=${placeholder "out"}/lib/systemd/system" 51 | "-Dsystemd-user-service=true" 52 | "-Dsystemd-system-service=true" 53 | ]; 54 | 55 | meta.broken = lib.versionOlder pipewire.version "0.3.37"; 56 | } 57 | -------------------------------------------------------------------------------- /modules/home/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | git = ./git.nix; 3 | github = ./github.nix; 4 | bitbucket = ./bitbucket.nix; 5 | devops = ./devops.nix; 6 | sshd = ./sshd.nix; 7 | ssh = ./ssh.nix; 8 | konawall = ./konawall.nix; 9 | task = ./task.nix; 10 | page = ./page.nix; 11 | starship = ./starship.nix; 12 | kakoune = ./kakoune.nix; 13 | rustfmt = ./rustfmt.nix; 14 | filebin = ./filebin.nix; 15 | display = ./display.nix; 16 | buku = ./buku.nix; 17 | i3 = ./i3.nix; 18 | i3gopher = ./i3gopher.nix; 19 | lorri = ./lorri.nix; 20 | shell = ./shell.nix; 21 | less = ./less.nix; 22 | firefox = ./firefox.nix; 23 | tridactyl = ./tridactyl.nix; 24 | ncpamixer = ./ncpamixer.nix; 25 | ncmpcpp = ./ncmpcpp.nix; 26 | mpc = ./mpc.nix; 27 | mpd = ./mpd.nix; 28 | pulsemixer = ./pulsemixer.nix; 29 | nix-path = ./nix-path.nix; 30 | offlineimap = ./offlineimap.nix; 31 | syncplay = ./syncplay.nix; 32 | imv = ./imv.nix; 33 | weechat = ./weechat.nix; 34 | xdg = ./xdg.nix; 35 | watchdog = ./watchdog.nix; 36 | user = ./user.nix; 37 | bindings = ./bindings.nix; 38 | 39 | __functionArgs = { }; 40 | __functor = self: { ... }: { 41 | imports = with self; [ 42 | git github bitbucket devops 43 | sshd ssh 44 | konawall 45 | task 46 | page 47 | starship 48 | kakoune 49 | rustfmt 50 | filebin 51 | display 52 | buku 53 | i3 i3gopher 54 | lorri 55 | shell 56 | less 57 | firefox 58 | tridactyl 59 | ncpamixer 60 | ncmpcpp mpc 61 | mpd 62 | pulsemixer 63 | nix-path 64 | offlineimap 65 | syncplay 66 | imv 67 | weechat 68 | xdg 69 | watchdog 70 | user 71 | bindings 72 | ]; 73 | }; 74 | } 75 | -------------------------------------------------------------------------------- /lib/alsa.nix: -------------------------------------------------------------------------------- 1 | { lib }: with lib; let 2 | needsQuote = value: hasInfix " " value || hasInfix "'" value || hasInfix "$" value || hasInfix "," value || hasInfix "/" value; 3 | quotedStr = name: ''"${name}"''; 4 | quotedKey = name: 5 | if needsQuote name 6 | then ''"${name}"'' 7 | else name; 8 | alsaConf = conf: let 9 | directives = 10 | if isAttrs conf then alsaConfDirectives conf 11 | else if isList conf then concatMap alsaConfDirectives conf 12 | else throw "invalid alsaconf type"; 13 | in concatStringsSep "\n" ([ 14 | "Syntax 3" 15 | ] ++ directives); 16 | alsaConfDirectives = conf: mapAttrsToList alsaConfDirective conf; 17 | alsaConfDirective = key: value: let 18 | keyStr = 19 | if isString key 20 | then quotedKey key 21 | else concatMapStringsSep "." quotedKey key; 22 | in "${keyStr} " + alsaConfValue value; 23 | alsaListValue = value: 24 | if isString value then quotedStr value 25 | else if isAttrs value then concatStringsSep "\n" (alsaConfDirectives value) 26 | else toString value; 27 | alsaConfValue = value: 28 | if isString value then quotedStr value 29 | else if isList value then "[\n" + concatMapStringsSep "\n" alsaListValue value + "\n]" 30 | else if isAttrs value then "{\n" + concatStringsSep "\n" (alsaConfDirectives value) + "\n}" 31 | else toString value; 32 | alsaDirectiveTypePrimitives = with types; [ 33 | str int float 34 | ]; 35 | alsaDirectiveType = with types; oneOf ([ 36 | (listOf (oneOf (alsaDirectiveTypePrimitives ++ singleton (attrsOf (oneOf alsaDirectiveTypePrimitives))))) 37 | (attrsOf alsaDirectiveType // { description = "attrs"; }) 38 | ] ++ alsaDirectiveTypePrimitives); 39 | in { 40 | inherit alsaConf alsaConfDirective alsaDirectiveType; 41 | } 42 | -------------------------------------------------------------------------------- /pkgs/public/linux/generate-config.patch: -------------------------------------------------------------------------------- 1 | diff --git a/pkgs/os-specific/linux/kernel/generate-config.pl b/pkgs/os-specific/linux/kernel/generate-config.pl 2 | index f886fcfdc35..0eae358c449 100644 3 | --- a/pkgs/os-specific/linux/kernel/generate-config.pl 4 | +++ b/pkgs/os-specific/linux/kernel/generate-config.pl 5 | @@ -1,3 +1,4 @@ 6 | +#!/bin/env perl -w 7 | # This script runs `make config' to generate a Linux kernel 8 | # configuration file. For each question (i.e. kernel configuration 9 | # option), unless an override is provided, it answers "m" if possible, 10 | @@ -47,7 +48,7 @@ sub runConfig { 11 | my $line = ""; my $s; 12 | my %choices = (); 13 | 14 | - my ($prevQuestion, $prevName); 15 | + my ($prevQuestion, $prevAnswer, $prevName); 16 | 17 | while (!eof IN) { 18 | read IN, $s, 1 or next; 19 | @@ -76,10 +77,12 @@ sub runConfig { 20 | # Build everything as a module if possible. 21 | $answer = "m" if $autoModules && $alts =~ /\/m/ && !($preferBuiltin && $alts =~ /Y/); 22 | $answer = $answers{$name} if defined $answers{$name}; 23 | + $answer = "" if $prevQuestion && $prevQuestion eq $question && $name eq $prevName; 24 | print STDERR "QUESTION: $question, NAME: $name, ALTS: $alts, ANSWER: $answer\n" if $debug; 25 | print OUT "$answer\n"; 26 | - die "repeated question: $question" if $prevQuestion && $prevQuestion eq $question && $name eq $prevName; 27 | + die "repeated question: $question" if $prevQuestion && $prevQuestion eq $question && $name eq $prevName && $prevAnswer eq ""; 28 | $prevQuestion = $question; 29 | + $prevAnswer = $answer; 30 | $prevName = $name; 31 | } 32 | 33 | -------------------------------------------------------------------------------- /pkgs/public/nvidia-vbios-vfio-patcher/rtx.patch: -------------------------------------------------------------------------------- 1 | diff --git a/nvidia_vbios_vfio_patcher.py b/nvidia_vbios_vfio_patcher.py 2 | index 80087e8..b5aa9ab 100755 3 | --- a/nvidia_vbios_vfio_patcher.py 4 | +++ b/nvidia_vbios_vfio_patcher.py 5 | @@ -70,14 +70,20 @@ class VBIOSROM(object): 6 | # Search for the footer, which are shortly followed by 7 | # 'NPDS' and 'NPDE' strings. 'NPDS' and 'NPDE' markers are separated by 8 | # 28 ASCII characters 9 | - FOOTER_REGEX = ( 10 | - b'564e(([a-z]|[0-9]){348})(4e504453)(([a-z]|[0-9]){56})(4e504445)' 11 | - ) 12 | - result = re.compile(FOOTER_REGEX).search(self.content) 13 | - if not result or len(result.groups()) != 6: 14 | - raise CheckException("Couldn't find the ROM footer!") 15 | - 16 | - self.offsets["footer"] = result.start(0) 17 | + FOOTER_DETECTORS = [ 18 | + (b'564e(([a-z]|[0-9]){476})(4e504453)(([a-z]|[0-9]){56})(4e504445)', 'RTX 20XX / GTX 16XX'), 19 | + (b'564e(([a-z]|[0-9]){348})(4e504453)(([a-z]|[0-9]){56})(4e504445)', 'GTX 10XX'), 20 | + (b'564e(([a-z]|[0-9]){124})(4e504453)(([a-z]|[0-9]){56})(4e504445)', 'GTX XXX (400 - 900 Series)'), 21 | + ] 22 | + for FOOTER_REGEX, SERIES in FOOTER_DETECTORS: 23 | + result = re.compile(FOOTER_REGEX).search(self.content) 24 | + if result and len(result.groups()) == 6: 25 | + self.offsets["footer"] = result.start(0) 26 | + print("ROM footer for " + SERIES + " found!") 27 | + return 28 | + 29 | + raise CheckException("Couldn't find the ROM footer!") 30 | + 31 | 32 | def run_sanity_tests(self, ignore_check=False): 33 | """ 34 | -------------------------------------------------------------------------------- /modules/nixos/mosh.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, lib, ... }: with lib; let 2 | cfg = config.services.mosh; 3 | # TODO: if no extraArguments are supplied, just put normal mosh-server in $PATH? 4 | extraArguments = map escapeShellArg cfg.extraArguments; 5 | mosh-server = pkgs.writeShellScriptBin "mosh-server" '' 6 | if [[ $1 != new ]]; then 7 | echo "unknown command $1" >&2 8 | exit 1 9 | fi 10 | shift 11 | 12 | exec ${cfg.package}/bin/mosh-server new ${concatStringsSep " " extraArguments} "$@" 13 | ''; 14 | in { 15 | options.services.mosh = { 16 | enable = mkEnableOption "mosh-server"; 17 | 18 | package = mkOption { 19 | type = types.package; 20 | default = pkgs.mosh; 21 | defaultText = "pkgs.mosh"; 22 | }; 23 | 24 | ports = { 25 | from = mkOption { 26 | type = types.nullOr types.port; 27 | default = null; 28 | example = "30000"; 29 | }; 30 | 31 | to = mkOption { 32 | type = types.nullOr types.port; 33 | default = null; 34 | example = "40000"; 35 | }; 36 | }; 37 | 38 | extraArguments = mkOption { 39 | type = types.listOf types.str; 40 | default = []; 41 | }; 42 | }; 43 | 44 | config = mkIf cfg.enable { 45 | environment.systemPackages = singleton mosh-server; 46 | services.mosh.extraArguments = let 47 | portRange = "${toString cfg.ports.from}" + optionalString (cfg.ports.to != null) ":${toString cfg.ports.to}"; 48 | in optionals (cfg.ports.from != null) [ 49 | "-p" portRange 50 | ]; 51 | networking.firewall.allowedUDPPortRanges = mkIf (cfg.ports.from != null && cfg.ports.to != null) [ { 52 | inherit (cfg.ports) from to; 53 | } ]; 54 | networking.firewall.allowedUDPPorts = mkIf (cfg.ports.from != null && cfg.ports.to == null) [ cfg.ports.from ]; 55 | }; 56 | } 57 | -------------------------------------------------------------------------------- /pkgs/polybarScripts.nix: -------------------------------------------------------------------------------- 1 | let 2 | src = { 3 | owner = "polybar"; 4 | repo = "polybar-scripts"; 5 | rev = "8a6a2c7fc6beb281515f81ccf5b9fafc830a3230"; 6 | sha256 = "sha256-4f12SSidJGElPbHs94WyoKj9kJH4dWsZSqMGOyzSJII="; 7 | version = "2024.05.21"; 8 | }; 9 | in { 10 | player-mpris-tail = { 11 | python3Packages 12 | , lib, fetchFromGitHub 13 | , gobject-introspection, wrapGAppsHook3 14 | , pip ? buildPackages.python3Packages.pip, buildPackages 15 | }: let 16 | sourceRoot = "source/polybar-scripts/player-mpris-tail"; 17 | in python3Packages.buildPythonApplication { 18 | pname = "mpris-tail"; 19 | inherit (src) version; 20 | 21 | inherit sourceRoot; 22 | src = fetchFromGitHub { 23 | inherit (src) owner repo rev sha256; 24 | }; 25 | format = "setuptools"; 26 | 27 | propagatedBuildInputs = with python3Packages; [ 28 | dbus-python 29 | pygobject3 30 | ]; 31 | 32 | nativeBuildInputs = [ 33 | pip 34 | gobject-introspection 35 | wrapGAppsHook3 36 | ]; 37 | 38 | passAsFile = [ "setup" ]; 39 | setupRequirements = ["dbus-python" "pygobject"]; 40 | setup = '' 41 | import os 42 | from setuptools import find_packages, setup 43 | setup( 44 | name='@pname@', 45 | version='@version@', 46 | install_requires=os.environ["setupRequirements"].split(), 47 | packages=find_packages(), 48 | scripts=['player-mpris-tail.py'], 49 | ) 50 | ''; 51 | postPatch = '' 52 | substituteAll $setupPath setup.py 53 | ''; 54 | 55 | meta = { 56 | description = "Displays the current track and the play-pause status without polling"; 57 | homepage = "https://github.com/${src.owner}/${src.repo}/tree/master/${sourceRoot}"; 58 | mainProgram = "player-mpris-tail.py"; 59 | }; 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /pkgs/urxvt/osc-52.nix: -------------------------------------------------------------------------------- 1 | { stdenvNoCC, writeScript, fetchFromGitHub, perl }: 2 | 3 | stdenvNoCC.mkDerivation { 4 | name = "urxvt-osc-52"; 5 | dontPatchShebangs = true; 6 | 7 | # https://github.com/parantapa/dotfiles/blob/master/urxvt-perl/52-osc 8 | # #! ${perl}/bin/perl 9 | # #! perl 10 | src = writeScript "osc52.pl" '' 11 | #! ${perl}/bin/perl 12 | 13 | =head1 NAME 14 | 15 | 52-osc - Implement OSC 32 ; Interact with X11 clipboard 16 | 17 | =head1 SYNOPSIS 18 | 19 | urxvt -pe 52-osc 20 | 21 | =head1 DESCRIPTION 22 | 23 | This extension implements OSC 52 for interacting with system clipboard 24 | 25 | Most code stolen from: 26 | http://ailin.tucana.uberspace.de/static/nei/*/Code/urxvt/ 27 | 28 | =cut 29 | 30 | use MIME::Base64; 31 | use Encode; 32 | 33 | sub on_osc_seq { 34 | my ($term, $op, $args) = @_; 35 | return () unless $op eq 52; 36 | 37 | my ($clip, $data) = split ';', $args, 2; 38 | if ($data eq '?') { 39 | if ($clip !~ /c/) { 40 | # I don't feel like doing the x11 selection dance, maybe cave in and `xsel -po` here instead? 41 | $term->selection_grab(urxvt::CurrentTime, $clip =~ /c/); 42 | } 43 | my $data_free = $term->selection(undef, $clip =~ /c/); 44 | Encode::_utf8_off($data_free); # XXX 45 | $term->tt_write("\e]52;$clip;".encode_base64($data_free, "")."\a"); 46 | } 47 | else { 48 | my $data_decoded = decode_base64($data); 49 | Encode::_utf8_on($data_decoded); # XXX 50 | $term->selection($data_decoded, $clip =~ /c/); 51 | $term->selection_grab(urxvt::CurrentTime, $clip =~ /c/); 52 | } 53 | 54 | () 55 | } 56 | ''; 57 | 58 | unpackPhase = "true"; 59 | installPhase = '' 60 | install -Dm 0755 $src $out/lib/urxvt/perl/osc-52 61 | ''; 62 | } 63 | -------------------------------------------------------------------------------- /modules/home/pulsemixer.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: with lib; let 2 | cfg = config.programs.pulsemixer; 3 | ini = pkgs.formats.ini { }; 4 | convertValue = value: 5 | if value == true then "yes" 6 | else if value == false then "no" 7 | else toString value; 8 | valueType = with types; oneOf [ int str bool ]; 9 | in { 10 | options.programs.pulsemixer = { 11 | enable = mkEnableOption "pulsemixer"; 12 | 13 | package = mkOption { 14 | type = types.package; 15 | default = pkgs.pulsemixer; 16 | defaultText = "pkgs.pulsemixer"; 17 | }; 18 | 19 | # https://github.com/GeorgeFilipkin/pulsemixer#configuration 20 | config = { 21 | general = mkOption { 22 | type = types.attrsOf valueType; 23 | default = { }; 24 | }; 25 | ui = mkOption { 26 | type = types.attrsOf valueType; 27 | default = { }; 28 | }; 29 | style = mkOption { 30 | type = with types; attrsOf str; 31 | default = { }; 32 | }; 33 | renames = mkOption { 34 | type = with types; attrsOf str; 35 | default = { }; 36 | }; 37 | }; 38 | 39 | configContent = mkOption { 40 | inherit (ini) type; 41 | }; 42 | }; 43 | 44 | config = { 45 | home.packages = mkIf cfg.enable [ cfg.package ]; 46 | xdg.configFile."pulsemixer.cfg" = mkIf cfg.enable { 47 | source = ini.generate "pulsemixer" cfg.configContent; 48 | }; 49 | programs.pulsemixer = { 50 | configContent = { 51 | general = mapAttrs (_: value: mkOptionDefault (convertValue value)) cfg.config.general; 52 | ui = mapAttrs (_: value: mkOptionDefault (convertValue value)) cfg.config.ui; 53 | style = mapAttrs (_: mkOptionDefault) cfg.config.style; 54 | renames = mapAttrs (_: mkOptionDefault) cfg.config.renames; 55 | }; 56 | }; 57 | }; 58 | } 59 | -------------------------------------------------------------------------------- /modules/home/bindings.nix: -------------------------------------------------------------------------------- 1 | { commonRoot, pkgs, nixosConfig, config, options, lib, ... }: with lib; let 2 | cfg = config.networking; 3 | arc'lib = import ../../lib { inherit lib; }; 4 | unmerged = lib.unmerged or arc'lib.unmerged; 5 | hasOsBindings = config.nixos.hasSettings && nixosConfig ? networking.bindings; 6 | hasCommonRoot = (builtins.tryEval (commonRoot ? tag)).value; 7 | addCommonRoot = optional hasCommonRoot commonRoot.tag; 8 | in { 9 | options = { 10 | networking = { 11 | bindings = mkOption { 12 | type = unmerged.types.attrs; 13 | default = { }; 14 | }; 15 | domains = mkOption { 16 | type = unmerged.types.attrs; 17 | default = { }; 18 | }; 19 | evalBindings = mkOption { 20 | type = types.attrsOf (types.submodule ([ 21 | ../misc/binding.nix 22 | ] ++ addCommonRoot)); 23 | internal = true; 24 | }; 25 | evalDomains = mkOption { 26 | type = types.attrsOf (types.submodule ([ 27 | ../misc/domain.nix 28 | ({ ... }: { 29 | config._module.args = { 30 | inherit pkgs nixosConfig; 31 | homeConfig = config; 32 | }; 33 | }) 34 | ] ++ addCommonRoot)); 35 | internal = true; 36 | }; 37 | }; 38 | }; 39 | config = { 40 | networking.evalBindings = unmerged.mergeAttrs cfg.bindings; 41 | networking.evalDomains = unmerged.mergeAttrs cfg.domains; 42 | nixos.settings.networking = mapAttrs (_: unmerged.mergeAttrs) { 43 | inherit (cfg) bindings domains; 44 | }; 45 | _module.args.networking = { 46 | bindings = if hasOsBindings 47 | then nixosConfig.networking.bindings 48 | else cfg.evalBindings; 49 | domains = if hasOsBindings 50 | then nixosConfig.networking.domains 51 | else cfg.evalDomains; 52 | }; 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /pkgs/customized/rnnoise-plugin.diff: -------------------------------------------------------------------------------- 1 | commit 0e4540ae60278f22c4f2c7e1dd0bc42eafc17783 2 | Author: arcnmx 3 | Date: Mon May 24 01:38:15 2021 -0700 4 | 5 | support external rnnoise 6 | 7 | diff --git a/CMakeLists.txt b/CMakeLists.txt 8 | index a15261f..3d59cc1 100644 9 | --- a/CMakeLists.txt 10 | +++ b/CMakeLists.txt 11 | @@ -13,7 +13,15 @@ option(BUILD_VST_PLUGIN "If the VST plugin should be built" ON) 12 | option(BUILD_LV2_PLUGIN "If the LV2 plugin should be built" ON) 13 | option(BUILD_LADSPA_PLUGIN "If the LADSPA plugin should be built" ON) 14 | 15 | -add_subdirectory(src/rnnoise) 16 | +find_package(PkgConfig) 17 | +if(PkgConfig_FOUND) 18 | + pkg_search_module(RNNOISE IMPORTED_TARGET rnnoise) 19 | + if(rnnoise_FOUND) 20 | + add_library(RnNoise ALIAS PkgConfig::RNNOISE) 21 | + else() 22 | + add_subdirectory(src/rnnoise) 23 | + endif() 24 | +endif() 25 | add_subdirectory(src/common) 26 | if(BUILD_VST_PLUGIN) 27 | add_subdirectory(src/vst_plugin) 28 | diff --git a/src/common/src/RnNoiseCommonPlugin.cpp b/src/common/src/RnNoiseCommonPlugin.cpp 29 | index 7d62f49..e6ae467 100644 30 | --- a/src/common/src/RnNoiseCommonPlugin.cpp 31 | +++ b/src/common/src/RnNoiseCommonPlugin.cpp 32 | @@ -6,7 +6,7 @@ 33 | #include 34 | #include 35 | 36 | -#include 37 | +#include 38 | 39 | void RnNoiseCommonPlugin::init() { 40 | deinit(); 41 | @@ -111,7 +111,7 @@ void RnNoiseCommonPlugin::process(const float *in, float *out, int32_t sampleFra 42 | } 43 | 44 | void RnNoiseCommonPlugin::createDenoiseState() { 45 | - m_denoiseState = std::shared_ptr(rnnoise_create(), [](DenoiseState *st) { 46 | + m_denoiseState = std::shared_ptr(rnnoise_create(NULL), [](DenoiseState *st) { 47 | rnnoise_destroy(st); 48 | }); 49 | } 50 | \ No newline at end of file 51 | -------------------------------------------------------------------------------- /pkgs/public/nvidia-capture-sdk.nix: -------------------------------------------------------------------------------- 1 | { stdenv 2 | , lib 3 | , requireFile 4 | , unzip 5 | , msitools 6 | }: with lib; stdenv.mkDerivation rec { 7 | pname = "nvidia-capture-sdk"; 8 | version = if stdenv.isLinux 9 | then "8.0.4" 10 | else "7.1.1"; 11 | 12 | src = requireFile { 13 | url = "https://developer.nvidia.com/capture-sdk"; 14 | name = if stdenv.isLinux 15 | then "Capture_Linux_v${version}.tgz" 16 | else "NVIDIA-Capture-SDK-${version}.zip"; 17 | sha256 = if stdenv.isLinux 18 | then "17mbwnm28dj2bp0k3wyx7vwwzj6ysarjfdhykm8fhqha471g1pv2" 19 | else "1v1lvrpmf3lby1kih5f3x69qj4dlxm0cmgji947byyi8dypaahx5"; 20 | }; 21 | 22 | nativeBuildInputs = optionals stdenv.hostPlatform.isWindows [ unzip msitools ]; 23 | 24 | unpackPhase = optionalString stdenv.hostPlatform.isWindows '' 25 | unzip $src 26 | msiextract NVIDIA-Capture-SDK-${version}.msi 27 | ''; 28 | 29 | buildPhase = ":"; 30 | 31 | outputs = [ "out" "sdk" ]; 32 | 33 | nvPrefix = if stdenv.isLinux 34 | then "NvFBC" 35 | else "Program Files/NVIDIA Corporation/NVIDIA Capture SDK"; 36 | 37 | installPhase = '' 38 | runHook preInstall 39 | 40 | install -d $out 41 | mv "$nvPrefix/inc" $out/include 42 | 43 | install -d $sdk 44 | ln -s $out/include $sdk/inc 45 | 46 | if [[ -d "$nvPrefix/bin" ]]; then 47 | mv "$nvPrefix/bin" $out/ 48 | ln -s $out/bin $sdk/bin 49 | fi 50 | 51 | '' + optionalString stdenv.hostPlatform.isWindows '' 52 | ln -s NvEncodeAPI/NvEncodeAPI.h $out/nvEncodeAPI.h 53 | ln -s NvFBC/nvFBC.h $out/NvFBC.h 54 | '' + '' 55 | runHook postInstall 56 | ''; 57 | 58 | postFixup = optionalString stdenv.hostPlatform.isMinGW '' 59 | sed -i -e 's/Windows\.h/windows.h/' $out/include/NvFBC/*.h 60 | ''; 61 | 62 | meta = { 63 | license = licenses.unfree; 64 | platforms = with platforms; linux ++ windows; 65 | }; 66 | } 67 | -------------------------------------------------------------------------------- /pkgs/public/crates/cargo-llvm-lines-fix-filter.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/main.rs b/src/main.rs 2 | index 855b4fc..68ab87b 100644 3 | --- a/src/main.rs 4 | +++ b/src/main.rs 5 | @@ -23,8 +23,6 @@ enum Opt { 6 | raw(setting = "structopt::clap::AppSettings::AllowExternalSubcommands") 7 | )] 8 | LLVMLines { 9 | - #[structopt(long = "filter-cargo", raw(hidden = "true"))] 10 | - filter_cargo: bool, 11 | #[structopt(long = "lib", raw(hidden = "true"))] 12 | lib: bool, 13 | 14 | @@ -44,10 +42,10 @@ enum Opt { 15 | 16 | fn main() { 17 | let Opt::LLVMLines { 18 | - filter_cargo, sort, .. 19 | + sort, .. 20 | } = Opt::from_args(); 21 | 22 | - let result = cargo_llvm_lines(filter_cargo, sort); 23 | + let result = cargo_llvm_lines(env::var_os(FILTER_CARGO).is_some(), sort); 24 | 25 | process::exit(match result { 26 | Ok(code) => code, 27 | @@ -73,6 +71,8 @@ fn cargo_llvm_lines(filter_cargo: bool, sort_order: SortOrder) -> io::Result io::Result<()> { 34 | let mut cmd = Command::new("cargo"); 35 | let args: Vec<_> = env::args_os() 36 | @@ -86,7 +86,6 @@ fn run_cargo_rustc(outfile: PathBuf) -> io::Result<()> { 37 | 38 | let mut filter_cargo = Vec::new(); 39 | filter_cargo.extend(args.iter().map(OsString::as_os_str)); 40 | - filter_cargo.push(OsStr::new("--filter-cargo")); 41 | 42 | let _wait = cmd.pipe_to(&[OsStr::new("cat")], &filter_cargo)?; 43 | run(cmd)?; 44 | @@ -278,6 +277,7 @@ impl PipeTo for Command { 45 | errcmd.stdin(stderr); 46 | errcmd.stdout(Stdio::null()); 47 | errcmd.stderr(Stdio::inherit()); 48 | + errcmd.env(FILTER_CARGO, "1"); 49 | let spawn = errcmd.spawn()?; 50 | Ok(Wait(vec![spawn, child])) 51 | } 52 | -------------------------------------------------------------------------------- /modules/nixos/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | nix = ./nix.nix; 3 | systemd = ./systemd.nix; 4 | systemd-user-translate = ./systemd-user-translate.nix; 5 | polkit-systemd = ./polkit-systemd.nix; 6 | users-chroot = ./users-chroot.nix; 7 | cpuinfo = ./cpuinfo.nix; 8 | dht22-exporter = ./dht22-exporter.nix; 9 | modprobe = ./modprobe.nix; 10 | kernel = ./kernel.nix; 11 | dsdt = ./dsdt.nix; 12 | crypttab = ./crypttab.nix; 13 | target = ./target.nix; 14 | glauth = ./glauth.nix; 15 | common-root = ./common-root.nix; 16 | mutable-state = ./mutable-state.nix; 17 | pulseaudio = ./pulseaudio.nix; 18 | wireplumber = ./wireplumber.nix; 19 | alsa = ./alsa.nix; 20 | yggdrasil = ./yggdrasil.nix; 21 | ddclient3 = ./ddclient.nix; 22 | bindings = import ./bindings.nix // { 23 | __functor = _: { ... }: { imports = [ ./bindings.nix ]; }; 24 | }; 25 | service-bindings = import ./service-bindings.nix // { 26 | __functor = _: { ... }: { imports = [ ./service-bindings.nix ]; }; 27 | }; 28 | matrix-appservices = ./matrix-appservices.nix; 29 | matrix-synapse-appservices = ./matrix-synapse-appservices.nix; 30 | display = ./display.nix; 31 | filebin = ./filebin.nix; 32 | mosh = ./mosh.nix; 33 | home = ./home.nix; 34 | doc-warnings = ./doc-warnings.nix; 35 | 36 | __functionArgs = { }; 37 | __functor = self: { ... }: { 38 | imports = with self; [ 39 | nix 40 | systemd 41 | systemd-user-translate 42 | polkit-systemd 43 | users-chroot 44 | cpuinfo 45 | dht22-exporter 46 | target 47 | glauth 48 | modprobe 49 | kernel dsdt 50 | crypttab 51 | mutable-state 52 | common-root 53 | pulseaudio 54 | wireplumber 55 | alsa 56 | yggdrasil 57 | bindings 58 | service-bindings 59 | matrix-appservices 60 | matrix-synapse-appservices 61 | display 62 | filebin 63 | mosh 64 | home 65 | doc-warnings 66 | ]; 67 | }; 68 | } 69 | -------------------------------------------------------------------------------- /pkgs/obs/streamfx-cmake.patch: -------------------------------------------------------------------------------- 1 | diff --git a/CMakeLists.txt b/CMakeLists.txt 2 | index 2ab9755..9010777 100644 3 | --- a/CMakeLists.txt 4 | +++ b/CMakeLists.txt 5 | @@ -108,12 +108,12 @@ if(NOT (${PREFIX}VERSION STREQUAL "")) 6 | list(GET T_VERSION 0 VERSION_MAJOR) 7 | list(GET T_VERSION 1 VERSION_MINOR) 8 | list(GET T_VERSION 2 VERSION_PATCH) 9 | - if (T_VERSIONLEN GREATER_EQUAL 3) 10 | + if (T_VERSIONLEN GREATER_EQUAL 4) 11 | list(GET T_VERSION 3 VERSION_TWEAK) 12 | else() 13 | set(VERSION_BUILD 0) 14 | endif() 15 | - if (T_VERSIONLEN GREATER_EQUAL 4) 16 | + if (T_VERSIONLEN GREATER_EQUAL 5) 17 | list(GET T_VERSION 4 VERSION_COMMIT) 18 | else() 19 | set(VERSION_COMMIT "") 20 | @@ -170,7 +170,7 @@ set(PROJECT_VERSION_STRING ${VERSION_STRING}) 21 | ################################################################################ 22 | 23 | # Search Paths 24 | -set(CMAKE_MODULE_PATH 25 | +list(APPEND CMAKE_MODULE_PATH 26 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake/clang" 27 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" 28 | "${CMAKE_CURRENT_SOURCE_DIR}/cmake" 29 | @@ -407,16 +407,7 @@ if(NOT ${PREFIX}OBS_NATIVE) 30 | endif() 31 | endif() 32 | 33 | - # Download libOBS 34 | - download_project( 35 | - PROJ libobs 36 | - URL "${_DOWNLOAD_OBS_URL}" 37 | - URL_HASH "${_DOWNLOAD_OBS_HASH}" 38 | - DOWNLOAD_NO_PROGRESS OFF 39 | - UPDATE_DISCONNECTED OFF 40 | - ) 41 | - 42 | - include("${libobs_SOURCE_DIR}/cmake/LibObs/LibObsConfig.cmake") 43 | + find_package(LibObs REQUIRED CONFIG) 44 | endif() 45 | 46 | ################################################################################ 47 | @@ -876,10 +867,7 @@ if(REQUIRE_OBSFE) 48 | set(HAVE_OBSFE ON) 49 | endif() 50 | else() 51 | - if (EXISTS "${libobs_SOURCE_DIR}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake") 52 | - include("${libobs_SOURCE_DIR}/cmake/obs-frontend-api/obs-frontend-apiConfig.cmake") 53 | - set(HAVE_OBSFE ON) 54 | - endif() 55 | + set(HAVE_OBSFE ON) 56 | endif() 57 | endif() 58 | 59 | -------------------------------------------------------------------------------- /pkgs/public/firenvim-native.nix: -------------------------------------------------------------------------------- 1 | { runCommand 2 | , neovim-unwrapped 3 | , firenvim ? vimPlugins.firenvim or null, vimPlugins 4 | , lib 5 | }: runCommand "firenvim-native" { 6 | nativeBuildInputs = [ neovim-unwrapped ]; 7 | inherit firenvim; 8 | vimExe = neovim-unwrapped.meta.mainProgram or (lib.getName neovim-unwrapped); 9 | meta.broken = firenvim == null; 10 | } '' 11 | mkdir home 12 | export HOME=$PWD/home 13 | export XDG_CONFIG_HOME=$HOME/.config 14 | export XDG_DATA_HOME=$HOME/.local/share 15 | export XDG_RUNTIME_DIR=$PWD/run 16 | $vimExe --headless -n --clean \ 17 | --cmd "source $firenvim/autoload/firenvim.vim" \ 18 | --cmd "call firenvim#install(1)" \ 19 | --cmd quit 20 | ls -l 21 | 22 | install -d $out/lib/{mozilla,librewolf} $out/etc/{chromium,vivaldi,opt/chrome,opt/brave,opt/edge} 23 | mv $HOME/.mozilla/native-messaging-hosts $out/lib/mozilla/ 24 | mv $HOME/.librewolf/native-messaging-hosts $out/lib/librewolf/ 25 | mv $XDG_CONFIG_HOME/vivaldi/NativeMessagingHosts $out/etc/vivaldi/native-messaging-hosts 26 | mv $XDG_CONFIG_HOME/chromium/NativeMessagingHosts $out/etc/chromium/native-messaging-hosts 27 | mv $XDG_CONFIG_HOME/google-chrome/NativeMessagingHosts $out/etc/opt/chrome/native-messaging-hosts 28 | mv $XDG_CONFIG_HOME/BraveSoftware/Brave-Browser/NativeMessagingHosts $out/etc/opt/brave/native-messaging-hosts 29 | mv $XDG_CONFIG_HOME/microsoft-edge/NativeMessagingHosts $out/etc/opt/edge/native-messaging-hosts 30 | 31 | FIRENVIM_BIN=$XDG_DATA_HOME/firenvim/firenvim 32 | sed -i \ 33 | -e "s|$XDG_CONFIG_HOME|\\\$XDG_CONFIG_HOME|" \ 34 | -e "s|$XDG_DATA_HOME|\\\$XDG_DATA_HOME|" \ 35 | -e "s|$XDG_RUNTIME_DIR|\\\$XDG_RUNTIME_DIR|" \ 36 | -e "s|$(type -P $vimExe)|$vimExe|" \ 37 | -e "/XDG_DATA_DIRS=/d" \ 38 | -e "/export PATH=/d" \ 39 | $FIRENVIM_BIN 40 | install -Dm0755 -t $out/lib/firenvim $FIRENVIM_BIN 41 | find $out -name '*.json' -exec sed -i \ 42 | -e "s|$FIRENVIM_BIN|$out/lib/firenvim/firenvim|" \ 43 | "{}" \; 44 | '' 45 | -------------------------------------------------------------------------------- /modules/home/display.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, config, ... }: with lib; let 2 | hconfig = config; 3 | displayType = { name, config, ... }: { 4 | imports = [ ../misc/display.nix ]; 5 | 6 | options = { 7 | dynamic = { 8 | nvidia = mkOption { 9 | type = types.package; 10 | }; 11 | xrandr = mkOption { 12 | type = types.package; 13 | }; 14 | postLayout = mkOption { 15 | type = types.lines; 16 | default = ""; 17 | }; 18 | }; 19 | }; 20 | config = { 21 | enable = mkDefault true; 22 | dynamic = let 23 | nvidia-args = { 24 | assign = "CurrentMetaMode=${config.nvidia.metaModes}"; 25 | }; 26 | displayset-nvidia = pkgs.writeShellScript "displayset-${name}-nvidia" '' 27 | nvidia-settings ${cli.toGNUCommandLineShell { } nvidia-args} 28 | ${config.dynamic.postLayout} 29 | ''; 30 | xrandr-args = { 31 | 32 | }; 33 | displayset-xrandr = pkgs.writeShellScript "displayset-${name}-xrandr" '' 34 | xrandr ${escapeShellArgs config.xserver.xrandr.args} 35 | ${config.dynamic.postLayout} 36 | ''; 37 | in { 38 | postLayout = mkIf hconfig.services.polybar.enable '' 39 | ${hconfig.systemd.user.systemctlPath} --user restart polybar.service 40 | ''; # monitor count might change, also polybar tray can break on bar movement 41 | nvidia = mkOptionDefault displayset-nvidia; 42 | xrandr = mkOptionDefault displayset-xrandr; 43 | }; 44 | }; 45 | }; 46 | in { 47 | options.hardware.display = mkOption { 48 | type = types.attrsOf (types.submodule displayType); 49 | default = { }; 50 | }; 51 | config.home.packages = mkMerge (mapAttrsToList (k: display: mkIf display.enable (singleton (pkgs.writeShellScriptBin "displaylayout-${k}" '' 52 | exec ${if display.nvidia.enable then display.dynamic.nvidia else display.dynamic.xrandr} 53 | ''))) config.hardware.display); 54 | } 55 | -------------------------------------------------------------------------------- /pkgs/overrides.nix: -------------------------------------------------------------------------------- 1 | { arc }: with arc.super.lib; let 2 | overrides = [ 3 | { 4 | attr = "notmuch"; 5 | withAttr = "notmuch-arc"; 6 | superAttr = "nixpkgsNotmuch"; 7 | fallback = { ... }: arc.packages.groups.customized.notmuch-arc; 8 | } 9 | { 10 | attr = "rust-analyzer-unwrapped"; 11 | withAttr = "rust-analyzer-unwrapped-mimalloc"; 12 | superAttr = "rust-analyzer-unwrapped-nixpkgs"; 13 | fallback = { ... }: arc.packages.groups.customized.rust-analyzer-unwrapped-mimalloc; 14 | } 15 | { 16 | attr = "ncpamixer"; 17 | superAttr = "nixpkgsNcpamixer"; 18 | apply = { previous, self, ... }: let 19 | segfaultLoopback = self.fetchpatch { 20 | url = "https://github.com/fulhax/ncpamixer/pull/49.diff"; 21 | sha256 = "0bnh9xii3j7kvj46hwl87y6fa4x6mi7q7p2fd0rg814i0s9b682s"; 22 | }; 23 | in if previous.version == "1.3.3.1" then previous.overrideAttrs (old: { 24 | patches = old.patches or [] ++ [ segfaultLoopback ]; 25 | enableParallelBuilding = true; 26 | buildPhase = null; 27 | }) else previous; 28 | } 29 | { 30 | attr = "cargo-expand"; 31 | apply = { previous, self, ... }: previous.overrideAttrs (old: { 32 | buildInputs = old.buildInputs or [ ] 33 | ++ self.lib.optional self.hostPlatform.isDarwin self.darwin.libiconv; 34 | }); 35 | } 36 | { 37 | attr = "cargo-watch"; 38 | apply = { previous, self, ... }: previous.overrideAttrs (old: { 39 | buildInputs = old.buildInputs or [ ] 40 | ++ self.lib.optional self.hostPlatform.isDarwin self.darwin.libiconv; 41 | }); 42 | } 43 | { 44 | attr = "libmpdclient"; 45 | withAttr = "libmpdclient-buffer"; 46 | superAttr = "nixpkgsLibmpdclient"; 47 | fallback = { ... }: arc.packages.groups.customized.libmpdclient-buffer; 48 | } 49 | 50 | # TODO: make tests that assert given (uncustomized) packages are still broken 51 | ]; 52 | in mapListToAttrs (o: nameValuePair o.attr o) overrides 53 | -------------------------------------------------------------------------------- /pkgs/public/matrix/mx-puppet-discord/default.nix: -------------------------------------------------------------------------------- 1 | { stdenv, fetchFromGitLab, lib, nodejs-18_x, nodeEnv, pkg-config, libjpeg 2 | , vips, pixman, cairo, pango 3 | , fetchgit, fetchurl 4 | }: 5 | 6 | let 7 | nodejs = nodejs-18_x; 8 | src = fetchFromGitLab { 9 | owner = "ruslang02"; 10 | repo = "mx-puppet-discord"; 11 | rev = "785d0a0f8def8c7a404d3ba7dea552e1e4cb55ce"; 12 | sha256 = "sha256-WuAh2AGScxu1w1mlTAfaxGO2jUotoonrhLSxk2B75PI="; 13 | }; 14 | 15 | myNodePackages = import ./node-packages.nix { 16 | inherit fetchurl stdenv lib fetchgit; 17 | nodeEnv = nodeEnv.override { 18 | inherit nodejs; 19 | }; 20 | nix-gitignore = throw "nix-gitignore"; 21 | }; 22 | 23 | in myNodePackages.package.override { 24 | pname = "mx-puppet-discord-develop"; 25 | version = "2022-09-23"; 26 | 27 | inherit src; 28 | 29 | nativeBuildInputs = [ nodejs.pkgs.node-pre-gyp pkg-config ]; 30 | buildInputs = [ libjpeg vips pixman cairo pango ]; 31 | 32 | preRebuild = '' 33 | substituteInPlace node_modules/@discordjs/opus/deps/binding.gyp \ 34 | --replace-fail '"cflags": [' '"cflags": ["-Wno-incompatible-pointer-types","-Wno-implicit-function-declaration",' 35 | ''; 36 | 37 | postInstall = '' 38 | # Patch shebangs in node_modules, otherwise the webpack build fails with interpreter problems 39 | patchShebangs --build "$out/lib/node_modules/mx-puppet-discord/node_modules/" 40 | # compile Typescript sources 41 | patch -p1 < ${./typescript.patch} 42 | npm run build 43 | 44 | # Make an executable to run the server 45 | mkdir -p $out/bin 46 | cat < $out/bin/mx-puppet-discord 47 | #!/bin/sh 48 | exec ${nodejs}/bin/node $out/lib/node_modules/@mx-puppet/discord/build/index.js "\$@" 49 | EOF 50 | chmod +x $out/bin/mx-puppet-discord 51 | ''; 52 | 53 | meta = with lib; { 54 | description = "A discord puppeting bridge for matrix"; 55 | license = licenses.asl20; 56 | homepage = "https://gitlab.com/mx-puppet/mx-puppet-discord"; 57 | platforms = platforms.unix; 58 | broken = true; 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /pkgs/personal/filebin/filebin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | # config defaults 5 | FILEBIN_BOXCAR_KEY= 6 | FILEBIN_S3_BUCKET= 7 | FILEBIN_S3_CLASS=ONEZONE_IA 8 | FILEBIN_FOLDER=dump 9 | 10 | main() { 11 | OPT_NOTIFY= 12 | OPT_DELETE= 13 | ARGS=() 14 | 15 | while getopts ":nd" opt; do 16 | case $opt in 17 | n) 18 | OPT_NOTIFY=1 19 | ARGS+=(-n) 20 | ;; 21 | d) 22 | OPT_DELETE=1 23 | ARGS+=(-d) 24 | ;; 25 | :) 26 | echo "Expected argument for option: -$OPTARG" >&2 27 | usage >&2 28 | return 1 29 | ;; 30 | \?) 31 | echo "Invalid option: -$OPTARG" >&2 32 | usage >&2 33 | return 1 34 | ;; 35 | esac 36 | done 37 | 38 | for CONF_FILE in /etc/arc/filebin.conf ${XDG_CONFIG_HOME-$HOME/.config}/filebin/config ${FILEBIN_CONFIG_FILE-}; do 39 | if [[ -f $CONF_FILE ]]; then 40 | source "$CONF_FILE" 41 | fi 42 | done 43 | 44 | export AWS_DEFAULT_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY 45 | 46 | FILE="$1" 47 | 48 | if [[ -d "$FILE" ]]; then 49 | for f in $FILE/*; do 50 | url=$("$0" "$f" ${ARGS[@]+"${ARGS[@]}"}) 51 | echo "$url" 52 | done 53 | else 54 | NEWFILENAME="$(filebin_key "$FILE")" 55 | 56 | URL="https://${FILEBIN_S3_BUCKET}.s3.amazonaws.com/${NEWFILENAME}" 57 | 58 | echo "$URL" 59 | 60 | aws s3 cp \ 61 | --storage-class "$FILEBIN_S3_CLASS" \ 62 | "$FILE" "s3://${FILEBIN_S3_BUCKET}/${NEWFILENAME}" 63 | 64 | if [[ -n $OPT_DELETE ]]; then 65 | rm -f "$FILE" 66 | fi 67 | 68 | if [[ -n $OPT_NOTIFY ]]; then 69 | filebin_notify 70 | fi 71 | fi 72 | } 73 | 74 | # functions can be overridden 75 | 76 | filebin_key() { 77 | FILENAME=$(basename "$1") 78 | HASH=$(sha1sum "$1") 79 | HASH=${HASH:2:8} 80 | 81 | echo "${FILEBIN_FOLDER}/${HASH}/${FILENAME}" 82 | } 83 | 84 | filebin_notify() { 85 | curl -fsSL http://new.boxcar.io/api/notifications \ 86 | -d "user_credentials=$FILEBIN_BOXCAR_KEY" \ 87 | -d "notification[title]=filebin: $(basename "$FILE")" \ 88 | -d "notification[long_message]=$URL" \ 89 | -d "notification[sound]=no-sound" > /dev/null & 90 | } 91 | 92 | main "$@" 93 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![ci-badge][]][ci] 2 | 3 | A collection of packages and modules for Nix, NixOS, and home-manager. 4 | 5 | ```bash 6 | nix run nixpkgs.cachix -c cachix use arc 7 | ``` 8 | 9 | ## Organization 10 | 11 | The following top-level attrs are exposed: 12 | 13 | - `arc.packages` exposes all packages available 14 | - `arc.packages.groups` of packages can also be found here, such as `vimPlugins` 15 | - `arc.build` is for build support helper functions and similar 16 | - `arc.shells` contains some ready-made customizeable shell environments 17 | - `arc.shells.rust.stable` contains a bunch of stuff 18 | - `arc.shells.rust.nightly` is an occasionally-pinned unstable rust shell 19 | - `arc.lib` contains library functions 20 | - `arc.modules` can be used to import modules for nixos and other systems 21 | - `arc.modules.nixos` contains [nixos](https://nixos.org/) modules 22 | - `arc.modules.home-manager` contains [home-manager](https://github.com/nix-community/home-manager) modules 23 | - `arc.modules.misc` contains generic or helper modules that may be used in all contexts 24 | - `arc.overlays` can be applied on top of nixpkgs 25 | - `arc.overlays.arc` adds the channel as `pkgs.arc` 26 | - `arc.overlays.lib` adds `arc.lib` to `pkgs.lib` 27 | - `arc.overlays.python` adds `pkgs.pythonOverrides` that can be used to modify python package sets 28 | - it also populates it with packages included with the channel 29 | - `arc.overlays.shells` adds `pkgs.shells` 30 | - `arc.overlays.fetchurl` replaces `pkgs.fetchurl` with a builtin nix fetcher 31 | - `arc.overlays.overrides` replaces some packge derivations with [the arc overrides](pkgs/overrides.nix) 32 | - `arc.pkgs` overlays the whole channel on top of nixpkgs, generally including all of the above 33 | 34 | ### Packages 35 | 36 | [NUR package list](https://nur.nix-community.org/repos/arc/) 37 | 38 | To find out what packages are available... 39 | 40 | ```bash 41 | nix-env -f. -qa '*' 42 | nix build -f. packages. 43 | ``` 44 | 45 | [ci-badge]: https://github.com/arcnmx/nixexprs/workflows/arc-nixexprs/badge.svg 46 | [ci]: https://github.com/arcnmx/nixexprs/actions?workflow=arc-nixexprs 47 | -------------------------------------------------------------------------------- /modules/misc/mutable-state.nix: -------------------------------------------------------------------------------- 1 | let 2 | mutablePathModule = { lib, state, config, ... }: with lib; { 3 | options = { 4 | name = mkOption { 5 | type = types.str; 6 | default = builtins.baseNameOf config.path; 7 | }; 8 | 9 | path = mkOption { 10 | type = types.path; 11 | }; 12 | 13 | owner = mkOption { 14 | type = types.str; 15 | default = state.owner; 16 | }; 17 | group = mkOption { 18 | type = types.str; 19 | default = state.group; 20 | }; 21 | 22 | exclude = mkOption { 23 | type = types.listOf types.str; 24 | default = [ ]; 25 | }; 26 | 27 | excludeExtract = mkOption { 28 | type = types.listOf types.str; 29 | default = [ ]; 30 | }; 31 | }; 32 | }; 33 | in { config, name, lib, ... }: with lib; { 34 | options = { 35 | enable = mkEnableOption "${name} mutable state" // { 36 | default = true; 37 | }; 38 | instanced = mkOption { 39 | type = types.bool; 40 | default = false; 41 | description = "Set if the service may be deployed to multiple machines in a network"; 42 | }; 43 | name = mkOption { 44 | type = types.str; 45 | default = name; 46 | }; 47 | # TODO: pre/post backup actions/commands... 48 | databases = { 49 | postgresql = mkOption { 50 | type = types.listOf types.str; 51 | default = [ ]; 52 | }; 53 | }; 54 | owner = mkOption { 55 | type = types.str; 56 | default = "root"; 57 | }; 58 | group = mkOption { 59 | type = types.str; 60 | default = "root"; 61 | }; 62 | serviceNames = mkOption { 63 | type = types.listOf types.str; 64 | default = [ ]; 65 | }; 66 | paths = mkOption { 67 | type = let 68 | mutablePathType = types.submodule [ 69 | mutablePathModule 70 | ({ ... }: { 71 | _module.args.state = config; 72 | }) 73 | ]; 74 | in types.listOf (types.coercedTo types.path (path: { inherit path; }) mutablePathType); 75 | default = [ ]; 76 | }; 77 | }; 78 | } 79 | -------------------------------------------------------------------------------- /pkgs/python/pyopenssl-pyo3.patch: -------------------------------------------------------------------------------- 1 | From 0c1b51d9b6815245b79ddcac70055f7449935edc Mon Sep 17 00:00:00 2001 2 | From: Trygve Aaberge 3 | Date: Mon, 23 Dec 2024 12:27:08 +0100 4 | Subject: [PATCH] Conditionally print certificate info 5 | 6 | The cryptography package (which pyOpenSSL depends on) doesn't support 7 | being loaded in multiple sub interpreters from version 41.0.0. Doing it 8 | in previous versions seemed to work, but could apparenly cause soundness 9 | issues, so it errors out from version 41.0.0. Note that this isn't a 10 | change in the cryptography package, but in pyo3 from version 0.17.0, 11 | which cryptography uses. 12 | 13 | This causes the script to fail when reloading it, or if you load it 14 | after another script with the same dependency. However, since pyOpenSSL 15 | is only used to print certificate info, wrap it in a try and skip 16 | printing info instead of crashing if pyOpenSSL can't be imported. 17 | 18 | There is another issue with a dependency of matrix-nio using pyo3 19 | (rpds-py via jsonschema), but this at least helps with part of the 20 | problem. 21 | 22 | See https://github.com/poljar/weechat-matrix/issues/357 for more 23 | details. 24 | --- 25 | main.py | 11 ++++++++++- 26 | 1 file changed, 10 insertions(+), 1 deletion(-) 27 | 28 | diff --git a/main.py b/main.py 29 | index 765043a..348cf1b 100644 30 | --- a/main.py 31 | +++ b/main.py 32 | @@ -40,6 +40,5 @@ 33 | 34 | import logbook 35 | import json 36 | -import OpenSSL.crypto as crypto 37 | from logbook import Logger, StreamHandler 38 | 39 | @@ -118,6 +117,16 @@ 40 | 41 | 42 | def print_certificate_info(buff, sock, cert): 43 | + try: 44 | + import OpenSSL.crypto as crypto 45 | + except: 46 | + message = ( 47 | + "{prefix}matrix: printing certificate info is not supported after reload, " 48 | + + "see https://github.com/poljar/weechat-matrix/issues/357" 49 | + ).format(prefix=W.prefix("network")) 50 | + W.prnt(buff, message) 51 | + return 52 | + 53 | cert_pem = ssl.DER_cert_to_PEM_cert(sock.getpeercert(True)) 54 | 55 | x509 = crypto.load_certificate(crypto.FILETYPE_PEM, cert_pem) 56 | -------------------------------------------------------------------------------- /modules/nixos/dht22-exporter.nix: -------------------------------------------------------------------------------- 1 | { config, lib, pkgs, ... }: with lib; let 2 | cfg = config.services.dht22-exporter; 3 | in { 4 | options.services.dht22-exporter = { 5 | enable = mkEnableOption "DHT22 Prometheus Exporter"; 6 | platform = mkOption { 7 | description = "The board you are going to run the exporter on"; 8 | default = null; 9 | type = with types; nullOr (enum [ 10 | "pi" 11 | "pi2" 12 | "bbb" 13 | ]); 14 | }; 15 | package = mkOption { 16 | type = types.package; 17 | default = with pkgs.python3Packages; dht22-exporter.override { 18 | adafruit-dht = adafruit-dht.override { inherit (cfg) platform; }; 19 | }; 20 | }; 21 | address = mkOption { 22 | description = "The address Prometheus ingests from"; 23 | type = types.nullOr types.str; 24 | default = null; 25 | }; 26 | port = mkOption { 27 | description = "The port Prometheus ingests from"; 28 | type = types.nullOr types.port; 29 | default = null; 30 | }; 31 | gpio = mkOption { 32 | description = "The GPIO pin of your board"; 33 | type = types.int; 34 | default = 4; 35 | }; 36 | pollingRate = mkOption { 37 | description = "How often in seconds to poll the sensor?"; 38 | type = types.int; 39 | default = 2; 40 | }; 41 | user = mkOption { 42 | type = types.str; 43 | default = "root"; 44 | }; 45 | group = mkOption { 46 | type = types.str; 47 | default = "root"; 48 | }; 49 | }; 50 | config = mkIf cfg.enable { 51 | systemd.services.dht22-exporter = { 52 | wantedBy = singleton "multi-user.target"; 53 | serviceConfig = { 54 | User = cfg.user; 55 | Group = cfg.group; 56 | ExecStart = let 57 | args = [ 58 | "-g" (toString cfg.gpio) 59 | "-i" (toString cfg.pollingRate) 60 | ] ++ optionals (cfg.port != null) [ "-p" (toString cfg.port) ] 61 | ++ optionals (cfg.address != null) [ "-a" cfg.address ]; 62 | in "${cfg.package}/bin/dht22_exporter.py " + escapeShellArgs args; 63 | }; 64 | }; 65 | }; 66 | } 67 | -------------------------------------------------------------------------------- /overlays/default.nix: -------------------------------------------------------------------------------- 1 | let 2 | lib = import ../lib { 3 | # we can get away with using some functions by passing builtins as lib 4 | lib = { 5 | foldl = builtins.foldl'; 6 | } // builtins; 7 | }; 8 | collectOverlays = builtins.foldl' 9 | (overlays: overlay: overlays // overlay.arc'internal or { }) 10 | { }; 11 | needsSanitation = pkgs: builtins.any (overlay: overlay ? arc'internal && overlay.arc'internal.path or null != ../.) pkgs.overlays; 12 | sanitize = pkgs: let 13 | sanitized = import pkgs.path { 14 | inherit (pkgs) config; 15 | overlays = builtins.filter (overlay: ! overlay ? arc'internal) pkgs.overlays; 16 | }; 17 | in if overlays.hasOverlays pkgs then sanitized else pkgs; 18 | hasOverlay = name: pkgs: builtins.any (overlay: overlay.arc'internal.${name} or false) pkgs.overlays; 19 | hasOverlays = pkgs: builtins.any (overlay: overlay ? arc'internal) pkgs.overlays; 20 | 21 | overlays' = builtins.mapAttrs (name: overlay: { 22 | inherit name overlay; 23 | arc'internal = { 24 | path = ../.; 25 | ${name} = true; 26 | }; 27 | 28 | __functor = self: self.overlay; 29 | }) { 30 | arc = import ./arc.nix; 31 | lib = import ./lib.nix; 32 | fetchurl = import ./fetchurl.nix; 33 | shells = import ./shells.nix; 34 | python = import ./python.nix; 35 | packages = import ./packages.nix; 36 | overrides = import ./overrides.nix; 37 | }; 38 | 39 | overlays = overlays' // { 40 | ordered = [ 41 | overlays.arc 42 | overlays.lib 43 | overlays.python 44 | overlays.packages 45 | overlays.overrides 46 | overlays.fetchurl 47 | overlays.shells 48 | ]; 49 | 50 | all = { 51 | overlays = overlays.ordered; 52 | arc'internal = collectOverlays overlays.ordered // { 53 | path = ../.; 54 | inherit collectOverlays needsSanitation sanitize; 55 | }; 56 | __functor = self: lib.composeManyExtensions self.overlays; 57 | }; 58 | 59 | wrap = pkgs: pkgs.appendOverlays overlays.ordered; 60 | inherit hasOverlay hasOverlays; 61 | 62 | inherit (overlays.all) arc'internal; 63 | __functor = self: self.all; 64 | }; 65 | in overlays 66 | -------------------------------------------------------------------------------- /modules/home/mpd.nix: -------------------------------------------------------------------------------- 1 | { pkgs, networking, options, config, lib, ... }: with lib; let 2 | cfg = config.services.mpd; 3 | opts = options.services.mpd; 4 | inherit (config.nixos) user; 5 | hasSocket = cfg.network.listenAddress == "any" && user.uid or null != null; 6 | in { 7 | options.services.mpd = { 8 | configText = mkOption { 9 | type = types.lines; 10 | }; 11 | configPath = mkOption { 12 | type = types.path; 13 | default = "${pkgs.writeText "mpd.conf" cfg.configText}"; 14 | }; 15 | bindings = mkOption { 16 | type = types.attrsOf types.unspecified; 17 | }; 18 | hasBinding = mkOption { 19 | type = types.bool; 20 | default = opts.bindings.isDefined && cfg.bindings != { }; 21 | }; 22 | }; 23 | config = { 24 | services.mpd = { 25 | bindings = mkIf cfg.enable { 26 | network = networking.bindings.mpd; 27 | socket = mkIf hasSocket networking.bindings.mpd-socket; 28 | }; 29 | configText = '' 30 | music_directory "${cfg.musicDirectory}" 31 | playlist_directory "${cfg.playlistDirectory}" 32 | ${lib.optionalString (cfg.dbFile != null) '' 33 | db_file "${cfg.dbFile}" 34 | ''} 35 | state_file "${cfg.dataDir}/state" 36 | sticker_file "${cfg.dataDir}/sticker.sql" 37 | ${optionalString (cfg.network.listenAddress != "any") 38 | ''bind_to_address "${cfg.network.listenAddress}"''} 39 | ${optionalString (cfg.network.port != 6600) 40 | ''port "${toString cfg.network.port}"''} 41 | ${cfg.extraConfig} 42 | ''; 43 | }; 44 | systemd.user.services.mpd = mkIf cfg.enable { 45 | Service.ExecStart = mkOverride (modules.defaultOverridePriority - 1) "${cfg.package}/bin/mpd --no-daemon ${cfg.configPath}"; 46 | }; 47 | networking.bindings = mkIf cfg.enable { 48 | mpd = { 49 | protocol = mkDefault "mpd"; 50 | port = mkDefault cfg.network.port; 51 | address = mkDefault (if cfg.network.listenAddress == "any" 52 | then "*" 53 | else cfg.network.listenAddress); 54 | }; 55 | mpd-socket = mkIf hasSocket { 56 | address = "/run/user/${toString user.uid}/mpd/socket"; 57 | }; 58 | }; 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /modules/nixos/nix.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, lib, ... }: with lib; let 2 | cfg = config.nix; 3 | accessTokens = mapAttrsToList (key: value: 4 | "${key}=${value}" 5 | ) cfg.accessTokens; 6 | accessTokensStr = concatStringsSep " " accessTokens; 7 | experimentalFeatures = concatStringsSep " " cfg.experimentalFeatures; 8 | in { 9 | options.nix = { 10 | accessTokens = mkOption { 11 | type = with types; attrsOf str; 12 | default = { }; 13 | example = { 14 | "github.com" = "23ac...b289"; 15 | }; 16 | }; 17 | isNix24 = mkOption { 18 | type = types.bool; 19 | default = versionAtLeast cfg.package.version "2.4"; 20 | readOnly = true; 21 | }; 22 | nix24 = { 23 | package = mkOption { 24 | type = types.package; 25 | default = pkgs.nix_2_4; 26 | }; 27 | wrapped = mkOption { 28 | type = types.package; 29 | default = pkgs.runCommand "nix24" { 30 | passAsFile = [ "script" ]; 31 | script = '' 32 | #!@runtimeShell@ 33 | set -eu 34 | 35 | if [[ ! $PATH = @out@/bin:* ]]; then 36 | export PATH="@out@/bin:$PATH" 37 | fi 38 | exec @nix@/bin/nix \ 39 | --extra-experimental-features ${escapeShellArg experimentalFeatures} \ 40 | --access-tokens ${escapeShellArg accessTokensStr} \ 41 | "$@" 42 | ''; 43 | inherit (pkgs) runtimeShell; 44 | nix = cfg.nix24.package; 45 | } '' 46 | mkdir -p $out/bin 47 | substituteAll $scriptPath $out/bin/nix 48 | chmod +x $out/bin/nix 49 | ''; 50 | readOnly = true; 51 | }; 52 | }; 53 | experimentalFeatures = mkOption { 54 | type = with types; listOf (enum [ 55 | "nix-command" "flakes" "repl-flake" 56 | "ca-derivations" "impure-derivations" 57 | "recursive-nix" "fetch-closure" 58 | "discard-references" 59 | "cgroups" 60 | "no-url-literals" 61 | ]); 62 | default = [ ]; 63 | }; 64 | }; 65 | config.nix.settings = { 66 | access-tokens = mkIf (cfg.isNix24 && cfg.accessTokens != { }) accessTokens; 67 | experimental-features = mkIf (cfg.isNix24 && cfg.experimentalFeatures != [ ]) cfg.experimentalFeatures; 68 | }; 69 | } 70 | -------------------------------------------------------------------------------- /modules/home/i3gopher.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: with lib; let 2 | cfg = config.services.i3gopher; 3 | exec = "${cfg.package}/bin/i3gopher"; 4 | arc = import ../../canon.nix { inherit pkgs; }; 5 | in { 6 | options.services.i3gopher = { 7 | enable = mkEnableOption "i3 focus history"; 8 | exec = mkOption { 9 | description = "command to execute on any window event"; 10 | type = types.nullOr types.str; 11 | example = "killall -USR1 i3status"; 12 | default = null; 13 | }; 14 | package = mkOption { 15 | type = types.package; 16 | default = (pkgs.i3gopher or arc.packages.i3gopher).override { 17 | enableSway = config.wayland.windowManager.sway.enable; 18 | enableI3 = config.xsession.windowManager.i3.enable; 19 | i3 = config.xsession.windowManager.i3.package; 20 | sway = config.wayland.windowManager.sway.package; 21 | }; 22 | defaultText = "pkgs.i3gopher"; 23 | }; 24 | 25 | focus-last = mkOption { 26 | description = "command to run in an i3 keybind to toggle last focus"; 27 | type = types.str; 28 | readOnly = true; 29 | default = "${exec} --focus-last"; 30 | example = '' 31 | xsession.windowManager.i3.keybindings = { 32 | "Mod4+Tab" = "exec --no-startup-id \${config.services.i3gopher.focus-last}"; 33 | } 34 | ''; 35 | }; 36 | }; 37 | 38 | config.systemd.user.services = mkIf cfg.enable { 39 | i3gopher = { 40 | Unit = { 41 | Description = "i3 focus history"; 42 | After = mkMerge [ 43 | (mkIf config.xsession.windowManager.i3.enable ["i3-session.target"]) 44 | (mkIf config.wayland.windowManager.sway.enable ["sway-session.target"]) 45 | ]; 46 | PartOf = ["graphical-session.target"]; 47 | }; 48 | Service = { 49 | Type = "exec"; 50 | Restart = "on-failure"; 51 | # TODO: systemd/shell string escapes 52 | ${if cfg.exec != null then "Environment" else null} = ["I3GOPHER_EXEC=\"${cfg.exec}\""]; 53 | ExecStart = if cfg.exec != null 54 | then "${exec} -exec \${I3GOPHER_EXEC}" 55 | else exec; 56 | }; 57 | Install.WantedBy = mkMerge [ 58 | (mkIf config.xsession.windowManager.i3.enable ["i3-session.target"]) 59 | (mkIf config.wayland.windowManager.sway.enable ["sway-session.target"]) 60 | ]; 61 | }; 62 | }; 63 | } 64 | -------------------------------------------------------------------------------- /lib/gst.nix: -------------------------------------------------------------------------------- 1 | { lib }: with lib; let 2 | shorthandSyntax = key: input: assert length (attrNames input.${key}) == 1; { 3 | # { key.name = value; } into { type = key; key = name; options = value; } 4 | type = key; 5 | ${key} = head (attrNames input.${key}); 6 | options = head (attrValues input.${key}); 7 | }; 8 | pipelineNormalize = input: 9 | if isAttrs input.element or null then shorthandSyntax "element" input 10 | else if isAttrs input.caps or null then shorthandSyntax "caps" input 11 | else if input ? element then { 12 | type = "element"; 13 | } // input else if input ? pipeline then { 14 | type = "pipeline"; 15 | } // input else if input ? pipelines then { 16 | type = "pipelines"; 17 | } // input else if input ? caps then { 18 | type = "caps"; 19 | } // input else if isList input && length input > 0 && (pipelineNormalize (head input)).type == "pipeline" then { 20 | type = "pipelines"; 21 | pipelines = input; 22 | } else if isList input then { 23 | type = "pipeline"; 24 | pipeline = input; 25 | } else if isString input then { 26 | type = "element"; 27 | element = input; 28 | } else throw "unsupported pipeline element"; 29 | pipelineValue = input: 30 | if input == true then "true" 31 | else if input == false then "false" 32 | else toString input; 33 | pipelineKeyValue = k: v: "${k}=${pipelineValue v}"; 34 | pipelineElementOptions = element: mapAttrsToList pipelineKeyValue element.options or { }; 35 | pipelineStrings = input: let 36 | item = pipelineNormalize input; 37 | in { 38 | element = singleton item.element ++ pipelineElementOptions item; 39 | caps = singleton (concatStringsSep "," (singleton item.caps ++ pipelineElementOptions item)); 40 | pipeline = concatLists (imap0 (i: e: optional (i > 0) "!" ++ pipelineStrings e) item.pipeline); 41 | pipelines = concatMap pipelineStrings item.pipelines; 42 | }.${item.type}; 43 | pipelineString = p: concatStringsSep " " (pipelineStrings p); 44 | pipelineShellString = p: escapeShellArgs (pipelineStrings p); 45 | # TODO: are there scenarios where pipelines should be surrounded in ( brackets )? 46 | searchVarName = "GST_PLUGIN_SYSTEM_PATH_1_0"; 47 | makeSearchVar = makeSearchPath "lib/gstreamer-1.0"; 48 | in { 49 | inherit pipelineNormalize pipelineKeyValue pipelineValue pipelineElementOptions 50 | pipelineStrings pipelineString pipelineShellString 51 | searchVarName makeSearchVar; 52 | } 53 | -------------------------------------------------------------------------------- /pkgs/public/looking-glass/host.nix: -------------------------------------------------------------------------------- 1 | { stdenv, lib 2 | , fetchFromGitHub 3 | , fetchpatch 4 | , looking-glass-client 5 | , cmake, pkg-config 6 | , libbfd, libGLU, libX11 7 | , libxcb, libXfixes 8 | , pipewire, glib 9 | , nvidia-capture-sdk 10 | , enableNvfbc ? false 11 | , enablePipewire ? stdenv.hostPlatform.isLinux 12 | , enableXcb ? stdenv.hostPlatform.isLinux 13 | , enableBacktrace ? false 14 | , optimizeForArch ? null 15 | }: with lib; let 16 | namedPatches = import ./patches.nix { inherit fetchpatch; }; 17 | in stdenv.mkDerivation rec { 18 | pname = "looking-glass-host"; 19 | version = "2024-11-14"; 20 | src = fetchFromGitHub { 21 | owner = "gnif"; 22 | repo = "LookingGlass"; 23 | rev = "e25492a3a36f7e1fde6e3c3014620525a712a64a"; 24 | sha256 = "sha256-DBmCJRlB7KzbWXZqKA0X4VTpe+DhhYG5uoxsblPXVzg="; 25 | fetchSubmodules = true; 26 | }; 27 | 28 | nativeBuildInputs = [ 29 | cmake 30 | ] ++ optional stdenv.hostPlatform.isLinux pkg-config; 31 | buildInputs = optionals stdenv.hostPlatform.isLinux [ 32 | ] ++ optionals enableXcb [ 33 | libbfd libGLU libX11 34 | libxcb libXfixes 35 | ] ++ optionals enablePipewire [ 36 | pipewire 37 | glib 38 | ]; 39 | 40 | /*patches = with namedPatches; [ 41 | nvfbc-pointerthread 42 | nvfbc-framesize nvfbc-scale 43 | ];*/ 44 | 45 | preConfigure = '' 46 | echo $version > VERSION 47 | if [[ $version = 20??-??-?? ]]; then 48 | export SOURCE_DATE_EPOCH=$(date -d $version +%s) 49 | fi 50 | ''; 51 | 52 | makeFlags = [ 53 | "VERBOSE=1" 54 | ]; 55 | cmakeDir = "../host"; 56 | cmakeFlags = [ 57 | "-DOPTIMIZE_FOR_NATIVE=${if optimizeForArch == null then "OFF" else optimizeForArch}" 58 | "-DENABLE_BACKTRACE=${if enableBacktrace then "ON" else "OFF"}" 59 | ] ++ optionals stdenv.hostPlatform.isLinux [ 60 | "-DUSE_XCB=${if enableXcb then "ON" else "OFF"}" 61 | "-DUSE_PIPEWIRE=${if enablePipewire then "ON" else "OFF"}" 62 | ] ++ optionals enableNvfbc [ 63 | "-DUSE_NVFBC=ON" 64 | "-DNVFBC_SDK=${nvidia-capture-sdk.sdk}" 65 | ]; 66 | 67 | # glib G_DEFINE_AUTOPTR_CLEANUP_FUNC error: 'response' may be used uninitialized 68 | NIX_CFLAGS_COMPILE = optional enablePipewire "-Wno-maybe-uninitialized"; 69 | 70 | hardeningDisable = [ "all" ]; 71 | 72 | meta = looking-glass-client.meta or { } // { 73 | platforms = with platforms; linux ++ windows; 74 | }; 75 | 76 | passthru = { 77 | inherit namedPatches; 78 | }; 79 | } 80 | -------------------------------------------------------------------------------- /ci/eval.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import { } }: with pkgs.lib; let 2 | pkgs' = pkgs; 3 | arc = import ../. { pkgs = pkgs.extend pythonTestOverlay; }; 4 | overlays = import ../overlays; 5 | pythonTestOverlay = self: super: { 6 | pythonOverrides = super.pythonOverrides or { } // { 7 | arc'test = { python }: python.version; 8 | }; 9 | }; 10 | pkgsOverlayFetchurl = pkgs.extend overlays.fetchurl; 11 | pkgsOverlayPackages = pkgs.extend overlays.packages; 12 | pkgsOverlayArc = pkgs.extend overlays.arc; 13 | pkgsOverlayOverrides = pkgs.extend overlays.overrides; 14 | pkgsOverlayPython = (pkgs.extend overlays.python).extend pythonTestOverlay; 15 | pkgsOverlayShells = pkgs.extend overlays.shells; 16 | pkgsManualOverlay = pkgs.extend (self: super: { 17 | arc = import ../. { pkgs = self; }; 18 | }); 19 | pkgsOverlay = (overlays.wrap pkgs).extend pythonTestOverlay; 20 | compare = a: b: 21 | if isFunction a then functionArgs a == functionArgs b 22 | else a == b; 23 | testAll = tests: all id tests; 24 | tests = { 25 | individualOverlayFetchurl = { pkgs ? pkgsOverlayFetchurl }: testAll ( 26 | optionals (overlays.hasOverlay "fetchurl" pkgs) [ 27 | (!(compare pkgs.fetchurl pkgs'.fetchurl)) 28 | (compare pkgs.nixpkgsFetchurl pkgs'.fetchurl) 29 | ]); 30 | overlayPackages = { pkgs ? pkgsOverlayPackages }: testAll [ 31 | (pkgs ? paswitch) 32 | (pkgs.pass-arc.outPath != "") 33 | (arc.packages.pass-arc.outPath != "") 34 | ]; 35 | overlayArc = { pkgs ? pkgsOverlayArc }: testAll [ 36 | (pkgs ? arc.packages) 37 | ]; 38 | overlayPython = { pkgs ? pkgsOverlayPython }: testAll [ 39 | (pkgs.python3Packages.arc'test != pkgs.python2.pkgs.arc'test) 40 | ]; 41 | overlayOverrides = { pkgs ? pkgsOverlayOverrides }: testAll ( 42 | optionals (overlays.hasOverlay "overrides" pkgs) [ 43 | (pkgs.notmuch.pname != "notmuch") 44 | (pkgs.nixpkgsNotmuch.pname == "notmuch") 45 | (pkgs.notmuch.super.pname == "notmuch") 46 | ]); 47 | overlayShells = { pkgs ? pkgsOverlayShells }: testAll ( 48 | optionals (overlays.hasOverlay "shells" pkgs) [ 49 | ((pkgs.mkShell { }) ? shellEnv) 50 | ]); 51 | manualOverlay = { pkgs ? pkgsManualOverlay }: testAll [ 52 | (pkgs ? arc.packages.paswitch) 53 | ]; 54 | }; 55 | in mapAttrs (_: v: v { }) tests // 56 | mapAttrs' (k: v: nameValuePair "${k}'wrapped" (v { pkgs = pkgsOverlay; })) tests // 57 | mapAttrs' (k: v: nameValuePair "${k}'channel" (v { pkgs = arc.pkgs; })) tests 58 | -------------------------------------------------------------------------------- /pkgs/obs/shader-filter-build.patch: -------------------------------------------------------------------------------- 1 | diff --git a/plugins/obs-shader-filter/CMakeLists.txt b/plugins/obs-shader-filter/CMakeLists.txt 2 | index bc4cf121..5951c476 100644 3 | --- a/CMakeLists.txt 4 | +++ b/CMakeLists.txt 5 | @@ -5,9 +5,10 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) 6 | set(CMAKE_AUTOMOC ON) 7 | set(CMAKE_AUTOUIC ON) 8 | 9 | -#find_package(LibObs REQUIRED) 10 | +find_package(LibObs REQUIRED) 11 | find_package(Qt5Core REQUIRED) 12 | find_package(Qt5Widgets REQUIRED) 13 | +find_package(PkgConfig REQUIRED) 14 | 15 | include_directories( 16 | # SYSTEM "${CMAKE_SOURCE_DIR}/libobs" 17 | @@ -16,9 +17,8 @@ include_directories( 18 | ${Qt5Widgets_INCLUDES} 19 | ) 20 | 21 | -find_package(FFmpeg REQUIRED 22 | - COMPONENTS avcodec) 23 | -include_directories(${FFMPEG_INCLUDE_DIRS}) 24 | +pkg_check_modules(FFMPEG REQUIRED IMPORTED_TARGET 25 | + libavcodec) 26 | 27 | if(MSVC) 28 | set(obs-shader-filter_PLATFORM_DEPS 29 | @@ -43,16 +43,24 @@ add_library(obs-shader-filter MODULE 30 | ${obs-shader-filter_SOURCES} 31 | ${obs-shader-filter_HEADERS} 32 | ) 33 | - 34 | + 35 | target_link_libraries(obs-shader-filter 36 | libobs 37 | Qt5::Core 38 | Qt5::Widgets 39 | ${obs-shader-filter_PLATFORM_DEPS} 40 | - ${FFMPEG_LIBRARIES} 41 | + PkgConfig::FFMPEG 42 | # obs-frontend-api 43 | # Qt5::Core 44 | # Qt5::Widgets 45 | ) 46 | 47 | -install_obs_plugin_with_data(obs-shader-filter data) 48 | +file(GLOB locale_files data/locale/*.ini) 49 | +file(GLOB data_files data/*.effect) 50 | +file(GLOB shader_files data/*.effect shaders/*.shader) 51 | + 52 | +include(GNUInstallDirs) 53 | +install(TARGETS obs-shader-filter LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/obs-plugins") 54 | +install(FILES ${locale_files} DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/obs/obs-plugins/obs-shader-filter/locale") 55 | +install(FILES ${data_files} DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/obs/obs-plugins/obs-shader-filter") 56 | +install(FILES ${shader_files} DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/obs-shader-filter") 57 | diff --git a/plugins/obs-shader-filter/obs-shader-filter.hpp b/plugins/obs-shader-filter/obs-shader-filter.hpp 58 | index cce27f46..836b3d0e 100644 59 | --- a/obs-shader-filter.hpp 60 | +++ b/obs-shader-filter.hpp 61 | @@ -176,7 +176,7 @@ public: 62 | if (!_compiled) { 63 | _errString = "Expression Error At [" + std::to_string(_err) + "] in: " + expression + "\n" + 64 | expression.substr(0, _err) + "[ERROR HERE]" + expression.substr(_err); 65 | - blog(LOG_WARNING, _errString.c_str()); 66 | + blog(LOG_WARNING, "%s", _errString.c_str()); 67 | } else { 68 | _errString = ""; 69 | _expr = expression; 70 | -------------------------------------------------------------------------------- /modules/home/watchdog.nix: -------------------------------------------------------------------------------- 1 | { pkgs, osConfig ? { }, config, lib, ... }: with lib; let 2 | cfg = config.services.watchdogs; 3 | services = filterAttrs (_: wd: wd.enable) cfg.services; 4 | arclib = import ../../lib { inherit lib; }; 5 | unmerged = lib.unmerged or arclib.unmerged; 6 | canRequire = false; 7 | package = pkgs.writeShellScriptBin "watchdog-command" '' 8 | while ${pkgs.coreutils}/bin/sleep $((WATCHDOG_USEC / 3250000)); do 9 | if "$@" > /dev/null; then 10 | ${builtins.dirOf config.systemd.user.systemctlPath}/systemd-notify WATCHDOG=1 11 | else 12 | echo tripped >&2 13 | fi 14 | done 15 | ''; 16 | watchdogModule = { config, name, ... }: { 17 | options = { 18 | enable = mkEnableOption "watchdog" // { 19 | default = true; 20 | }; 21 | name = mkOption { 22 | type = types.str; 23 | default = name + "-watchdog"; 24 | }; 25 | service = mkOption { 26 | type = unmerged.type; 27 | }; 28 | target = mkOption { 29 | type = types.str; 30 | }; 31 | command = mkOption { 32 | type = with types; listOf str; 33 | }; 34 | interval = mkOption { 35 | type = types.str; 36 | default = "120s"; 37 | }; 38 | }; 39 | config = { 40 | service = rec { 41 | Install = mkIf canRequire { 42 | RequiredBy = Unit.After; 43 | }; 44 | Unit = { 45 | After = [ config.target ]; 46 | BindsTo = Unit.After; 47 | }; 48 | Service = { 49 | WatchdogSec = config.interval; 50 | WatchdogSignal = "SIGTERM"; 51 | NotifyAccess = "all"; 52 | ExecStart = "${getExe cfg.package} ${escapeShellArgs config.command}"; 53 | Nice = 10; 54 | }; 55 | }; 56 | }; 57 | }; 58 | in { 59 | options.services.watchdogs = { 60 | enable = mkEnableOption "watchdogs" // { 61 | default = cfg.services != { }; 62 | }; 63 | package = mkOption { 64 | type = types.package; 65 | default = package; 66 | }; 67 | services = mkOption { 68 | type = with types; attrsOf (submodule watchdogModule); 69 | default = { }; 70 | }; 71 | }; 72 | config = mkIf cfg.enable { 73 | systemd.user.services = mapAttrs' (_: wd: nameValuePair wd.name (unmerged.merge wd.service)) services; 74 | systemd.user.targets = mkMerge (mapAttrsToList (_: wd: { 75 | ${removeSuffix ".target" wd.target}.Unit = { 76 | Requires = mkIf (!canRequire) [ "${wd.name}.service" ]; 77 | BindsTo = [ "${wd.name}.service" ]; 78 | }; 79 | }) services); 80 | }; 81 | } 82 | -------------------------------------------------------------------------------- /modules/nixos/bindings.nix: -------------------------------------------------------------------------------- 1 | let 2 | bindServiceModule = { lib, config, ... }: with lib; { 3 | options = { 4 | provides = mkOption { 5 | type = types.listOf types.str; 6 | }; 7 | }; 8 | }; 9 | nixosModule = { commonRoot, pkgs, config, options, lib, ... }: with lib; { 10 | imports = [ 11 | ./common-root.nix 12 | ]; 13 | 14 | options = { 15 | networking = { 16 | enabledBindings = mkOption { 17 | type = with types; listOf unspecified; 18 | default = [ ]; 19 | }; 20 | bindings = mkOption { 21 | type = with types; attrsOf (submodule [ 22 | ../misc/binding.nix 23 | commonRoot.tag 24 | ]); 25 | }; 26 | domains = mkOption { 27 | type = with types; attrsOf (submodule [ 28 | ../misc/domain.nix 29 | commonRoot.tag 30 | ({ ... }: { 31 | config._module.args = { 32 | inherit pkgs; 33 | nixosConfig = config; 34 | }; 35 | }) 36 | ]); 37 | }; 38 | }; 39 | }; 40 | config = { 41 | networking = { 42 | bindings = { }; 43 | domains = { }; 44 | enabledBindings = let 45 | enabledDomains = filterAttrs (_: d: d.enable) config.networking.domains; 46 | enabledBindings = domain: filterAttrs (_: b: b.enable) domain.bindings; 47 | mapDomain = _: domain: attrValues (enabledBindings domain); 48 | in mkMerge (mapAttrsToList mapDomain enabledDomains); 49 | }; 50 | networking.firewall = let 51 | externalBindings = filter (binding: binding.firewall.open) config.networking.enabledBindings; 52 | public' = partition (binding: binding.firewall.interfaces == null) externalBindings; 53 | public = public'.right; 54 | interfaces'' = concatMap (binding: map (interface: nameValuePair interface binding) binding.firewall.interfaces) public'.wrong; 55 | interfaces' = groupBy (b: b.name) interfaces''; 56 | interfaces = mapAttrs (_: map ({ name, value }: value)) interfaces'; 57 | mapToAllowed = bindings: let 58 | tcp = partition (b: b.transport == "tcp") bindings; 59 | in { 60 | allowedTCPPorts = map (binding: binding.port) tcp.right; 61 | allowedUDPPorts = map (binding: binding.port) tcp.wrong; 62 | }; 63 | in mapToAllowed public // { 64 | interfaces = mapAttrs (_: mapToAllowed) interfaces; 65 | }; 66 | }; 67 | }; 68 | in { 69 | services = import ./service-bindings.nix; 70 | 71 | __functor = self: nixosModule; 72 | } 73 | -------------------------------------------------------------------------------- /modules/home/git.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: with lib; let 2 | cfg = config.programs.git; 3 | git-config-email-apply = name: user: '' 4 | git config user.name "${user.name}" 5 | git config user.email "${user.email}" 6 | '' + optionalString (user.signingKey != null) '' 7 | git config user.signingkey "${user.signingKey}" 8 | git config tag.forceSignAnnotated true 9 | ''; 10 | git-config-email-url-match = name: user: '' 11 | github-${name}:*) 12 | NAME=${toLower name} 13 | break 14 | ;; 15 | ''; 16 | git-config-email-name-match = name: user: '' 17 | ${toLower name}) 18 | ${git-config-email-apply name user} 19 | ${if length user.aliases > 0 20 | then let 21 | aliasless = user // { aliases = []; }; 22 | fn = alias: git-config-email-name-match alias aliasless; 23 | in map fn user.aliases 24 | else "" 25 | } 26 | ;; 27 | ''; 28 | git-config-email = pkgs.writeShellScriptBin "git-config-email" '' 29 | set -eu 30 | 31 | if [[ $# -lt 1 ]]; then 32 | REMOTE_URLS=$(git remote -v | cut -d $'\t' -f 2 | cut -d ' ' -f 1) 33 | 34 | NAME= 35 | for REMOTE_URL in $REMOTE_URLS; do 36 | case $REMOTE_URL in 37 | ${concatStringsSep "\n" (mapAttrsToList git-config-email-url-match cfg.configEmail)} 38 | esac 39 | done 40 | if [[ -z $NAME ]]; then 41 | echo "Name could not be autodetected" >&2 42 | exit 1 43 | fi 44 | else 45 | NAME=$1 46 | fi 47 | 48 | case $NAME in 49 | ${concatStringsSep "\n" (mapAttrsToList git-config-email-name-match cfg.configEmail)} 50 | *) 51 | echo "Unrecognized name $NAME." >&2 52 | exit 1 53 | ;; 54 | esac 55 | ''; 56 | userType = types.submodule { 57 | options = { 58 | name = mkOption { 59 | type = types.str; 60 | description = "git commit full name"; 61 | }; 62 | email = mkOption { 63 | type = types.str; 64 | description = "git commit email address"; 65 | }; 66 | signingKey = mkOption { 67 | type = types.nullOr types.str; 68 | description = "git-config-email GPG signing key"; 69 | default = null; 70 | }; 71 | aliases = mkOption { 72 | type = types.listOf types.str; 73 | description = "git-config-email short name aliases"; 74 | default = [ ]; 75 | }; 76 | }; 77 | }; 78 | in { 79 | options.programs.git = { 80 | configEmail = mkOption { 81 | type = types.attrsOf userType; 82 | default = { }; 83 | }; 84 | }; 85 | 86 | config.home.packages = mkIf (cfg.configEmail != { }) [git-config-email]; 87 | } 88 | -------------------------------------------------------------------------------- /pkgs/obs/shader-filter-cmake.patch: -------------------------------------------------------------------------------- 1 | diff --git a/plugins/obs-shader-filter/CMakeLists.txt b/plugins/obs-shader-filter/CMakeLists.txt 2 | index bc4cf121..5951c476 100644 3 | --- a/plugins/obs-shader-filter/CMakeLists.txt 4 | +++ b/plugins/obs-shader-filter/CMakeLists.txt 5 | @@ -5,9 +5,10 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) 6 | set(CMAKE_AUTOMOC ON) 7 | set(CMAKE_AUTOUIC ON) 8 | 9 | -#find_package(LibObs REQUIRED) 10 | +find_package(LibObs REQUIRED) 11 | find_package(Qt5Core REQUIRED) 12 | find_package(Qt5Widgets REQUIRED) 13 | +find_package(PkgConfig REQUIRED) 14 | 15 | include_directories( 16 | # SYSTEM "${CMAKE_SOURCE_DIR}/libobs" 17 | @@ -16,9 +17,8 @@ include_directories( 18 | ${Qt5Widgets_INCLUDES} 19 | ) 20 | 21 | -find_package(FFmpeg REQUIRED 22 | - COMPONENTS avcodec) 23 | -include_directories(${FFMPEG_INCLUDE_DIRS}) 24 | +pkg_check_modules(FFMPEG REQUIRED IMPORTED_TARGET 25 | + libavcodec) 26 | 27 | if(MSVC) 28 | set(obs-shader-filter_PLATFORM_DEPS 29 | @@ -43,16 +43,24 @@ add_library(obs-shader-filter MODULE 30 | ${obs-shader-filter_SOURCES} 31 | ${obs-shader-filter_HEADERS} 32 | ) 33 | - 34 | + 35 | target_link_libraries(obs-shader-filter 36 | libobs 37 | Qt5::Core 38 | Qt5::Widgets 39 | ${obs-shader-filter_PLATFORM_DEPS} 40 | - ${FFMPEG_LIBRARIES} 41 | + PkgConfig::FFMPEG 42 | # obs-frontend-api 43 | # Qt5::Core 44 | # Qt5::Widgets 45 | ) 46 | 47 | -install_obs_plugin_with_data(obs-shader-filter data) 48 | +file(GLOB locale_files data/locale/*.ini) 49 | +file(GLOB data_files data/*.effect) 50 | +file(GLOB shader_files data/*.effect shaders/*.shader) 51 | + 52 | +include(GNUInstallDirs) 53 | +install(TARGETS obs-shader-filter LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/obs-plugins") 54 | +install(FILES ${locale_files} DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/obs/obs-plugins/obs-shader-filter/locale") 55 | +install(FILES ${data_files} DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/obs/obs-plugins/obs-shader-filter") 56 | +install(FILES ${shader_files} DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/obs-shader-filter") 57 | diff --git a/plugins/obs-shader-filter/obs-shader-filter.hpp b/plugins/obs-shader-filter/obs-shader-filter.hpp 58 | index cce27f46..836b3d0e 100644 59 | --- a/plugins/obs-shader-filter/obs-shader-filter.hpp 60 | +++ b/plugins/obs-shader-filter/obs-shader-filter.hpp 61 | @@ -176,7 +176,7 @@ public: 62 | if (!_compiled) { 63 | _errString = "Expression Error At [" + std::to_string(_err) + "] in: " + expression + "\n" + 64 | expression.substr(0, _err) + "[ERROR HERE]" + expression.substr(_err); 65 | - blog(LOG_WARNING, _errString.c_str()); 66 | + blog(LOG_WARNING, "%s", _errString.c_str()); 67 | } else { 68 | _errString = ""; 69 | _expr = expression; 70 | -------------------------------------------------------------------------------- /modules/home/nix-path.nix: -------------------------------------------------------------------------------- 1 | { config, lib, ... }: with lib; let 2 | cfg = config.home.nix; 3 | nixPathDirs = filterAttrs (_: v: v.type == "path") config.home.nix.nixPath; 4 | nixPaths = filterAttrs (_: v: v.type != "path") config.home.nix.nixPath; 5 | nixPaths' = mapAttrsToList (_: v: v.repr) nixPaths; 6 | nixPath = [ 7 | config.home.nix.nixPathDirectory 8 | ] ++ nixPaths' ++ workaround; 9 | sessionVariables = { 10 | NIX_PATH = concatStringsSep ":" nixPath; 11 | }; 12 | # nix 2.0 CLI adds magic default attrs for NIX_PATH entries, but doesn't support populating it from prefixless paths so fix that 13 | # (it will actually still load them from the prefixless path, but there need to be explicit entries so it knows the keys) 14 | # alternatively: "${k}=${config.home.nix.nixPathDirectory}/${k}" 15 | workaround = mapAttrsToList (k: _: "${k}=/xxx") nixPathDirs; 16 | in { 17 | options.home.nix = { 18 | enable = mkEnableOption "nix configuration"; 19 | nixPathDirectory = mkOption { 20 | type = types.path; 21 | default = config.xdg.configHome + "/nix/path"; 22 | }; 23 | nixPath = let 24 | pathType = types.submodule ({ name, config, ... }: { 25 | options = { 26 | name = mkOption { 27 | type = types.nullOr types.str; 28 | default = name; 29 | }; 30 | type = mkOption { 31 | type = types.enum [ "path" "url" "explicit" ]; 32 | default = if hasPrefix "/" config.path then "path" else "url"; 33 | }; 34 | path = mkOption { 35 | type = types.str; 36 | }; 37 | repr = mkOption { 38 | type = types.str; 39 | default = if config.name == null 40 | then config.path 41 | else "${config.name}=${config.path}"; 42 | }; 43 | }; 44 | }); 45 | fudge = types.coercedTo types.str (path: { 46 | inherit path; # TODO: detect path vs url 47 | }) pathType; 48 | in mkOption { 49 | type = types.attrsOf fudge; 50 | default = { }; 51 | }; 52 | }; 53 | config = mkIf cfg.enable { 54 | home = { 55 | nix.nixPath = { 56 | default = mkOptionDefault { 57 | type = "explicit"; 58 | path = "."; 59 | }; 60 | release = mkOptionDefault { 61 | type = "explicit"; 62 | path = "./release.nix"; 63 | }; 64 | }; 65 | inherit sessionVariables; 66 | }; 67 | # TODO: bash, zsh, systemd.user? 68 | # TODO: also set nixos settings? 69 | xdg.configFile = mapAttrs' (k: v: nameValuePair "nix/path/${k}" { 70 | source = config.lib.file.mkOutOfStoreSymlink v.path; 71 | }) nixPathDirs; 72 | }; 73 | } 74 | -------------------------------------------------------------------------------- /pkgs/public/weechat/scripts.nix: -------------------------------------------------------------------------------- 1 | { 2 | # https://weechat.org/scripts/ 3 | auto_away = { buildWeechatScript }: buildWeechatScript { 4 | pname = "auto_away.py"; 5 | version = "0.4"; 6 | sha256 = "02my55fz9cid3zhnfdn0xjjf3lw5cmi3gw3z3sm54yif0h77jwbn"; 7 | }; 8 | autoconf = { buildWeechatScript }: buildWeechatScript { 9 | pname = "autoconf.py"; 10 | version = "0.4"; 11 | sha256 = "122krj58hvsn7z6221ra7f1l5h6xa4g0dsdsrxzwkvkq83j01f00"; 12 | }; 13 | emoji = { buildWeechatScript }: buildWeechatScript { 14 | pname = "emoji.lua"; 15 | version = "5"; 16 | sha256 = "072ampdhvvmah5hjc2raxvgjx632mmqa1j42sf3jabh0q4ha52ps"; 17 | }; 18 | parse_relayed_msg = { buildWeechatScript }: buildWeechatScript { 19 | pname = "parse_relayed_msg.pl"; 20 | version = "1.9.7"; 21 | sha256 = "sha256-Q9CWSfEkDe1H0ncuJVcede5q8UtaqroYHHin9IlsJgY="; 22 | }; 23 | title = { buildWeechatScript }: buildWeechatScript { 24 | pname = "title.py"; 25 | version = "0.9"; 26 | sha256 = "1h8mxpv47q3inhynlfjm3pdjxlr2fl06z4cdhr06kpm8f7xvz56p"; 27 | }; 28 | unread_buffer = { buildWeechatScript }: buildWeechatScript { 29 | pname = "unread_buffer.py"; 30 | version = "2"; 31 | sha256 = "0xrds576lvvbbimg9zl17s62zg0nyymv4qnjsbjx770hcwbbyp2s"; 32 | }; 33 | urlgrab = { buildWeechatScript }: buildWeechatScript { 34 | pname = "urlgrab.py"; 35 | version = "3.2"; 36 | sha256 = "sha256-9sRgwQl55VLs/FvgfLc16+nNrvoxlRvmwuurV33S6hc="; 37 | patches = [ 38 | ./urlgrab-homedir.patch 39 | ]; 40 | }; 41 | vimode = { buildWeechatScript }: buildWeechatScript { 42 | pname = "vimode.py"; 43 | version = "0.8.1"; 44 | sha256 = "1nz0y4w1r0whcrsqrwk6vc6f1lz62qkph5i445zjdgqy98x1v9bf"; 45 | }; 46 | vimode-develop = { fetchFromGitHub, stdenvNoCC, fetchurl }: stdenvNoCC.mkDerivation rec { 47 | pname = "vimode.py"; 48 | version = "2021-03-13"; 49 | rev = "897a33b9fb28c98c4e0a1c292d13536dd57f85c7"; 50 | src = fetchFromGitHub { 51 | owner = "GermainZ"; 52 | repo = "weechat-vimode"; 53 | rev = rev; 54 | sha256 = "1mg6j2iwlg8y0ys7zy7vl2q6hk4hg5nqir02z26n2pg33rfb3hmm"; 55 | }; 56 | 57 | patches = let 58 | fixrev = "d67f36d01890b042f084e60f4f3b61e0803ada5b"; 59 | sha256 = "sha256-IIiaMDd4eSag2MGcpmOy5A97kZ/f4xXfI0EEHeh5TrA="; 60 | in [ (fetchurl { 61 | name = "weechat-vimode-arc.patch"; 62 | url = "https://github.com/GermainZ/weechat-vimode/compare/GermainZ:${rev}...arcnmx:${fixrev}.diff"; 63 | inherit sha256; 64 | }) ]; 65 | 66 | installPhase = '' 67 | install -Dt $out/share vimode.py 68 | ''; 69 | 70 | passthru.scripts = [ pname ]; 71 | }; 72 | weechat-matrix = { python3Packages, weechat-matrix }: python3Packages.weechat-matrix or weechat-matrix; 73 | } 74 | -------------------------------------------------------------------------------- /pkgs/default.nix: -------------------------------------------------------------------------------- 1 | { pkgs ? import { } 2 | , arc ? (import ../canon.nix { inherit pkgs; }) 3 | , self ? arc.pkgs 4 | , super ? arc.super.pkgs 5 | , lib ? arc.super.lib 6 | }: with lib; let 7 | overrides' = import ./overrides.nix { inherit arc; }; 8 | overrides = builtins.mapAttrs (_: o: (overlayOverride (o // { 9 | inherit self super; 10 | })).${o.attr}) overrides'; 11 | packages' = { 12 | personal = import ./personal; 13 | public = import ./public; 14 | customized = import ./customized; 15 | }; 16 | callPackages = builtins.mapAttrs (_: attrs: arc.callPackageAttrs attrs { }); 17 | packages = callPackages packages'; 18 | groups' = { 19 | vimPlugins = import ./vimPlugins.nix; 20 | kakPlugins = import ./kakPlugins.nix; 21 | mpvScripts = import ./mpvScripts.nix; 22 | polybarScripts = import ./polybarScripts.nix; 23 | kernelPatches = import ./kernelPatches.nix; 24 | rxvt-unicode-plugins = import ./urxvt; 25 | obs-studio-plugins = import ./obs; 26 | zsh-plugins = import ./zsh; 27 | gitAndTools = import ./git; 28 | weechatScripts = import ./public/weechat/scripts.nix; 29 | }; 30 | groups = callPackages groups'; 31 | groupsWithoutGit = 32 | # changed in nixpkgs to an alias on 2021-01-14 33 | if versionAtLeast version "21.03pre" 34 | then builtins.removeAttrs groups [ "gitAndTools" ] 35 | else groups; 36 | customization = { 37 | pythonOverrides = import ./python; 38 | }; 39 | select = { 40 | inherit overrides; 41 | inherit groups; 42 | toplevel = packages.personal // packages.public // packages.customized; 43 | exported = packages.public // packages.customized; 44 | all = attrsets.mergeAttrsList (attrValues packages ++ attrValues groups); 45 | }; 46 | extendWith = super: select.exported // 47 | builtins.mapAttrs (makeOrExtend super) groupsWithoutGit // 48 | builtins.mapAttrs (attr: group: super.${attr} or { } // group) customization; 49 | extendWithOverrides = self: super: { 50 | callPackageOverrides = super.callPackageOverrides or { } // mapAttrs' (k: o: 51 | nameValuePair o.withAttr { ${k} = self.${o.superAttr} or super.${k} or (o.fallback { }); } 52 | ) (filterAttrs (_: o: o.withAttr or null != null) overrides'); 53 | } // attrsets.mergeAttrsList (mapAttrsToList (_: o: overlayOverride (o // { 54 | inherit self super; 55 | })) overrides'); 56 | in lib.recurseIntoAttrs or lib.id select.toplevel // { 57 | groups = 58 | builtins.mapAttrs (_: lib.dontRecurseIntoAttrs or lib.id) (packages // select) // 59 | builtins.mapAttrs (_: lib.recurseIntoAttrs or lib.id) groups; 60 | customization = 61 | builtins.mapAttrs (_: lib.dontRecurseIntoAttrs or lib.id) customization; 62 | personal = lib.dontRecurseIntoAttrs or lib.id packages.personal; 63 | inherit extendWith; 64 | inherit extendWithOverrides; 65 | } 66 | -------------------------------------------------------------------------------- /modules/home/page.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: with lib; let 2 | cfg = config.programs.page; 3 | args = 4 | optionals cfg.openLines.enable [ "-O" (toString (- cfg.openLines.promptHeight)) ] 5 | ++ optionals (cfg.queryLines != 0) [ "-q" (toString cfg.queryLines) ]; 6 | batWrapper = pkgs.writeShellScriptBin "bat" '' 7 | ARGS=() 8 | for arg in "$@"; do 9 | if [[ $arg = --language=* ]]; then 10 | LANG=$(cut -d= -f2 <<<"$arg") 11 | ARGS+=("--file-name=stdin.$LANG") 12 | elif [[ $arg = --plain ]]; then 13 | ARGS+=("--style=plain") 14 | else 15 | ARGS+=("$arg") 16 | fi 17 | done 18 | if [[ -n $PAGE_BAT_LANG ]]; then 19 | ARGS+=("--language=$PAGE_BAT_LANG") 20 | fi 21 | exec ${getExe config.programs.bat.package or pkgs.bat} "''${ARGS[@]}" 22 | ''; 23 | pager = pkgs.writeShellScriptBin "page" '' 24 | PAGE_NVIM_ARGS=(${escapeShellArgs args} "$@") 25 | ${cfg.wrapper.setup} 26 | exec ${cfg.package}/bin/page "''${PAGE_NVIM_ARGS[@]}" 27 | ''; 28 | in { 29 | options.programs.page = { 30 | enable = mkEnableOption "page"; 31 | package = mkOption { 32 | type = types.package; 33 | default = pkgs.page; 34 | defaultText = literalExpression "pkgs.page"; 35 | }; 36 | finalPackage = mkOption { 37 | type = types.package; 38 | default = pager; 39 | defaultText = literalExpression "wrapped config.programs.page.package"; 40 | }; 41 | 42 | wrapper = { 43 | setup = mkOption { 44 | type = types.lines; 45 | }; 46 | bat = { 47 | enable = mkEnableOption "bat wrapper" // { 48 | default = config.programs.bat.enable; 49 | }; 50 | package = mkOption { 51 | type = types.package; 52 | default = batWrapper; 53 | }; 54 | }; 55 | }; 56 | 57 | manPager = mkEnableOption "page as MANPAGER"; 58 | 59 | queryLines = mkOption { 60 | type = types.ints.between 0 100000; 61 | default = 0; 62 | }; 63 | openLines = { 64 | enable = mkEnableOption "skip pager if output is smaller than terminal height"; 65 | promptHeight = mkOption { 66 | type = types.int; 67 | default = 1; 68 | }; 69 | }; 70 | }; 71 | config = { 72 | programs.page = { 73 | wrapper.setup = mkMerge [ 74 | (mkBefore ''export PAGE_NVIM=1'') 75 | (mkIf cfg.wrapper.bat.enable ''export PATH=${cfg.wrapper.bat.package}/bin:$PATH'') 76 | ]; 77 | }; 78 | programs.bat.enable = mkIf (cfg.enable && cfg.openLines.enable) (mkOverride 1450 true); 79 | home = mkIf cfg.enable { 80 | packages = singleton cfg.finalPackage; 81 | sessionVariables = mkMerge [ { 82 | PAGER = "page"; 83 | } (mkIf cfg.manPager { 84 | MANPAGER = "page -t man"; 85 | }) ]; 86 | }; 87 | }; 88 | } 89 | -------------------------------------------------------------------------------- /modules/nixos/modprobe.nix: -------------------------------------------------------------------------------- 1 | { pkgs, config, lib, ... }: with lib; let 2 | cfg = config.boot.modprobe; 3 | modules = partition (mod: mod.includeInInitrd) (attrValues cfg.modules); 4 | optionString = option: value: let 5 | str = 6 | if value == true then "1" 7 | else if value == false then "0" 8 | else toString value; 9 | in "${option}=${str}"; 10 | moduleType = types.submodule ({ config, name, ... }: { 11 | options = { 12 | moduleName = mkOption { 13 | type = types.str; 14 | default = name; 15 | }; 16 | blacklist = mkOption { 17 | type = types.bool; 18 | default = false; 19 | }; 20 | includeInInitrd = mkOption { 21 | type = types.bool; 22 | default = true; 23 | }; 24 | aliases = mkOption { 25 | type = types.listOf types.str; 26 | default = [ ]; 27 | }; 28 | installCommands = mkOption { 29 | type = types.listOf types.str; 30 | default = [ ]; 31 | }; 32 | removeCommands = mkOption { 33 | type = types.listOf types.str; 34 | default = [ ]; 35 | }; 36 | options = mkOption { 37 | type = types.attrsOf types.unspecified; 38 | default = { }; 39 | }; 40 | extraConfig = mkOption { 41 | type = types.lines; 42 | default = ""; 43 | }; 44 | modprobeConfig = mkOption { 45 | type = types.lines; 46 | readOnly = true; 47 | }; 48 | }; 49 | config = { 50 | modprobeConfig = let 51 | aliases = map (alias: ''alias ${alias} ${config.moduleName}'') config.aliases; 52 | options = ''options ${config.moduleName} '' + concatStringsSep " " (mapAttrsToList optionString (filterAttrs (_: opt: opt != null) config.options)); 53 | install = ''install ${config.moduleName} '' + concatStringsSep "; " config.installCommands; 54 | remove = ''remove ${config.moduleName} '' + concatStringsSep "; " config.removeCommands; 55 | in mkMerge ([ 56 | (mkIf config.blacklist "blacklist ${config.moduleName}") 57 | (mkIf (config.options != { }) options) 58 | (mkIf (config.installCommands != [ ]) install) 59 | (mkIf (config.removeCommands != [ ]) remove) 60 | config.extraConfig 61 | ] ++ aliases); 62 | }; 63 | }); 64 | in { 65 | options.boot.modprobe = { 66 | enable = mkOption { 67 | type = types.bool; 68 | default = cfg.modules != { }; 69 | }; 70 | modules = mkOption { 71 | type = types.attrsOf moduleType; 72 | default = { }; 73 | }; 74 | }; 75 | config = mkIf cfg.enable { 76 | boot.extraModprobeConfig = mkMerge (map (mod: mod.modprobeConfig) modules.right); 77 | environment.etc."modprobe.d/excluded.conf" = mkIf (modules.wrong != []) { 78 | text = mkMerge (map (mod: mod.modprobeConfig) modules.wrong); 79 | }; 80 | }; 81 | } 82 | -------------------------------------------------------------------------------- /pkgs/public/ffr/r3-bin.nix: -------------------------------------------------------------------------------- 1 | { fetchurl 2 | , stdenvNoCC 3 | , makeWrapper 4 | , unzip 5 | , writeShellScript 6 | , lib 7 | , wine64 8 | , wine 9 | , lightspark ? null 10 | , enableWine ? !stdenvNoCC.hostPlatform.isWindows 11 | , enableLightspark ? false 12 | , binArch ? if stdenvNoCC.hostPlatform.is64bit then "64bit" else "32bit" 13 | }: let 14 | inherit (lib.lists) optional; 15 | inherit (lib.meta) getExe; 16 | mainProgram = "R3"; 17 | wine' = if binArch == "64bit" then wine64 else wine; 18 | in stdenvNoCC.mkDerivation rec { 19 | pname = "ffr-r3air-bin"; 20 | version = "2.0.1"; 21 | src = fetchurl { 22 | url = "https://github.com/flashflashrevolution/rCubed/releases/download/v${version}/rCubed-${version}-${binArch}.zip"; 23 | sha256 = { 24 | "2.0.1-64bit" = "sha256-E6E0K2PVIRiOsJWfEBgR2Jl9hYc4wSN9Sobp2oorRZY="; 25 | "2.0.1-32bit" = "sha256-GP6pMbph5lAsX1uFZUNh4uGlDb3Jv2EtR05BHJbnQpc="; 26 | }."${version}-${binArch}"; 27 | }; 28 | 29 | nativeBuildInputs = [ unzip ] 30 | ++ optional (enableWine || enableLightspark) makeWrapper; 31 | buildInputs = 32 | optional enableWine wine' 33 | ++ optional enableLightspark lightspark; 34 | strictDeps = true; 35 | 36 | installDir = "lib/r3air"; 37 | ${if enableWine then "wineBin" else null} = getExe wine'; 38 | ${if enableLightspark then "lightsparkBin" else null} = getExe lightspark; 39 | inherit mainProgram; 40 | 41 | ${if enableWine then "setupScript" else null} = writeShellScript "${pname}-setup" '' 42 | set -eu 43 | mkdir -p "$FFR_R3_CACHE/"song_cache "$FFR_R3_DATA/"{dbinfo,replays,noteskins} 44 | ln -sf "$1/"* "$FFR_R3_DATA/"{dbinfo,replays,noteskins} "$FFR_R3_CACHE/" 45 | ''; 46 | 47 | installPhase = let 48 | installExe = '' 49 | ln -s "$out/$installDir/R3.exe" $out/bin/$mainProgram.exe 50 | ''; 51 | installWine = '' 52 | makeWrapper $wineBin $out/bin/$mainProgram \ 53 | --run 'export FFR_R3_CACHE=''${FFR_R3_CACHE-$XDG_CACHE_HOME/r3air}' \ 54 | --run 'export FFR_R3_DATA=''${FFR_R3_DATA-$XDG_DATA_HOME/r3air}' \ 55 | --run "$setupScript $out/$installDir" \ 56 | --run 'cd $FFR_R3_CACHE' \ 57 | --append-flags "R3.exe" 58 | ''; 59 | installLightspark = '' 60 | makeWrapper $lightsparkBin $out/bin/$mainProgram \ 61 | --add-flags "--air" --add-flags "$out/$installDir/R3.exe" 62 | ''; 63 | in '' 64 | runHook preInstall 65 | 66 | install -d "$out/$installDir" $out/bin 67 | mv 'Adobe AIR' META-INF \ 68 | *.exe *.swf changelog.txt data mimetype \ 69 | "$out/$installDir" 70 | 71 | ${if enableWine then installWine else if enableLightspark then installLightspark else installExe} 72 | 73 | runHook postInstall 74 | ''; 75 | 76 | meta = { 77 | inherit mainProgram; 78 | homepage = "https://www.flashflashrevolution.com"; 79 | license = lib.licenses.agpl3Plus; 80 | }; 81 | passthru.ci = { 82 | skip = true; 83 | }; 84 | } 85 | -------------------------------------------------------------------------------- /modules/nixos/dsdt.nix: -------------------------------------------------------------------------------- 1 | { config, options, pkgs, lib, ... }: with lib; let 2 | cfg = config.boot.initrd.dsdt; 3 | opts = options.boot.initrd.dsdt; 4 | patchedAcpiTable = { 5 | dsdt 6 | , versionPre 7 | , versionPost 8 | , checks ? [ ] 9 | , replace ? [ ] 10 | }: pkgs.runCommand "dsdt-s3.aml" { 11 | nativeBuildInputs = [ pkgs.buildPackages.acpica-tools ]; 12 | inherit dsdt versionPre versionPost; 13 | } '' 14 | iasl -p ./dsdt -d $dsdt 15 | if ! grep -qF "0x$versionPre" dsdt.dsl; then 16 | echo version 0x$versionPre not found in dsdt >&2 17 | exit 1 18 | fi 19 | ${concatMapStringsSep "\n" ({ check, message }: "if ${check}; then echo ${escapeShellArg message} >&2; exit 1; fi") checks} 20 | sed -i \ 21 | -e "s/, 0x$versionPre/, 0x$versionPost/" \ 22 | ${concatMapStringsSep " " ({ find, replace, flags ? "" }: "-e s/${find}/${replace}/${flags}") replace} \ 23 | dsdt.dsl 24 | iasl -tc dsdt.dsl 25 | mv dsdt.aml $out 26 | ''; 27 | acpiImage = dsdt: pkgs.runCommand "dsdt.img" { 28 | nativeBuildInputs = [ pkgs.buildPackages.cpio ]; 29 | inherit dsdt; 30 | } '' 31 | install -D $dsdt kernel/firmware/acpi/dsdt.aml 32 | find kernel | cpio -H newc --create > $out 33 | ''; 34 | in { 35 | options.boot.initrd.dsdt = with types; { 36 | enable = mkEnableOption "DSDT patches" // { 37 | default = opts.table.isDefined; 38 | }; 39 | table = mkOption { 40 | type = path; 41 | }; 42 | version = mkOption { 43 | type = strMatching "[0-9a-f]+"; 44 | }; 45 | image = mkOption { 46 | type = path; 47 | default = acpiImage cfg.table; 48 | defaultText = "mkAcpiImage config.boot.initrd.dsdt.table"; 49 | }; 50 | patch = { 51 | enable = mkEnableOption "DSDT patches" // { 52 | default = cfg.patch.s3.enable; 53 | }; 54 | table = mkOption { 55 | type = path; 56 | }; 57 | version = mkOption { 58 | type = strMatching "[0-9a-f]+"; 59 | }; 60 | s3.enable = mkEnableOption "DSDT S3 sleep patch"; 61 | }; 62 | }; 63 | config.boot = { 64 | initrd = { 65 | prepend = mkIf cfg.enable [ "${cfg.image}" ]; 66 | dsdt = { 67 | table = let 68 | patched = patchedAcpiTable { 69 | dsdt = cfg.patch.table; 70 | versionPre = cfg.patch.version; 71 | versionPost = cfg.version; 72 | checks = optional cfg.patch.s3.enable { 73 | check = "! grep -qF 'XS3,' dsdt.dsl"; 74 | message = "XS3 not found in dsdt"; 75 | }; 76 | replace = optional cfg.patch.s3.enable { 77 | find = "XS3,"; replace = "_S3,"; 78 | }; 79 | }; 80 | in mkIf cfg.patch.enable (mkOptionDefault patched); 81 | }; 82 | }; 83 | kernelParams = mkIf (cfg.enable && cfg.patch.enable && cfg.patch.s3.enable) [ 84 | "mem_sleep_default=deep" 85 | ]; 86 | }; 87 | } 88 | -------------------------------------------------------------------------------- /modules/home/github.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, lib, ... }: 2 | with lib; 3 | let 4 | cfg = config.programs.git.gitHub; 5 | in { 6 | options.programs.git.gitHub = let 7 | typeRepoConfig = types.submodule { 8 | options = { 9 | user = mkOption { 10 | type = types.str; 11 | description = "User to reference from programs.git.gitHub.users"; 12 | }; 13 | }; 14 | }; 15 | typeUserConfig = types.submodule { 16 | options = { 17 | name = mkOption { 18 | type = types.nullOr types.str; 19 | description = "git commit name"; 20 | default = null; 21 | }; 22 | email = mkOption { 23 | type = types.nullOr types.str; 24 | description = "git commit email address"; 25 | default = null; 26 | }; 27 | signingKey = mkOption { 28 | type = types.nullOr types.str; 29 | description = "GPG signing key"; 30 | default = null; 31 | }; 32 | sshKeyPrivate = mkOption { 33 | type = types.nullOr types.path; 34 | description = "SSH Key"; 35 | default = null; 36 | }; 37 | sshKeyPublic = mkOption { 38 | type = types.nullOr types.path; 39 | description = "SSH Key"; 40 | default = null; 41 | }; 42 | keysHash = mkOption { 43 | type = types.str; 44 | description = "Fixed-output derivation hash"; 45 | }; 46 | }; 47 | }; 48 | in { 49 | enable = mkOption { 50 | type = types.bool; 51 | #default = mkIf (config.programs.git.gitHub.users != null); 52 | default = config.programs.git.gitHub.users != null; 53 | }; 54 | users = mkOption { 55 | type = types.attrsOf typeUserConfig; 56 | default = {}; 57 | }; 58 | sharedRepos = mkOption { 59 | type = types.attrsOf typeRepoConfig; 60 | default = {}; 61 | }; 62 | orgs = mkOption { 63 | type = types.attrsOf typeRepoConfig; 64 | default = {}; 65 | }; 66 | }; 67 | 68 | config = let 69 | userRepos = mapAttrs (name: _: { user = name; }) cfg.users; 70 | repos = cfg.sharedRepos // cfg.orgs // userRepos; 71 | urlInsteadOf = name: config: let 72 | host = "github-${config.user}"; 73 | in { 74 | "${host}:${name}".insteadOf = ["git@github.com:${name}" "ssh://git@github.com/${name}"]; 75 | }; 76 | urls = mapAttrsToList urlInsteadOf repos; 77 | in mkIf cfg.enable { 78 | programs.git.configEmail = mapAttrs (name: user: { 79 | name = if user.name != null then user.name else name; 80 | email = if user.email != null then user.email else "${name}@users.noreply.github.com"; 81 | signingKey = user.signingKey; 82 | }) cfg.users; 83 | programs.git.extraConfig.url = attrsets.mergeAttrsList urls; 84 | programs.ssh.matchBlocks = mapAttrs' (name: user: 85 | nameValuePair "github-${name}" (let 86 | privateKey = optional (user.sshKeyPrivate != null) user.sshKeyPrivate; 87 | in { 88 | hostname = "github.com"; 89 | user = "git"; 90 | identitiesOnly = true; 91 | compression = false; 92 | identityFile = map toString privateKey; 93 | }) 94 | ) cfg.users; 95 | }; 96 | } 97 | --------------------------------------------------------------------------------