Compare commits

...

5 commits

Author SHA1 Message Date
69a164e502 flake.lock: Update
Flake lock file updates:

• Updated input 'hyprland':
    'git+https://github.com/hyprwm/Hyprland/?rev=300228b503b36e5977b0d58713c5b4cf1f07b8a9&submodules=1' (2024-07-17)
  → 'git+https://github.com/hyprwm/Hyprland/?ref=refs/heads/main&rev=300228b503b36e5977b0d58713c5b4cf1f07b8a9&submodules=1' (2024-07-17)
• Updated input 'lix':
    '6abad7cb23.tar.gz?narHash=sha256-D5bBsSKvYmVn8U4lhrvMemko7m2I/sicjyAYEWDfW9A%3D' (2024-07-26)
  → '61a93d5308.tar.gz?narHash=sha256-IDr%2BfHKwmpaWi4hzD2RYLdiaGEFOrsFm%2BNeHKETxMhk%3D' (2024-08-01)
• Updated input 'lix-module':
    'd70318fb94.tar.gz?narHash=sha256-8Oqzl9QPjEe/n8y0R2tC6%2B2v/H6xBgABHXOJwxmnBg0%3D' (2024-07-11)
  → 'e350380d72.tar.gz?narHash=sha256-%2B7RReWaFQUO8MfAhJYNm4FkALuM3rPGy2AlXXv9Jmc8%3D' (2024-08-01)
• Updated input 'nixos-wsl':
    'github:nix-community/NixOS-WSL/ac026940beb42f74c5666f6ed3989aca41eddeea?narHash=sha256-Rnjo49C5/slnmcQW9c57IdiHJZ3YEFmUn3as/NIPD4E%3D' (2024-07-26)
  → 'github:nix-community/NixOS-WSL/f373ad59ae5866f0f98216bd5c71526b373450d2?narHash=sha256-37vyqHPx57deHhwvi4jwyNQLYkhm/rlVTYKOG1iahsc%3D' (2024-07-29)
• Updated input 'nixos-wsl/nixpkgs':
    'github:NixOS/nixpkgs/0c53b6b8c2a3e46c68e04417e247bba660689c9d?narHash=sha256-b6PLr0Ty7JPDBtJtjnYzlBf02bbH9alWMAgispMkTwk%3D' (2024-07-19)
  → 'github:NixOS/nixpkgs/8c50662509100d53229d4be607f1a3a31157fa12?narHash=sha256-2ShmEaFi0kJVOEEu5gmlykN5dwjWYWYUJmlRTvZQRpU%3D' (2024-07-27)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/038fb464fcfa79b4f08131b07f2d8c9a6bcc4160?narHash=sha256-Ul3rIdesWaiW56PS/Ak3UlJdkwBrD4UcagCmXZR9Z7Y%3D' (2024-07-28)
  → 'github:nixos/nixpkgs/c3392ad349a5227f4a3464dce87bcc5046692fce?narHash=sha256-5US0/pgxbMksF92k1%2BeOa8arJTJiPvsdZj9Dl%2BvJkM4%3D' (2024-07-31)
• Updated input 'nixpkgs-wayland':
    'github:nix-community/nixpkgs-wayland/6642ef653bf2fcd39b118ada1371ba4519bdcc7b?narHash=sha256-NWY1LnxdZOGFt5/VHcL4GPGSP6iBniOZBHz3WCxwhZI%3D' (2024-07-28)
  → 'github:nix-community/nixpkgs-wayland/0bbe640011f1350933109f5450b15f9bd1fb5e9f?narHash=sha256-9YvLtuLAA%2BLVmfrvlOsynHkS0DRCYnHFEp72NfXFVnc%3D' (2024-08-01)
• Updated input 'nixpkgs-wayland/nixpkgs':
    'github:nixos/nixpkgs/b73c2221a46c13557b1b3be9c2070cc42cf01eb3?narHash=sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg%3D' (2024-07-27)
  → 'github:nixos/nixpkgs/9f918d616c5321ad374ae6cb5ea89c9e04bf3e58?narHash=sha256-/DJBI6trCeVnasdjUo9pbnodCLZcFqnVZiLUfqLH4jA%3D' (2024-07-31)
