tree-wide: format with nixfmt

Another saturday another useless formatter change.
It's my dotfiles, after all

alejandra doesn't handle c-style inline comments well.
This commit is contained in:
Primrose 2025-11-08 10:15:58 +08:00
parent ec704b5272
commit ebf8468807
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
116 changed files with 1895 additions and 1689 deletions

View file

@ -1,22 +1,27 @@
{sources ? import ./npins}: { {
sources ? import ./npins,
}:
{
# for repl sessions # for repl sessions
inherit sources; inherit sources;
lib = import (sources.nixpkgs + "/lib"); lib = import (sources.nixpkgs + "/lib");
nixosConfigurations = builtins.mapAttrs (_: import (sources.nixpkgs + "/nixos/lib/eval-config.nix")) { nixosConfigurations =
vanadium = { builtins.mapAttrs (_: import (sources.nixpkgs + "/nixos/lib/eval-config.nix"))
system = "x86_64-linux"; {
modules = [./nix/configurations/vanadium.nix]; vanadium = {
}; system = "x86_64-linux";
hydrogen = { modules = [ ./nix/configurations/vanadium.nix ];
system = "aarch64-linux"; };
modules = [./nix/configurations/hydrogen.nix]; hydrogen = {
}; system = "aarch64-linux";
installer = { modules = [ ./nix/configurations/hydrogen.nix ];
system = "x86_64-linux"; };
modules = [./nix/configurations/installer.nix]; installer = {
}; system = "x86_64-linux";
}; modules = [ ./nix/configurations/installer.nix ];
};
};
packages = import ./nix/packages {inherit sources;}; packages = import ./nix/packages { inherit sources; };
} }

View file

@ -4,133 +4,135 @@ let
hostname = "hydrogen"; hostname = "hydrogen";
username = "leana"; username = "leana";
in in
{ {
modulesPath, modulesPath,
config, config,
pkgs, pkgs,
lib, lib,
... ...
}: let }:
inherit (lib.modules) mkAliasOptionModule; let
in { inherit (lib.modules) mkAliasOptionModule;
imports = [ in
# The generator and hardware configuration {
(modulesPath + "/installer/sd-card/sd-image-aarch64.nix") imports = [
# The generator and hardware configuration
(modulesPath + "/installer/sd-card/sd-image-aarch64.nix")
# #
# Shorthands # Shorthands
# #
(mkAliasOptionModule ["me"] ["users" "users" username]) (mkAliasOptionModule [ "me" ] [ "users" "users" username ])
(mkAliasOptionModule ["hm"] ["home-manager" "users" username]) (mkAliasOptionModule [ "hm" ] [ "home-manager" "users" username ])
# #
# hostname # hostname
# #
{_module.args = {inherit hostname;};} { _module.args = { inherit hostname; }; }
# #
# nixpkgs # nixpkgs
# #
{ {
nixpkgs = { nixpkgs = {
overlays = map import [ overlays = map import [
../overlays/agenix.nix ../overlays/agenix.nix
../overlays/nur.nix ../overlays/nur.nix
../overlays/nix-tree.nix ../overlays/nix-tree.nix
../packages/overlay.nix ../packages/overlay.nix
# use lix everywhere and wrap it with nom # use lix everywhere and wrap it with nom
../overlays/lix.nix ../overlays/lix.nix
../overlays/nix-monitored.nix ../overlays/nix-monitored.nix
];
# Set NIX_PATH and flake registry at the same time
# https://github.com/NixOS/nixpkgs/pull/254405
flake.source = sources.nixpkgs;
};
nix.package = pkgs.nix-monitored;
system.nixos.version = lib.substring 0 8 sources.nixpkgs.revision;
}
./hydrogen/nixos/misc.nix
./hydrogen/nixos/programs.nix
./hydrogen/nixos/connectivity.nix
../nixosModules/common/fish.nix
../nixosModules/common/disable-command-not-found.nix
../nixosModules/common/network.nix
../nixosModules/common/sudo-conf.nix
../nixosModules/common/system-nixconf.nix
# QUIRK:
# Had issue when building the installer as it fails to bootstrap itself
# Might be useful to disable for the first build.
# ../nixosModules/extra/secure_dns.nix
../nixosModules/extra/leana.nix
#
# Extern modules
#
(sources.agenix + "/modules/age.nix")
(sources.nixos-hardware + "/raspberry-pi/4")
#
# home-manager
#
(sources.home-manager + "/nixos")
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [{home.stateVersion = lib.mkDefault config.system.stateVersion;}];
};
hm.imports = [
#
# hostname
#
{_module.args = {inherit hostname;};}
#
# home modules
#
./hydrogen/home/programs.nix
./hydrogen/home/dev.nix
../homeModules/common/btop
../homeModules/common/fish
../homeModules/common/starship
../homeModules/common/fzf.nix
../homeModules/common/tmux
../homeModules/common/vim
../homeModules/common/direnv.nix
../homeModules/common/git.nix
../homeModules/common/gpg.nix
../homeModules/common/leana.nix
../homeModules/common/locale.nix
../homeModules/common/packages.nix
../homeModules/common/tealdeer.nix
../homeModules/extra/tmux-fish-integration.nix
#
# Extern modules
#
(sources.agenix + "/modules/age-home.nix")
(import sources.wired-notify).homeManagerModules.default
]; ];
}
# # Set NIX_PATH and flake registry at the same time
# Secrets # https://github.com/NixOS/nixpkgs/pull/254405
# flake.source = sources.nixpkgs;
{ };
age.secrets = {
wpa_password.file = "${../secrets/wpa_password.age}"; nix.package = pkgs.nix-monitored;
};
} system.nixos.version = lib.substring 0 8 sources.nixpkgs.revision;
]; }
}
./hydrogen/nixos/misc.nix
./hydrogen/nixos/programs.nix
./hydrogen/nixos/connectivity.nix
../nixosModules/common/fish.nix
../nixosModules/common/disable-command-not-found.nix
../nixosModules/common/network.nix
../nixosModules/common/sudo-conf.nix
../nixosModules/common/system-nixconf.nix
# QUIRK:
# Had issue when building the installer as it fails to bootstrap itself
# Might be useful to disable for the first build.
# ../nixosModules/extra/secure_dns.nix
../nixosModules/extra/leana.nix
#
# Extern modules
#
(sources.agenix + "/modules/age.nix")
(sources.nixos-hardware + "/raspberry-pi/4")
#
# home-manager
#
(sources.home-manager + "/nixos")
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [ { home.stateVersion = lib.mkDefault config.system.stateVersion; } ];
};
hm.imports = [
#
# hostname
#
{ _module.args = { inherit hostname; }; }
#
# home modules
#
./hydrogen/home/programs.nix
./hydrogen/home/dev.nix
../homeModules/common/btop
../homeModules/common/fish
../homeModules/common/starship
../homeModules/common/fzf.nix
../homeModules/common/tmux
../homeModules/common/vim
../homeModules/common/direnv.nix
../homeModules/common/git.nix
../homeModules/common/gpg.nix
../homeModules/common/leana.nix
../homeModules/common/locale.nix
../homeModules/common/packages.nix
../homeModules/common/tealdeer.nix
../homeModules/extra/tmux-fish-integration.nix
#
# Extern modules
#
(sources.agenix + "/modules/age-home.nix")
(import sources.wired-notify).homeManagerModules.default
];
}
#
# Secrets
#
{
age.secrets = {
wpa_password.file = "${../secrets/wpa_password.age}";
};
}
];
}

View file

@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
home.packages = [ home.packages = [
pkgs.nil # nix pkgs.nil # nix
pkgs.pyright # python pkgs.pyright # python

View file

@ -3,12 +3,15 @@
lib, lib,
config, config,
... ...
}: { }:
home.sessionVariables = let {
fishCfg = config.programs.fish; home.sessionVariables =
in { let
"SHELL" = lib.mkIf fishCfg.enable (lib.getExe fishCfg.package); fishCfg = config.programs.fish;
}; in
{
"SHELL" = lib.mkIf fishCfg.enable (lib.getExe fishCfg.package);
};
home.packages = [ home.packages = [
pkgs.nmap pkgs.nmap

View file

@ -2,7 +2,8 @@
config, config,
lib, lib,
... ...
}: { }:
{
users.users.root.openssh.authorizedKeys.keys = import ../../../identities.nix; users.users.root.openssh.authorizedKeys.keys = import ../../../identities.nix;
networking = { networking = {
@ -22,13 +23,12 @@
userControlled.enable = true; userControlled.enable = true;
secretsFile = config.age.secrets.wpa_password.path; secretsFile = config.age.secrets.wpa_password.path;
scanOnLowSignal = false; scanOnLowSignal = false;
networks = let networks =
fromList = import ../../../networks/wpa_supplicant-compat.nix; let
networks = import ../../../networks/list.nix; fromList = import ../../../networks/wpa_supplicant-compat.nix;
in networks = import ../../../networks/list.nix;
fromList ( in
builtins.filter (x: x.ssid == "~") networks fromList (builtins.filter (x: x.ssid == "~") networks);
);
}; };
}; };

View file

@ -13,8 +13,7 @@
# 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 # 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 = [ nixpkgs.overlays = [
(final: prev: { (final: prev: {
makeModulesClosure = x: makeModulesClosure = x: prev.makeModulesClosure (x // { allowMissing = true; });
prev.makeModulesClosure (x // {allowMissing = true;});
}) })
]; ];
} }

View file

