From 8b37fc0a7d5fd3af4fc32652e1504e8e7fe15bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ryan4yin=20=7C=20=E4=BA=8C=E8=8A=B1?= Date: Sat, 3 Oct 2026 10:09:38 +0800 Subject: [PATCH] chore: remove dead configuration (#352) Drop declarations that nothing references, including the incorrect `attrs.listToAttrs = lib.genAttrs` alias. --- hardening/nixpaks/default.nix | 4 -- home/base/core/git.nix | 3 -- home/linux/gui/base/README.md | 1 - home/linux/gui/base/immutable-file.nix | 67 -------------------------- lib/attrs.nix | 47 ------------------ lib/default.nix | 2 - vars/networking.nix | 13 ----- 7 files changed, 137 deletions(-) delete mode 100644 home/linux/gui/base/immutable-file.nix delete mode 100644 lib/attrs.nix diff --git a/hardening/nixpaks/default.nix b/hardening/nixpaks/default.nix index 1a9e6efb..4dd56707 100644 --- a/hardening/nixpaks/default.nix +++ b/hardening/nixpaks/default.nix @@ -10,10 +10,6 @@ let inherit (pkgs) lib; inherit pkgs; }; - safeBind = sloth: realdir: mapdir: [ - (sloth.mkdir (sloth.concat' sloth.appDataDir realdir)) - (sloth.concat' sloth.homeDir mapdir) - ]; }; wrapper = _pkgs: path: (_pkgs.callPackage path callArgs); in diff --git a/home/base/core/git.nix b/home/base/core/git.nix index ad331bff..38c91217 100644 --- a/home/base/core/git.nix +++ b/home/base/core/git.nix @@ -105,7 +105,4 @@ # Git terminal UI (written in go). programs.lazygit.enable = true; - - # Yet another Git TUI (written in rust). - programs.gitui.enable = false; } diff --git a/home/linux/gui/base/README.md b/home/linux/gui/base/README.md index 0079ff7c..d7ab40a9 100644 --- a/home/linux/gui/base/README.md +++ b/home/linux/gui/base/README.md @@ -96,7 +96,6 @@ Noctalia consolidates functionality that previously required multiple tools: ### System Utilities - **[`misc.nix`](./misc.nix)**: Misc GUI apps (e-book reader, remote desktop, hardened IM clients) -- **[`immutable-file.nix`](./immutable-file.nix)**: Immutable file handling ## Related Documentation diff --git a/home/linux/gui/base/immutable-file.nix b/home/linux/gui/base/immutable-file.nix deleted file mode 100644 index a3993cf5..00000000 --- a/home/linux/gui/base/immutable-file.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -############################################################################################## -# -# Provide a option `home.immutable-file`, it works like `home.file` but make the generated file immutable. -# -# Copy from https://github.com/iosmanthus/nixos-config/blob/349917b/modules/immutable-file.nix -# -# this module use the `chattr +i` to make the file immutable, `i` indicates `immutable`, -# it's a i-node flags only works on Linux. -# -# TODO not used yet, need to test it. -# -############################################################################################## -with lib; -let - cfg = config.home.immutable-file; - immutableFileOpts = _: { - options = { - src = mkOption { - type = types.path; - }; - dst = mkOption { - type = types.path; - }; - }; - }; - mkImmutableFile = pkgs.writeScript "make_immutable_file" '' - # $1: dst - # $2: src - if [ ! -d "$(dirname $1)" ]; then - mkdir -p $1 - fi - - if [ -f $1 ]; then - sudo chattr -i $1 - fi - - sudo cp $2 $1 - sudo chattr +i $1 - ''; -in -{ - options.home.immutable-file = mkOption { - type = with types; attrsOf (submodule immutableFileOpts); - default = { }; - }; - - config = mkIf (cfg != { }) { - home.activation = mapAttrs' ( - name: - { - src, - dst, - }: - nameValuePair "make-immutable-${name}" ( - lib.hm.dag.entryAfter [ "writeBoundary" ] '' - ${mkImmutableFile} ${dst} ${src} - '' - ) - ) cfg; - }; -} diff --git a/lib/attrs.nix b/lib/attrs.nix deleted file mode 100644 index 43267383..00000000 --- a/lib/attrs.nix +++ /dev/null @@ -1,47 +0,0 @@ -# https://github.com/NixOS/nixpkgs/blob/master/lib/attrsets.nix -{ lib, ... }: -{ - # Generate an attribute set from a list. - # - # lib.genAttrs [ "foo" "bar" ] (name: "x_" + name) - # => { foo = "x_foo"; bar = "x_bar"; } - listToAttrs = lib.genAttrs; - - # Update only the values of the given attribute set. - # - # mapAttrs - # (name: value: ("bar-" + value)) - # { x = "a"; y = "b"; } - # => { x = "bar-a"; y = "bar-b"; } - inherit (lib.attrsets) mapAttrs; - - # Update both the names and values of the given attribute set. - # - # mapAttrs' - # (name: value: nameValuePair ("foo_" + name) ("bar-" + value)) - # { x = "a"; y = "b"; } - # => { foo_x = "bar-a"; foo_y = "bar-b"; } - inherit (lib.attrsets) mapAttrs'; - - # Merge a list of attribute sets into one. smilar to the operator `a // b`, but for a list of attribute sets. - # NOTE: the later attribute set overrides the former one! - # - # mergeAttrsList - # [ { x = "a"; y = "b"; } { x = "c"; z = "d"; } { g = "e"; } ] - # => { x = "c"; y = "b"; z = "d"; g = "e"; } - inherit (lib.attrsets) mergeAttrsList; - - # Generate a string from an attribute set. - # - # attrsets.foldlAttrs - # (acc: name: value: acc + "\nexport ${name}=${value}") - # "# A shell script" - # { x = "a"; y = "b"; } - # => - # ``` - # # A shell script - # export x=a - # export y=b - # ```` - inherit (lib.attrsets) foldlAttrs; -} diff --git a/lib/default.nix b/lib/default.nix index 3e6fc894..154dc5b0 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -4,8 +4,6 @@ macosSystem = import ./macosSystem.nix; nixosSystem = import ./nixosSystem.nix; - attrs = import ./attrs.nix { inherit lib; }; - genK3sServerModule = import ./genK3sServerModule.nix; genK3sAgentModule = import ./genK3sAgentModule.nix; genVmHostModule = import ./genVmHostModule.nix; diff --git a/vars/networking.nix b/vars/networking.nix index be4647e5..504b889b 100644 --- a/vars/networking.nix +++ b/vars/networking.nix @@ -18,7 +18,6 @@ rec { "2400:3200::1" # Alidns "2606:4700:4700::1111" # Cloudflare ]; - prefixLength = 24; # Dedicated VIP block for the k3s clusters, outside the router's DHCP pool # (.2-.99). One /29 per cluster, handed to kube-vip: the first usable address @@ -155,18 +154,6 @@ rec { }; }; - hostsInterface = lib.attrsets.mapAttrs (key: val: { - interfaces."${val.iface}" = { - useDHCP = false; - ipv4.addresses = [ - { - inherit prefixLength; - address = val.ipv4; - } - ]; - }; - }) hostsAddr; - ssh = { # define the host alias for remote builders # this config will be written to /etc/ssh/ssh_config