• Updated input 'roc':
    'github:roc-lang/roc/d5db3137a3d8da46f92c31b6bf088bc495f759c2?narHash=sha256-TbCSht10gPCF84/HpJs2Ji/AiqfCQiF%2BoUnUiLKVlWg%3D' (2024-07-24)
  → 'github:roc-lang/roc/790eabd933e13b0836c6ec243c77f873a5956966?narHash=sha256-hjdIYAuQMWLtlxxj9GpgnfFgmGJhxDDYXnBvEVeNXG8%3D' (2024-08-01)
• Updated input 'zig2nix':
    'github:Cloudef/zig2nix/db4d9258aee5eb0cdea47e4b655585cbc5d6ebe1?narHash=sha256-5UXG8njk2MpBEQmbgE4wpm/CaaLfp35fBAHu6Ug3Kw4%3D' (2024-07-29)
  → 'github:Cloudef/zig2nix/b368a9170c6d6727375d2f43baf2565280e86019?narHash=sha256-b9q/NoJ3I5LtXVvxxjxNRxDEVMd%2B1daVldCyAYH7aCU%3D' (2024-08-01)
2024-08-01 17:52:27 +00:00
8fe9b61e64
don't build nix-du for now 2024-08-01 12:49:37 -05:00
e578f4d365
clean some of the disk 2024-08-01 12:29:07 -05:00
3908bb8d95
simpler dry run output 2024-08-01 12:28:35 -05:00
f7e25099e6
go back to nixos-unstable fail2ban 2024-07-31 11:02:47 -05:00
8 changed files with 43 additions and 177 deletions

View file

@ -16,6 +16,7 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- uses: daylin-bot/actions/setup@main - uses: daylin-bot/actions/setup@main
- uses: ./.github/actions/clean-disk
- run: git checkout -B flake-lock - run: git checkout -B flake-lock

View file