@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
environment.systemPackages = [ environment.systemPackages = [
pkgs.man-pages pkgs.man-pages
pkgs.man-pages-posix pkgs.man-pages-posix

View file

@ -9,7 +9,8 @@
lib, lib,
modulesPath, modulesPath,
... ...
}: { }:
{
imports = [ imports = [
../nixosModules/common/system-nixconf.nix ../nixosModules/common/system-nixconf.nix
../nixosModules/common/sudo-conf.nix ../nixosModules/common/sudo-conf.nix
@ -18,10 +19,15 @@
]; ];
nix.settings = { nix.settings = {
extra-substituters = ["https://leana8959.cachix.org"]; extra-substituters = [ "https://leana8959.cachix.org" ];
extra-trusted-substituters = ["https://leana8959.cachix.org"]; extra-trusted-substituters = [ "https://leana8959.cachix.org" ];
extra-trusted-public-keys = ["leana8959.cachix.org-1:CxQSAp8lcgMv8Me459of0jdXRW2tcyeYRKTiiUq8z0M="]; extra-trusted-public-keys = [
experimental-features = ["nix-command" "flakes"]; "leana8959.cachix.org-1:CxQSAp8lcgMv8Me459of0jdXRW2tcyeYRKTiiUq8z0M="
];
experimental-features = [
"nix-command"
"flakes"
];
}; };
nixpkgs = { nixpkgs = {
@ -45,7 +51,7 @@
pkgs.btop pkgs.btop
]; ];
networking.firewall.allowedTCPPorts = [8080]; # in case you wanna nc networking.firewall.allowedTCPPorts = [ 8080 ]; # in case you wanna nc
programs.tmux.enable = true; programs.tmux.enable = true;
users.users.nixos.shell = pkgs.fish; users.users.nixos.shell = pkgs.fish;

View file

@ -5,225 +5,227 @@ let
hostname = "vanadium"; hostname = "vanadium";
username = "leana"; username = "leana";
in in
{ {
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: let }:
inherit (lib.modules) mkAliasOptionModule; let
in { inherit (lib.modules) mkAliasOptionModule;
imports = [ in
# {
# Shorthands imports = [
# #
(mkAliasOptionModule ["me"] ["users" "users" username]) # Shorthands
(mkAliasOptionModule ["hm"] ["home-manager" "users" username]) #
(mkAliasOptionModule [ "me" ] [ "users" "users" username ])
(mkAliasOptionModule [ "hm" ] [ "home-manager" "users" username ])
# #
# hostname # hostname
# #
{_module.args = {inherit hostname;};} { _module.args = { inherit hostname; }; }
# #
# nixpkgs # nixpkgs
# #
{ {
# affect the generated nix.conf, doesn't need to be turned off during nixos-install # affect the generated nix.conf, doesn't need to be turned off during nixos-install
nix = { nix = {
distributedBuilds = true; distributedBuilds = true;
settings.builders-use-substitutes = true; settings.builders-use-substitutes = true;
};
nixpkgs = {
config = {
# For btop, ROCm support is needed for AMD GPU
# https://github.com/aristocratos/btop?tab=readme-ov-file#gpu-compatibility
rocmSupport = true;
}; };
nixpkgs = { overlays = map import [
config = { ../overlays/agenix.nix
# For btop, ROCm support is needed for AMD GPU ../overlays/disko.nix
# https://github.com/aristocratos/btop?tab=readme-ov-file#gpu-compatibility ../overlays/nur.nix
rocmSupport = true; ../overlays/wired-notify.nix
}; ../overlays/nix-tree.nix
../overlays/wallpapers.nix
../overlays/nil.nix
../overlays/dix.nix
../overlays/eepy.nix
../overlays/calibre-no-mime.nix
../overlays/fcitx5-table-extra-taiwanese.nix
overlays = map import [ ../overlays/iosevka.nix
../overlays/agenix.nix ../packages/overlay.nix
../overlays/disko.nix
../overlays/nur.nix
../overlays/wired-notify.nix
../overlays/nix-tree.nix
../overlays/wallpapers.nix
../overlays/nil.nix
../overlays/dix.nix
../overlays/eepy.nix
../overlays/calibre-no-mime.nix
../overlays/fcitx5-table-extra-taiwanese.nix
../overlays/iosevka.nix ./vanadium/overlay.nix
../packages/overlay.nix ./vanadium/kernel-overlay.nix
./vanadium/overlay.nix # removed, but I need it for PLFA!
./vanadium/kernel-overlay.nix ../overlays/pin-emacs28.nix
# removed, but I need it for PLFA! # use lix everywhere and wrap it with nom
../overlays/pin-emacs28.nix ../overlays/lix.nix
../overlays/nix-monitored.nix
# use lix everywhere and wrap it with nom
../overlays/lix.nix
../overlays/nix-monitored.nix
];
# Set NIX_PATH and flake registry at the same time
# https://github.com/NixOS/nixpkgs/pull/254405
flake.source = sources.nixpkgs;
};
nix.package = pkgs.nix-monitored;
system.nixos.version = lib.substring 0 8 sources.nixpkgs.revision;
}
#
# NixOS modules
#
./vanadium/nixos/hardware-configuration.nix # generated
./vanadium/nixos/fs.nix
./vanadium/nixos/restic.nix
./vanadium/nixos/battery.nix
./vanadium/nixos/audio.nix
./vanadium/nixos/connectivity.nix
./vanadium/nixos/input.nix
./vanadium/nixos/misc.nix
./vanadium/nixos/display.nix
./vanadium/nixos/gui.nix
./vanadium/nixos/locale.nix
./vanadium/nixos/unfree-predicate.nix
./vanadium/nixos/programs.nix
../nixosModules/common/fish.nix
../nixosModules/common/disable-command-not-found.nix
../nixosModules/common/network.nix
../nixosModules/common/sudo-conf.nix
../nixosModules/common/system-nixconf.nix
../nixosModules/common/xscreensaver.nix
# QUIRK:
# Had issue when building the installer as it fails to bootstrap itself
# Might be useful to disable for the first build.
# ../nixosModules/extra/secure_dns.nix
../nixosModules/extra/zram.nix
../nixosModules/extra/leana.nix
#
# Extern modules
#
(sources.disko + "/module.nix")
../disko/vanadium/btrfs.nix
(sources.agenix + "/modules/age.nix")
(import sources.url-eater).nixosModules.default
(sources.nixos-hardware + "/framework/13-inch/7040-amd")
#
# home-manager
#
(sources.home-manager + "/nixos")
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [{home.stateVersion = lib.mkDefault config.system.stateVersion;}];
};
hm.imports = [
#
# hostname
#
{_module.args = {inherit hostname;};}
#
# home modules
#
./vanadium/home/programs.nix
./vanadium/home/misc.nix
./vanadium/home/firefox.nix
./vanadium/home/xmobar.nix
# Language server packages, etc
./vanadium/home/dev.nix
../homeModules/common/btop
../homeModules/common/cmus
../homeModules/common/fcitx5
../homeModules/common/fish
../homeModules/common/nushell.nix
../homeModules/common/starship
../homeModules/common/tmux
../homeModules/common/vim
../homeModules/common/wired
../homeModules/common/atuin.nix
../homeModules/common/direnv.nix
../homeModules/common/feh.nix
../homeModules/common/firefox.nix
../homeModules/common/fzf.nix
../homeModules/common/git.nix
../homeModules/common/gpg.nix
../homeModules/common/kitty.nix
../homeModules/common/leana.nix
../homeModules/common/locale.nix
../homeModules/common/lazygit.nix
../homeModules/common/packages.nix
../homeModules/common/password-store.nix
../homeModules/common/sioyek.nix
../homeModules/common/tealdeer.nix
../homeModules/common/user-nixconf.nix
../homeModules/extra/tmux-fish-integration.nix
#
# Extern modules
#
(sources.agenix + "/modules/age-home.nix")
(import sources.wired-notify).homeManagerModules.default
]; ];
}
# # Set NIX_PATH and flake registry at the same time
# Secrets # https://github.com/NixOS/nixpkgs/pull/254405
# flake.source = sources.nixpkgs;
{ };
nix.package = pkgs.nix-monitored;
system.nixos.version = lib.substring 0 8 sources.nixpkgs.revision;
}
#
# NixOS modules
#
./vanadium/nixos/hardware-configuration.nix # generated
./vanadium/nixos/fs.nix
./vanadium/nixos/restic.nix
./vanadium/nixos/battery.nix
./vanadium/nixos/audio.nix
./vanadium/nixos/connectivity.nix
./vanadium/nixos/input.nix
./vanadium/nixos/misc.nix
./vanadium/nixos/display.nix
./vanadium/nixos/gui.nix
./vanadium/nixos/locale.nix
./vanadium/nixos/unfree-predicate.nix
./vanadium/nixos/programs.nix
../nixosModules/common/fish.nix
../nixosModules/common/disable-command-not-found.nix
../nixosModules/common/network.nix
../nixosModules/common/sudo-conf.nix
../nixosModules/common/system-nixconf.nix
../nixosModules/common/xscreensaver.nix
# QUIRK:
# Had issue when building the installer as it fails to bootstrap itself
# Might be useful to disable for the first build.
# ../nixosModules/extra/secure_dns.nix
../nixosModules/extra/zram.nix
../nixosModules/extra/leana.nix
#
# Extern modules
#
(sources.disko + "/module.nix")
../disko/vanadium/btrfs.nix
(sources.agenix + "/modules/age.nix")
(import sources.url-eater).nixosModules.default
(sources.nixos-hardware + "/framework/13-inch/7040-amd")
#
# home-manager
#
(sources.home-manager + "/nixos")
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [ { home.stateVersion = lib.mkDefault config.system.stateVersion; } ];
};
hm.imports = [
#
# hostname
#
{ _module.args = { inherit hostname; }; }
#
# home modules
#
./vanadium/home/programs.nix
./vanadium/home/misc.nix
./vanadium/home/firefox.nix
./vanadium/home/xmobar.nix
# Language server packages, etc
./vanadium/home/dev.nix
../homeModules/common/btop
../homeModules/common/cmus
../homeModules/common/fcitx5
../homeModules/common/fish
../homeModules/common/nushell.nix
../homeModules/common/starship
../homeModules/common/tmux
../homeModules/common/vim
../homeModules/common/wired
../homeModules/common/atuin.nix
../homeModules/common/direnv.nix
../homeModules/common/feh.nix
../homeModules/common/firefox.nix
../homeModules/common/fzf.nix
../homeModules/common/git.nix
../homeModules/common/gpg.nix
../homeModules/common/kitty.nix
../homeModules/common/leana.nix
../homeModules/common/locale.nix
../homeModules/common/lazygit.nix
../homeModules/common/packages.nix
../homeModules/common/password-store.nix
../homeModules/common/sioyek.nix
../homeModules/common/tealdeer.nix
../homeModules/common/user-nixconf.nix
../homeModules/extra/tmux-fish-integration.nix
#
# Extern modules
#
(sources.agenix + "/modules/age-home.nix")
(import sources.wired-notify).homeManagerModules.default
];
}
#
# Secrets
#
{
age.secrets = {
wpa_password.file = "${../secrets/wpa_password.age}";
restic_backblaze_pwd.file = "${../secrets/restic_backblaze_pwd.age}";
restic_backblaze_repo.file = "${../secrets/restic_backblaze_repo.age}";
restic_backblaze_env.file = "${../secrets/restic_backblaze_env.age}";
four_pwd.file = "${../secrets/four_pwd.age}";
restic_four_pwd.file = "${../secrets/restic_four_pwd.age}";
sgbk_pwd.file = "${../secrets/sgbk_pwd.age}";
restic_sgbk_pwd.file = "${../secrets/restic_sgbk_pwd.age}";
two_pwd.file = "${../secrets/two_pwd.age}";
};
hm = {
age.secrets = { age.secrets = {
wpa_password.file = "${../secrets/wpa_password.age}"; sshconfig = {
file = "${../secrets/sshconfig.age}";
restic_backblaze_pwd.file = "${../secrets/restic_backblaze_pwd.age}"; path = "/home/leana/.ssh/config";
restic_backblaze_repo.file = "${../secrets/restic_backblaze_repo.age}"; };
restic_backblaze_env.file = "${../secrets/restic_backblaze_env.age}"; iambconfig = {
file = "${../secrets/iambconfig.age}";
four_pwd.file = "${../secrets/four_pwd.age}"; path = "/home/leana/.config/iamb/config.toml";
restic_four_pwd.file = "${../secrets/restic_four_pwd.age}";
sgbk_pwd.file = "${../secrets/sgbk_pwd.age}";
restic_sgbk_pwd.file = "${../secrets/restic_sgbk_pwd.age}";
two_pwd.file = "${../secrets/two_pwd.age}";
};
hm = {
age.secrets = {
sshconfig = {
file = "${../secrets/sshconfig.age}";
path = "/home/leana/.ssh/config";
};
iambconfig = {
file = "${../secrets/iambconfig.age}";
path = "/home/leana/.config/iamb/config.toml";
};
}; };
}; };
} };
]; }
} ];
}

View file

@ -3,7 +3,8 @@
lib, lib,
config, config,
... ...
}: { }:
{
home.packages = [ home.packages = [
# preview markdown # preview markdown
pkgs.python3Packages.grip pkgs.python3Packages.grip
@ -42,10 +43,11 @@
"haskell/cabal" "haskell/cabal"
]; ];
}; };
includes = let includes =
fromList = import ../../../git-identities/git-compat.nix; let
identities = import ../../../git-identities/list.nix; fromList = import ../../../git-identities/git-compat.nix;
in identities = import ../../../git-identities/list.nix;
in
fromList identities; fromList identities;
}; };

View file

