mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-11-13 12:13:46 +01:00
chore: remove dead configuration (#352)
Drop declarations that nothing references, including the incorrect `attrs.listToAttrs = lib.genAttrs` alias.
This commit is contained in:
1 parent
a902678522
commit
8b37fc0a7d
7 files changed
-137
No files matched your search
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user