commit 6af992e5a97df6701b888c9fc4eb9b9f0a3e0ce2
parent 56087e88a48671025a08f562829ccb292ecf8777
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sun, 11 Sep 2022 21:09:16 +0200
parent 56087e88a48671025a08f562829ccb292ecf8777
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sun, 11 Sep 2022 21:09:16 +0200
pkgs: overlay own packages into nixpkgs
20 files changed, 79 insertions(+), 82 deletions(-)
diff --git a/configurations/common.nix b/configurations/common.nix @@ -1,11 +1,15 @@ { config, pkgs, lib, ... }: { + imports = [ <home-manager/nixos> <agenix/modules/age.nix> + + ../pkgs ../modules ../helpers/make-nixpkgs.nix + ./programs/cli/bash.nix ./programs/cli/git.nix ./programs/cli/micro.nix @@ -73,7 +77,7 @@ environment.systemPackages = with pkgs; [ alacritty.terminfo - (pkgs.callPackage <agenix/pkgs/agenix.nix> {}) + agenix ]; users.users = { @@ -88,6 +92,7 @@ extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDb2eZ2ymt+Zsf0eTlmjW2jPdS013lbde1+EGkgu6bz9lVTR8aawshF2HcoaWp5a5dJr3SKyihDM8hbWSYB3qyTHihNGyCArqSvAtZRw301ailRVHGqiwUITTfcg1533TtmWvlJZgOIFM1VvSAfdueDRRRzbygmn749fS9nhUTDzLtjqX5LvhpqhzsD+eOqPrV6Ne8E1e42JxQb5AJPY1gj9mk6eAarvtEHQYEe+/hp9ERjtCdN5DfuOJnqfaKS0ytPj/NbQskbX/TMgeUVio11iC2NbXsnAtzMmtbLX4mxlDQrR6aZmU/rHQ4aeJqI/Tj2rrF46icri7s0tnnit1OjT5PSxXgifcOtn06qoxYZMT1x+Dyrt40vNkGmxmxCnirm8B+6MKXgd/Ys+7tnOm1ht8TmLm96x6KdOiF3Zq/tMxhPAzp8JriTKSo7k7U9XxStFghTbhhBNc7OX89ZbpalLEnvbQiz87gZxhcx8cLvzIjslOHmZOSWC5Pgr4wwuj3Akq63i4ya6/BzM6v4UoBuDAB6fz3NHKL4R5X20la7Pvt7OBysQkGClWfj6ipMR1bFE2mfYtlMioXNgTjC+NCpEl1+81MH7dv2565Hk8CLV8FMxv6GujbAZGjjcM47lpWM1cBQvpBMUA/lLkyiCPK0YxNWAB7Co+jYDl6CR0Ubew== cardno:6445161" + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDo0M+Nyx9j/NCanyPgSNn8V1tJ0h9QMM3CWEbAHDhMenLUTQHJPQ2IVLb2WZcvnD57nx6uYhdqr57jAP6ciD1tmgjqGSk5+B13ebB0zjm9yVGs+UHF4o5yRbo7WAJM5CEFUlVuQatmWKpHG/t+BIe2QnDk/pvsA5JtvHKrh4zuGV3ngTjHomzMhP2lAum9V5PC4ygji1t2FdyiVdoyHJYW1skIYgNF19jBzcBCApkJwMk1HB/WdHH6oA3ceT9gYmiMrLHypgebnKgs77jazKPMTqx03mZkU6DqoJ/8qgxnwIio/BfJjTKUgCV1p16U26E2kI3L0Lt4q76YmQp3hEiHef4bvrqBAYF83VcRuoF+QPp0UNracKCctZcNvHr9ezxZt51TAjIpNeTB9eewqlvydu+fWgVBt2k74z9V5V8NpS5UlXGVWAg3LOgrhUgneHEhfAWEW+6/kMeDazI3IYB5dGMQ2T2lijN5R5Kww2RH24B+4Bgi/vqnjY+gqVC+LG8= root@blechkasten" ]; };
diff --git a/configurations/darwin/speakers.nix b/configurations/darwin/speakers.nix @@ -2,7 +2,6 @@ let secrets = import ../../secrets; - SpeakerDaemon = pkgs.callPackage ../../pkgs/SpeakerDaemon {}; switchSpeakers = pkgs.writeScript "switchSpeakers.sh" '' #!/usr/bin/env bash @@ -23,7 +22,7 @@ in { path = [ config.environment.systemPath ]; serviceConfig = { - ProgramArguments = [ "${SpeakerDaemon}/bin/SpeakerDaemon" ]; + ProgramArguments = [ "${pkgs.SpeakerDaemon}/bin/SpeakerDaemon" ]; KeepAlive = true; }; };
diff --git a/configurations/darwin/systemEnvironment.nix b/configurations/darwin/systemEnvironment.nix @@ -1,10 +1,10 @@ { config, pkgs, lib, ... }: -let - bgiparser = pkgs.callPackage ../../pkgs/bgiparser.nix {}; - asitop = pkgs.callPackage ../../pkgs/asitop.nix {}; +{ -in { + imports = [ + ../../pkgs + ]; nix = { package = pkgs.nix; @@ -17,7 +17,7 @@ in { home-manager = { useUserPackages = true; - users.leah.home.packages = [ bgiparser asitop ]; + users.leah.home.packages = with pkgs; [ bgiparser asitop colmena ]; users.leah.home.homeDirectory = lib.mkForce "/Users/leah/"; }; @@ -27,7 +27,7 @@ in { shells = [ pkgs.bashInteractive ]; systemPackages = with pkgs; [ bashInteractive - (pkgs.callPackage <agenix/pkgs/agenix.nix> {}) + agenix ]; };
diff --git a/configurations/darwin/yabai.nix b/configurations/darwin/yabai.nix @@ -1,8 +1,6 @@ { config, pkgs, ... }: let - yabai = pkgs.callPackage ../../pkgs/yabai.nix {}; - toggleFloating = pkgs.writeScript "yabaiToggleFloating.sh" '' #!/usr/bin/env bash PATH=$(eval echo $PATH) @@ -22,13 +20,13 @@ let in { environment.etc."sudoers.d/yabai".text = '' - leah ALL = (root) NOPASSWD: ${yabai}/bin/yabai --load-sa + leah ALL = (root) NOPASSWD: ${pkgs.yabai}/bin/yabai --load-sa ''; services.yabai = { - enable = true; - package = yabai; - config = { + enable = true; + package = pkgs.yabai; + config = { layout = "float"; window_placement = "second_child";
diff --git a/configurations/desktop-sway.nix b/configurations/desktop-sway.nix @@ -72,7 +72,6 @@ ./programs/imv.nix ./programs/cli/ansible.nix - ./programs/cli/garminexport.nix ./programs/cli/texlive.nix ./programs/sublime-text3.nix ./programs/libreoffice.nix
diff --git a/configurations/programs/cli/garminexport.nix b/configurations/programs/cli/garminexport.nix @@ -1,12 +0,0 @@ -{ pkgs, lib, ... }: - -let - garminexport = pkgs.callPackage ../../../pkgs/garminexport.nix {}; - -in { - - home-manager.users.leah = { - home.packages = [ garminexport ]; - }; - -}
diff --git a/configurations/programs/cli/starship.nix b/configurations/programs/cli/starship.nix @@ -9,6 +9,9 @@ enableZshIntegration = true; settings = { add_newline = false; + status = { + disabled = false; + }; }; }; };
diff --git a/configurations/programs/cli/utilities.nix b/configurations/programs/cli/utilities.nix @@ -1,9 +1,6 @@ { pkgs, ... }: -let - phockup = pkgs.callPackage ../../../pkgs/phockup.nix {}; - -in { +{ home-manager.users.leah = { home = { packages = with pkgs; [ @@ -32,6 +29,7 @@ in { smartmontools phockup + garminexport ] ++ (if pkgs.stdenv.isLinux then [ usbutils pciutils
diff --git a/machines/blechkasten/darwin-configuration.nix b/machines/blechkasten/darwin-configuration.nix @@ -32,7 +32,6 @@ ../../configurations/programs/cli/utilities.nix ../../configurations/programs/cli/network-utilities.nix ../../configurations/programs/cli/scripts.nix - ../../configurations/programs/cli/garminexport.nix ./syncthing.nix ];
diff --git a/machines/lollo/airsane.nix b/machines/lollo/airsane.nix @@ -1,13 +1,10 @@ { pkgs, ... }: -let - AirSane = pkgs.callPackage ../../pkgs/AirSane {}; - -in { +{ users.users.leah.extraGroups = [ "scanner" "lp" ]; - environment.systemPackages = [ AirSane ]; + environment.systemPackages = [ pkgs.AirSane ]; hardware.sane.enable = true; services.saned.enable = true;
diff --git a/machines/lollo/gotosocial.nix b/machines/lollo/gotosocial.nix @@ -1,9 +1,6 @@ { config, pkgs, ... }: -let - gotosocial = pkgs.callPackage ../../pkgs/gotosocial {}; - -in { +{ imports = [ ../../modules/gotosocial.nix ]; @@ -17,10 +14,9 @@ in { services.gotosocial = { enable = true; - package = gotosocial; config = '' - web-template-base-dir: "${gotosocial}/share/template/" - web-asset-base-dir: "${gotosocial}/share/assets/" + web-template-base-dir: "${pkgs.gotosocial}/share/template/" + web-asset-base-dir: "${pkgs.gotosocial}/share/assets/" application-name: "ctucx.gts"
diff --git a/machines/lollo/smarthome/smartied.nix b/machines/lollo/smarthome/smartied.nix @@ -3,10 +3,6 @@ let secrets = import ../../../secrets; - kvg-station-departures = pkgs.callPackage ../../../pkgs/kvg-station-departures.nix {}; - smartied = pkgs.callPackage ../../../pkgs/smartied.nix {}; - smartiePWA = pkgs.callPackage ../../../pkgs/smartie-pwa {}; - smartiedConfig = { devices = { "modbus-20" = { @@ -405,7 +401,7 @@ in { onFailure = [ "notify-failure@%i.service" ]; serviceConfig = { - ExecStart = "${smartied}/bin/smartied"; + ExecStart = "${pkgs.smartied}/bin/smartied"; Restart = "on-failure"; RestartSec = "5"; }; @@ -425,7 +421,7 @@ in { forceSSL = true; locations = { "/" = { - root = smartiePWA; + root = pkgs.smartiePWA; index = "index.html"; }; "/ws" = { @@ -434,7 +430,7 @@ in { }; "/departures".extraConfig = '' include "${pkgs.nginx}/conf/fastcgi_params"; - fastcgi_param SCRIPT_FILENAME "${kvg-station-departures}/bin/kvg_kiel_station_departures"; + fastcgi_param SCRIPT_FILENAME "${pkgs.kvg-station-departures}/bin/kvg_kiel_station_departures"; fastcgi_param QUERY_STRING $args; fastcgi_pass unix:${config.services.fcgiwrap.socketAddress}; '';
diff --git a/machines/osterei/git/stagit.nix b/machines/osterei/git/stagit.nix @@ -1,8 +1,6 @@ { config, lib, pkgs, ... }: let - stagit = pkgs.callPackage ../../../pkgs/stagit.nix {}; - rebuildScript = pkgs.writeShellScript "init-stagit" '' systemctl start init-stagit; systemctl status init-stagit; @@ -22,7 +20,7 @@ let printf "Generating stagit index... " # set assets if not already there - ln -sf "${stagit}/share/doc/stagit/style.css" "/var/lib/stagit/style.css" 2> /dev/null + ln -sf "${pkgs.stagit}/share/doc/stagit/style.css" "/var/lib/stagit/style.css" 2> /dev/null # generate index arguments args="-n 'ctucx.git' -e 'git@ctu.cx'" @@ -38,7 +36,7 @@ let done # make index - echo "$args" | xargs ${stagit}/bin/stagit-index > /var/lib/stagit/index.html + echo "$args" | xargs ${pkgs.stagit}/bin/stagit-index > /var/lib/stagit/index.html # set correct permissions chmod 755 /var/lib/stagit/index.html; @@ -70,7 +68,7 @@ in { cd "/var/lib/stagit/$reponame" || return 1 # make pages - ${stagit}/bin/stagit -c '.stagit-build-cache' -n 'ctucx.git' -h 'https://git.ctu.cx/' -s 'git@${config.networking.hostName}.ctu.cx:' "$1" + ${pkgs.stagit}/bin/stagit -c '.stagit-build-cache' -n 'ctucx.git' -h 'https://git.ctu.cx/' -s 'git@${config.networking.hostName}.ctu.cx:' "$1" echo "done" } @@ -144,7 +142,7 @@ in { cd "/var/lib/stagit/$reponame" || return 1 # make pages - ${stagit}/bin/stagit -c '.stagit-build-cache' -n 'ctucx.git' -h 'https://git.ctu.cx/' -s 'git@${config.networking.hostName}.ctu.cx:' "$1" + ${pkgs.stagit}/bin/stagit -c '.stagit-build-cache' -n 'ctucx.git' -h 'https://git.ctu.cx/' -s 'git@${config.networking.hostName}.ctu.cx:' "$1" # set correct permissions chmod 755 -R /var/lib/stagit/$reponame;
diff --git a/machines/osterei/maddy.nix b/machines/osterei/maddy.nix @@ -1,13 +1,10 @@ { config, lib, pkgs, ... }: let - inherit (pkgs.callPackage ../../helpers/writePythonScriptBin.nix {}) writePythonScriptBin; - - maddy = pkgs.callPackage ../../pkgs/maddy.nix {}; secrets = import ../../secrets/default.nix; std = import <nix-std>; - mailboxFilterScript = writePythonScriptBin "mailbox-filter.py" (ps: [ ps.toml ps.mail-parser ]) '' + mailboxFilterScript = pkgs.writePythonScriptBin "mailbox-filter.py" (ps: [ ps.toml ps.mail-parser ]) '' from email.header import Header, decode_header, make_header import sys, re import toml, mailparser @@ -48,7 +45,7 @@ let sys.exit(0) ''; - receiveFilterScript = writePythonScriptBin "receive-filter.py" (ps: [ ps.toml ]) '' + receiveFilterScript = pkgs.writePythonScriptBin "receive-filter.py" (ps: [ ps.toml ]) '' import sys, toml try: @@ -79,12 +76,6 @@ let in { - nixpkgs.overlays = [ - (final: prev: { - maddy = maddy; - }) - ]; - environment.etc."maddy/filters/mailbox/leah@ctu.cx.toml".text = "${std.serde.toTOML secrets.maddy.mailboxFilter}"; environment.etc."maddy/filters/receive.toml".text = "${std.serde.toTOML secrets.maddy.receiveFilter}";
diff --git a/machines/osterei/matrix-synapse.nix b/machines/osterei/matrix-synapse.nix @@ -77,7 +77,7 @@ in { forceSSL = true; locations = { "/_matrix".proxyPass = "http://127.0.0.1:8008"; - "/".root = pkgs.callPackage ../../pkgs/cinny.nix { + "/".root = pkgs.cinny.override { conf = { defaultHomeserver = 0; homeserverList = [
diff --git a/machines/osterei/websites/photos.ctu.cx.nix b/machines/osterei/websites/photos.ctu.cx.nix @@ -1,9 +1,6 @@ { pkgs, lib, ... }: let - - gallery = pkgs.callPackage ../../../pkgs/gallery.nim {}; - galleryConfig = { SourceDir = "/mnt/photos.ctu.cx"; TargetDir = "/var/lib/ctucx-gallery"; @@ -76,7 +73,7 @@ in { Type = "oneshot"; # DynamicUser = true; - ExecStart = "${gallery}/bin/gallery ${galleryConfigFile}"; + ExecStart = "${pkgs.ctucx-gallery}/bin/gallery ${galleryConfigFile}"; User = "ctucx-gallery"; Group = "ctucx-gallery";
diff --git a/modules/darwin/hidutil.nix b/modules/darwin/hidutil.nix @@ -5,8 +5,6 @@ with lib; let cfg = config.hidutil; - XPCEventStreamHandler = pkgs.callPackage ../../pkgs/XPCEventStreamHandler {}; - # convert hex to int with nix! pow = base: exp: lib.foldl' (a: x: x * a) 1 (lib.genList (_: base) exp); hexToDec = v: @@ -67,7 +65,7 @@ in { Label = "org.nixos.activateUserKeyMapping-${entry.VendorID}:${entry.ProductID}"; ProgramArguments = [ - "${XPCEventStreamHandler}/bin/xpc_set_event_stream_handler" + "${pkgs.XPCEventStreamHandler}/bin/xpc_set_event_stream_handler" "${pkgs.writeScript "hidutil" '' #!/usr/bin/env bash osascript -e 'display notification "Load UserKeyMapping for ${entry.VendorID}:${entry.ProductID}" with title "hidutil"'
diff --git a/modules/gotosocial.nix b/modules/gotosocial.nix @@ -12,22 +12,23 @@ in { enable = mkEnableOption "gotosocial"; package = mkOption { - type = types.package; + type = types.package; + default = pkgs.gotosocial; }; user = mkOption { - type = types.str; + type = types.str; default = "gotosocial"; }; group = mkOption { - type = types.str; + type = types.str; default = "gotosocial"; }; stateDir = mkOption { - type = types.str; - default = "/var/lib/gotosocial"; + type = types.str; + default = "/var/lib/gotosocial"; readOnly = true; };
diff --git a/pkgs/default.nix b/pkgs/default.nix @@ -0,0 +1,34 @@ +{ pkgs, lib, ... }: + +{ + + nixpkgs.overlays = [ + (final: prev: { + + writePythonScriptBin = (pkgs.callPackage ./writePythonScriptBin.nix {}).writePythonScriptBin; + dns = import <dns.nix>; + + agenix = pkgs.callPackage <agenix/pkgs/agenix.nix> {}; + + yabai = pkgs.callPackage ./yabai.nix {}; + asitop = pkgs.callPackage ./asitop.nix {}; + bgiparser = pkgs.callPackage ./bgiparser.nix {}; + XPCEventStreamHandler = pkgs.callPackage ./XPCEventStreamHandler {}; + SpeakerDaemon = pkgs.callPackage ./SpeakerDaemon {}; + + garminexport = pkgs.callPackage ./garminexport.nix {}; + phockup = pkgs.callPackage ./phockup.nix {}; + stagit = pkgs.callPackage ./stagit.nix {}; + maddy = pkgs.callPackage ./maddy.nix {}; + gotosocial = pkgs.callPackage ./gotosocial {}; + AirSane = pkgs.callPackage ./AirSane {}; + cinny = pkgs.callPackage ./cinny.nix {}; + ctucx-gallery = pkgs.callPackage ./gallery.nim {}; + kvg-station-departures = pkgs.callPackage ./kvg-station-departures.nix {}; + smartied = pkgs.callPackage ./smartied.nix {}; + smartiePWA = pkgs.callPackage ./smartie-pwa {}; + + }) + ]; + +}