@ -2,9 +2,11 @@
pkgs, pkgs,
config, config,
... ...
}: let }:
let
inherit (pkgs) nur; inherit (pkgs) nur;
in { in
{
programs.firefox = { programs.firefox = {
enable = true; enable = true;
@ -106,26 +108,29 @@ in {
font-family: monospace; font-family: monospace;
} }
''; '';
extensions.packages = let extensions.packages =
addons = nur.repos.rycee.firefox-addons; let
in [ addons = nur.repos.rycee.firefox-addons;
addons.sponsorblock in
addons.return-youtube-dislikes [
addons.consent-o-matic addons.sponsorblock
]; addons.return-youtube-dislikes
addons.consent-o-matic
];
}; };
junk = { junk = {
id = 1; id = 1;
inherit inherit (config.programs.firefox.profiles.default)
(config.programs.firefox.profiles.default)
settings settings
userChrome userChrome
; ;
extensions.packages = let extensions.packages =
addons = nur.repos.rycee.firefox-addons; let
in [addons.multi-account-containers]; addons = nur.repos.rycee.firefox-addons;
in
[ addons.multi-account-containers ];
containers = { containers = {
raisin = { raisin = {
@ -144,15 +149,16 @@ in {
# Isolate it because it's proprietary # Isolate it because it's proprietary
tampermonkey = { tampermonkey = {
id = 2; id = 2;
inherit inherit (config.programs.firefox.profiles.default)
(config.programs.firefox.profiles.default)
settings settings
userChrome userChrome
; ;
extensions.packages = let extensions.packages =
addons = nur.repos.rycee.firefox-addons; let
in [addons.tampermonkey]; addons = nur.repos.rycee.firefox-addons;
in
[ addons.tampermonkey ];
}; };
}; };
}; };

View file

@ -1,19 +1,23 @@
{ {
pkgs, pkgs,
lib, lib,
nixosConfig ? {}, nixosConfig ? { },
... ...
}: { }:
{
# #
# fonts # fonts
# #
fonts.fontconfig = { fonts.fontconfig = {
enable = true; enable = true;
defaultFonts = lib.mapAttrsRecursive (_: v: v ++ ["Last Resort"]) { defaultFonts = lib.mapAttrsRecursive (_: v: v ++ [ "Last Resort" ]) {
sansSerif = ["Ubuntu" "Noto Sans CJK TC"]; sansSerif = [
serif = ["Noto Serif CJK TC"]; "Ubuntu"
monospace = ["Iosevka"]; "Noto Sans CJK TC"
emoji = ["Noto Color Emoji"]; ];
serif = [ "Noto Serif CJK TC" ];
monospace = [ "Iosevka" ];
emoji = [ "Noto Color Emoji" ];
}; };
}; };
home.packages = [ home.packages = [
@ -39,8 +43,7 @@
x11.enable = true; x11.enable = true;
gtk.enable = true; gtk.enable = true;
inherit inherit (nixosConfig.services.xserver.displayManager.lightdm.greeters.gtk.cursorTheme)
(nixosConfig.services.xserver.displayManager.lightdm.greeters.gtk.cursorTheme)
name name
package package
size size
@ -55,7 +58,7 @@
xdg.mimeApps = { xdg.mimeApps = {
enable = true; enable = true;
defaultApplications = { defaultApplications = {
"x-scheme-handler/mailto" = ["org.gnome.Evolution.desktop"]; "x-scheme-handler/mailto" = [ "org.gnome.Evolution.desktop" ];
}; };
}; };
} }

View file

@ -3,16 +3,19 @@
lib, lib,
config, config,
... ...
}: { }:
{
home.sessionPath = [ home.sessionPath = [
"${config.home.homeDirectory}/.local/bin" "${config.home.homeDirectory}/.local/bin"
]; ];
home.sessionVariables = let home.sessionVariables =
fishCfg = config.programs.fish; let
in { fishCfg = config.programs.fish;
"SHELL" = lib.mkIf fishCfg.enable (lib.getExe fishCfg.package); in
}; {
"SHELL" = lib.mkIf fishCfg.enable (lib.getExe fishCfg.package);
};
home.packages = [ home.packages = [
pkgs.ghc # my favorite calculator pkgs.ghc # my favorite calculator
@ -37,9 +40,7 @@
# lol # lol
pkgs.macchanger pkgs.macchanger
/* # The file picker is not ergonomic enough, sadly
The file picker is not ergonomic enough, sadly
*/
# pkgs.helix # pkgs.helix
# pkgs.nushell # pkgs.nushell
@ -172,7 +173,7 @@
gnome-keyring = { gnome-keyring = {
enable = true; enable = true;
components = ["secrets"]; components = [ "secrets" ];
}; };
}; };
} }

View file

@ -1,23 +1,31 @@
{pkgs, ...}: { { pkgs, ... }:
home.packages = let {
inherit (pkgs) lib; home.packages =
let
inherit (pkgs) lib;
ghc = pkgs.haskellPackages.ghc.withPackages (haskellPackages: [ ghc = pkgs.haskellPackages.ghc.withPackages (haskellPackages: [
haskellPackages.xmobar haskellPackages.xmobar
]); ]);
wrapped-xmobar = pkgs.symlinkJoin { wrapped-xmobar = pkgs.symlinkJoin {
name = "xmobar"; name = "xmobar";
paths = [pkgs.xmobar]; paths = [ pkgs.xmobar ];
buildInputs = [pkgs.makeWrapper]; buildInputs = [ pkgs.makeWrapper ];
postBuild = '' postBuild = ''
wrapProgram $out/bin/xmobar \ wrapProgram $out/bin/xmobar \
--prefix PATH : "${lib.makeBinPath [ghc pkgs.libnotify]}" --prefix PATH : "${
''; lib.makeBinPath [
}; ghc
in [ pkgs.libnotify
wrapped-xmobar ]
]; }"
'';
};
in
[
wrapped-xmobar
];
xdg.configFile = { xdg.configFile = {
"xmobar" = { "xmobar" = {

View file

@ -1,6 +1,8 @@
final: prev: let final: prev:
let
inherit (final) lib; inherit (final) lib;
in { in
{
linuxPackages = final.linuxPackagesFor ( linuxPackages = final.linuxPackagesFor (
prev.linuxPackages.kernel.override { prev.linuxPackages.kernel.override {
# TODO: The error message is quite unintuitive, maybe improve it? # TODO: The error message is quite unintuitive, maybe improve it?

View file

@ -5,5 +5,5 @@
jack.enable = true; jack.enable = true;
}; };
me.extraGroups = ["audio"]; me.extraGroups = [ "audio" ];
} }

View file

@ -3,12 +3,16 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }:
{
# For nautilius and iOS # For nautilius and iOS
services.gvfs.enable = true; services.gvfs.enable = true;
# iOS # iOS
services.usbmuxd.enable = true; services.usbmuxd.enable = true;
environment.systemPackages = with pkgs; [libimobiledevice idevicerestore]; environment.systemPackages = with pkgs; [
libimobiledevice
idevicerestore
];
# https://unix.stackexchange.com/questions/592775/how-can-i-enable-apple-ios-fast-charge-support # https://unix.stackexchange.com/questions/592775/how-can-i-enable-apple-ios-fast-charge-support
services.udev.extraRules = '' services.udev.extraRules = ''
@ -34,10 +38,11 @@
userControlled.enable = true; userControlled.enable = true;
secretsFile = config.age.secrets.wpa_password.path; secretsFile = config.age.secrets.wpa_password.path;
scanOnLowSignal = false; scanOnLowSignal = false;
networks = let networks =
fromList = import ../../../networks/wpa_supplicant-compat.nix; let
networks = import ../../../networks/list.nix; fromList = import ../../../networks/wpa_supplicant-compat.nix;
in networks = import ../../../networks/list.nix;
in
fromList networks; fromList networks;
}; };
}; };

View file

@ -2,13 +2,14 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }:
{
imports = [ imports = [
# #
# builtin screen # builtin screen
# #
{ {
me.extraGroups = ["video"]; me.extraGroups = [ "video" ];
programs.light.enable = true; programs.light.enable = true;
} }
@ -16,10 +17,10 @@
# external screen # external screen
# #
{ {
me.extraGroups = ["i2c"]; me.extraGroups = [ "i2c" ];
hardware.i2c.enable = true; hardware.i2c.enable = true;
environment.systemPackages = [pkgs.ddcutil]; environment.systemPackages = [ pkgs.ddcutil ];
boot.kernelModules = ["i2c-dev"]; boot.kernelModules = [ "i2c-dev" ];
} }
]; ];
@ -33,145 +34,160 @@
"20_xmonad" = "${lib.getExe pkgs.haskellPackages.xmonad} --restart"; # make sure feh keeps up "20_xmonad" = "${lib.getExe pkgs.haskellPackages.xmonad} --restart"; # make sure feh keeps up
}; };
profiles = let profiles =
singleton = k: v: {${k} = v;}; let
singleton = k: v: { ${k} = v; };
fingerprints = { fingerprints = {
built-in = singleton "eDP-1" "00ffffffffffff0009e5ca0b000000002f200104a51c137803de50a3544c99260f505400000001010101010101010101010101010101115cd01881e02d50302036001dbe1000001aa749d01881e02d50302036001dbe1000001a000000fe00424f452043510a202020202020000000fe004e4531333546424d2d4e34310a0073"; built-in = singleton "eDP-1" "00ffffffffffff0009e5ca0b000000002f200104a51c137803de50a3544c99260f505400000001010101010101010101010101010101115cd01881e02d50302036001dbe1000001aa749d01881e02d50302036001dbe1000001a000000fe00424f452043510a202020202020000000fe004e4531333546424d2d4e34310a0073";
amethyst = device: singleton device "00ffffffffffff0006b35b27010101012c210103803c22782a29d5ad4f44a7240f5054bfef00714f81809500d1c0d1e8d1fc01010101565e00a0a0a029503020350055502100001a000000fd0030901edf3c000a202020202020000000fc005647323741514c33410a202020000000ff0052414c4d51533139373533370a0111020347f14a90030204014061603f1f230907078301000067030c002000384468d85dc401788003026d1a000002013090f00069096909e305ff01e6060701696900e2006ae20fc0eae70070a0a067500820980455502100001a6fc200a0a0a055503020350055502100001a5aa000a0a0a046503020350055502100001a0000bc"; amethyst =
orchid = device: singleton device "00ffffffffffff0004699a24642900002416010380341d782a2ac5a4564f9e280f5054b7ef00714f814081809500b300d1c081c08100023a801871382d40582c450009252100001e000000ff0043394c4d54463031303539360a000000fd00324b185311000a202020202020000000fc00415355532056533234370a20200173020322714f0102031112130414050e0f1d1e1f10230917078301000065030c0010008c0ad08a20e02d10103e9600092521000018011d007251d01e206e28550009252100001e011d00bc52d01e20b828554009252100001e8c0ad090204031200c4055000925210000180000000000000000000000000000000000000000005d"; device:
}; singleton device "00ffffffffffff0006b35b27010101012c210103803c22782a29d5ad4f44a7240f5054bfef00714f81809500d1c0d1e8d1fc01010101565e00a0a0a029503020350055502100001a000000fd0030901edf3c000a202020202020000000fc005647323741514c33410a202020000000ff0052414c4d51533139373533370a0111020347f14a90030204014061603f1f230907078301000067030c002000384468d85dc401788003026d1a000002013090f00069096909e305ff01e6060701696900e2006ae20fc0eae70070a0a067500820980455502100001a6fc200a0a0a055503020350055502100001a5aa000a0a0a046503020350055502100001a0000bc";
orchid =
device:
singleton device "00ffffffffffff0004699a24642900002416010380341d782a2ac5a4564f9e280f5054b7ef00714f814081809500b300d1c081c08100023a801871382d40582c450009252100001e000000ff0043394c4d54463031303539360a000000fd00324b185311000a202020202020000000fc00415355532056533234370a20200173020322714f0102031112130414050e0f1d1e1f10230917078301000065030c0010008c0ad08a20e02d10103e9600092521000018011d007251d01e206e28550009252100001e011d00bc52d01e20b828554009252100001e8c0ad090204031200c4055000925210000180000000000000000000000000000000000000000005d";
};
devices = rec { devices = rec {
built-in = "eDP-1"; built-in = "eDP-1";
# Run `xrandr` to see the max number # Run `xrandr` to see the max number
extern = map (portNumber: "DP-${toString portNumber}") (lib.range 1 8); extern = map (portNumber: "DP-${toString portNumber}") (lib.range 1 8);
all = [built-in] ++ extern; all = [ built-in ] ++ extern;
}; };
switches = { switches = {
setDPI = {dpi}: setDPI =
singleton "10_xrdb-dpi" "${lib.getExe pkgs.xorg.xrdb} -merge ${pkgs.writeText "xrdb-dpi-config" '' { dpi }:
Xcursor.size: 64 singleton "10_xrdb-dpi" "${lib.getExe pkgs.xorg.xrdb} -merge ${pkgs.writeText "xrdb-dpi-config" ''
Xft.dpi: ${toString dpi} Xcursor.size: 64
''}"; Xft.dpi: ${toString dpi}
''}";
# Is scoped to an output device, no need to be called on built-in display # Is scoped to an output device, no need to be called on built-in display
setSoftwareBrightness = { setSoftwareBrightness =
device, # obtain with `xrandr` {
brightness, # [0..1] device, # obtain with `xrandr`
}: brightness, # [0..1]
singleton "10_xrandr_brightness" '' }:
${lib.getExe pkgs.xorg.xrandr} --output ${device} --brightness ${toString brightness} singleton "10_xrandr_brightness" ''
''; ${lib.getExe pkgs.xorg.xrandr} --output ${device} --brightness ${toString brightness}
'';
# Is scoped to an output device, no need to be called on built-in display # Is scoped to an output device, no need to be called on built-in display
setDDCBrightness = { setDDCBrightness =
modelName, # obtain with `ddcutil detect` {
brightness, # [0..1] modelName, # obtain with `ddcutil detect`
}: brightness, # [0..1]
singleton "10_ddc_brightness" '' }:
${lib.getExe pkgs.ddcutil} --model ${modelName} setvcp 10 ${toString (builtins.floor (brightness * 100))} singleton "10_ddc_brightness" ''
''; ${lib.getExe pkgs.ddcutil} --model ${modelName} setvcp 10 ${
toString (builtins.floor (brightness * 100))
}
'';
setDDCContrast = { setDDCContrast =
modelName, # obtain with `ddcutil detect` {
contrast, # [0..1] modelName, # obtain with `ddcutil detect`
}: contrast, # [0..1]
singleton "10_ddc_contrast" '' }:
${lib.getExe pkgs.ddcutil} --model ${modelName} setvcp 12 ${toString (builtins.floor (contrast * 100))} singleton "10_ddc_contrast" ''
''; ${lib.getExe pkgs.ddcutil} --model ${modelName} setvcp 12 ${
}; toString (builtins.floor (contrast * 100))
}
'';
};
# Note: the "position" field corresponds to the "pos" field outputted by autorandr # Note: the "position" field corresponds to the "pos" field outputted by autorandr
# To get the current config, run `xrandr --auto` and then `autorandr --config` # To get the current config, run `xrandr --auto` and then `autorandr --config`
configs = { configs = {
allOff = lib.genAttrs devices.all (_: {enable = lib.mkDefault false;}); allOff = lib.genAttrs devices.all (_: {
enableBuiltin = { enable = lib.mkDefault false;
eDP-1 = { });
enable = true; enableBuiltin = {
crtc = 0; eDP-1 = {
mode = "2256x1504"; enable = true;
rate = "60.00"; crtc = 0;
primary = true; mode = "2256x1504";
rate = "60.00";
primary = true;
};
};
enableAmethyst = name: {
${name} = {
enable = true;
primary = true;
crtc = 1;
mode = "2560x1440";
rate = "59.95";
};
};
enableOrchid = name: {
${name} = {
enable = true;
primary = true;
crtc = 1;
mode = "1920x1080";
rate = "60.00";
};
}; };
}; };
enableAmethyst = name: {
${name} = { frameworkBuiltin = {
enable = true; fingerprint = fingerprints.built-in;
primary = true; config = lib.mkMerge [
crtc = 1; configs.allOff
mode = "2560x1440"; configs.enableBuiltin
rate = "59.95"; ];
}; hooks.postswitch = switches.setDPI { dpi = 150; };
}; };
enableOrchid = name: {
${name} = { mkAmethyst = name: {
enable = true; fingerprint = lib.mkMerge [
primary = true; fingerprints.built-in
crtc = 1; (fingerprints.amethyst name)
mode = "1920x1080"; ];
rate = "60.00"; config = lib.mkMerge [
}; configs.allOff
(configs.enableAmethyst name)
];
hooks.postswitch = lib.mkMerge [
(switches.setDPI { dpi = 110; })
(switches.setSoftwareBrightness {
device = name;
brightness = 1;
})
(switches.setDDCBrightness {
modelName = "VG27AQL3A";
brightness = 0;
})
(switches.setDDCContrast {
modelName = "VG27AQL3A";
contrast = 0.5;
})
];
}; };
};
frameworkBuiltin = { mkOrchid = name: {
fingerprint = fingerprints.built-in; fingerprint = lib.mkMerge [
config = lib.mkMerge [ fingerprints.built-in
configs.allOff (fingerprints.orchid name)
configs.enableBuiltin ];
]; config = lib.mkMerge [
hooks.postswitch = switches.setDPI {dpi = 150;}; configs.allOff
}; (configs.enableOrchid name)
];
mkAmethyst = name: { # seems like this display doesn't support DDC
fingerprint = lib.mkMerge [ hooks.postswitch = lib.mkMerge [
fingerprints.built-in (switches.setDPI { dpi = 100; })
(fingerprints.amethyst name) (switches.setSoftwareBrightness {
]; device = name;
config = lib.mkMerge [ brightness = 0.5;
configs.allOff })
(configs.enableAmethyst name) ];
]; };
hooks.postswitch = lib.mkMerge [ in
(switches.setDPI {dpi = 110;})
(switches.setSoftwareBrightness {
device = name;
brightness = 1;
})
(switches.setDDCBrightness {
modelName = "VG27AQL3A";
brightness = 0;
})
(switches.setDDCContrast {
modelName = "VG27AQL3A";
contrast = 0.5;
})
];
};
mkOrchid = name: {
fingerprint = lib.mkMerge [
fingerprints.built-in
(fingerprints.orchid name)
];
config = lib.mkMerge [
configs.allOff
(configs.enableOrchid name)
];
# seems like this display doesn't support DDC
hooks.postswitch = lib.mkMerge [
(switches.setDPI {dpi = 100;})
(switches.setSoftwareBrightness {
device = name;
brightness = 0.5;
})
];
};
in
lib.mkMerge [ lib.mkMerge [
{default = frameworkBuiltin;} { default = frameworkBuiltin; }
(lib.genAttrs' devices.extern (name: lib.nameValuePair "amethyst-${name}" (mkAmethyst name))) (lib.genAttrs' devices.extern (name: lib.nameValuePair "amethyst-${name}" (mkAmethyst name)))
(lib.genAttrs' devices.extern (name: lib.nameValuePair "orchid-${name}" (mkOrchid name))) (lib.genAttrs' devices.extern (name: lib.nameValuePair "orchid-${name}" (mkOrchid name)))
]; ];

View file

@ -2,7 +2,8 @@
config, config,
pkgs, pkgs,
... ...
}: { }:
{
services.btrfs.autoScrub = { services.btrfs.autoScrub = {
enable = true; enable = true;
fileSystems = [ fileSystems = [
@ -21,9 +22,9 @@
fileSystems = { fileSystems = {
/* /*
WARNING: WARNING:
Use "noauto" if you want to mount the drive at a later time and not all the time Use "noauto" if you want to mount the drive at a later time and not all the time
Otherwise the mount would fail and cascade into the graphical session being stopped Otherwise the mount would fail and cascade into the graphical session being stopped
*/ */
"/home/leana/mnt/tdk32" = { "/home/leana/mnt/tdk32" = {
@ -53,21 +54,23 @@
sgbk /dev/disk/by-uuid/21b5207e-c3cf-49da-b944-fb405ae1eee2 ${config.age.secrets.sgbk_pwd.path} noauto sgbk /dev/disk/by-uuid/21b5207e-c3cf-49da-b944-fb405ae1eee2 ${config.age.secrets.sgbk_pwd.path} noauto
''; '';
systemd.mounts = let systemd.mounts =
bindToCryptDev = dev: { let
what = "/dev/mapper/${dev}"; bindToCryptDev = dev: {
where = "/mnt/${dev}"; what = "/dev/mapper/${dev}";
unitConfig = { where = "/mnt/${dev}";
Requires = ["systemd-cryptsetup@${dev}.service"]; unitConfig = {
After = ["systemd-cryptsetup@${dev}.service"]; Requires = [ "systemd-cryptsetup@${dev}.service" ];
PropagatesStopTo = ["systemd-cryptsetup@${dev}.service"]; After = [ "systemd-cryptsetup@${dev}.service" ];
PropagatesStopTo = [ "systemd-cryptsetup@${dev}.service" ];
};
}; };
}; in
in [ [
(bindToCryptDev "four") (bindToCryptDev "four")
(bindToCryptDev "two") (bindToCryptDev "two")
(bindToCryptDev "sgbk") (bindToCryptDev "sgbk")
]; ];
environment.systemPackages = [ environment.systemPackages = [
pkgs.lsof pkgs.lsof

View file

@ -2,7 +2,8 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }:
{
services.xserver.windowManager.xmonad = { services.xserver.windowManager.xmonad = {
enable = true; enable = true;
enableContribAndExtras = true; enableContribAndExtras = true;

View file

@ -7,15 +7,20 @@
pkgs, pkgs,
modulesPath, modulesPath,
... ...
}: { }:
{
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt"]; boot.initrd.availableKernelModules = [
boot.initrd.kernelModules = ["dm-snapshot"]; "nvme"
boot.kernelModules = ["kvm-amd"]; "xhci_pci"
boot.extraModulePackages = []; "thunderbolt"
];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -13,7 +13,7 @@
}; };
}; };
me.extraGroups = ["scanner"]; me.extraGroups = [ "scanner" ];
hardware.sane = { hardware.sane = {
enable = true; enable = true;
brscan5.enable = true; brscan5.enable = true;

View file

@ -1,4 +1,5 @@
{lib, ...}: { { lib, ... }:
{
# https://en.wikipedia.org/wiki/List_of_tz_database_time_zones # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# `timedatectl list-timezones` # `timedatectl list-timezones`
time.timeZone = "Asia/Taipei"; time.timeZone = "Asia/Taipei";
@ -28,16 +29,16 @@
let let
genLocale = locale: lib.flip lib.genAttrs (_: locale); genLocale = locale: lib.flip lib.genAttrs (_: locale);
in in
# - xscreensaver freaks out on the time display # - xscreensaver freaks out on the time display
# - evolution add event becomes hard to use # - evolution add event becomes hard to use
# https://gitlab.gnome.org/GNOME/evolution/-/issues/3120 # https://gitlab.gnome.org/GNOME/evolution/-/issues/3120
genLocale "fr_FR.UTF-8" [ genLocale "fr_FR.UTF-8" [
"LC_TIME" "LC_TIME"
] ]
// genLocale "zh_TW.UTF-8" [ // genLocale "zh_TW.UTF-8" [
"LC_MONETARY" "LC_MONETARY"
"LC_ADDRESS" "LC_ADDRESS"
]; ];
}; };
# Wireless Regulatory Domain, uses ISO / IEC 3166 country code # Wireless Regulatory Domain, uses ISO / IEC 3166 country code

View file

@ -1,4 +1,5 @@
{config, ...}: { { config, ... }:
{
system.stateVersion = "24.11"; system.stateVersion = "24.11";
boot.loader = { boot.loader = {
@ -16,6 +17,6 @@
# Cross building # Cross building
# https://discourse.nixos.org/t/how-do-i-get-my-aarch64-linux-machine-to-build-x86-64-linux-extra-platforms-doesnt-seem-to-work/38106/2?u=leana8959 # https://discourse.nixos.org/t/how-do-i-get-my-aarch64-linux-machine-to-build-x86-64-linux-extra-platforms-doesnt-seem-to-work/38106/2?u=leana8959
boot.binfmt.emulatedSystems = ["aarch64-linux"]; boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
nix.settings.extra-platforms = config.boot.binfmt.emulatedSystems; nix.settings.extra-platforms = config.boot.binfmt.emulatedSystems;
} }

View file

@ -2,14 +2,15 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
imports = [ imports = [
# #
# Docker # Docker
# #
{ {
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
me.extraGroups = ["docker"]; me.extraGroups = [ "docker" ];
} }
# # # #

View file

@ -1,91 +1,94 @@
{config, ...}: { { config, ... }:
services.restic.backups = let {
pruneOpts = [ services.restic.backups =
"--keep-daily 7" let
"--keep-weekly 4" pruneOpts = [
"--keep-monthly 12" "--keep-daily 7"
"--keep-yearly 10" "--keep-weekly 4"
]; "--keep-monthly 12"
in { "--keep-yearly 10"
"backblaze" = {
paths = [
"/home/leana/Documents"
"/home/leana/Calibre"
]; ];
in
{
"backblaze" = {
paths = [
"/home/leana/Documents"
"/home/leana/Calibre"
];
passwordFile = config.age.secrets.restic_backblaze_pwd.path; passwordFile = config.age.secrets.restic_backblaze_pwd.path;
repositoryFile = config.age.secrets.restic_backblaze_repo.path; repositoryFile = config.age.secrets.restic_backblaze_repo.path;
environmentFile = config.age.secrets.restic_backblaze_env.path; environmentFile = config.age.secrets.restic_backblaze_env.path;
timerConfig = { timerConfig = {
OnCalendar = "daily"; OnCalendar = "daily";
Persistent = true; Persistent = true;
RandomizedDelaySec = "1h"; RandomizedDelaySec = "1h";
};
inherit pruneOpts;
}; };
inherit pruneOpts; "four" = {
paths = [
"/home/leana/Music"
"/home/leana/Documents"
"/home/leana/Calibre"
"/home/leana/Images"
];
repository = "/mnt/four/restic";
passwordFile = config.age.secrets.restic_four_pwd.path;
timerConfig = null;
inherit pruneOpts;
};
"sgbk" = {
paths = [
"/home/leana/Music"
"/home/leana/Documents"
"/home/leana/Calibre"
"/home/leana/Images"
];
timerConfig = null;
repository = "/mnt/sgbk/restic";
passwordFile = config.age.secrets.restic_sgbk_pwd.path;
inherit pruneOpts;
};
"two-to-four" = {
paths = [ "/mnt/two" ];
timerConfig = null;
repository = "/mnt/four/restic";
passwordFile = config.age.secrets.restic_four_pwd.path;
exclude = [ "lost+found" ];
inherit pruneOpts;
};
}; };
"four" = {
paths = [
"/home/leana/Music"
"/home/leana/Documents"
"/home/leana/Calibre"
"/home/leana/Images"
];
repository = "/mnt/four/restic";
passwordFile = config.age.secrets.restic_four_pwd.path;
timerConfig = null;
inherit pruneOpts;
};
"sgbk" = {
paths = [
"/home/leana/Music"
"/home/leana/Documents"
"/home/leana/Calibre"
"/home/leana/Images"
];
timerConfig = null;
repository = "/mnt/sgbk/restic";
passwordFile = config.age.secrets.restic_sgbk_pwd.path;
inherit pruneOpts;
};
"two-to-four" = {
paths = ["/mnt/two"];
timerConfig = null;
repository = "/mnt/four/restic";
passwordFile = config.age.secrets.restic_four_pwd.path;
exclude = ["lost+found"];
inherit pruneOpts;
};
};
systemd.services = { systemd.services = {
# TODO: # TODO:
# Wait for upstream to introduce direct access to unitConfig # Wait for upstream to introduce direct access to unitConfig
# c.f. https://github.com/NixOS/nixpkgs/pull/368234 # c.f. https://github.com/NixOS/nixpkgs/pull/368234
"restic-backups-four" = { "restic-backups-four" = {
requires = ["mnt-four.mount"]; requires = [ "mnt-four.mount" ];
after = ["mnt-four.mount"]; after = [ "mnt-four.mount" ];
unitConfig.PropagatesStopTo = ["mnt-four.mount"]; unitConfig.PropagatesStopTo = [ "mnt-four.mount" ];
}; };
"restic-backups-sgbk" = { "restic-backups-sgbk" = {
requires = ["mnt-sgbk.mount"]; requires = [ "mnt-sgbk.mount" ];
after = ["mnt-sgbk.mount"]; after = [ "mnt-sgbk.mount" ];
unitConfig.PropagatesStopTo = ["mnt-sgbk.mount"]; unitConfig.PropagatesStopTo = [ "mnt-sgbk.mount" ];
}; };
"restic-backups-two-to-four" = { "restic-backups-two-to-four" = {

View file

@ -1,27 +1,29 @@
{lib, ...}: { { lib, ... }:
{
nixpkgs.config.allowUnfreePredicate = lib.mkDefault ( nixpkgs.config.allowUnfreePredicate = lib.mkDefault (
pkg: let pkg:
let
name = lib.getName pkg; name = lib.getName pkg;
in in
builtins.elem name [ builtins.elem name [
"languagetool" "languagetool"
"vscode" "vscode"
"code" "code"
"tampermonkey" "tampermonkey"
"aseprite" "aseprite"
"posy-cursors" "posy-cursors"
"discord" "discord"
] ]
|| builtins.any (lib.flip lib.hasInfix name) [ || builtins.any (lib.flip lib.hasInfix name) [
# Scanner # Scanner
"brscan5" "brscan5"
"steam" "steam"
] ]
); );
} }

View file

@ -9,73 +9,75 @@ let
infuse = lib.flip infuse-lib.v1.infuse; infuse = lib.flip infuse-lib.v1.infuse;
in in
# Why shouldn't I go crazy with overlays? # Why shouldn't I go crazy with overlays?
final: final:
infuse { infuse {
cmus.__input.alsaSupport = _: false; cmus.__input.alsaSupport = _: false;
fish.__input.usePython = _: false; fish.__input.usePython = _: false;
tmux.__input.withSixel = _: false; tmux.__input.withSixel = _: false;
vlc.__input.chromecastSupport = _: false; vlc.__input.chromecastSupport = _: false;
vlc.__input.waylandSupport = _: false; vlc.__input.waylandSupport = _: false;
# I don't really use helix, but it's nice to have the W alias just in case # I don't really use helix, but it's nice to have the W alias just in case
helix.__output.patches.__append = [ helix.__output.patches.__append = [
./patches/helix/W-as-write.patch ./patches/helix/W-as-write.patch
]; ];
# Too loud # Too loud
alejandra.__output.patches.__append = [ alejandra.__output.patches.__append = [
./patches/alejandra/no-ads.patch ./patches/alejandra/no-ads.patch
]; ];
alejandra.__output.doCheck = _: false; alejandra.__output.doCheck = _: false;
# TODO: # TODO:
# pinned branch of https://github.com/astrand/xclip/tree/xerror # pinned branch of https://github.com/astrand/xclip/tree/xerror
# use this until #43 gets resolved properly # use this until #43 gets resolved properly
xclip.__output.src = _: xclip.__output.src =
final.fetchFromGitHub { _:
owner = "astrand"; final.fetchFromGitHub {
repo = "xclip"; owner = "astrand";
rev = "2c3b811002b35d3be7f39cc1145dd06bdb32e31c"; repo = "xclip";
hash = "sha256-hHbq97GTKiRw8LZa/LY4LUOFOd/5H4+S+NR0BJfcu6M="; rev = "2c3b811002b35d3be7f39cc1145dd06bdb32e31c";
}; hash = "sha256-hHbq97GTKiRw8LZa/LY4LUOFOd/5H4+S+NR0BJfcu6M=";
};
fcitx5.__output.cmakeFlags.__append = [ fcitx5.__output.cmakeFlags.__append = [
(lib.cmakeFeature "ENABLE_EMOJI" "Off") (lib.cmakeFeature "ENABLE_EMOJI" "Off")
(lib.cmakeFeature "ENABLE_WAYLAND" "Off") (lib.cmakeFeature "ENABLE_WAYLAND" "Off")
]; ];
fcitx5.__output.patches.__append = [ fcitx5.__output.patches.__append = [
./patches/fcitx5/disable-clipboard.patch ./patches/fcitx5/disable-clipboard.patch
./patches/fcitx5/disable-quickphrase.patch ./patches/fcitx5/disable-quickphrase.patch
./patches/fcitx5/disable-unicode.patch ./patches/fcitx5/disable-unicode.patch
]; ];
fcitx5-chinese-addons.__output.cmakeFlags.__append = [ fcitx5-chinese-addons.__output.cmakeFlags.__append = [
(lib.cmakeFeature "ENABLE_BROWSER" "Off") (lib.cmakeFeature "ENABLE_BROWSER" "Off")
(lib.cmakeFeature "ENABLE_CLOUDPINYIN" "Off") (lib.cmakeFeature "ENABLE_CLOUDPINYIN" "Off")
(lib.cmakeFeature "ENABLE_DATA" "Off") (lib.cmakeFeature "ENABLE_DATA" "Off")
]; ];
fcitx5-chinese-addons.__output.patches.__append = [ fcitx5-chinese-addons.__output.patches.__append = [
./patches/fcitx5-chinese-addons/disable-chttrans.patch ./patches/fcitx5-chinese-addons/disable-chttrans.patch
./patches/fcitx5-chinese-addons/disable-fullwidth.patch ./patches/fcitx5-chinese-addons/disable-fullwidth.patch
# Note: disabling pinyin helper breaks canjie # Note: disabling pinyin helper breaks canjie
]; ];
# Security, Xorg vuln # Security, Xorg vuln
# Backport has failed in upstream currently <https://github.com/NixOS/nixpkgs/pull/457804>, # Backport has failed in upstream currently <https://github.com/NixOS/nixpkgs/pull/457804>,
# might as well patch it while people are blogging about it <https://github.com/Xe/site/pull/1062> # might as well patch it while people are blogging about it <https://github.com/Xe/site/pull/1062>
# Upstream talks about it here https://lists.x.org/archives/xorg-announce/2025-October/003635.html # Upstream talks about it here https://lists.x.org/archives/xorg-announce/2025-October/003635.html
xorg.xorgserver.__output.version = oldVersion: let xorg.xorgserver.__output.version =
version = "21.1.20"; oldVersion:
in let
if oldVersion == version version = "21.1.20";
then throw "This patch has been merged upstream" in
else version; if oldVersion == version then throw "This patch has been merged upstream" else version;
xorg.xorgserver.__output.src = _: xorg.xorgserver.__output.src =
final.fetchurl { _:
url = "mirror://xorg/individual/xserver/xorg-server-21.1.20.tar.xz"; final.fetchurl {
sha256 = "sha256-dpW8YYJLOoG2utL3iwVADKAVAD3kAtGzIhFxBbcC6Tc="; url = "mirror://xorg/individual/xserver/xorg-server-21.1.20.tar.xz";
}; sha256 = "sha256-dpW8YYJLOoG2utL3iwVADKAVAD3kAtGzIhFxBbcC6Tc=";
} };
}

View file

@ -4,56 +4,65 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
{pkgs ? import sources.pin-florashell {}}: {
pkgs.mkShell (let pkgs ? import sources.pin-florashell { },
libs = with pkgs; [ }:
zlib pkgs.mkShell (
libpq let
libsodium libs = with pkgs; [
]; zlib
libpq
libsodium
];
hlib = pkgs.haskell.lib; hlib = pkgs.haskell.lib;
callHackage = { callHackage =
{
name, name,
version, version,
}: let }:
pkg = pkgs.haskell.packages.ghc910.callHackage name version {}; let
pkg = pkgs.haskell.packages.ghc910.callHackage name version { };
in in
hlib.dontCheck (hlib.doJailbreak pkg); hlib.dontCheck (hlib.doJailbreak pkg);
in { in
name = "flora"; {
packages = with pkgs; let name = "flora";
packages =
with pkgs;
let
haskellPackages = haskell.packages.ghc910; haskellPackages = haskell.packages.ghc910;
in in
# These don't build directly and need to be pinned # These don't build directly and need to be pinned
map callHackage [ map callHackage [
{ {
name = "fourmolu"; name = "fourmolu";
version = "0.17.0.0"; version = "0.17.0.0";
} }
{ {
name = "postgresql-migration"; name = "postgresql-migration";
version = "0.2.1.8"; version = "0.2.1.8";
} }
] ]
++ [ ++ [
haskellPackages.ghcid haskellPackages.ghcid
haskellPackages.cabal-fmt haskellPackages.cabal-fmt
haskellPackages.cabal-install haskellPackages.cabal-install
haskellPackages.ghc haskellPackages.ghc
haskellPackages.haskell-language-server haskellPackages.haskell-language-server
postgresql_14 postgresql_14
postgresqlTestHook postgresqlTestHook
yarn yarn
pkg-config pkg-config
esbuild esbuild
changelog-d changelog-d
] ]
++ libs; ++ libs;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs; LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs;
}) }
)

View file

@ -1,20 +1,26 @@
{pkgs ? import <nixpkgs> {}}: let {
pkgs ? import <nixpkgs> { },
}:
let
inherit (pkgs) lib; inherit (pkgs) lib;
in in
pkgs.mkShell { pkgs.mkShell {
name = "forgejo"; name = "forgejo";
packages = with pkgs; [ packages = with pkgs; [
gnumake gnumake
go go
golangci-lint golangci-lint
gofumpt gofumpt
nodejs nodejs
nodePackages.npm nodePackages.npm
]; ];
LD_LIBRARY_PATH = lib.makeLibraryPath (with pkgs; [ LD_LIBRARY_PATH = lib.makeLibraryPath (
with pkgs;
[
libuuid libuuid
]); ]
} );
}

View file

@ -1,4 +1,6 @@
{pkgs ? import <nixpkgs> {}}: {
pkgs ? import <nixpkgs> { },
}:
pkgs.mkShell rec { pkgs.mkShell rec {
name = "haddock2"; name = "haddock2";

View file

@ -1,53 +1,59 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
{pkgs ? import sources.pin-masna3shell {}}: {
pkgs.mkShell (let pkgs ? import sources.pin-masna3shell { },
libs = with pkgs; [ }:
zlib pkgs.mkShell (
libpq let
libsodium libs = with pkgs; [
]; zlib
libpq
libsodium
];
hlib = pkgs.haskell.lib; hlib = pkgs.haskell.lib;
callHackage = { callHackage =
{
name, name,
version, version,
haskellPackages ? pkgs.haskellPackages, haskellPackages ? pkgs.haskellPackages,
}: let }:
pkg = haskellPackages.callHackage name version {}; let
pkg = haskellPackages.callHackage name version { };
in in
hlib.dontCheck (hlib.doJailbreak pkg); hlib.dontCheck (hlib.doJailbreak pkg);
haskellPackages = pkgs.haskell.packages.ghc910; haskellPackages = pkgs.haskell.packages.ghc910;
in { in
name = "masna3"; {
packages = name = "masna3";
[ packages = [
pkgs.haskell.packages.ghc9102.ghc pkgs.haskell.packages.ghc9102.ghc
pkgs.haskell.packages.ghc9102.haskell-language-server pkgs.haskell.packages.ghc9102.haskell-language-server
haskellPackages.cabal-install haskellPackages.cabal-install
haskellPackages.postgresql-migration haskellPackages.postgresql-migration
(callHackage { (callHackage {
name = "fourmolu"; name = "fourmolu";
version = "0.18.0.0"; version = "0.18.0.0";
haskellPackages = pkgs.haskell.packages.ghc912; haskellPackages = pkgs.haskell.packages.ghc912;
}) })
(callHackage { (callHackage {
name = "hlint"; name = "hlint";
version = "3.10"; version = "3.10";
haskellPackages = pkgs.haskell.packages.ghc912; haskellPackages = pkgs.haskell.packages.ghc912;
}) })
pkgs.haskell.packages.ghc98.apply-refact pkgs.haskell.packages.ghc98.apply-refact
haskellPackages.ghc-tags haskellPackages.ghc-tags
haskellPackages.cabal-gild haskellPackages.cabal-gild
pkgs.gnumake pkgs.gnumake
pkgs.pkg-config pkgs.pkg-config
] ]
++ libs; ++ libs;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs; LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs;
}) }
)

View file

@ -1,37 +1,40 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
{pkgs ? import sources.pin-necro-man-nixpkgs {}}: let {
shell = { pkgs ? import sources.pin-necro-man-nixpkgs { },
}:
let
shell =
{
mkShell, mkShell,
# #
pkgs, pkgs,
python310Packages, python310Packages,
texlive, texlive,
}: }:
mkShell { mkShell {
name = "necro-manual"; name = "necro-manual";
packages = [ packages = [
pkgs.emacs pkgs.emacs
python310Packages.pygments python310Packages.pygments
(texlive.combine { (texlive.combine {
inherit inherit (texlive)
(texlive) scheme-medium
scheme-medium #
# wrapfig
wrapfig capt-of
capt-of minted
minted upquote
upquote todonotes
todonotes fvextra
fvextra catchfile
catchfile xstring
xstring framed
framed ;
; })
}) ];
]; };
}; in
in pkgs.callPackage shell { }
pkgs.callPackage shell {}

View file

@ -1,14 +1,16 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
{pkgs ? import sources.pin-vim-tw {}}: {
pkgs.mkShell { pkgs ? import sources.pin-vim-tw { },
name = "vim-tw"; }:
packages = with pkgs; [ pkgs.mkShell {
haskellPackages.cabal-fmt name = "vim-tw";
haskellPackages.cabal-install packages = with pkgs; [
haskellPackages.ghc haskellPackages.cabal-fmt
haskellPackages.haskell-language-server haskellPackages.cabal-install
haskellPackages.retrie haskellPackages.ghc
]; haskellPackages.haskell-language-server
} haskellPackages.retrie
];
}

View file

@ -14,7 +14,7 @@
type = "filesystem"; type = "filesystem";
format = "vfat"; format = "vfat";
mountpoint = "/boot"; mountpoint = "/boot";
mountOptions = ["umask=0077"]; mountOptions = [ "umask=0077" ];
}; };
}; };
@ -24,7 +24,7 @@
content = { content = {
type = "luks"; type = "luks";
name = "crypted"; name = "crypted";
extraOpenArgs = []; extraOpenArgs = [ ];
settings.allowDiscards = true; settings.allowDiscards = true;
content = { content = {
type = "lvm_pv"; type = "lvm_pv";
@ -74,12 +74,15 @@
}; };
"/home" = { "/home" = {
mountOptions = ["compress=zstd"]; mountOptions = [ "compress=zstd" ];
mountpoint = "/home"; mountpoint = "/home";
}; };
"/nix" = { "/nix" = {
mountOptions = ["compress=zstd" "noatime"]; mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/nix"; mountpoint = "/nix";
}; };
}; };

View file

@ -18,7 +18,7 @@
type = "filesystem"; type = "filesystem";
format = "vfat"; format = "vfat";
mountpoint = "/boot"; mountpoint = "/boot";
mountOptions = ["umask=0077"]; mountOptions = [ "umask=0077" ];
}; };
}; };
luks = { luks = {
@ -26,7 +26,7 @@
content = { content = {
type = "luks"; type = "luks";
name = "crypted"; name = "crypted";
extraOpenArgs = []; extraOpenArgs = [ ];
settings = { settings = {
allowDiscards = true; allowDiscards = true;
}; };
@ -50,7 +50,7 @@
type = "filesystem"; type = "filesystem";
format = "ext4"; format = "ext4";
mountpoint = "/"; mountpoint = "/";
mountOptions = ["defaults"]; mountOptions = [ "defaults" ];
}; };
}; };
nix = { nix = {
@ -59,7 +59,7 @@
type = "filesystem"; type = "filesystem";
format = "ext4"; format = "ext4";
mountpoint = "/nix"; mountpoint = "/nix";
mountOptions = ["noatime"]; mountOptions = [ "noatime" ];
}; };
}; };
swap = { swap = {

View file

@ -14,7 +14,7 @@
type = "filesystem"; type = "filesystem";
format = "vfat"; format = "vfat";
mountpoint = "/boot"; mountpoint = "/boot";
mountOptions = ["umask=0077"]; mountOptions = [ "umask=0077" ];
}; };
}; };
@ -24,7 +24,7 @@
content = { content = {
type = "luks"; type = "luks";
name = "crypted"; name = "crypted";
extraOpenArgs = []; extraOpenArgs = [ ];
settings.allowDiscards = true; settings.allowDiscards = true;
content = { content = {
type = "lvm_pv"; type = "lvm_pv";
@ -70,17 +70,20 @@
subvolumes = { subvolumes = {
"/root" = { "/root" = {
mountOptions = ["noatime"]; mountOptions = [ "noatime" ];
mountpoint = "/"; mountpoint = "/";
}; };
"/home" = { "/home" = {
mountOptions = ["noatime"]; mountOptions = [ "noatime" ];
mountpoint = "/home"; mountpoint = "/home";
}; };
"/nix" = { "/nix" = {
mountOptions = ["compress=zstd" "noatime"]; mountOptions = [
"compress=zstd"
"noatime"
];
mountpoint = "/nix"; mountpoint = "/nix";
}; };
}; };

View file

@ -15,7 +15,7 @@
type = "filesystem"; type = "filesystem";
format = "vfat"; format = "vfat";
mountpoint = "/boot"; mountpoint = "/boot";
mountOptions = ["umask=0077"]; mountOptions = [ "umask=0077" ];
}; };
}; };
luks = { luks = {
@ -23,7 +23,7 @@
content = { content = {
type = "luks"; type = "luks";
name = "crypted"; name = "crypted";
extraOpenArgs = []; extraOpenArgs = [ ];
settings = { settings = {
allowDiscards = true; allowDiscards = true;
}; };
@ -47,7 +47,7 @@
type = "filesystem"; type = "filesystem";
format = "ext4"; format = "ext4";
mountpoint = "/"; mountpoint = "/";
mountOptions = ["defaults"]; mountOptions = [ "defaults" ];
}; };
}; };
nix = { nix = {
@ -56,7 +56,7 @@
type = "filesystem"; type = "filesystem";
format = "ext4"; format = "ext4";
mountpoint = "/nix"; mountpoint = "/nix";
mountOptions = ["noatime"]; mountOptions = [ "noatime" ];
}; };
}; };
swap = { swap = {

View file

@ -1,14 +1,20 @@
let let
hasconfigRemoteCondition = { hasconfigRemoteCondition =
# Custom arguments {
url, # Custom arguments
path ? "*/**", url,
... path ? "*/**",
} @ cfg: let ...
cfg' = builtins.removeAttrs cfg ["url" "path"]; }@cfg:
in [ let
(cfg' // {condition = "hasconfig:remote.*.url:git@${url}:${path}";}) cfg' = builtins.removeAttrs cfg [
(cfg' // {condition = "hasconfig:remote.*.url:https://${url}/${path}";}) "url"
]; "path"
];
in
[
(cfg' // { condition = "hasconfig:remote.*.url:git@${url}:${path}"; })
(cfg' // { condition = "hasconfig:remote.*.url:https://${url}/${path}"; })
];
in in
builtins.concatMap hasconfigRemoteCondition builtins.concatMap hasconfigRemoteCondition

View file

@ -16,7 +16,8 @@ let
blameIgnore = { blameIgnore = {
blame.ignoreRevsFile = ".git-blame-ignore-revs"; blame.ignoreRevsFile = ".git-blame-ignore-revs";
}; };
in [ in
[
# Univ stuff # Univ stuff
{ {
url = "gitlab.istic.univ-rennes1.fr"; url = "gitlab.istic.univ-rennes1.fr";

View file

@ -1,6 +1,6 @@
{ {
programs.atuin = { programs.atuin = {
flags = ["--disable-up-arrow"]; flags = [ "--disable-up-arrow" ];
settings = { settings = {
history_filter = [ history_filter = [
# privacy # privacy

View file

@ -1,4 +1,5 @@
{config, ...}: { { config, ... }:
{
programs.btop = { programs.btop = {
settings.color_theme = "${config.programs.btop.package}/share/btop/themes/onedark.theme"; settings.color_theme = "${config.programs.btop.package}/share/btop/themes/onedark.theme";
extraConfig = builtins.readFile ./btop.conf; extraConfig = builtins.readFile ./btop.conf;

View file

@ -2,49 +2,51 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }:
programs.cmus.extraConfig = let {
# dispatch to multiple callbacks programs.cmus.extraConfig =
callback-script = pkgs.writeShellApplication { let
name = "cmus-callback-script"; # dispatch to multiple callbacks
runtimeInputs = [ callback-script = pkgs.writeShellApplication {
pkgs.cmusfm name = "cmus-callback-script";
pkgs.libnotify runtimeInputs = [
]; pkgs.cmusfm
text = '' pkgs.libnotify
# All keys contain only chars a-z. Values are UTF-8 strings. ];
# text = ''
# Keys: status file url artist album discnumber tracknumber title date # All keys contain only chars a-z. Values are UTF-8 strings.
# - status (stopped, playing, paused) is always given #
# - file or url is given only if track is 'loaded' in cmus # Keys: status file url artist album discnumber tracknumber title date
# - other keys/values are given only if they are available # - status (stopped, playing, paused) is always given
# - file or url is given only if track is 'loaded' in cmus
# - other keys/values are given only if they are available
# Use a map so that we can redirect all the args to cmusfm # Use a map so that we can redirect all the args to cmusfm
argv=("$@") argv=("$@")
declare -A map declare -A map
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
map["$1"]="$2" map["$1"]="$2"
shift shift
shift shift
done done
# Setup pretty symbols # Setup pretty symbols
case ''${map[status]} in case ''${map[status]} in
paused) paused)
SYMB="" SYMB=""
;; ;;
playing) playing)
SYMB="" SYMB=""
;; ;;
esac esac
notify-send \ notify-send \
"$SYMB ''${map[title]}" \ "$SYMB ''${map[title]}" \
"''${map[artist]} / ''${map[album]}" "''${map[artist]} / ''${map[album]}"
cmusfm "''${argv[@]}" cmusfm "''${argv[@]}"
''; '';
}; };
in in
builtins.readFile ./rc builtins.readFile ./rc
+ lib.optionalString pkgs.stdenv.isLinux '' + lib.optionalString pkgs.stdenv.isLinux ''
set status_display_program=${lib.getExe callback-script} set status_display_program=${lib.getExe callback-script}

View file

@ -1,4 +1,5 @@
{config, ...}: { { config, ... }:
{
programs.direnv = { programs.direnv = {
nix-direnv.enable = true; nix-direnv.enable = true;
config = { config = {

View file

@ -3,9 +3,11 @@
config, config,
lib, lib,
... ...
}: let }:
let
cfg = config.i18n.inputMethod; cfg = config.i18n.inputMethod;
in { in
{
i18n.inputMethod = { i18n.inputMethod = {
fcitx5.addons = [ fcitx5.addons = [
pkgs.fcitx5-chinese-addons pkgs.fcitx5-chinese-addons

View file

@ -3,11 +3,13 @@
config, config,
lib, lib,
... ...
}: let }:
let
inherit (pkgs) nur; inherit (pkgs) nur;
cfg = config.programs.firefox; cfg = config.programs.firefox;
in { in
{
programs.firefox = { programs.firefox = {
# https://mozilla.github.io/policy-templates # https://mozilla.github.io/policy-templates
# The following have more complex logic, keep them as policies and not profiles # The following have more complex logic, keep them as policies and not profiles
@ -19,7 +21,14 @@ in {
]; ];
SearchEngines = { SearchEngines = {
Remove = ["Google" "Bing" "DuckDuckGo" "Qwant" "eBay" "Perplexity"]; Remove = [
"Google"
"Bing"
"DuckDuckGo"
"Qwant"
"eBay"
"Perplexity"
];
Default = "leta"; Default = "leta";
Add = [ Add = [
{ {
@ -102,23 +111,25 @@ in {
"media.peerconnection.enabled" = false; "media.peerconnection.enabled" = false;
}; };
extensions.packages = let extensions.packages =
addons = nur.repos.rycee.firefox-addons; let
in [ addons = nur.repos.rycee.firefox-addons;
addons.ublock-origin in
addons.privacy-badger [
addons.user-agent-string-switcher addons.ublock-origin
addons.privacy-badger
addons.user-agent-string-switcher
/* /*
Here's to you who want to remove news feed eradicator because you find it annoying: Here's to you who want to remove news feed eradicator because you find it annoying:
It is here to annoy you so it is less likely for you to be on the agency inversion path. It is here to annoy you so it is less likely for you to be on the agency inversion path.
DO NOT REMOVE IT. I repeat, DO NOT REMOVE IT. DO NOT REMOVE IT. I repeat, DO NOT REMOVE IT.
If you think it's annoying, go do some jump rope, sing, live. If you think it's annoying, go do some jump rope, sing, live.
*/ */
addons.news-feed-eradicator # did you read the comment above? addons.news-feed-eradicator # did you read the comment above?
addons.multi-account-containers addons.multi-account-containers
]; ];
}; };
}; };

View file

@ -2,7 +2,8 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }:
{
programs.fish = { programs.fish = {
shellAbbrs = lib.mkMerge [ shellAbbrs = lib.mkMerge [
(lib.mkIf pkgs.stdenv.isLinux { (lib.mkIf pkgs.stdenv.isLinux {

View file

@ -2,7 +2,8 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
imports = [ imports = [
./aliasesAbbrs.nix ./aliasesAbbrs.nix
]; ];
@ -10,7 +11,7 @@
# #
# Script dependencies # Script dependencies
# #
home.packages = [pkgs.vivid]; home.packages = [ pkgs.vivid ];
programs = { programs = {
fd.enable = true; fd.enable = true;
fzf.enable = true; fzf.enable = true;
@ -24,11 +25,9 @@
# #
# Scripts and functions # Scripts and functions
# #
xdg.configFile = xdg.configFile = lib.mapAttrs' (
lib.mapAttrs' path: _: lib.nameValuePair "fish/functions/${path}" { source = "${./functions}/${path}"; }
(path: _: ) (builtins.readDir ./functions);
lib.nameValuePair "fish/functions/${path}" {source = "${./functions}/${path}";})
(builtins.readDir ./functions);
programs.fish = { programs.fish = {
interactiveShellInit = builtins.readFile ./shellInit.fish; interactiveShellInit = builtins.readFile ./shellInit.fish;

View file

@ -3,7 +3,8 @@
config, config,
pkgs, pkgs,
... ...
}: { }:
{
# git plugins # git plugins
programs.git = { programs.git = {
lfs.enable = true; lfs.enable = true;
@ -11,18 +12,18 @@
# known to fail on aarch64-linux # known to fail on aarch64-linux
(lib.mkIf (pkgs.system == "aarch64-linux") ( (lib.mkIf (pkgs.system == "aarch64-linux") (
# TODO: investigate this # TODO: investigate this
lib.warn "patdiff has been forcibly disabled because it has previously failed to build" lib.warn "patdiff has been forcibly disabled because it has previously failed to build" lib.mkForce
lib.mkForce false
false
)) ))
(lib.mkDefault true) (lib.mkDefault true)
]; ];
}; };
# 懶惰鬼賴皮 # 懶惰鬼賴皮
programs.lazygit = let programs.lazygit =
patdiffCfg = config.programs.git.patdiff; let
in patdiffCfg = config.programs.git.patdiff;
in
lib.mkIf patdiffCfg.enable { lib.mkIf patdiffCfg.enable {
settings = { settings = {
git.paging.externalDiffCommand = "${lib.getExe' patdiffCfg.package "patdiff-git-wrapper"}"; git.paging.externalDiffCommand = "${lib.getExe' patdiffCfg.package "patdiff-git-wrapper"}";

View file

@ -1,25 +1,27 @@
{pkgs, ...}: { { pkgs, ... }:
{
services = { services = {
gpg-agent.defaultCacheTtl = 1209600; gpg-agent.defaultCacheTtl = 1209600;
gpg-agent.pinentry.package = pkgs.pinentry-tty; gpg-agent.pinentry.package = pkgs.pinentry-tty;
}; };
programs.gpg.publicKeys = let programs.gpg.publicKeys =
fromUrl = { let
url, fromUrl =
hash, {
trust ? 5, url,
}: { hash,
source = pkgs.fetchurl {inherit url hash;}; trust ? 5,
inherit trust; }:
}; {
source = pkgs.fetchurl { inherit url hash; };
inherit trust;
};
github = {user, ...} @ args: github =
fromUrl ( { user, ... }@args:
builtins.removeAttrs args ["user"] fromUrl (builtins.removeAttrs args [ "user" ] // { url = "https://github.com/${user}.gpg"; });
// {url = "https://github.com/${user}.gpg";} in
);
in
map github [ map github [
# Do not depend on my own forgejo instance / self-host server to avoid a single point of failure # Do not depend on my own forgejo instance / self-host server to avoid a single point of failure
{ {

View file

@ -3,9 +3,11 @@
lib, lib,
config, config,
... ...
}: let }:
let
cfg = config.programs.kitty; cfg = config.programs.kitty;
in { in
{
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ home.packages = [
pkgs.nerd-fonts.iosevka pkgs.nerd-fonts.iosevka

View file

@ -2,9 +2,11 @@
config, config,
lib, lib,
... ...
}: let }:
let
cfg = config.programs.lazygit; cfg = config.programs.lazygit;
in { in
{
programs.tmux.extraConfig = lib.mkIf cfg.enable '' programs.tmux.extraConfig = lib.mkIf cfg.enable ''
bind g run-shell "tmux new-window ${lib.getExe cfg.package}" bind g run-shell "tmux new-window ${lib.getExe cfg.package}"
''; '';

View file

@ -3,12 +3,14 @@
lib, lib,
config, config,
... ...
}: { }:
{
home = { home = {
username = lib.mkDefault "leana"; username = lib.mkDefault "leana";
homeDirectory = let homeDirectory =
inherit (config.home) username; let
in inherit (config.home) username;
in
lib.mkMerge [ lib.mkMerge [
(lib.mkIf pkgs.stdenv.isLinux ("/home/" + username)) (lib.mkIf pkgs.stdenv.isLinux ("/home/" + username))
(lib.mkIf pkgs.stdenv.isDarwin ("/Users/" + username)) (lib.mkIf pkgs.stdenv.isDarwin ("/Users/" + username))

View file

@ -2,7 +2,8 @@
nixosConfig ? null, nixosConfig ? null,
lib, lib,
... ...
}: { }:
{
home.language = { home.language = {
base = lib.mkDefault nixosConfig.i18n.defaultLocale or "en_US.UTF-8"; base = lib.mkDefault nixosConfig.i18n.defaultLocale or "en_US.UTF-8";
}; };

View file

@ -2,21 +2,21 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }:
{
programs = { programs = {
vim.enable = true; vim.enable = true;
}; };
home.packages = home.packages = [
[ pkgs.file
pkgs.file pkgs.gnused
pkgs.gnused pkgs.tree
pkgs.tree pkgs.findutils # xargs and more
pkgs.findutils # xargs and more pkgs.rsync
pkgs.rsync pkgs.parallel
pkgs.parallel pkgs.jq
pkgs.jq ]
] # coreutils for darwin
# coreutils for darwin ++ lib.optional pkgs.stdenv.isDarwin pkgs.uutils-coreutils-noprefix;
++ lib.optional pkgs.stdenv.isDarwin pkgs.uutils-coreutils-noprefix;
} }

View file

@ -3,9 +3,11 @@
pkgs, pkgs,
lib, lib,
... ...
}: let }:
let
cfg = config.programs.password-store; cfg = config.programs.password-store;
in { in
{
home.packages = lib.mkIf cfg.enable [ home.packages = lib.mkIf cfg.enable [
pkgs.pwgen pkgs.pwgen
pkgs.diceware pkgs.diceware

View file

@ -2,7 +2,8 @@
config, config,
lib, lib,
... ...
}: { }:
{
programs.sioyek = { programs.sioyek = {
bindings = { bindings = {
"move_up" = "k"; "move_up" = "k";
@ -17,8 +18,11 @@
"u" "u"
"<C-u>" "<C-u>"
]; ];
"toggle_two_page_mode" = ["T"]; "toggle_two_page_mode" = [ "T" ];
"goto_mark" = ["`" "'"]; "goto_mark" = [
"`"
"'"
];
}; };
config.should_launch_new_window = "1"; config.should_launch_new_window = "1";
@ -27,7 +31,7 @@
xdg.mimeApps = lib.mkIf config.programs.sioyek.enable { xdg.mimeApps = lib.mkIf config.programs.sioyek.enable {
enable = true; enable = true;
defaultApplications = { defaultApplications = {
"application/pdf" = ["sioyek.desktop"]; "application/pdf" = [ "sioyek.desktop" ];
}; };
}; };
} }

View file

@ -2,9 +2,11 @@
lib, lib,
config, config,
... ...
}: let }:
let
cfg = config.programs.starship; cfg = config.programs.starship;
in { in
{
xdg.configFile = lib.mkIf cfg.enable { xdg.configFile = lib.mkIf cfg.enable {
"starship.toml".source = "${./starship.toml}"; "starship.toml".source = "${./starship.toml}";
}; };

View file

@ -2,7 +2,8 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }:
{
programs.tmux.extraConfig = programs.tmux.extraConfig =
builtins.readFile ./tmux.conf builtins.readFile ./tmux.conf
+ lib.optionalString pkgs.stdenv.isDarwin '' + lib.optionalString pkgs.stdenv.isDarwin ''

View file

@ -3,7 +3,8 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
nix = { nix = {
package = lib.mkDefault (nixosConfig.nix.package or pkgs.nix); package = lib.mkDefault (nixosConfig.nix.package or pkgs.nix);

View file

@ -1,27 +1,30 @@
{pkgs, ...}: { { pkgs, ... }:
{
programs.vim = { programs.vim = {
extraConfig = builtins.readFile ./vimrc; extraConfig = builtins.readFile ./vimrc;
plugins = let plugins =
vpkgs = pkgs.vimPlugins; let
vpkgs = pkgs.vimPlugins;
paramount = pkgs.vimUtils.buildVimPlugin { paramount = pkgs.vimUtils.buildVimPlugin {
name = "paramount"; name = "paramount";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "owickstrom"; owner = "owickstrom";
repo = "vim-colors-paramount"; repo = "vim-colors-paramount";
rev = "a5601d36fb6932e8d1a6f8b37b179a99b1456798"; rev = "a5601d36fb6932e8d1a6f8b37b179a99b1456798";
hash = "sha256-j9nMjKYK7bqrGHprYp0ddLEWs1CNMudxXD13sOROVmY="; hash = "sha256-j9nMjKYK7bqrGHprYp0ddLEWs1CNMudxXD13sOROVmY=";
};
}; };
}; in
in [ [
vpkgs.vim-sleuth vpkgs.vim-sleuth
vpkgs.vim-surround vpkgs.vim-surround
vpkgs.vim-fugitive vpkgs.vim-fugitive
vpkgs.vim-commentary vpkgs.vim-commentary
vpkgs.undotree vpkgs.undotree
vpkgs.tabular vpkgs.tabular
vpkgs.vim-caddyfile vpkgs.vim-caddyfile
paramount paramount
]; ];
}; };
} }

View file

@ -1,5 +1,6 @@
{pkgs, ...}: { { pkgs, ... }:
home.packages = [pkgs.iosevka]; {
home.packages = [ pkgs.iosevka ];
services.wired = { services.wired = {
config = "${./wired.ron}"; config = "${./wired.ron}";
}; };

View file

@ -4,7 +4,8 @@
lib, lib,
config, config,
... ...
}: { }:
{
assertions = [ assertions = [
{ {
assertion = config.programs.fish.enable; assertion = config.programs.fish.enable;
@ -22,7 +23,9 @@
WORKTREE_PATH = "wt"; WORKTREE_PATH = "wt";
}; };
programs.direnv.config.whitelist.prefix = [(config.home.sessionVariables.REPO_PATH + "/leana8959")]; programs.direnv.config.whitelist.prefix = [
(config.home.sessionVariables.REPO_PATH + "/leana8959")
];
programs.tmux.extraConfig = lib.mkBefore '' programs.tmux.extraConfig = lib.mkBefore ''
# sessionizer binds # sessionizer binds
bind -n C-f run-shell "tmux new-window tmux-sessionizer" bind -n C-f run-shell "tmux new-window tmux-sessionizer"

View file

@ -3,19 +3,20 @@
nerd-font-patcher, nerd-font-patcher,
parallel, parallel,
stdenvNoCC, stdenvNoCC,
}: { }:
{
font, font,
extraArgs ? [], extraArgs ? [ ],
useDefaultsArgs ? true, useDefaultsArgs ? true,
}: }:
stdenvNoCC.mkDerivation { stdenvNoCC.mkDerivation {
/* /*
Credits: Credits:
https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1231189572 https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1231189572
https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1544597422 https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1544597422
long font names is not problematic: long font names is not problematic:
https://github.com/ryanoasis/nerd-fonts/issues/1018#issuecomment-1953555781 https://github.com/ryanoasis/nerd-fonts/issues/1018#issuecomment-1953555781
*/ */
name = "${font.name}-NerdFont"; name = "${font.name}-NerdFont";
src = font; src = font;
@ -24,20 +25,22 @@ stdenvNoCC.mkDerivation {
parallel parallel
]; ];
buildPhase = let buildPhase =
args = let
lib.optionals useDefaultsArgs [ args =
"--careful" lib.optionals useDefaultsArgs [
"--complete" "--careful"
"--quiet" "--complete"
"--no-progressbars" "--quiet"
] "--no-progressbars"
++ extraArgs; ]
in '' ++ extraArgs;
mkdir -p nerd-font in
find \( -name \*.ttf -o -name \*.otf \) | parallel --jobs=$NIX_BUILD_CORES nerd-font-patcher {} \ ''
--outputdir nerd-font ${builtins.concatStringsSep " " args} mkdir -p nerd-font
''; find \( -name \*.ttf -o -name \*.otf \) | parallel --jobs=$NIX_BUILD_CORES nerd-font-patcher {} \
--outputdir nerd-font ${builtins.concatStringsSep " " args}
'';
installPhase = '' installPhase = ''
exists() { [ -e "$1" ]; } exists() { [ -e "$1" ]; }

View file

@ -2,7 +2,8 @@ let
preferredPriority = 20; preferredPriority = 20;
privatePriority = 10; privatePriority = 10;
limitedPriority = -10; limitedPriority = -10;
in [ in
[
{ {
ssid = "~"; ssid = "~";
priority = preferredPriority; priority = preferredPriority;
@ -36,7 +37,7 @@ in [
priority = privatePriority; priority = privatePriority;
scanOnLowSignal = true; scanOnLowSignal = true;
authProtocols = ["WPA-EAP"]; authProtocols = [ "WPA-EAP" ];
auth = '' auth = ''
pairwise=CCMP pairwise=CCMP
group=CCMP TKIP group=CCMP TKIP
@ -81,13 +82,13 @@ in [
randomizeMac = true; randomizeMac = true;
} }
{ssid = "_SNCF_WIFI_INOUI";} { ssid = "_SNCF_WIFI_INOUI"; }
{ssid = "_WIFI_LYRIA";} { ssid = "_WIFI_LYRIA"; }
{ssid = "EurostarTrainsWiFi";} { ssid = "EurostarTrainsWiFi"; }
{ssid = "SBB-FREE";} { ssid = "SBB-FREE"; }
{ssid = "AOT Airport Free Wi-Fi by NT";} { ssid = "AOT Airport Free Wi-Fi by NT"; }
{ssid = "NewTaipei";} { ssid = "NewTaipei"; }
{ssid = "Fami-WiFi";} { ssid = "Fami-WiFi"; }
{ {
ssid = "iPhone de Léana "; ssid = "iPhone de Léana ";

View file

@ -6,32 +6,39 @@ let
lib = import (sources.nixpkgs + "/lib"); lib = import (sources.nixpkgs + "/lib");
# wpa_supplicant uses `strchr` to seek to the first `=`, so the only forbidden character is `=`. # wpa_supplicant uses `strchr` to seek to the first `=`, so the only forbidden character is `=`.
escapePwdKey = lib.replaceStrings ["="] ["_"]; escapePwdKey = lib.replaceStrings [ "=" ] [ "_" ];
go = networkArgs @ { go =
ssid, networkArgs@{
# Custom fields wrapping nixpkgs module options ssid,
hasPassword ? false, # Custom fields wrapping nixpkgs module options
scanOnLowSignal ? false, hasPassword ? false,
randomizeMac ? false, scanOnLowSignal ? false,
... randomizeMac ? false,
}: { ...
${ssid} = lib.mkMerge [ }:
(builtins.removeAttrs networkArgs ["ssid" "hasPassword" "scanOnLowSignal" "randomizeMac"]) {
(lib.optionalAttrs hasPassword { ${ssid} = lib.mkMerge [
pskRaw = "ext:${escapePwdKey ssid}"; (builtins.removeAttrs networkArgs [
}) "ssid"
(lib.optionalAttrs scanOnLowSignal { "hasPassword"
extraConfig = '' "scanOnLowSignal"
bgscan="simple:30:-70:3600" "randomizeMac"
''; ])
}) (lib.optionalAttrs hasPassword {
(lib.optionalAttrs randomizeMac { pskRaw = "ext:${escapePwdKey ssid}";
extraConfig = '' })
mac_addr=1 (lib.optionalAttrs scanOnLowSignal {
''; extraConfig = ''
}) bgscan="simple:30:-70:3600"
]; '';
}; })
(lib.optionalAttrs randomizeMac {
extraConfig = ''
mac_addr=1
'';
})
];
};
in in
ns: lib.mkMerge (map go ns) ns: lib.mkMerge (map go ns)

View file

@ -1 +1 @@
{programs.command-not-found.enable = false;} { programs.command-not-found.enable = false; }

View file

@ -5,15 +5,18 @@
config, config,
lib, lib,
... ...
}: let }:
let
fishNixOSEnabled = config.programs.fish.enable; fishNixOSEnabled = config.programs.fish.enable;
fishHMEnabled = fishHMEnabled =
if config ? home-manager if config ? home-manager then
then lib.any (userConfig: userConfig.programs.fish.enable) (lib.attrValues config.home-manager.users) lib.any (userConfig: userConfig.programs.fish.enable) (lib.attrValues config.home-manager.users)
else false; else
false;
fishEnabled = fishNixOSEnabled || fishHMEnabled; fishEnabled = fishNixOSEnabled || fishHMEnabled;
in { in
{
environment.pathsToLink = lib.mkIf fishEnabled [ environment.pathsToLink = lib.mkIf fishEnabled [
"/share/fish/vendor_conf.d" "/share/fish/vendor_conf.d"
"/share/fish/vendor_completions.d" "/share/fish/vendor_completions.d"

View file

@ -1,4 +1,5 @@
{hostname, ...}: { { hostname, ... }:
{
networking.hostName = hostname; networking.hostName = hostname;
services.openssh = { services.openssh = {

View file

@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
security.sudo.enable = false; security.sudo.enable = false;
environment.systemPackages = [ environment.systemPackages = [
@ -18,8 +19,8 @@
# doas's docs says it searches in a "limited subset of PATH" if it's relative. # doas's docs says it searches in a "limited subset of PATH" if it's relative.
# I suspect that it doesn't search the PATH added ad-hoc by the nix-shell, also not a good solution. # I suspect that it doesn't search the PATH added ad-hoc by the nix-shell, also not a good solution.
# Also, for some reason, the rule won't match. # Also, for some reason, the rule won't match.
users = [":wheel"]; users = [ ":wheel" ];
setEnv = ["PATH"]; setEnv = [ "PATH" ];
} }
]; ];
}; };

View file

@ -2,7 +2,8 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
nix = { nix = {
package = lib.mkDefault pkgs.nix; package = lib.mkDefault pkgs.nix;

View file

@ -5,14 +5,16 @@
config, config,
lib, lib,
... ...
}: let }:
let
cfg = config.services.xscreensaver; cfg = config.services.xscreensaver;
in { in
{
options = { options = {
services.xscreensaver.hooks = lib.mkOption { services.xscreensaver.hooks = lib.mkOption {
type = with lib.types; attrsOf str; type = with lib.types; attrsOf str;
description = "An attrset of events mapped a block of shell command to be run"; description = "An attrset of events mapped a block of shell command to be run";
default = {}; default = { };
}; };
}; };
@ -20,26 +22,29 @@ in {
systemd.user.services = { systemd.user.services = {
"xscreensaver-hooks" = { "xscreensaver-hooks" = {
description = "Run commands on xscreensaver events"; description = "Run commands on xscreensaver events";
after = ["graphical-session.target" "xscreensaver.service"]; after = [
partOf = ["graphical-session.target"]; "graphical-session.target"
wantedBy = ["graphical-session.target"]; "xscreensaver.service"
script = let ];
handlers = partOf = [ "graphical-session.target" ];
lib.concatMapAttrsStringSep "\n" (event: action: '' wantedBy = [ "graphical-session.target" ];
script =
let
handlers = lib.concatMapAttrsStringSep "\n" (event: action: ''
"${event}") "${event}")
( ${action} ( ${action}
) )
;; ;;
'') '') cfg.hooks;
cfg.hooks; in
in '' ''
xscreensaver-command -watch | while read event rest; do xscreensaver-command -watch | while read event rest; do
echo "The handler script got \"$event\"" echo "The handler script got \"$event\""
case $event in case $event in
${handlers} ${handlers}
esac esac
done done
''; '';
path = [ path = [
cfg.package # contains xscreensaver-command cfg.package # contains xscreensaver-command
]; ];

View file

@ -2,21 +2,22 @@
config, config,
pkgs, pkgs,
... ...
}: { }:
{
# #
# My user # My user
# #
nix.settings.trusted-users = ["leana"]; nix.settings.trusted-users = [ "leana" ];
users.users."leana" = { users.users."leana" = {
isNormalUser = true; isNormalUser = true;
home = "/home/leana"; home = "/home/leana";
description = "Leana"; description = "Leana";
group = "leana"; group = "leana";
extraGroups = ["wheel"]; extraGroups = [ "wheel" ];
shell = pkgs.bash; shell = pkgs.bash;
openssh.authorizedKeys.keys = config.users.users.root.openssh.authorizedKeys.keys; openssh.authorizedKeys.keys = config.users.users.root.openssh.authorizedKeys.keys;
}; };
users.groups.leana = {}; users.groups.leana = { };
# #
# My nix binary cache # My nix binary cache

View file

@ -1,5 +1,5 @@
{ {
# This will temporarily disable the dedicated graphics and boot into the system. # This will temporarily disable the dedicated graphics and boot into the system.
# If your computer suffers from the GPU's death it won't boot unless you do this. # If your computer suffers from the GPU's death it won't boot unless you do this.
boot.kernelParams = ["radeon.modeset=0"]; boot.kernelParams = [ "radeon.modeset=0" ];
} }

View file

@ -3,10 +3,12 @@
lib, lib,
config, config,
... ...
}: let }:
let
cfg = config.services.parrot; cfg = config.services.parrot;
t = lib.types; t = lib.types;
in { in
{
options = { options = {
services.parrot = { services.parrot = {
enable = lib.mkEnableOption "parrot"; enable = lib.mkEnableOption "parrot";
@ -23,12 +25,12 @@ in {
group = "parrot"; group = "parrot";
isSystemUser = true; isSystemUser = true;
}; };
users.groups."parrot" = {}; users.groups."parrot" = { };
systemd.services."parrot" = { systemd.services."parrot" = {
description = " A hassle-free, highly performant, self-hosted Discord music bot with YouTube and Spotify support. Powered by yt-dlp."; description = " A hassle-free, highly performant, self-hosted Discord music bot with YouTube and Spotify support. Powered by yt-dlp.";
after = ["network.target"]; after = [ "network.target" ];
wantedBy = ["multi-user.target"]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
User = "parrot"; User = "parrot";

View file

@ -1,7 +1,11 @@
# https://nixos.wiki/wiki/Encrypted_DNS # https://nixos.wiki/wiki/Encrypted_DNS
{pkgs, ...}: { { pkgs, ... }:
{
networking = { networking = {
nameservers = ["127.0.0.1" "::1"]; nameservers = [
"127.0.0.1"
"::1"
];
dhcpcd.extraConfig = "nohook resolv.conf"; dhcpcd.extraConfig = "nohook resolv.conf";
# networkmanager.dns = "none"; # networkmanager.dns = "none";
}; };
@ -13,7 +17,7 @@
# Settings reference: # Settings reference:
# https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/dnscrypt-proxy/example-dnscrypt-proxy.toml # https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/dnscrypt-proxy/example-dnscrypt-proxy.toml
settings = { settings = {
listen_addresses = ["127.0.0.1:53"]; listen_addresses = [ "127.0.0.1:53" ];
ipv4_servers = true; ipv4_servers = true;
require_dnssec = true; require_dnssec = true;

View file

@ -3,10 +3,12 @@
config, config,
lib, lib,
... ...
}: let }:
let
cfg = config.services.typst-bot; cfg = config.services.typst-bot;
t = lib.types; t = lib.types;
in { in
{
options = { options = {
services.typst-bot = { services.typst-bot = {
enable = lib.mkEnableOption "typst-bot"; enable = lib.mkEnableOption "typst-bot";
@ -30,7 +32,7 @@ in {
isSystemUser = true; isSystemUser = true;
home = cfg.dataDir; home = cfg.dataDir;
}; };
users.groups."typst-bot" = {}; users.groups."typst-bot" = { };
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d ${cfg.dataDir}/cache 700 typst-bot typst-bot - -" "d ${cfg.dataDir}/cache 700 typst-bot typst-bot - -"
@ -39,15 +41,15 @@ in {
systemd.services."typst-bot" = { systemd.services."typst-bot" = {
description = "A discord bot to render Typst code"; description = "A discord bot to render Typst code";
after = ["network.target"]; after = [ "network.target" ];
wantedBy = ["multi-user.target"]; wantedBy = [ "multi-user.target" ];
preStart = '' preStart = ''
: >${cfg.dataDir}/sqlite/db.sqlite : >${cfg.dataDir}/sqlite/db.sqlite
''; '';
# Don't pollute the global path # Don't pollute the global path
path = [pkgs.typst-bot]; path = [ pkgs.typst-bot ];
script = "typst-bot"; script = "typst-bot";
serviceConfig = { serviceConfig = {

View file

@ -1 +1 @@
{zramSwap.enable = true;} { zramSwap.enable = true; }

View file

@ -1,7 +1,7 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
final: _: { final: _: {
# Use flake so the package inputs is pinned # Use flake so the package inputs is pinned
agenix = sources.agenix.asFlake.packages.${final.system}.default; agenix = sources.agenix.asFlake.packages.${final.system}.default;
} }

View file

@ -2,8 +2,8 @@
final: prev: { final: prev: {
calibre = final.symlinkJoin { calibre = final.symlinkJoin {
name = "calibre"; name = "calibre";
paths = [prev.calibre]; paths = [ prev.calibre ];
buildInputs = [final.makeWrapper]; buildInputs = [ final.makeWrapper ];
postBuild = '' postBuild = ''
rm -r $out/share/mime rm -r $out/share/mime
''; '';

View file

@ -1,6 +1,6 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
final: _: { final: _: {
disko = sources.disko.asFlake.packages.${final.system}.default; disko = sources.disko.asFlake.packages.${final.system}.default;
} }

View file

@ -1,6 +1,6 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
final: _: { final: _: {
dix = sources.dix.asFlake.packages.${final.system}.default; dix = sources.dix.asFlake.packages.${final.system}.default;
} }

View file

@ -1,6 +1,6 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
final: _: { final: _: {
eepy = sources.eepy.asFlake.packages.${final.system}.default; eepy = sources.eepy.asFlake.packages.${final.system}.default;
} }

View file

@ -1,18 +1,14 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
final: prev: { final: prev: {
fcitx5-table-extra = prev.fcitx5-table-extra.overrideAttrs (oldAttrs: { fcitx5-table-extra = prev.fcitx5-table-extra.overrideAttrs (oldAttrs: {
src = sources.fcitx5-table-extra; src = sources.fcitx5-table-extra;
nativeBuildInputs = nativeBuildInputs = oldAttrs.nativeBuildInputs or [ ] ++ [
oldAttrs.nativeBuildInputs or [] final.python3
++ [ ];
final.python3 preConfigure = oldAttrs.preConfigure or "" + ''
]; python3 ./generate.py
preConfigure = '';
oldAttrs.preConfigure or "" });
+ '' }
python3 ./generate.py
'';
});
}

View file

@ -1,7 +1,8 @@
final: prev: rec { final: prev: rec {
nerd-fonts = let nerd-fonts =
mkNerdFont = final.callPackage ../lib/mkNerdFont.nix {}; let
in mkNerdFont = final.callPackage ../lib/mkNerdFont.nix { };
in
prev.nerd-fonts prev.nerd-fonts
// { // {
iosevka = mkNerdFont { iosevka = mkNerdFont {

View file

@ -2,21 +2,18 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
final: _: { final: _: {
nil = let nil =
let
pkg = sources.nil.asFlake.packages.${final.system}.default; pkg = sources.nil.asFlake.packages.${final.system}.default;
in in
pkg.overrideAttrs ( pkg.overrideAttrs (oldAttrs: {
oldAttrs: { patches = oldAttrs.patches or [ ] ++ [
patches = (final.fetchpatch {
oldAttrs.patches or [] name = "fix-handling-inherit-and-patfield-in-inline-assist";
++ [ url = "https://github.com/oxalica/nil/pull/178.patch";
(final.fetchpatch { hash = "sha256-4f7DeWJtt63IyOjqlwzz0f05rv1NBYZO4JWEkFeDimk=";
name = "fix-handling-inherit-and-patfield-in-inline-assist"; })
url = "https://github.com/oxalica/nil/pull/178.patch"; ];
hash = "sha256-4f7DeWJtt63IyOjqlwzz0f05rv1NBYZO4JWEkFeDimk="; });
}) }
];
}
);
}

View file

@ -1,12 +1,10 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
# The final nix is lix in this case # The final nix is lix in this case
final: prev: { final: prev: {
nix-monitored = nix-monitored = sources.nix-monitored.asFlake.packages.${final.system}.default.override {
sources.nix-monitored.asFlake.packages.${final.system}.default inherit (final) nix;
.override { withNotify = false; # noisy, spams "command completed" even for nix shells
inherit (final) nix; };
withNotify = false; # noisy, spams "command completed" even for nix shells }
};
}

View file

@ -3,6 +3,6 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
final: _: { final: _: {
nix-tree = (import sources.nix-tree).packages.${final.system}.default; nix-tree = (import sources.nix-tree).packages.${final.system}.default;
} }

View file

@ -1,4 +1,4 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
sources.nur.asFlake.overlays.default sources.nur.asFlake.overlays.default

View file

@ -1,6 +1,6 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
_: _: { _: _: {
unsafe-emacs28 = (import sources.pin-emacs28 {}).emacs; unsafe-emacs28 = (import sources.pin-emacs28 { }).emacs;
} }

View file

@ -1,7 +1,7 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
_: _: { _: _: {
# Isabelle version 2023 # Isabelle version 2023
isabelle-2023 = (import sources.pin-isabelle {}).isabelle; isabelle-2023 = (import sources.pin-isabelle { }).isabelle;
} }

View file

@ -1,8 +1,8 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
_: _: { _: _: {
# Wireshark bug # Wireshark bug
# https://gitlab.com/wireshark/wireshark/-/issues/19574 # https://gitlab.com/wireshark/wireshark/-/issues/19574
inherit (import sources.pin-wireshark {}) wireshark; inherit (import sources.pin-wireshark { }) wireshark;
} }

View file

@ -1,7 +1,7 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
_: _: rec { _: _: rec {
wallpapers_source = sources.wallpapers; wallpapers_source = sources.wallpapers;
wallpapers = import wallpapers_source {}; wallpapers = import wallpapers_source { };
} }

View file

@ -1,4 +1,4 @@
let let
sources = import ../../npins; sources = import ../../npins;
in in
(import sources.wired-notify).overlays.default (import sources.wired-notify).overlays.default

View file

@ -2,26 +2,27 @@
fetchFromGitHub, fetchFromGitHub,
stdenvNoCC, stdenvNoCC,
lib, lib,
}: let }:
let
rev = "9bb188e2701138e03f73bacebd6b19b181ca0012"; rev = "9bb188e2701138e03f73bacebd6b19b181ca0012";
in in
stdenvNoCC.mkDerivation { stdenvNoCC.mkDerivation {
pname = "ai_blocklist"; pname = "ai_blocklist";
version = "unstable-" + lib.substring 0 8 rev; version = "unstable-" + lib.substring 0 8 rev;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "laylavish"; owner = "laylavish";
repo = "uBlockOrigin-HUGE-AI-Blocklist"; repo = "uBlockOrigin-HUGE-AI-Blocklist";
inherit rev; inherit rev;
hash = "sha256-p3wfR28DH6V8BHn9DT10d09Yq3mdbBecWwlR1CdDYUA="; hash = "sha256-p3wfR28DH6V8BHn9DT10d09Yq3mdbBecWwlR1CdDYUA=";
}; };
installPhase = '' installPhase = ''
mkdir -p $out/share mkdir -p $out/share
cp noai_hosts.txt $out/share/hosts.txt cp noai_hosts.txt $out/share/hosts.txt
# drop domain names # drop domain names
cat $out/share/hosts.txt | cat $out/share/hosts.txt |
sed 's/^0.0.0.0 //' > $out/share/domains.txt sed 's/^0.0.0.0 //' > $out/share/domains.txt
''; '';
} }

View file

@ -2,20 +2,24 @@
rustPlatform, rustPlatform,
fetchFromGitea, fetchFromGitea,
}: }:
rustPlatform.buildRustPackage (finalAttrs: let rustPlatform.buildRustPackage (
cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml")); finalAttrs:
cargoLock = finalAttrs.src + "/Cargo.lock"; let
in { cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml"));
pname = "audio-lint"; cargoLock = finalAttrs.src + "/Cargo.lock";
version = cargoToml.package.version; in
{
pname = "audio-lint";
version = cargoToml.package.version;
src = fetchFromGitea { src = fetchFromGitea {
domain = "git.confusedcompiler.org"; domain = "git.confusedcompiler.org";
owner = "leana8959"; owner = "leana8959";
repo = "audio-lint"; repo = "audio-lint";
rev = "3ea38c85c5f6135958e51ad4ff13a96ccd68a21c"; rev = "3ea38c85c5f6135958e51ad4ff13a96ccd68a21c";
hash = "sha256-h1SnWAh3FPL5GweOXVXXtp+swZApgecYaWjy7rM/J+w="; hash = "sha256-h1SnWAh3FPL5GweOXVXXtp+swZApgecYaWjy7rM/J+w=";
}; };
cargoLock.lockFile = cargoLock; cargoLock.lockFile = cargoLock;
}) }
)

View file

@ -6,29 +6,33 @@
libxcb, libxcb,
fetchFromGitHub, fetchFromGitHub,
}: }:
rustPlatform.buildRustPackage (finalAttrs: let rustPlatform.buildRustPackage (
cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml")); finalAttrs:
cargoLock = finalAttrs.src + "/Cargo.lock"; let
in { cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml"));
pname = "emoji-picker"; cargoLock = finalAttrs.src + "/Cargo.lock";
version = cargoToml.package.version; in
{
pname = "emoji-picker";
version = cargoToml.package.version;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "leana8959"; owner = "leana8959";
repo = "emoji-picker"; repo = "emoji-picker";
rev = "d77c086bb3ed1ba55560c5027cc58e2c033c9ca7"; rev = "d77c086bb3ed1ba55560c5027cc58e2c033c9ca7";
hash = "sha256-gLsBhtSnrOdU/qH9WR3UnsclfptRAP0Wv+MJjY+wYGc="; hash = "sha256-gLsBhtSnrOdU/qH9WR3UnsclfptRAP0Wv+MJjY+wYGc=";
}; };
cargoLock.lockFile = cargoLock; cargoLock.lockFile = cargoLock;
nativeBuildInputs = [ nativeBuildInputs = [
python3 python3
pkg-config pkg-config
]; ];
buildInputs = [ buildInputs = [
openssl.dev openssl.dev
libxcb libxcb
]; ];
}) }
)

View file

@ -2,25 +2,26 @@
fetchFromGitHub, fetchFromGitHub,
stdenvNoCC, stdenvNoCC,
lib, lib,
}: let }:
let
rev = "cc19c050997d5f54014bb20c764b131e003dfb17"; rev = "cc19c050997d5f54014bb20c764b131e003dfb17";
in in
stdenvNoCC.mkDerivation { stdenvNoCC.mkDerivation {
pname = "hategroup_blocklist"; pname = "hategroup_blocklist";
version = "unstable-" + lib.substring 0 8 rev; version = "unstable-" + lib.substring 0 8 rev;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "chigh"; owner = "chigh";
repo = "hategroup-dnsbl"; repo = "hategroup-dnsbl";
inherit rev; inherit rev;
hash = "sha256-SZBrjIBUw687MdrbOV7WrP5IhAAtKvPL2GqdcICHNvQ="; hash = "sha256-SZBrjIBUw687MdrbOV7WrP5IhAAtKvPL2GqdcICHNvQ=";
}; };
installPhase = '' installPhase = ''
mkdir -p $out/share mkdir -p $out/share
cp blocklist.txt $out/share/domains.txt cp blocklist.txt $out/share/domains.txt
cat $out/share/domains.txt | cat $out/share/domains.txt |
sed 's/^\([^#].*\)$/0.0.0.0 \1/' > $out/share/hosts.txt sed 's/^\([^#].*\)$/0.0.0.0 \1/' > $out/share/hosts.txt
''; '';
} }

View file

@ -3,31 +3,26 @@
haskell, haskell,
fetchFromGitea, fetchFromGitea,
installShellFiles, installShellFiles,
}: let }:
let
inherit (haskell.lib.compose) justStaticExecutables overrideCabal; inherit (haskell.lib.compose) justStaticExecutables overrideCabal;
drv = drv = haskellPackages.callCabal2nix "hbrainfuck" (fetchFromGitea {
haskellPackages.callCabal2nix "hbrainfuck" domain = "git.confusedcompiler.org";
(fetchFromGitea { owner = "leana8959";
domain = "git.confusedcompiler.org"; repo = "hbrainfuck";
owner = "leana8959"; rev = "5eea5ff0d7efc0bd866a2273686032ba9cab5baa";
repo = "hbrainfuck"; hash = "sha256-/htXOULUJN8+PsAYaG281Ge/9ULZoWip63IUxuVbTSg=";
rev = "5eea5ff0d7efc0bd866a2273686032ba9cab5baa"; }) { };
hash = "sha256-/htXOULUJN8+PsAYaG281Ge/9ULZoWip63IUxuVbTSg=";
})
{};
cabalOverrides = o: { cabalOverrides = o: {
buildTools = o.buildTools or [] ++ [installShellFiles]; buildTools = o.buildTools or [ ] ++ [ installShellFiles ];
postInstall = postInstall = o.postInstall or "" + ''
o.postInstall or "" installShellCompletion --cmd hbrainfuck \
+ '' --bash <("$out/bin/hbf" --bash-completion-script "$out/bin/hbf") \
installShellCompletion --cmd hbrainfuck \ --fish <("$out/bin/hbf" --fish-completion-script "$out/bin/hbf") \
--bash <("$out/bin/hbf" --bash-completion-script "$out/bin/hbf") \ --zsh <("$out/bin/hbf" --zsh-completion-script "$out/bin/hbf")
--fish <("$out/bin/hbf" --fish-completion-script "$out/bin/hbf") \ '';
--zsh <("$out/bin/hbf" --zsh-completion-script "$out/bin/hbf")
'';
}; };
in in
justStaticExecutables justStaticExecutables (overrideCabal cabalOverrides drv)
(overrideCabal cabalOverrides drv)

View file

@ -2,18 +2,16 @@
haskellPackages, haskellPackages,
haskell, haskell,
fetchFromGitea, fetchFromGitea,
}: let }:
let
inherit (haskell.lib.compose) justStaticExecutables; inherit (haskell.lib.compose) justStaticExecutables;
drv = drv = haskellPackages.callCabal2nix "hutils" (fetchFromGitea {
haskellPackages.callCabal2nix "hutils" domain = "git.confusedcompiler.org";
(fetchFromGitea { owner = "leana8959";
domain = "git.confusedcompiler.org"; repo = "hutils";
owner = "leana8959"; rev = "30b503bec011f8908e26c0e1e961936d56da74cc";
repo = "hutils"; hash = "sha256-lPwqxsz7WXdDMonjdWvTziR5HuE5HY2GyU2rQkwn0VU=";
rev = "30b503bec011f8908e26c0e1e961936d56da74cc"; }) { };
hash = "sha256-lPwqxsz7WXdDMonjdWvTziR5HuE5HY2GyU2rQkwn0VU=";
})
{};
in in
justStaticExecutables drv justStaticExecutables drv

Some files were not shown because too many files have changed in this diff Show more