@ -307,6 +307,7 @@
"locked": { "locked": {
"lastModified": 1721248202, "lastModified": 1721248202,
"narHash": "sha256-VAhuQQ4EKbw/6z7K2IoR83+gXUdMksLWFQOhJNhSvQE=", "narHash": "sha256-VAhuQQ4EKbw/6z7K2IoR83+gXUdMksLWFQOhJNhSvQE=",
"ref": "refs/heads/main",
"rev": "300228b503b36e5977b0d58713c5b4cf1f07b8a9", "rev": "300228b503b36e5977b0d58713c5b4cf1f07b8a9",
"revCount": 4930, "revCount": 4930,
"submodules": true, "submodules": true,
@ -498,11 +499,11 @@
"lix": { "lix": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1721992157, "lastModified": 1722529543,
"narHash": "sha256-D5bBsSKvYmVn8U4lhrvMemko7m2I/sicjyAYEWDfW9A=", "narHash": "sha256-IDr+fHKwmpaWi4hzD2RYLdiaGEFOrsFm+NeHKETxMhk=",
"rev": "6abad7cb238c5c7bf59a83bed55e7590c544fc2e", "rev": "61a93d53081141d4ab222dcb939dd5caa8ffc767",
"type": "tarball", "type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/6abad7cb238c5c7bf59a83bed55e7590c544fc2e.tar.gz" "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/61a93d53081141d4ab222dcb939dd5caa8ffc767.tar.gz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
@ -521,11 +522,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1720695775, "lastModified": 1722485024,
"narHash": "sha256-8Oqzl9QPjEe/n8y0R2tC6+2v/H6xBgABHXOJwxmnBg0=", "narHash": "sha256-+7RReWaFQUO8MfAhJYNm4FkALuM3rPGy2AlXXv9Jmc8=",
"rev": "d70318fb946a0e720dfdd1fb10b0645c14e2a02a", "rev": "e350380d72f94035c309e19fda2fd550f6ab7376",
"type": "tarball", "type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/d70318fb946a0e720dfdd1fb10b0645c14e2a02a.tar.gz" "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/e350380d72f94035c309e19fda2fd550f6ab7376.tar.gz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
@ -627,11 +628,11 @@
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1722012218, "lastModified": 1722253092,
"narHash": "sha256-Rnjo49C5/slnmcQW9c57IdiHJZ3YEFmUn3as/NIPD4E=", "narHash": "sha256-37vyqHPx57deHhwvi4jwyNQLYkhm/rlVTYKOG1iahsc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NixOS-WSL", "repo": "NixOS-WSL",
"rev": "ac026940beb42f74c5666f6ed3989aca41eddeea", "rev": "f373ad59ae5866f0f98216bd5c71526b373450d2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -679,11 +680,11 @@
"nixpkgs": "nixpkgs_7" "nixpkgs": "nixpkgs_7"
}, },
"locked": { "locked": {
"lastModified": 1722171028, "lastModified": 1722530466,
"narHash": "sha256-NWY1LnxdZOGFt5/VHcL4GPGSP6iBniOZBHz3WCxwhZI=", "narHash": "sha256-9YvLtuLAA+LVmfrvlOsynHkS0DRCYnHFEp72NfXFVnc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixpkgs-wayland", "repo": "nixpkgs-wayland",
"rev": "6642ef653bf2fcd39b118ada1371ba4519bdcc7b", "rev": "0bbe640011f1350933109f5450b15f9bd1fb5e9f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -726,11 +727,11 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1721409541, "lastModified": 1722087241,
"narHash": "sha256-b6PLr0Ty7JPDBtJtjnYzlBf02bbH9alWMAgispMkTwk=", "narHash": "sha256-2ShmEaFi0kJVOEEu5gmlykN5dwjWYWYUJmlRTvZQRpU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0c53b6b8c2a3e46c68e04417e247bba660689c9d", "rev": "8c50662509100d53229d4be607f1a3a31157fa12",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -742,11 +743,11 @@
}, },
"nixpkgs_5": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1722141560, "lastModified": 1722415718,
"narHash": "sha256-Ul3rIdesWaiW56PS/Ak3UlJdkwBrD4UcagCmXZR9Z7Y=", "narHash": "sha256-5US0/pgxbMksF92k1+eOa8arJTJiPvsdZj9Dl+vJkM4=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "038fb464fcfa79b4f08131b07f2d8c9a6bcc4160", "rev": "c3392ad349a5227f4a3464dce87bcc5046692fce",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -774,11 +775,11 @@
}, },
"nixpkgs_7": { "nixpkgs_7": {
"locked": { "locked": {
"lastModified": 1722062969, "lastModified": 1722421184,
"narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=", "narHash": "sha256-/DJBI6trCeVnasdjUo9pbnodCLZcFqnVZiLUfqLH4jA=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3", "rev": "9f918d616c5321ad374ae6cb5ea89c9e04bf3e58",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -851,11 +852,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1721802603, "lastModified": 1722523856,
"narHash": "sha256-TbCSht10gPCF84/HpJs2Ji/AiqfCQiF+oUnUiLKVlWg=", "narHash": "sha256-hjdIYAuQMWLtlxxj9GpgnfFgmGJhxDDYXnBvEVeNXG8=",
"owner": "roc-lang", "owner": "roc-lang",
"repo": "roc", "repo": "roc",
"rev": "d5db3137a3d8da46f92c31b6bf088bc495f759c2", "rev": "790eabd933e13b0836c6ec243c77f873a5956966",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1150,11 +1151,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1722216224, "lastModified": 1722475688,
"narHash": "sha256-5UXG8njk2MpBEQmbgE4wpm/CaaLfp35fBAHu6Ug3Kw4=", "narHash": "sha256-b9q/NoJ3I5LtXVvxxjxNRxDEVMd+1daVldCyAYH7aCU=",
"owner": "Cloudef", "owner": "Cloudef",
"repo": "zig2nix", "repo": "zig2nix",
"rev": "db4d9258aee5eb0cdea47e4b655585cbc5d6ebe1", "rev": "b368a9170c6d6727375d2f43baf2565280e86019",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -1,9 +1,8 @@
{ pkgs, enabled, ... }: { enabled, ... }:
{ {
services.resolved = enabled; services.resolved = enabled;
services.fail2ban = { services.fail2ban = {
package = pkgs.callPackage ../../pkgs/fail2ban { };
enable = true; enable = true;
maxretry = 5; maxretry = 5;
bantime = "24h"; bantime = "24h";

View file

@ -5,6 +5,8 @@
quarto quarto
cachix cachix
graphviz graphviz
nix-du # nix-du # failing to build suddenly?
# https://github.com/symphorien/nix-du/issues/23
# maybe llvm related?
]; ];
} }

View file

@ -1,98 +0,0 @@
# pkg: https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/security/fail3ban/default.nix
# module: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/security/fail2ban.nix
{
lib,
stdenv,
fetchFromGitHub,
python3,
installShellFiles,
}:
let
rev = "8170e9fe75fd2c2c4c51a1d9972b683401cddccb";
in
python3.pkgs.buildPythonApplication {
pname = "fail2ban";
# version = "1.0.2";
version = "1.1.0-${builtins.substring 0 8 rev}";
src = fetchFromGitHub {
owner = "fail2ban";
repo = "fail2ban";
hash = "sha256-cOHpUPEEp3FoRjywun205ugbV+I51EWVTGwZS0jNRwE=";
# rev = version;
inherit rev;
};
outputs = [
"out"
"man"
];
nativeBuildInputs = [ installShellFiles ];
pythonPath = lib.optionals stdenv.isLinux (
with python3.pkgs;
[
systemd
pyinotify
]
);
preConfigure = ''
for i in config/action.d/sendmail*.conf; do
substituteInPlace $i \
--replace /usr/sbin/sendmail sendmail
done
substituteInPlace config/filter.d/dovecot.conf \
--replace dovecot.service dovecot2.service
'';
doCheck = false;
preInstall = ''
substituteInPlace setup.py --replace /usr/share/doc/ share/doc/
# see https://github.com/NixOS/nixpkgs/issues/4968
${python3.pythonOnBuildForHost.interpreter} setup.py install_data --install-dir=$out --root=$out
'';
postInstall =
let
sitePackages = "$out/${python3.sitePackages}";
in
''
install -m 644 -D -t "$out/lib/systemd/system" build/fail2ban.service
# Replace binary paths
sed -i "s#build/bdist.*/wheel/fail2ban.*/scripts/#$out/bin/#g" $out/lib/systemd/system/fail2ban.service
# Delete creating the runtime directory, systemd does that
sed -i "/ExecStartPre/d" $out/lib/systemd/system/fail2ban.service
# see https://github.com/NixOS/nixpkgs/issues/4968
rm -r "${sitePackages}/etc"
installManPage man/*.[1-9]
# This is a symlink to the build python version created by `updatePyExec`, seemingly to assure the same python version is used?
rm $out/bin/fail2ban-python
ln -s ${python3.interpreter} $out/bin/fail2ban-python
''
+ lib.optionalString stdenv.isLinux ''
# see https://github.com/NixOS/nixpkgs/issues/4968
rm -r "${sitePackages}/usr"
'';
meta = with lib; {
homepage = "https://www.fail2ban.org/";
description = "Program that scans log files for repeated failing login attempts and bans IP addresses";
license = licenses.gpl2Plus;
maintainers = with maintainers; [
eelco
lovek323
];
};
}

View file

@ -10,7 +10,7 @@ var dryCmd = &cobra.Command{
Use: "dry", Use: "dry",
Short: "poor man's nix flake check", Short: "poor man's nix flake check",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
oizys.Dry(verbose, minimal, args...) oizys.Dry( minimal, args...)
}, },
} }

View file

@ -191,13 +191,13 @@ func parseDryRun2(buf string) ([]string, []string) {
} }
// TODO: refactor to account for --debug and not --verbose? // TODO: refactor to account for --debug and not --verbose?
func showDryRunResult(nixOutput string, verbose bool) { func showDryRunResult(nixOutput string) {
toBuild, toFetch := parseDryRun(nixOutput) toBuild, toFetch := parseDryRun(nixOutput)
toFetch.Show(o.debug) toFetch.Show(o.debug)
toBuild.Show(true) toBuild.Show(true)
} }
func Dry(verbose bool, minimal bool, rest ...string) { func Dry(minimal bool, rest ...string) {
cmd := exec.Command("nix", "build", "--dry-run") cmd := exec.Command("nix", "build", "--dry-run")
cmd.Args = append(cmd.Args, rest...) cmd.Args = append(cmd.Args, rest...)
if o.resetCache { if o.resetCache {
@ -226,7 +226,7 @@ func Dry(verbose bool, minimal bool, rest ...string) {
if minimal { if minimal {
fmt.Println(string(result)) fmt.Println(string(result))
} else { } else {
showDryRunResult(string(result), verbose) showDryRunResult(string(result))
} }
} }

View file

@ -9,7 +9,6 @@ import (
"github.com/charmbracelet/lipgloss" "github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/log" "github.com/charmbracelet/log"
"golang.org/x/term"
) )
func ShowFailedOutput(buf []byte) { func ShowFailedOutput(buf []byte) {
@ -23,55 +22,23 @@ func ShowFailedOutput(buf []byte) {
} }
} }
// TODO: seperate parsing and displaying of packages
func terminalSize() (int, int) {
fd := os.Stdout.Fd()
if !term.IsTerminal(int(fd)) {
log.Error("failed to get terminal size")
return 80, 0
}
w, h, err := term.GetSize(int(fd))
if err != nil {
log.Fatal(err)
}
return w, h
}
type Packages struct { type Packages struct {
desc string desc string
names []string names []string
pad int
} }
func ParsePackages(lines []string, desc string) *Packages { func ParsePackages(lines []string, desc string) *Packages {
w, _ := terminalSize()
maxAcceptable := (w / 4) - 1
maxLen := 0
names := make([]string, len(lines)) names := make([]string, len(lines))
for i, pkg := range lines { for i, pkg := range lines {
s := strings.SplitN(pkg, "-", 2) s := strings.SplitN(pkg, "-", 2)
if len(s) != 2 { if len(s) != 2 {
log.Fatalf("failed to trim hash path from this line: %s\n ", pkg) log.Fatalf("failed to trim hash path from this line: %s\n ", pkg)
} }
name := ellipsis(strings.Replace(s[1], ".drv", "", 1), maxAcceptable) name := strings.Replace(s[1], ".drv", "", 1)
if nameLen := len(name); nameLen > maxLen {
maxLen = nameLen
}
names[i] = name names[i] = name
} }
sort.Strings(names) sort.Strings(names)
return &Packages{names: names, pad: maxLen + 1, desc: desc} return &Packages{names: names, desc: desc}
}
func ellipsis(s string, maxLen int) string {
runes := []rune(s)
if len(runes) <= maxLen {
return s
}
if maxLen < 3 {
maxLen = 3
}
return string(runes[0:maxLen-3]) + "..."
} }
func (p *Packages) Show(verbose bool) { func (p *Packages) Show(verbose bool) {
@ -81,14 +48,8 @@ func (p *Packages) Show(verbose bool) {
} }
pkgs := p.names pkgs := p.names
w, _ := terminalSize() for _, pkg := range pkgs {
nCols := w / p.pad fmt.Printf(" %s\n", pkg)
fmt.Printf("%s\n", strings.Repeat("-", w))
for i, pkg := range pkgs {
fmt.Printf("%-*s", p.pad, pkg)
if (i+1)%nCols == 0 {
fmt.Println()
}
} }
fmt.Println() fmt.Println()
} }