mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
hydrogen: init (#20)
Reviewed-on: https://codeberg.org/leana8959/.files/pulls/20 Co-authored-by: Léana 江 <leana.jiang+git@icloud.com> Co-committed-by: Léana 江 <leana.jiang+git@icloud.com>
This commit is contained in:
parent
a1024668db
commit
006798d917
31 changed files with 481 additions and 141 deletions
73
nix/configurations/hydrogen/nixos/connectivity.nix
Normal file
73
nix/configurations/hydrogen/nixos/connectivity.nix
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
users.users.root.openssh.authorizedKeys.keys = let
|
||||
ids = import ../../../identities.nix;
|
||||
in
|
||||
builtins.concatMap builtins.attrValues (builtins.attrValues ids);
|
||||
|
||||
networking = {
|
||||
networkmanager.enable = lib.mkForce false;
|
||||
|
||||
firewall.allowedTCPPorts = [
|
||||
8080
|
||||
|
||||
# For 'localsend'
|
||||
# https://github.com/localsend/localsend?tab=readme-ov-file#setup
|
||||
53317
|
||||
];
|
||||
|
||||
# To enable roaming https://wiki.archlinux.org/title/Wpa_supplicant#Roaming
|
||||
wireless = {
|
||||
enable = true;
|
||||
userControlled.enable = true;
|
||||
secretsFile = config.age.secrets.wpa_password.path;
|
||||
scanOnLowSignal = false;
|
||||
networks = let
|
||||
# wpa_supplicant uses `strchr` to seek to the first `=`, so the only forbidden character is `=`.
|
||||
escapePwdKey = lib.replaceStrings ["="] ["_"];
|
||||
|
||||
fromList = ns: let
|
||||
go = networkArgs @ {
|
||||
ssid,
|
||||
# Custom fields wrapping nixpkgs module options
|
||||
hasPassword ? false,
|
||||
scanOnLowSignal ? false,
|
||||
randomizeMac ? false,
|
||||
...
|
||||
}: {
|
||||
${ssid} = lib.mkMerge [
|
||||
(builtins.removeAttrs networkArgs ["ssid" "hasPassword" "scanOnLowSignal" "randomizeMac"])
|
||||
(lib.optionalAttrs hasPassword {
|
||||
pskRaw = "ext:${escapePwdKey ssid}";
|
||||
})
|
||||
(lib.optionalAttrs scanOnLowSignal {
|
||||
extraConfig = ''
|
||||
bgscan="simple:30:-70:3600"
|
||||
'';
|
||||
})
|
||||
(lib.optionalAttrs randomizeMac {
|
||||
extraConfig = ''
|
||||
mac_addr=1
|
||||
'';
|
||||
})
|
||||
];
|
||||
};
|
||||
in
|
||||
lib.mkMerge (map go ns);
|
||||
|
||||
allowList = builtins.filter (x: x.ssid == "~");
|
||||
in
|
||||
fromList (
|
||||
# We only want to use my own network
|
||||
allowList (
|
||||
import ../../../connectivity/networks.nix
|
||||
)
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
hardware.bluetooth.enable = true;
|
||||
}
|
||||
20
nix/configurations/hydrogen/nixos/misc.nix
Normal file
20
nix/configurations/hydrogen/nixos/misc.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
system.stateVersion = "25.05";
|
||||
|
||||
swapDevices = [
|
||||
{
|
||||
device = "/var/swapfile";
|
||||
size = 1024; # MB
|
||||
}
|
||||
];
|
||||
|
||||
# Related https://github.com/NixOS/nixpkgs/issues/154163#issuecomment-1350599022
|
||||
#
|
||||
# modprobe: FATAL: Module sun4i-drm not found in directory /nix/store/gvvwpdckzcr4iamp1iyrqw3nzb7bg6c4-linux-rpi-6.6.51-stable_20241008-modules/lib/modules/6.6.51
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
makeModulesClosure = x:
|
||||
prev.makeModulesClosure (x // {allowMissing = true;});
|
||||
})
|
||||
];
|
||||
}
|
||||
19
nix/configurations/hydrogen/nixos/programs.nix
Normal file
19
nix/configurations/hydrogen/nixos/programs.nix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{pkgs, ...}: {
|
||||
environment.systemPackages = [
|
||||
pkgs.man-pages
|
||||
pkgs.man-pages-posix
|
||||
];
|
||||
|
||||
#
|
||||
# Programs
|
||||
#
|
||||
programs = {
|
||||
vim.enable = true;
|
||||
vim.defaultEditor = true;
|
||||
|
||||
git.enable = true;
|
||||
};
|
||||
|
||||
# Helps with kitty when ssh from remote
|
||||
environment.enableAllTerminfo = true;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue