diff --git a/default.nix b/default.nix index 7445744d..ccf69117 100644 --- a/default.nix +++ b/default.nix @@ -1,22 +1,27 @@ -{sources ? import ./npins}: { +{ + sources ? import ./npins, +}: +{ # for repl sessions inherit sources; lib = import (sources.nixpkgs + "/lib"); - nixosConfigurations = builtins.mapAttrs (_: import (sources.nixpkgs + "/nixos/lib/eval-config.nix")) { - vanadium = { - system = "x86_64-linux"; - modules = [./nix/configurations/vanadium.nix]; - }; - hydrogen = { - system = "aarch64-linux"; - modules = [./nix/configurations/hydrogen.nix]; - }; - installer = { - system = "x86_64-linux"; - modules = [./nix/configurations/installer.nix]; - }; - }; + nixosConfigurations = + builtins.mapAttrs (_: import (sources.nixpkgs + "/nixos/lib/eval-config.nix")) + { + vanadium = { + system = "x86_64-linux"; + modules = [ ./nix/configurations/vanadium.nix ]; + }; + hydrogen = { + system = "aarch64-linux"; + modules = [ ./nix/configurations/hydrogen.nix ]; + }; + installer = { + system = "x86_64-linux"; + modules = [ ./nix/configurations/installer.nix ]; + }; + }; - packages = import ./nix/packages {inherit sources;}; + packages = import ./nix/packages { inherit sources; }; } diff --git a/nix/configurations/hydrogen.nix b/nix/configurations/hydrogen.nix index f4d95050..8db8304c 100644 --- a/nix/configurations/hydrogen.nix +++ b/nix/configurations/hydrogen.nix @@ -4,133 +4,135 @@ let hostname = "hydrogen"; username = "leana"; in - { - modulesPath, - config, - pkgs, - lib, - ... - }: let - inherit (lib.modules) mkAliasOptionModule; - in { - imports = [ - # The generator and hardware configuration - (modulesPath + "/installer/sd-card/sd-image-aarch64.nix") +{ + modulesPath, + config, + pkgs, + lib, + ... +}: +let + inherit (lib.modules) mkAliasOptionModule; +in +{ + imports = [ + # The generator and hardware configuration + (modulesPath + "/installer/sd-card/sd-image-aarch64.nix") - # - # Shorthands - # - (mkAliasOptionModule ["me"] ["users" "users" username]) - (mkAliasOptionModule ["hm"] ["home-manager" "users" username]) + # + # Shorthands + # + (mkAliasOptionModule [ "me" ] [ "users" "users" username ]) + (mkAliasOptionModule [ "hm" ] [ "home-manager" "users" username ]) - # - # hostname - # - {_module.args = {inherit hostname;};} + # + # hostname + # + { _module.args = { inherit hostname; }; } - # - # nixpkgs - # - { - nixpkgs = { - overlays = map import [ - ../overlays/agenix.nix - ../overlays/nur.nix - ../overlays/nix-tree.nix - ../packages/overlay.nix + # + # nixpkgs + # + { + nixpkgs = { + overlays = map import [ + ../overlays/agenix.nix + ../overlays/nur.nix + ../overlays/nix-tree.nix + ../packages/overlay.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; - } - - ./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 + # use lix everywhere and wrap it with nom + ../overlays/lix.nix + ../overlays/nix-monitored.nix ]; - } - # - # Secrets - # - { - age.secrets = { - wpa_password.file = "${../secrets/wpa_password.age}"; - }; - } - ]; - } + # 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 + ]; + } + + # + # Secrets + # + { + age.secrets = { + wpa_password.file = "${../secrets/wpa_password.age}"; + }; + } + ]; +} diff --git a/nix/configurations/hydrogen/home/dev.nix b/nix/configurations/hydrogen/home/dev.nix index 93d1e440..28a2d449 100644 --- a/nix/configurations/hydrogen/home/dev.nix +++ b/nix/configurations/hydrogen/home/dev.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ home.packages = [ pkgs.nil # nix pkgs.pyright # python diff --git a/nix/configurations/hydrogen/home/programs.nix b/nix/configurations/hydrogen/home/programs.nix index bfe508c8..1f2da428 100644 --- a/nix/configurations/hydrogen/home/programs.nix +++ b/nix/configurations/hydrogen/home/programs.nix @@ -3,12 +3,15 @@ lib, config, ... -}: { - home.sessionVariables = let - fishCfg = config.programs.fish; - in { - "SHELL" = lib.mkIf fishCfg.enable (lib.getExe fishCfg.package); - }; +}: +{ + home.sessionVariables = + let + fishCfg = config.programs.fish; + in + { + "SHELL" = lib.mkIf fishCfg.enable (lib.getExe fishCfg.package); + }; home.packages = [ pkgs.nmap diff --git a/nix/configurations/hydrogen/nixos/connectivity.nix b/nix/configurations/hydrogen/nixos/connectivity.nix index 767374c3..41c5a29f 100644 --- a/nix/configurations/hydrogen/nixos/connectivity.nix +++ b/nix/configurations/hydrogen/nixos/connectivity.nix @@ -2,7 +2,8 @@ config, lib, ... -}: { +}: +{ users.users.root.openssh.authorizedKeys.keys = import ../../../identities.nix; networking = { @@ -22,13 +23,12 @@ userControlled.enable = true; secretsFile = config.age.secrets.wpa_password.path; scanOnLowSignal = false; - networks = let - fromList = import ../../../networks/wpa_supplicant-compat.nix; - networks = import ../../../networks/list.nix; - in - fromList ( - builtins.filter (x: x.ssid == "~") networks - ); + networks = + let + fromList = import ../../../networks/wpa_supplicant-compat.nix; + networks = import ../../../networks/list.nix; + in + fromList (builtins.filter (x: x.ssid == "~") networks); }; }; diff --git a/nix/configurations/hydrogen/nixos/misc.nix b/nix/configurations/hydrogen/nixos/misc.nix index 3cb2c3d4..7dc4601c 100644 --- a/nix/configurations/hydrogen/nixos/misc.nix +++ b/nix/configurations/hydrogen/nixos/misc.nix @@ -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 nixpkgs.overlays = [ (final: prev: { - makeModulesClosure = x: - prev.makeModulesClosure (x // {allowMissing = true;}); + makeModulesClosure = x: prev.makeModulesClosure (x // { allowMissing = true; }); }) ]; } diff --git a/nix/configurations/hydrogen/nixos/programs.nix b/nix/configurations/hydrogen/nixos/programs.nix index 5f281024..b77c0323 100644 --- a/nix/configurations/hydrogen/nixos/programs.nix +++ b/nix/configurations/hydrogen/nixos/programs.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ environment.systemPackages = [ pkgs.man-pages pkgs.man-pages-posix diff --git a/nix/configurations/installer.nix b/nix/configurations/installer.nix index 035d918d..c821744a 100644 --- a/nix/configurations/installer.nix +++ b/nix/configurations/installer.nix @@ -9,7 +9,8 @@ lib, modulesPath, ... -}: { +}: +{ imports = [ ../nixosModules/common/system-nixconf.nix ../nixosModules/common/sudo-conf.nix @@ -18,10 +19,15 @@ ]; nix.settings = { - extra-substituters = ["https://leana8959.cachix.org"]; - extra-trusted-substituters = ["https://leana8959.cachix.org"]; - extra-trusted-public-keys = ["leana8959.cachix.org-1:CxQSAp8lcgMv8Me459of0jdXRW2tcyeYRKTiiUq8z0M="]; - experimental-features = ["nix-command" "flakes"]; + extra-substituters = [ "https://leana8959.cachix.org" ]; + extra-trusted-substituters = [ "https://leana8959.cachix.org" ]; + extra-trusted-public-keys = [ + "leana8959.cachix.org-1:CxQSAp8lcgMv8Me459of0jdXRW2tcyeYRKTiiUq8z0M=" + ]; + experimental-features = [ + "nix-command" + "flakes" + ]; }; nixpkgs = { @@ -45,7 +51,7 @@ pkgs.btop ]; - networking.firewall.allowedTCPPorts = [8080]; # in case you wanna nc + networking.firewall.allowedTCPPorts = [ 8080 ]; # in case you wanna nc programs.tmux.enable = true; users.users.nixos.shell = pkgs.fish; diff --git a/nix/configurations/vanadium.nix b/nix/configurations/vanadium.nix index 4ffe85bf..725c460f 100644 --- a/nix/configurations/vanadium.nix +++ b/nix/configurations/vanadium.nix @@ -5,225 +5,227 @@ let hostname = "vanadium"; username = "leana"; in - { - config, - lib, - pkgs, - ... - }: let - inherit (lib.modules) mkAliasOptionModule; - in { - imports = [ - # - # Shorthands - # - (mkAliasOptionModule ["me"] ["users" "users" username]) - (mkAliasOptionModule ["hm"] ["home-manager" "users" username]) +{ + config, + lib, + pkgs, + ... +}: +let + inherit (lib.modules) mkAliasOptionModule; +in +{ + imports = [ + # + # Shorthands + # + (mkAliasOptionModule [ "me" ] [ "users" "users" username ]) + (mkAliasOptionModule [ "hm" ] [ "home-manager" "users" username ]) - # - # hostname - # - {_module.args = {inherit hostname;};} + # + # hostname + # + { _module.args = { inherit hostname; }; } - # - # nixpkgs - # - { - # affect the generated nix.conf, doesn't need to be turned off during nixos-install - nix = { - distributedBuilds = true; - settings.builders-use-substitutes = true; + # + # nixpkgs + # + { + # affect the generated nix.conf, doesn't need to be turned off during nixos-install + nix = { + distributedBuilds = 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 = { - config = { - # For btop, ROCm support is needed for AMD GPU - # https://github.com/aristocratos/btop?tab=readme-ov-file#gpu-compatibility - rocmSupport = true; - }; + overlays = map import [ + ../overlays/agenix.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 = map import [ - ../overlays/agenix.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 + ../packages/overlay.nix - ../overlays/iosevka.nix - ../packages/overlay.nix + ./vanadium/overlay.nix + ./vanadium/kernel-overlay.nix - ./vanadium/overlay.nix - ./vanadium/kernel-overlay.nix + # removed, but I need it for PLFA! + ../overlays/pin-emacs28.nix - # removed, but I need it for PLFA! - ../overlays/pin-emacs28.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 + # use lix everywhere and wrap it with nom + ../overlays/lix.nix + ../overlays/nix-monitored.nix ]; - } - # - # Secrets - # - { + # 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 + ]; + } + + # + # 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 = { - 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 = { - sshconfig = { - file = "${../secrets/sshconfig.age}"; - path = "/home/leana/.ssh/config"; - }; - iambconfig = { - file = "${../secrets/iambconfig.age}"; - path = "/home/leana/.config/iamb/config.toml"; - }; + sshconfig = { + file = "${../secrets/sshconfig.age}"; + path = "/home/leana/.ssh/config"; + }; + iambconfig = { + file = "${../secrets/iambconfig.age}"; + path = "/home/leana/.config/iamb/config.toml"; }; }; - } - ]; - } + }; + } + ]; +} diff --git a/nix/configurations/vanadium/home/dev.nix b/nix/configurations/vanadium/home/dev.nix index 57bcf93e..9420274e 100644 --- a/nix/configurations/vanadium/home/dev.nix +++ b/nix/configurations/vanadium/home/dev.nix @@ -3,7 +3,8 @@ lib, config, ... -}: { +}: +{ home.packages = [ # preview markdown pkgs.python3Packages.grip @@ -42,10 +43,11 @@ "haskell/cabal" ]; }; - includes = let - fromList = import ../../../git-identities/git-compat.nix; - identities = import ../../../git-identities/list.nix; - in + includes = + let + fromList = import ../../../git-identities/git-compat.nix; + identities = import ../../../git-identities/list.nix; + in fromList identities; }; diff --git a/nix/configurations/vanadium/home/firefox.nix b/nix/configurations/vanadium/home/firefox.nix index 95e9dbd6..aab6da3f 100644 --- a/nix/configurations/vanadium/home/firefox.nix +++ b/nix/configurations/vanadium/home/firefox.nix @@ -2,9 +2,11 @@ pkgs, config, ... -}: let +}: +let inherit (pkgs) nur; -in { +in +{ programs.firefox = { enable = true; @@ -106,26 +108,29 @@ in { font-family: monospace; } ''; - extensions.packages = let - addons = nur.repos.rycee.firefox-addons; - in [ - addons.sponsorblock - addons.return-youtube-dislikes - addons.consent-o-matic - ]; + extensions.packages = + let + addons = nur.repos.rycee.firefox-addons; + in + [ + addons.sponsorblock + addons.return-youtube-dislikes + addons.consent-o-matic + ]; }; junk = { id = 1; - inherit - (config.programs.firefox.profiles.default) + inherit (config.programs.firefox.profiles.default) settings userChrome ; - extensions.packages = let - addons = nur.repos.rycee.firefox-addons; - in [addons.multi-account-containers]; + extensions.packages = + let + addons = nur.repos.rycee.firefox-addons; + in + [ addons.multi-account-containers ]; containers = { raisin = { @@ -144,15 +149,16 @@ in { # Isolate it because it's proprietary tampermonkey = { id = 2; - inherit - (config.programs.firefox.profiles.default) + inherit (config.programs.firefox.profiles.default) settings userChrome ; - extensions.packages = let - addons = nur.repos.rycee.firefox-addons; - in [addons.tampermonkey]; + extensions.packages = + let + addons = nur.repos.rycee.firefox-addons; + in + [ addons.tampermonkey ]; }; }; }; diff --git a/nix/configurations/vanadium/home/misc.nix b/nix/configurations/vanadium/home/misc.nix index c1fff0e5..33210803 100644 --- a/nix/configurations/vanadium/home/misc.nix +++ b/nix/configurations/vanadium/home/misc.nix @@ -1,19 +1,23 @@ { pkgs, lib, - nixosConfig ? {}, + nixosConfig ? { }, ... -}: { +}: +{ # # fonts # fonts.fontconfig = { enable = true; - defaultFonts = lib.mapAttrsRecursive (_: v: v ++ ["Last Resort"]) { - sansSerif = ["Ubuntu" "Noto Sans CJK TC"]; - serif = ["Noto Serif CJK TC"]; - monospace = ["Iosevka"]; - emoji = ["Noto Color Emoji"]; + defaultFonts = lib.mapAttrsRecursive (_: v: v ++ [ "Last Resort" ]) { + sansSerif = [ + "Ubuntu" + "Noto Sans CJK TC" + ]; + serif = [ "Noto Serif CJK TC" ]; + monospace = [ "Iosevka" ]; + emoji = [ "Noto Color Emoji" ]; }; }; home.packages = [ @@ -39,8 +43,7 @@ x11.enable = true; gtk.enable = true; - inherit - (nixosConfig.services.xserver.displayManager.lightdm.greeters.gtk.cursorTheme) + inherit (nixosConfig.services.xserver.displayManager.lightdm.greeters.gtk.cursorTheme) name package size @@ -55,7 +58,7 @@ xdg.mimeApps = { enable = true; defaultApplications = { - "x-scheme-handler/mailto" = ["org.gnome.Evolution.desktop"]; + "x-scheme-handler/mailto" = [ "org.gnome.Evolution.desktop" ]; }; }; } diff --git a/nix/configurations/vanadium/home/programs.nix b/nix/configurations/vanadium/home/programs.nix index c0296f94..f7030c31 100644 --- a/nix/configurations/vanadium/home/programs.nix +++ b/nix/configurations/vanadium/home/programs.nix @@ -3,16 +3,19 @@ lib, config, ... -}: { +}: +{ home.sessionPath = [ "${config.home.homeDirectory}/.local/bin" ]; - home.sessionVariables = let - fishCfg = config.programs.fish; - in { - "SHELL" = lib.mkIf fishCfg.enable (lib.getExe fishCfg.package); - }; + home.sessionVariables = + let + fishCfg = config.programs.fish; + in + { + "SHELL" = lib.mkIf fishCfg.enable (lib.getExe fishCfg.package); + }; home.packages = [ pkgs.ghc # my favorite calculator @@ -37,9 +40,7 @@ # lol pkgs.macchanger - /* - The file picker is not ergonomic enough, sadly - */ + # The file picker is not ergonomic enough, sadly # pkgs.helix # pkgs.nushell @@ -172,7 +173,7 @@ gnome-keyring = { enable = true; - components = ["secrets"]; + components = [ "secrets" ]; }; }; } diff --git a/nix/configurations/vanadium/home/xmobar.nix b/nix/configurations/vanadium/home/xmobar.nix index 40476f66..7dc65e8f 100644 --- a/nix/configurations/vanadium/home/xmobar.nix +++ b/nix/configurations/vanadium/home/xmobar.nix @@ -1,23 +1,31 @@ -{pkgs, ...}: { - home.packages = let - inherit (pkgs) lib; +{ pkgs, ... }: +{ + home.packages = + let + inherit (pkgs) lib; - ghc = pkgs.haskellPackages.ghc.withPackages (haskellPackages: [ - haskellPackages.xmobar - ]); + ghc = pkgs.haskellPackages.ghc.withPackages (haskellPackages: [ + haskellPackages.xmobar + ]); - wrapped-xmobar = pkgs.symlinkJoin { - name = "xmobar"; - paths = [pkgs.xmobar]; - buildInputs = [pkgs.makeWrapper]; - postBuild = '' - wrapProgram $out/bin/xmobar \ - --prefix PATH : "${lib.makeBinPath [ghc pkgs.libnotify]}" - ''; - }; - in [ - wrapped-xmobar - ]; + wrapped-xmobar = pkgs.symlinkJoin { + name = "xmobar"; + paths = [ pkgs.xmobar ]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/xmobar \ + --prefix PATH : "${ + lib.makeBinPath [ + ghc + pkgs.libnotify + ] + }" + ''; + }; + in + [ + wrapped-xmobar + ]; xdg.configFile = { "xmobar" = { diff --git a/nix/configurations/vanadium/kernel-overlay.nix b/nix/configurations/vanadium/kernel-overlay.nix index 4243b3f6..d2ceda7b 100644 --- a/nix/configurations/vanadium/kernel-overlay.nix +++ b/nix/configurations/vanadium/kernel-overlay.nix @@ -1,6 +1,8 @@ -final: prev: let +final: prev: +let inherit (final) lib; -in { +in +{ linuxPackages = final.linuxPackagesFor ( prev.linuxPackages.kernel.override { # TODO: The error message is quite unintuitive, maybe improve it? diff --git a/nix/configurations/vanadium/nixos/audio.nix b/nix/configurations/vanadium/nixos/audio.nix index f5ef99f5..f4c036de 100644 --- a/nix/configurations/vanadium/nixos/audio.nix +++ b/nix/configurations/vanadium/nixos/audio.nix @@ -5,5 +5,5 @@ jack.enable = true; }; - me.extraGroups = ["audio"]; + me.extraGroups = [ "audio" ]; } diff --git a/nix/configurations/vanadium/nixos/connectivity.nix b/nix/configurations/vanadium/nixos/connectivity.nix index 29927865..e2bf050a 100644 --- a/nix/configurations/vanadium/nixos/connectivity.nix +++ b/nix/configurations/vanadium/nixos/connectivity.nix @@ -3,12 +3,16 @@ pkgs, lib, ... -}: { +}: +{ # For nautilius and iOS services.gvfs.enable = true; # iOS 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 services.udev.extraRules = '' @@ -34,10 +38,11 @@ userControlled.enable = true; secretsFile = config.age.secrets.wpa_password.path; scanOnLowSignal = false; - networks = let - fromList = import ../../../networks/wpa_supplicant-compat.nix; - networks = import ../../../networks/list.nix; - in + networks = + let + fromList = import ../../../networks/wpa_supplicant-compat.nix; + networks = import ../../../networks/list.nix; + in fromList networks; }; }; diff --git a/nix/configurations/vanadium/nixos/display.nix b/nix/configurations/vanadium/nixos/display.nix index a9b2267b..cccc8ef2 100644 --- a/nix/configurations/vanadium/nixos/display.nix +++ b/nix/configurations/vanadium/nixos/display.nix @@ -2,13 +2,14 @@ pkgs, lib, ... -}: { +}: +{ imports = [ # # builtin screen # { - me.extraGroups = ["video"]; + me.extraGroups = [ "video" ]; programs.light.enable = true; } @@ -16,10 +17,10 @@ # external screen # { - me.extraGroups = ["i2c"]; + me.extraGroups = [ "i2c" ]; hardware.i2c.enable = true; - environment.systemPackages = [pkgs.ddcutil]; - boot.kernelModules = ["i2c-dev"]; + environment.systemPackages = [ pkgs.ddcutil ]; + boot.kernelModules = [ "i2c-dev" ]; } ]; @@ -33,145 +34,160 @@ "20_xmonad" = "${lib.getExe pkgs.haskellPackages.xmonad} --restart"; # make sure feh keeps up }; - profiles = let - singleton = k: v: {${k} = v;}; + profiles = + let + singleton = k: v: { ${k} = v; }; - fingerprints = { - built-in = singleton "eDP-1" "00ffffffffffff0009e5ca0b000000002f200104a51c137803de50a3544c99260f505400000001010101010101010101010101010101115cd01881e02d50302036001dbe1000001aa749d01881e02d50302036001dbe1000001a000000fe00424f452043510a202020202020000000fe004e4531333546424d2d4e34310a0073"; - amethyst = device: singleton device "00ffffffffffff0006b35b27010101012c210103803c22782a29d5ad4f44a7240f5054bfef00714f81809500d1c0d1e8d1fc01010101565e00a0a0a029503020350055502100001a000000fd0030901edf3c000a202020202020000000fc005647323741514c33410a202020000000ff0052414c4d51533139373533370a0111020347f14a90030204014061603f1f230907078301000067030c002000384468d85dc401788003026d1a000002013090f00069096909e305ff01e6060701696900e2006ae20fc0eae70070a0a067500820980455502100001a6fc200a0a0a055503020350055502100001a5aa000a0a0a046503020350055502100001a0000bc"; - orchid = device: singleton device "00ffffffffffff0004699a24642900002416010380341d782a2ac5a4564f9e280f5054b7ef00714f814081809500b300d1c081c08100023a801871382d40582c450009252100001e000000ff0043394c4d54463031303539360a000000fd00324b185311000a202020202020000000fc00415355532056533234370a20200173020322714f0102031112130414050e0f1d1e1f10230917078301000065030c0010008c0ad08a20e02d10103e9600092521000018011d007251d01e206e28550009252100001e011d00bc52d01e20b828554009252100001e8c0ad090204031200c4055000925210000180000000000000000000000000000000000000000005d"; - }; + fingerprints = { + built-in = singleton "eDP-1" "00ffffffffffff0009e5ca0b000000002f200104a51c137803de50a3544c99260f505400000001010101010101010101010101010101115cd01881e02d50302036001dbe1000001aa749d01881e02d50302036001dbe1000001a000000fe00424f452043510a202020202020000000fe004e4531333546424d2d4e34310a0073"; + amethyst = + device: + singleton device "00ffffffffffff0006b35b27010101012c210103803c22782a29d5ad4f44a7240f5054bfef00714f81809500d1c0d1e8d1fc01010101565e00a0a0a029503020350055502100001a000000fd0030901edf3c000a202020202020000000fc005647323741514c33410a202020000000ff0052414c4d51533139373533370a0111020347f14a90030204014061603f1f230907078301000067030c002000384468d85dc401788003026d1a000002013090f00069096909e305ff01e6060701696900e2006ae20fc0eae70070a0a067500820980455502100001a6fc200a0a0a055503020350055502100001a5aa000a0a0a046503020350055502100001a0000bc"; + orchid = + device: + singleton device "00ffffffffffff0004699a24642900002416010380341d782a2ac5a4564f9e280f5054b7ef00714f814081809500b300d1c081c08100023a801871382d40582c450009252100001e000000ff0043394c4d54463031303539360a000000fd00324b185311000a202020202020000000fc00415355532056533234370a20200173020322714f0102031112130414050e0f1d1e1f10230917078301000065030c0010008c0ad08a20e02d10103e9600092521000018011d007251d01e206e28550009252100001e011d00bc52d01e20b828554009252100001e8c0ad090204031200c4055000925210000180000000000000000000000000000000000000000005d"; + }; - devices = rec { - built-in = "eDP-1"; - # Run `xrandr` to see the max number - extern = map (portNumber: "DP-${toString portNumber}") (lib.range 1 8); - all = [built-in] ++ extern; - }; + devices = rec { + built-in = "eDP-1"; + # Run `xrandr` to see the max number + extern = map (portNumber: "DP-${toString portNumber}") (lib.range 1 8); + all = [ built-in ] ++ extern; + }; - switches = { - setDPI = {dpi}: - singleton "10_xrdb-dpi" "${lib.getExe pkgs.xorg.xrdb} -merge ${pkgs.writeText "xrdb-dpi-config" '' - Xcursor.size: 64 - Xft.dpi: ${toString dpi} - ''}"; + switches = { + setDPI = + { dpi }: + singleton "10_xrdb-dpi" "${lib.getExe pkgs.xorg.xrdb} -merge ${pkgs.writeText "xrdb-dpi-config" '' + Xcursor.size: 64 + Xft.dpi: ${toString dpi} + ''}"; - # Is scoped to an output device, no need to be called on built-in display - setSoftwareBrightness = { - device, # obtain with `xrandr` - brightness, # [0..1] - }: - 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 + setSoftwareBrightness = + { + device, # obtain with `xrandr` + brightness, # [0..1] + }: + 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 - setDDCBrightness = { - 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))} - ''; + # Is scoped to an output device, no need to be called on built-in display + setDDCBrightness = + { + 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)) + } + ''; - setDDCContrast = { - 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))} - ''; - }; + setDDCContrast = + { + 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)) + } + ''; + }; - # Note: the "position" field corresponds to the "pos" field outputted by autorandr - # To get the current config, run `xrandr --auto` and then `autorandr --config` - configs = { - allOff = lib.genAttrs devices.all (_: {enable = lib.mkDefault false;}); - enableBuiltin = { - eDP-1 = { - enable = true; - crtc = 0; - mode = "2256x1504"; - rate = "60.00"; - primary = true; + # Note: the "position" field corresponds to the "pos" field outputted by autorandr + # To get the current config, run `xrandr --auto` and then `autorandr --config` + configs = { + allOff = lib.genAttrs devices.all (_: { + enable = lib.mkDefault false; + }); + enableBuiltin = { + eDP-1 = { + enable = true; + crtc = 0; + 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} = { - enable = true; - primary = true; - crtc = 1; - mode = "2560x1440"; - rate = "59.95"; - }; + + frameworkBuiltin = { + fingerprint = fingerprints.built-in; + config = lib.mkMerge [ + configs.allOff + configs.enableBuiltin + ]; + hooks.postswitch = switches.setDPI { dpi = 150; }; }; - enableOrchid = name: { - ${name} = { - enable = true; - primary = true; - crtc = 1; - mode = "1920x1080"; - rate = "60.00"; - }; + + mkAmethyst = name: { + fingerprint = lib.mkMerge [ + fingerprints.built-in + (fingerprints.amethyst name) + ]; + 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 = { - fingerprint = fingerprints.built-in; - config = lib.mkMerge [ - configs.allOff - configs.enableBuiltin - ]; - hooks.postswitch = switches.setDPI {dpi = 150;}; - }; - - mkAmethyst = name: { - fingerprint = lib.mkMerge [ - fingerprints.built-in - (fingerprints.amethyst name) - ]; - 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; - }) - ]; - }; - - 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 + 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 [ - {default = frameworkBuiltin;} + { default = frameworkBuiltin; } (lib.genAttrs' devices.extern (name: lib.nameValuePair "amethyst-${name}" (mkAmethyst name))) (lib.genAttrs' devices.extern (name: lib.nameValuePair "orchid-${name}" (mkOrchid name))) ]; diff --git a/nix/configurations/vanadium/nixos/fs.nix b/nix/configurations/vanadium/nixos/fs.nix index 93c4d2c4..bfe64d4a 100644 --- a/nix/configurations/vanadium/nixos/fs.nix +++ b/nix/configurations/vanadium/nixos/fs.nix @@ -2,7 +2,8 @@ config, pkgs, ... -}: { +}: +{ services.btrfs.autoScrub = { enable = true; fileSystems = [ @@ -21,9 +22,9 @@ fileSystems = { /* - WARNING: - 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 + WARNING: + 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 */ "/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 ''; - systemd.mounts = let - bindToCryptDev = dev: { - what = "/dev/mapper/${dev}"; - where = "/mnt/${dev}"; - unitConfig = { - Requires = ["systemd-cryptsetup@${dev}.service"]; - After = ["systemd-cryptsetup@${dev}.service"]; - PropagatesStopTo = ["systemd-cryptsetup@${dev}.service"]; + systemd.mounts = + let + bindToCryptDev = dev: { + what = "/dev/mapper/${dev}"; + where = "/mnt/${dev}"; + unitConfig = { + Requires = [ "systemd-cryptsetup@${dev}.service" ]; + After = [ "systemd-cryptsetup@${dev}.service" ]; + PropagatesStopTo = [ "systemd-cryptsetup@${dev}.service" ]; + }; }; - }; - in [ - (bindToCryptDev "four") - (bindToCryptDev "two") - (bindToCryptDev "sgbk") - ]; + in + [ + (bindToCryptDev "four") + (bindToCryptDev "two") + (bindToCryptDev "sgbk") + ]; environment.systemPackages = [ pkgs.lsof diff --git a/nix/configurations/vanadium/nixos/gui.nix b/nix/configurations/vanadium/nixos/gui.nix index 57153696..836883ad 100644 --- a/nix/configurations/vanadium/nixos/gui.nix +++ b/nix/configurations/vanadium/nixos/gui.nix @@ -2,7 +2,8 @@ pkgs, lib, ... -}: { +}: +{ services.xserver.windowManager.xmonad = { enable = true; enableContribAndExtras = true; diff --git a/nix/configurations/vanadium/nixos/hardware-configuration.nix b/nix/configurations/vanadium/nixos/hardware-configuration.nix index 32be11fa..9b75a244 100644 --- a/nix/configurations/vanadium/nixos/hardware-configuration.nix +++ b/nix/configurations/vanadium/nixos/hardware-configuration.nix @@ -7,15 +7,20 @@ pkgs, modulesPath, ... -}: { +}: +{ imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt"]; - boot.initrd.kernelModules = ["dm-snapshot"]; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "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 # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/nix/configurations/vanadium/nixos/input.nix b/nix/configurations/vanadium/nixos/input.nix index 246d07f6..452c5678 100644 --- a/nix/configurations/vanadium/nixos/input.nix +++ b/nix/configurations/vanadium/nixos/input.nix @@ -13,7 +13,7 @@ }; }; - me.extraGroups = ["scanner"]; + me.extraGroups = [ "scanner" ]; hardware.sane = { enable = true; brscan5.enable = true; diff --git a/nix/configurations/vanadium/nixos/locale.nix b/nix/configurations/vanadium/nixos/locale.nix index de1bd43f..666053d8 100644 --- a/nix/configurations/vanadium/nixos/locale.nix +++ b/nix/configurations/vanadium/nixos/locale.nix @@ -1,4 +1,5 @@ -{lib, ...}: { +{ lib, ... }: +{ # https://en.wikipedia.org/wiki/List_of_tz_database_time_zones # `timedatectl list-timezones` time.timeZone = "Asia/Taipei"; @@ -28,16 +29,16 @@ let genLocale = locale: lib.flip lib.genAttrs (_: locale); in - # - xscreensaver freaks out on the time display - # - evolution add event becomes hard to use - # https://gitlab.gnome.org/GNOME/evolution/-/issues/3120 - genLocale "fr_FR.UTF-8" [ - "LC_TIME" - ] - // genLocale "zh_TW.UTF-8" [ - "LC_MONETARY" - "LC_ADDRESS" - ]; + # - xscreensaver freaks out on the time display + # - evolution add event becomes hard to use + # https://gitlab.gnome.org/GNOME/evolution/-/issues/3120 + genLocale "fr_FR.UTF-8" [ + "LC_TIME" + ] + // genLocale "zh_TW.UTF-8" [ + "LC_MONETARY" + "LC_ADDRESS" + ]; }; # Wireless Regulatory Domain, uses ISO / IEC 3166 country code diff --git a/nix/configurations/vanadium/nixos/misc.nix b/nix/configurations/vanadium/nixos/misc.nix index 91579fc2..4d512a82 100644 --- a/nix/configurations/vanadium/nixos/misc.nix +++ b/nix/configurations/vanadium/nixos/misc.nix @@ -1,4 +1,5 @@ -{config, ...}: { +{ config, ... }: +{ system.stateVersion = "24.11"; boot.loader = { @@ -16,6 +17,6 @@ # 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 - boot.binfmt.emulatedSystems = ["aarch64-linux"]; + boot.binfmt.emulatedSystems = [ "aarch64-linux" ]; nix.settings.extra-platforms = config.boot.binfmt.emulatedSystems; } diff --git a/nix/configurations/vanadium/nixos/programs.nix b/nix/configurations/vanadium/nixos/programs.nix index 2f479f34..0fbaf33c 100644 --- a/nix/configurations/vanadium/nixos/programs.nix +++ b/nix/configurations/vanadium/nixos/programs.nix @@ -2,14 +2,15 @@ lib, pkgs, ... -}: { +}: +{ imports = [ # # Docker # { virtualisation.docker.enable = true; - me.extraGroups = ["docker"]; + me.extraGroups = [ "docker" ]; } # # diff --git a/nix/configurations/vanadium/nixos/restic.nix b/nix/configurations/vanadium/nixos/restic.nix index 7e9eeefd..b90a92bc 100644 --- a/nix/configurations/vanadium/nixos/restic.nix +++ b/nix/configurations/vanadium/nixos/restic.nix @@ -1,91 +1,94 @@ -{config, ...}: { - services.restic.backups = let - pruneOpts = [ - "--keep-daily 7" - "--keep-weekly 4" - "--keep-monthly 12" - "--keep-yearly 10" - ]; - in { - "backblaze" = { - paths = [ - "/home/leana/Documents" - "/home/leana/Calibre" +{ config, ... }: +{ + services.restic.backups = + let + pruneOpts = [ + "--keep-daily 7" + "--keep-weekly 4" + "--keep-monthly 12" + "--keep-yearly 10" ]; + in + { + "backblaze" = { + paths = [ + "/home/leana/Documents" + "/home/leana/Calibre" + ]; - passwordFile = config.age.secrets.restic_backblaze_pwd.path; - repositoryFile = config.age.secrets.restic_backblaze_repo.path; - environmentFile = config.age.secrets.restic_backblaze_env.path; + passwordFile = config.age.secrets.restic_backblaze_pwd.path; + repositoryFile = config.age.secrets.restic_backblaze_repo.path; + environmentFile = config.age.secrets.restic_backblaze_env.path; - timerConfig = { - OnCalendar = "daily"; - Persistent = true; - RandomizedDelaySec = "1h"; + timerConfig = { + OnCalendar = "daily"; + Persistent = true; + 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 = { # TODO: # Wait for upstream to introduce direct access to unitConfig # c.f. https://github.com/NixOS/nixpkgs/pull/368234 "restic-backups-four" = { - requires = ["mnt-four.mount"]; - after = ["mnt-four.mount"]; - unitConfig.PropagatesStopTo = ["mnt-four.mount"]; + requires = [ "mnt-four.mount" ]; + after = [ "mnt-four.mount" ]; + unitConfig.PropagatesStopTo = [ "mnt-four.mount" ]; }; "restic-backups-sgbk" = { - requires = ["mnt-sgbk.mount"]; - after = ["mnt-sgbk.mount"]; - unitConfig.PropagatesStopTo = ["mnt-sgbk.mount"]; + requires = [ "mnt-sgbk.mount" ]; + after = [ "mnt-sgbk.mount" ]; + unitConfig.PropagatesStopTo = [ "mnt-sgbk.mount" ]; }; "restic-backups-two-to-four" = { diff --git a/nix/configurations/vanadium/nixos/unfree-predicate.nix b/nix/configurations/vanadium/nixos/unfree-predicate.nix index 97456b73..d880c61f 100644 --- a/nix/configurations/vanadium/nixos/unfree-predicate.nix +++ b/nix/configurations/vanadium/nixos/unfree-predicate.nix @@ -1,27 +1,29 @@ -{lib, ...}: { +{ lib, ... }: +{ nixpkgs.config.allowUnfreePredicate = lib.mkDefault ( - pkg: let + pkg: + let name = lib.getName pkg; in - builtins.elem name [ - "languagetool" + builtins.elem name [ + "languagetool" - "vscode" - "code" + "vscode" + "code" - "tampermonkey" + "tampermonkey" - "aseprite" + "aseprite" - "posy-cursors" + "posy-cursors" - "discord" - ] - || builtins.any (lib.flip lib.hasInfix name) [ - # Scanner - "brscan5" + "discord" + ] + || builtins.any (lib.flip lib.hasInfix name) [ + # Scanner + "brscan5" - "steam" - ] + "steam" + ] ); } diff --git a/nix/configurations/vanadium/overlay.nix b/nix/configurations/vanadium/overlay.nix index 5e5c3279..f7ee7a78 100644 --- a/nix/configurations/vanadium/overlay.nix +++ b/nix/configurations/vanadium/overlay.nix @@ -9,73 +9,75 @@ let infuse = lib.flip infuse-lib.v1.infuse; in - # Why shouldn't I go crazy with overlays? - final: - infuse { - cmus.__input.alsaSupport = _: false; +# Why shouldn't I go crazy with overlays? +final: +infuse { + 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.waylandSupport = _: false; + vlc.__input.chromecastSupport = _: false; + vlc.__input.waylandSupport = _: false; - # I don't really use helix, but it's nice to have the W alias just in case - helix.__output.patches.__append = [ - ./patches/helix/W-as-write.patch - ]; + # I don't really use helix, but it's nice to have the W alias just in case + helix.__output.patches.__append = [ + ./patches/helix/W-as-write.patch + ]; - # Too loud - alejandra.__output.patches.__append = [ - ./patches/alejandra/no-ads.patch - ]; - alejandra.__output.doCheck = _: false; + # Too loud + alejandra.__output.patches.__append = [ + ./patches/alejandra/no-ads.patch + ]; + alejandra.__output.doCheck = _: false; - # TODO: - # pinned branch of https://github.com/astrand/xclip/tree/xerror - # use this until #43 gets resolved properly - xclip.__output.src = _: - final.fetchFromGitHub { - owner = "astrand"; - repo = "xclip"; - rev = "2c3b811002b35d3be7f39cc1145dd06bdb32e31c"; - hash = "sha256-hHbq97GTKiRw8LZa/LY4LUOFOd/5H4+S+NR0BJfcu6M="; - }; + # TODO: + # pinned branch of https://github.com/astrand/xclip/tree/xerror + # use this until #43 gets resolved properly + xclip.__output.src = + _: + final.fetchFromGitHub { + owner = "astrand"; + repo = "xclip"; + rev = "2c3b811002b35d3be7f39cc1145dd06bdb32e31c"; + hash = "sha256-hHbq97GTKiRw8LZa/LY4LUOFOd/5H4+S+NR0BJfcu6M="; + }; - fcitx5.__output.cmakeFlags.__append = [ - (lib.cmakeFeature "ENABLE_EMOJI" "Off") - (lib.cmakeFeature "ENABLE_WAYLAND" "Off") - ]; - fcitx5.__output.patches.__append = [ - ./patches/fcitx5/disable-clipboard.patch - ./patches/fcitx5/disable-quickphrase.patch - ./patches/fcitx5/disable-unicode.patch - ]; - fcitx5-chinese-addons.__output.cmakeFlags.__append = [ - (lib.cmakeFeature "ENABLE_BROWSER" "Off") - (lib.cmakeFeature "ENABLE_CLOUDPINYIN" "Off") - (lib.cmakeFeature "ENABLE_DATA" "Off") - ]; - fcitx5-chinese-addons.__output.patches.__append = [ - ./patches/fcitx5-chinese-addons/disable-chttrans.patch - ./patches/fcitx5-chinese-addons/disable-fullwidth.patch - # Note: disabling pinyin helper breaks canjie - ]; + fcitx5.__output.cmakeFlags.__append = [ + (lib.cmakeFeature "ENABLE_EMOJI" "Off") + (lib.cmakeFeature "ENABLE_WAYLAND" "Off") + ]; + fcitx5.__output.patches.__append = [ + ./patches/fcitx5/disable-clipboard.patch + ./patches/fcitx5/disable-quickphrase.patch + ./patches/fcitx5/disable-unicode.patch + ]; + fcitx5-chinese-addons.__output.cmakeFlags.__append = [ + (lib.cmakeFeature "ENABLE_BROWSER" "Off") + (lib.cmakeFeature "ENABLE_CLOUDPINYIN" "Off") + (lib.cmakeFeature "ENABLE_DATA" "Off") + ]; + fcitx5-chinese-addons.__output.patches.__append = [ + ./patches/fcitx5-chinese-addons/disable-chttrans.patch + ./patches/fcitx5-chinese-addons/disable-fullwidth.patch + # Note: disabling pinyin helper breaks canjie + ]; - # Security, Xorg vuln - # Backport has failed in upstream currently , - # might as well patch it while people are blogging about it - # Upstream talks about it here https://lists.x.org/archives/xorg-announce/2025-October/003635.html - xorg.xorgserver.__output.version = oldVersion: let - version = "21.1.20"; - in - if oldVersion == version - then throw "This patch has been merged upstream" - else version; - xorg.xorgserver.__output.src = _: - final.fetchurl { - url = "mirror://xorg/individual/xserver/xorg-server-21.1.20.tar.xz"; - sha256 = "sha256-dpW8YYJLOoG2utL3iwVADKAVAD3kAtGzIhFxBbcC6Tc="; - }; - } + # Security, Xorg vuln + # Backport has failed in upstream currently , + # might as well patch it while people are blogging about it + # Upstream talks about it here https://lists.x.org/archives/xorg-announce/2025-October/003635.html + xorg.xorgserver.__output.version = + oldVersion: + let + version = "21.1.20"; + in + if oldVersion == version then throw "This patch has been merged upstream" else version; + xorg.xorgserver.__output.src = + _: + final.fetchurl { + url = "mirror://xorg/individual/xserver/xorg-server-21.1.20.tar.xz"; + sha256 = "sha256-dpW8YYJLOoG2utL3iwVADKAVAD3kAtGzIhFxBbcC6Tc="; + }; +} diff --git a/nix/devShells/flora.nix b/nix/devShells/flora.nix index 21c35fb8..1b94c3ee 100644 --- a/nix/devShells/flora.nix +++ b/nix/devShells/flora.nix @@ -4,56 +4,65 @@ let sources = import ../../npins; in - {pkgs ? import sources.pin-florashell {}}: - pkgs.mkShell (let - libs = with pkgs; [ - zlib - libpq - libsodium - ]; +{ + pkgs ? import sources.pin-florashell { }, +}: +pkgs.mkShell ( + let + libs = with pkgs; [ + zlib + libpq + libsodium + ]; - hlib = pkgs.haskell.lib; + hlib = pkgs.haskell.lib; - callHackage = { + callHackage = + { name, version, - }: let - pkg = pkgs.haskell.packages.ghc910.callHackage name version {}; + }: + let + pkg = pkgs.haskell.packages.ghc910.callHackage name version { }; in - hlib.dontCheck (hlib.doJailbreak pkg); - in { - name = "flora"; - packages = with pkgs; let + hlib.dontCheck (hlib.doJailbreak pkg); + in + { + name = "flora"; + packages = + with pkgs; + let haskellPackages = haskell.packages.ghc910; in - # These don't build directly and need to be pinned - map callHackage [ - { - name = "fourmolu"; - version = "0.17.0.0"; - } - { - name = "postgresql-migration"; - version = "0.2.1.8"; - } - ] - ++ [ - haskellPackages.ghcid - haskellPackages.cabal-fmt - haskellPackages.cabal-install - haskellPackages.ghc - haskellPackages.haskell-language-server + # These don't build directly and need to be pinned + map callHackage [ + { + name = "fourmolu"; + version = "0.17.0.0"; + } + { + name = "postgresql-migration"; + version = "0.2.1.8"; + } + ] + ++ [ + haskellPackages.ghcid + haskellPackages.cabal-fmt + haskellPackages.cabal-install + haskellPackages.ghc + haskellPackages.haskell-language-server - postgresql_14 - postgresqlTestHook + postgresql_14 + postgresqlTestHook - yarn + yarn - pkg-config - esbuild - changelog-d - ] - ++ libs; + pkg-config + esbuild + changelog-d + ] + ++ libs; - LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs; - }) + LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs; + } +) diff --git a/nix/devShells/forgejo.nix b/nix/devShells/forgejo.nix index 103ae074..ed8eba15 100644 --- a/nix/devShells/forgejo.nix +++ b/nix/devShells/forgejo.nix @@ -1,20 +1,26 @@ -{pkgs ? import {}}: let +{ + pkgs ? import { }, +}: +let inherit (pkgs) lib; in - pkgs.mkShell { - name = "forgejo"; - packages = with pkgs; [ - gnumake +pkgs.mkShell { + name = "forgejo"; + packages = with pkgs; [ + gnumake - go - golangci-lint - gofumpt + go + golangci-lint + gofumpt - nodejs - nodePackages.npm - ]; + nodejs + nodePackages.npm + ]; - LD_LIBRARY_PATH = lib.makeLibraryPath (with pkgs; [ + LD_LIBRARY_PATH = lib.makeLibraryPath ( + with pkgs; + [ libuuid - ]); - } + ] + ); +} diff --git a/nix/devShells/haddock2.nix b/nix/devShells/haddock2.nix index 47c4d064..447cc726 100644 --- a/nix/devShells/haddock2.nix +++ b/nix/devShells/haddock2.nix @@ -1,4 +1,6 @@ -{pkgs ? import {}}: +{ + pkgs ? import { }, +}: pkgs.mkShell rec { name = "haddock2"; diff --git a/nix/devShells/masna3.nix b/nix/devShells/masna3.nix index 89da2ccb..60c9a391 100644 --- a/nix/devShells/masna3.nix +++ b/nix/devShells/masna3.nix @@ -1,53 +1,59 @@ let sources = import ../../npins; in - {pkgs ? import sources.pin-masna3shell {}}: - pkgs.mkShell (let - libs = with pkgs; [ - zlib - libpq - libsodium - ]; +{ + pkgs ? import sources.pin-masna3shell { }, +}: +pkgs.mkShell ( + let + libs = with pkgs; [ + zlib + libpq + libsodium + ]; - hlib = pkgs.haskell.lib; + hlib = pkgs.haskell.lib; - callHackage = { + callHackage = + { name, version, haskellPackages ? pkgs.haskellPackages, - }: let - pkg = haskellPackages.callHackage name version {}; + }: + let + pkg = haskellPackages.callHackage name version { }; in - hlib.dontCheck (hlib.doJailbreak pkg); + hlib.dontCheck (hlib.doJailbreak pkg); - haskellPackages = pkgs.haskell.packages.ghc910; - in { - name = "masna3"; - packages = - [ - pkgs.haskell.packages.ghc9102.ghc - pkgs.haskell.packages.ghc9102.haskell-language-server + haskellPackages = pkgs.haskell.packages.ghc910; + in + { + name = "masna3"; + packages = [ + pkgs.haskell.packages.ghc9102.ghc + pkgs.haskell.packages.ghc9102.haskell-language-server - haskellPackages.cabal-install - haskellPackages.postgresql-migration - (callHackage { - name = "fourmolu"; - version = "0.18.0.0"; - haskellPackages = pkgs.haskell.packages.ghc912; - }) - (callHackage { - name = "hlint"; - version = "3.10"; - haskellPackages = pkgs.haskell.packages.ghc912; - }) - pkgs.haskell.packages.ghc98.apply-refact - haskellPackages.ghc-tags - haskellPackages.cabal-gild + haskellPackages.cabal-install + haskellPackages.postgresql-migration + (callHackage { + name = "fourmolu"; + version = "0.18.0.0"; + haskellPackages = pkgs.haskell.packages.ghc912; + }) + (callHackage { + name = "hlint"; + version = "3.10"; + haskellPackages = pkgs.haskell.packages.ghc912; + }) + pkgs.haskell.packages.ghc98.apply-refact + haskellPackages.ghc-tags + haskellPackages.cabal-gild - pkgs.gnumake - pkgs.pkg-config - ] - ++ libs; + pkgs.gnumake + pkgs.pkg-config + ] + ++ libs; - LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs; - }) + LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath libs; + } +) diff --git a/nix/devShells/necro-man.nix b/nix/devShells/necro-man.nix index 098e0cdc..6039be67 100644 --- a/nix/devShells/necro-man.nix +++ b/nix/devShells/necro-man.nix @@ -1,37 +1,40 @@ let sources = import ../../npins; in - {pkgs ? import sources.pin-necro-man-nixpkgs {}}: let - shell = { +{ + pkgs ? import sources.pin-necro-man-nixpkgs { }, +}: +let + shell = + { mkShell, # pkgs, python310Packages, texlive, }: - mkShell { - name = "necro-manual"; - packages = [ - pkgs.emacs - python310Packages.pygments + mkShell { + name = "necro-manual"; + packages = [ + pkgs.emacs + python310Packages.pygments - (texlive.combine { - inherit - (texlive) - scheme-medium - # - wrapfig - capt-of - minted - upquote - todonotes - fvextra - catchfile - xstring - framed - ; - }) - ]; - }; - in - pkgs.callPackage shell {} + (texlive.combine { + inherit (texlive) + scheme-medium + # + wrapfig + capt-of + minted + upquote + todonotes + fvextra + catchfile + xstring + framed + ; + }) + ]; + }; +in +pkgs.callPackage shell { } diff --git a/nix/devShells/vim-tw.nix b/nix/devShells/vim-tw.nix index 58c6678c..1e5595b1 100644 --- a/nix/devShells/vim-tw.nix +++ b/nix/devShells/vim-tw.nix @@ -1,14 +1,16 @@ let sources = import ../../npins; in - {pkgs ? import sources.pin-vim-tw {}}: - pkgs.mkShell { - name = "vim-tw"; - packages = with pkgs; [ - haskellPackages.cabal-fmt - haskellPackages.cabal-install - haskellPackages.ghc - haskellPackages.haskell-language-server - haskellPackages.retrie - ]; - } +{ + pkgs ? import sources.pin-vim-tw { }, +}: +pkgs.mkShell { + name = "vim-tw"; + packages = with pkgs; [ + haskellPackages.cabal-fmt + haskellPackages.cabal-install + haskellPackages.ghc + haskellPackages.haskell-language-server + haskellPackages.retrie + ]; +} diff --git a/nix/disko/tungsten/btrfs.nix b/nix/disko/tungsten/btrfs.nix index 88f5a492..66201153 100644 --- a/nix/disko/tungsten/btrfs.nix +++ b/nix/disko/tungsten/btrfs.nix @@ -14,7 +14,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = ["umask=0077"]; + mountOptions = [ "umask=0077" ]; }; }; @@ -24,7 +24,7 @@ content = { type = "luks"; name = "crypted"; - extraOpenArgs = []; + extraOpenArgs = [ ]; settings.allowDiscards = true; content = { type = "lvm_pv"; @@ -74,12 +74,15 @@ }; "/home" = { - mountOptions = ["compress=zstd"]; + mountOptions = [ "compress=zstd" ]; mountpoint = "/home"; }; "/nix" = { - mountOptions = ["compress=zstd" "noatime"]; + mountOptions = [ + "compress=zstd" + "noatime" + ]; mountpoint = "/nix"; }; }; diff --git a/nix/disko/tungsten/default.nix b/nix/disko/tungsten/default.nix index 172e29f5..0df2006c 100644 --- a/nix/disko/tungsten/default.nix +++ b/nix/disko/tungsten/default.nix @@ -18,7 +18,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = ["umask=0077"]; + mountOptions = [ "umask=0077" ]; }; }; luks = { @@ -26,7 +26,7 @@ content = { type = "luks"; name = "crypted"; - extraOpenArgs = []; + extraOpenArgs = [ ]; settings = { allowDiscards = true; }; @@ -50,7 +50,7 @@ type = "filesystem"; format = "ext4"; mountpoint = "/"; - mountOptions = ["defaults"]; + mountOptions = [ "defaults" ]; }; }; nix = { @@ -59,7 +59,7 @@ type = "filesystem"; format = "ext4"; mountpoint = "/nix"; - mountOptions = ["noatime"]; + mountOptions = [ "noatime" ]; }; }; swap = { diff --git a/nix/disko/vanadium/btrfs.nix b/nix/disko/vanadium/btrfs.nix index 7ee68251..84b9efb0 100644 --- a/nix/disko/vanadium/btrfs.nix +++ b/nix/disko/vanadium/btrfs.nix @@ -14,7 +14,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = ["umask=0077"]; + mountOptions = [ "umask=0077" ]; }; }; @@ -24,7 +24,7 @@ content = { type = "luks"; name = "crypted"; - extraOpenArgs = []; + extraOpenArgs = [ ]; settings.allowDiscards = true; content = { type = "lvm_pv"; @@ -70,17 +70,20 @@ subvolumes = { "/root" = { - mountOptions = ["noatime"]; + mountOptions = [ "noatime" ]; mountpoint = "/"; }; "/home" = { - mountOptions = ["noatime"]; + mountOptions = [ "noatime" ]; mountpoint = "/home"; }; "/nix" = { - mountOptions = ["compress=zstd" "noatime"]; + mountOptions = [ + "compress=zstd" + "noatime" + ]; mountpoint = "/nix"; }; }; diff --git a/nix/disko/vanadium/default.nix b/nix/disko/vanadium/default.nix index 2590fceb..22941fd0 100644 --- a/nix/disko/vanadium/default.nix +++ b/nix/disko/vanadium/default.nix @@ -15,7 +15,7 @@ type = "filesystem"; format = "vfat"; mountpoint = "/boot"; - mountOptions = ["umask=0077"]; + mountOptions = [ "umask=0077" ]; }; }; luks = { @@ -23,7 +23,7 @@ content = { type = "luks"; name = "crypted"; - extraOpenArgs = []; + extraOpenArgs = [ ]; settings = { allowDiscards = true; }; @@ -47,7 +47,7 @@ type = "filesystem"; format = "ext4"; mountpoint = "/"; - mountOptions = ["defaults"]; + mountOptions = [ "defaults" ]; }; }; nix = { @@ -56,7 +56,7 @@ type = "filesystem"; format = "ext4"; mountpoint = "/nix"; - mountOptions = ["noatime"]; + mountOptions = [ "noatime" ]; }; }; swap = { diff --git a/nix/git-identities/git-compat.nix b/nix/git-identities/git-compat.nix index 28bc74a6..d9806d98 100644 --- a/nix/git-identities/git-compat.nix +++ b/nix/git-identities/git-compat.nix @@ -1,14 +1,20 @@ let - hasconfigRemoteCondition = { - # Custom arguments - url, - path ? "*/**", - ... - } @ cfg: let - cfg' = builtins.removeAttrs cfg ["url" "path"]; - in [ - (cfg' // {condition = "hasconfig:remote.*.url:git@${url}:${path}";}) - (cfg' // {condition = "hasconfig:remote.*.url:https://${url}/${path}";}) - ]; + hasconfigRemoteCondition = + { + # Custom arguments + url, + path ? "*/**", + ... + }@cfg: + let + cfg' = builtins.removeAttrs cfg [ + "url" + "path" + ]; + in + [ + (cfg' // { condition = "hasconfig:remote.*.url:git@${url}:${path}"; }) + (cfg' // { condition = "hasconfig:remote.*.url:https://${url}/${path}"; }) + ]; in - builtins.concatMap hasconfigRemoteCondition +builtins.concatMap hasconfigRemoteCondition diff --git a/nix/git-identities/list.nix b/nix/git-identities/list.nix index 9568c0c1..7df85864 100644 --- a/nix/git-identities/list.nix +++ b/nix/git-identities/list.nix @@ -16,7 +16,8 @@ let blameIgnore = { blame.ignoreRevsFile = ".git-blame-ignore-revs"; }; -in [ +in +[ # Univ stuff { url = "gitlab.istic.univ-rennes1.fr"; diff --git a/nix/homeModules/common/atuin.nix b/nix/homeModules/common/atuin.nix index 940d0e02..86c5b17a 100644 --- a/nix/homeModules/common/atuin.nix +++ b/nix/homeModules/common/atuin.nix @@ -1,6 +1,6 @@ { programs.atuin = { - flags = ["--disable-up-arrow"]; + flags = [ "--disable-up-arrow" ]; settings = { history_filter = [ # privacy diff --git a/nix/homeModules/common/btop/default.nix b/nix/homeModules/common/btop/default.nix index b5344c6c..3a3c2389 100644 --- a/nix/homeModules/common/btop/default.nix +++ b/nix/homeModules/common/btop/default.nix @@ -1,4 +1,5 @@ -{config, ...}: { +{ config, ... }: +{ programs.btop = { settings.color_theme = "${config.programs.btop.package}/share/btop/themes/onedark.theme"; extraConfig = builtins.readFile ./btop.conf; diff --git a/nix/homeModules/common/cmus/default.nix b/nix/homeModules/common/cmus/default.nix index 07c185db..7ebf12b9 100644 --- a/nix/homeModules/common/cmus/default.nix +++ b/nix/homeModules/common/cmus/default.nix @@ -2,49 +2,51 @@ pkgs, lib, ... -}: { - programs.cmus.extraConfig = let - # dispatch to multiple callbacks - callback-script = pkgs.writeShellApplication { - name = "cmus-callback-script"; - runtimeInputs = [ - pkgs.cmusfm - pkgs.libnotify - ]; - text = '' - # All keys contain only chars a-z. Values are UTF-8 strings. - # - # Keys: status file url artist album discnumber tracknumber title date - # - 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 +}: +{ + programs.cmus.extraConfig = + let + # dispatch to multiple callbacks + callback-script = pkgs.writeShellApplication { + name = "cmus-callback-script"; + runtimeInputs = [ + pkgs.cmusfm + pkgs.libnotify + ]; + text = '' + # All keys contain only chars a-z. Values are UTF-8 strings. + # + # Keys: status file url artist album discnumber tracknumber title date + # - 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 - argv=("$@") - declare -A map - while [ $# -gt 0 ]; do - map["$1"]="$2" - shift - shift - done + # Use a map so that we can redirect all the args to cmusfm + argv=("$@") + declare -A map + while [ $# -gt 0 ]; do + map["$1"]="$2" + shift + shift + done - # Setup pretty symbols - case ''${map[status]} in - paused) - SYMB="⏸" - ;; - playing) - SYMB="⏵" - ;; - esac + # Setup pretty symbols + case ''${map[status]} in + paused) + SYMB="⏸" + ;; + playing) + SYMB="⏵" + ;; + esac - notify-send \ - "$SYMB ''${map[title]}" \ - "''${map[artist]} / ''${map[album]}" - cmusfm "''${argv[@]}" - ''; - }; - in + notify-send \ + "$SYMB ''${map[title]}" \ + "''${map[artist]} / ''${map[album]}" + cmusfm "''${argv[@]}" + ''; + }; + in builtins.readFile ./rc + lib.optionalString pkgs.stdenv.isLinux '' set status_display_program=${lib.getExe callback-script} diff --git a/nix/homeModules/common/direnv.nix b/nix/homeModules/common/direnv.nix index aa4f2673..6ea2fc3d 100644 --- a/nix/homeModules/common/direnv.nix +++ b/nix/homeModules/common/direnv.nix @@ -1,4 +1,5 @@ -{config, ...}: { +{ config, ... }: +{ programs.direnv = { nix-direnv.enable = true; config = { diff --git a/nix/homeModules/common/fcitx5/default.nix b/nix/homeModules/common/fcitx5/default.nix index d0e86339..4e1cc178 100644 --- a/nix/homeModules/common/fcitx5/default.nix +++ b/nix/homeModules/common/fcitx5/default.nix @@ -3,9 +3,11 @@ config, lib, ... -}: let +}: +let cfg = config.i18n.inputMethod; -in { +in +{ i18n.inputMethod = { fcitx5.addons = [ pkgs.fcitx5-chinese-addons diff --git a/nix/homeModules/common/firefox.nix b/nix/homeModules/common/firefox.nix index 2f349d00..9831eb4f 100644 --- a/nix/homeModules/common/firefox.nix +++ b/nix/homeModules/common/firefox.nix @@ -3,11 +3,13 @@ config, lib, ... -}: let +}: +let inherit (pkgs) nur; cfg = config.programs.firefox; -in { +in +{ programs.firefox = { # https://mozilla.github.io/policy-templates # The following have more complex logic, keep them as policies and not profiles @@ -19,7 +21,14 @@ in { ]; SearchEngines = { - Remove = ["Google" "Bing" "DuckDuckGo" "Qwant" "eBay" "Perplexity"]; + Remove = [ + "Google" + "Bing" + "DuckDuckGo" + "Qwant" + "eBay" + "Perplexity" + ]; Default = "leta"; Add = [ { @@ -102,23 +111,25 @@ in { "media.peerconnection.enabled" = false; }; - extensions.packages = let - addons = nur.repos.rycee.firefox-addons; - in [ - addons.ublock-origin - addons.privacy-badger - addons.user-agent-string-switcher + extensions.packages = + let + addons = nur.repos.rycee.firefox-addons; + in + [ + 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: - 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. + /* + 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. + DO NOT REMOVE IT. I repeat, DO NOT REMOVE IT. - If you think it's annoying, go do some jump rope, sing, live. - */ - addons.news-feed-eradicator # did you read the comment above? - addons.multi-account-containers - ]; + If you think it's annoying, go do some jump rope, sing, live. + */ + addons.news-feed-eradicator # did you read the comment above? + addons.multi-account-containers + ]; }; }; diff --git a/nix/homeModules/common/fish/aliasesAbbrs.nix b/nix/homeModules/common/fish/aliasesAbbrs.nix index 253dae7f..330a0159 100644 --- a/nix/homeModules/common/fish/aliasesAbbrs.nix +++ b/nix/homeModules/common/fish/aliasesAbbrs.nix @@ -2,7 +2,8 @@ pkgs, lib, ... -}: { +}: +{ programs.fish = { shellAbbrs = lib.mkMerge [ (lib.mkIf pkgs.stdenv.isLinux { diff --git a/nix/homeModules/common/fish/default.nix b/nix/homeModules/common/fish/default.nix index 240a6c29..6a866084 100644 --- a/nix/homeModules/common/fish/default.nix +++ b/nix/homeModules/common/fish/default.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ imports = [ ./aliasesAbbrs.nix ]; @@ -10,7 +11,7 @@ # # Script dependencies # - home.packages = [pkgs.vivid]; + home.packages = [ pkgs.vivid ]; programs = { fd.enable = true; fzf.enable = true; @@ -24,11 +25,9 @@ # # Scripts and functions # - xdg.configFile = - lib.mapAttrs' - (path: _: - lib.nameValuePair "fish/functions/${path}" {source = "${./functions}/${path}";}) - (builtins.readDir ./functions); + xdg.configFile = lib.mapAttrs' ( + path: _: lib.nameValuePair "fish/functions/${path}" { source = "${./functions}/${path}"; } + ) (builtins.readDir ./functions); programs.fish = { interactiveShellInit = builtins.readFile ./shellInit.fish; diff --git a/nix/homeModules/common/git.nix b/nix/homeModules/common/git.nix index 68f151c6..c3a19f91 100644 --- a/nix/homeModules/common/git.nix +++ b/nix/homeModules/common/git.nix @@ -3,7 +3,8 @@ config, pkgs, ... -}: { +}: +{ # git plugins programs.git = { lfs.enable = true; @@ -11,18 +12,18 @@ # known to fail on aarch64-linux (lib.mkIf (pkgs.system == "aarch64-linux") ( # TODO: investigate this - lib.warn "patdiff has been forcibly disabled because it has previously failed to build" - lib.mkForce - false + lib.warn "patdiff has been forcibly disabled because it has previously failed to build" lib.mkForce + false )) (lib.mkDefault true) ]; }; # 懶惰鬼賴皮 - programs.lazygit = let - patdiffCfg = config.programs.git.patdiff; - in + programs.lazygit = + let + patdiffCfg = config.programs.git.patdiff; + in lib.mkIf patdiffCfg.enable { settings = { git.paging.externalDiffCommand = "${lib.getExe' patdiffCfg.package "patdiff-git-wrapper"}"; diff --git a/nix/homeModules/common/gpg.nix b/nix/homeModules/common/gpg.nix index 02df7fa6..1ef69531 100644 --- a/nix/homeModules/common/gpg.nix +++ b/nix/homeModules/common/gpg.nix @@ -1,25 +1,27 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ services = { gpg-agent.defaultCacheTtl = 1209600; gpg-agent.pinentry.package = pkgs.pinentry-tty; }; - programs.gpg.publicKeys = let - fromUrl = { - url, - hash, - trust ? 5, - }: { - source = pkgs.fetchurl {inherit url hash;}; - inherit trust; - }; + programs.gpg.publicKeys = + let + fromUrl = + { + url, + hash, + trust ? 5, + }: + { + source = pkgs.fetchurl { inherit url hash; }; + inherit trust; + }; - github = {user, ...} @ args: - fromUrl ( - builtins.removeAttrs args ["user"] - // {url = "https://github.com/${user}.gpg";} - ); - in + github = + { user, ... }@args: + fromUrl (builtins.removeAttrs args [ "user" ] // { url = "https://github.com/${user}.gpg"; }); + in map github [ # Do not depend on my own forgejo instance / self-host server to avoid a single point of failure { diff --git a/nix/homeModules/common/kitty.nix b/nix/homeModules/common/kitty.nix index 24b5e1b8..afe1a9c5 100644 --- a/nix/homeModules/common/kitty.nix +++ b/nix/homeModules/common/kitty.nix @@ -3,9 +3,11 @@ lib, config, ... -}: let +}: +let cfg = config.programs.kitty; -in { +in +{ config = lib.mkIf cfg.enable { home.packages = [ pkgs.nerd-fonts.iosevka diff --git a/nix/homeModules/common/lazygit.nix b/nix/homeModules/common/lazygit.nix index be6c2aef..f6a56eb6 100644 --- a/nix/homeModules/common/lazygit.nix +++ b/nix/homeModules/common/lazygit.nix @@ -2,9 +2,11 @@ config, lib, ... -}: let +}: +let cfg = config.programs.lazygit; -in { +in +{ programs.tmux.extraConfig = lib.mkIf cfg.enable '' bind g run-shell "tmux new-window ${lib.getExe cfg.package}" ''; diff --git a/nix/homeModules/common/leana.nix b/nix/homeModules/common/leana.nix index 760a6549..ae64efef 100644 --- a/nix/homeModules/common/leana.nix +++ b/nix/homeModules/common/leana.nix @@ -3,12 +3,14 @@ lib, config, ... -}: { +}: +{ home = { username = lib.mkDefault "leana"; - homeDirectory = let - inherit (config.home) username; - in + homeDirectory = + let + inherit (config.home) username; + in lib.mkMerge [ (lib.mkIf pkgs.stdenv.isLinux ("/home/" + username)) (lib.mkIf pkgs.stdenv.isDarwin ("/Users/" + username)) diff --git a/nix/homeModules/common/locale.nix b/nix/homeModules/common/locale.nix index 21e96dc5..e8949aef 100644 --- a/nix/homeModules/common/locale.nix +++ b/nix/homeModules/common/locale.nix @@ -2,7 +2,8 @@ nixosConfig ? null, lib, ... -}: { +}: +{ home.language = { base = lib.mkDefault nixosConfig.i18n.defaultLocale or "en_US.UTF-8"; }; diff --git a/nix/homeModules/common/packages.nix b/nix/homeModules/common/packages.nix index 470c527d..fac0711a 100644 --- a/nix/homeModules/common/packages.nix +++ b/nix/homeModules/common/packages.nix @@ -2,21 +2,21 @@ pkgs, lib, ... -}: { +}: +{ programs = { vim.enable = true; }; - home.packages = - [ - pkgs.file - pkgs.gnused - pkgs.tree - pkgs.findutils # xargs and more - pkgs.rsync - pkgs.parallel - pkgs.jq - ] - # coreutils for darwin - ++ lib.optional pkgs.stdenv.isDarwin pkgs.uutils-coreutils-noprefix; + home.packages = [ + pkgs.file + pkgs.gnused + pkgs.tree + pkgs.findutils # xargs and more + pkgs.rsync + pkgs.parallel + pkgs.jq + ] + # coreutils for darwin + ++ lib.optional pkgs.stdenv.isDarwin pkgs.uutils-coreutils-noprefix; } diff --git a/nix/homeModules/common/password-store.nix b/nix/homeModules/common/password-store.nix index 159152e0..04d8c5f9 100644 --- a/nix/homeModules/common/password-store.nix +++ b/nix/homeModules/common/password-store.nix @@ -3,9 +3,11 @@ pkgs, lib, ... -}: let +}: +let cfg = config.programs.password-store; -in { +in +{ home.packages = lib.mkIf cfg.enable [ pkgs.pwgen pkgs.diceware diff --git a/nix/homeModules/common/sioyek.nix b/nix/homeModules/common/sioyek.nix index 9c018fc8..6547d74d 100644 --- a/nix/homeModules/common/sioyek.nix +++ b/nix/homeModules/common/sioyek.nix @@ -2,7 +2,8 @@ config, lib, ... -}: { +}: +{ programs.sioyek = { bindings = { "move_up" = "k"; @@ -17,8 +18,11 @@ "u" "" ]; - "toggle_two_page_mode" = ["T"]; - "goto_mark" = ["`" "'"]; + "toggle_two_page_mode" = [ "T" ]; + "goto_mark" = [ + "`" + "'" + ]; }; config.should_launch_new_window = "1"; @@ -27,7 +31,7 @@ xdg.mimeApps = lib.mkIf config.programs.sioyek.enable { enable = true; defaultApplications = { - "application/pdf" = ["sioyek.desktop"]; + "application/pdf" = [ "sioyek.desktop" ]; }; }; } diff --git a/nix/homeModules/common/starship/default.nix b/nix/homeModules/common/starship/default.nix index 664103c0..e61b90b0 100644 --- a/nix/homeModules/common/starship/default.nix +++ b/nix/homeModules/common/starship/default.nix @@ -2,9 +2,11 @@ lib, config, ... -}: let +}: +let cfg = config.programs.starship; -in { +in +{ xdg.configFile = lib.mkIf cfg.enable { "starship.toml".source = "${./starship.toml}"; }; diff --git a/nix/homeModules/common/tmux/default.nix b/nix/homeModules/common/tmux/default.nix index 7efa8f11..47ecb2a2 100644 --- a/nix/homeModules/common/tmux/default.nix +++ b/nix/homeModules/common/tmux/default.nix @@ -2,7 +2,8 @@ pkgs, lib, ... -}: { +}: +{ programs.tmux.extraConfig = builtins.readFile ./tmux.conf + lib.optionalString pkgs.stdenv.isDarwin '' diff --git a/nix/homeModules/common/user-nixconf.nix b/nix/homeModules/common/user-nixconf.nix index 574a939e..9ca3a09e 100644 --- a/nix/homeModules/common/user-nixconf.nix +++ b/nix/homeModules/common/user-nixconf.nix @@ -3,7 +3,8 @@ lib, pkgs, ... -}: { +}: +{ nix = { package = lib.mkDefault (nixosConfig.nix.package or pkgs.nix); diff --git a/nix/homeModules/common/vim/default.nix b/nix/homeModules/common/vim/default.nix index ee264962..81944c7f 100644 --- a/nix/homeModules/common/vim/default.nix +++ b/nix/homeModules/common/vim/default.nix @@ -1,27 +1,30 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ programs.vim = { extraConfig = builtins.readFile ./vimrc; - plugins = let - vpkgs = pkgs.vimPlugins; + plugins = + let + vpkgs = pkgs.vimPlugins; - paramount = pkgs.vimUtils.buildVimPlugin { - name = "paramount"; - src = pkgs.fetchFromGitHub { - owner = "owickstrom"; - repo = "vim-colors-paramount"; - rev = "a5601d36fb6932e8d1a6f8b37b179a99b1456798"; - hash = "sha256-j9nMjKYK7bqrGHprYp0ddLEWs1CNMudxXD13sOROVmY="; + paramount = pkgs.vimUtils.buildVimPlugin { + name = "paramount"; + src = pkgs.fetchFromGitHub { + owner = "owickstrom"; + repo = "vim-colors-paramount"; + rev = "a5601d36fb6932e8d1a6f8b37b179a99b1456798"; + hash = "sha256-j9nMjKYK7bqrGHprYp0ddLEWs1CNMudxXD13sOROVmY="; + }; }; - }; - in [ - vpkgs.vim-sleuth - vpkgs.vim-surround - vpkgs.vim-fugitive - vpkgs.vim-commentary - vpkgs.undotree - vpkgs.tabular - vpkgs.vim-caddyfile - paramount - ]; + in + [ + vpkgs.vim-sleuth + vpkgs.vim-surround + vpkgs.vim-fugitive + vpkgs.vim-commentary + vpkgs.undotree + vpkgs.tabular + vpkgs.vim-caddyfile + paramount + ]; }; } diff --git a/nix/homeModules/common/wired/default.nix b/nix/homeModules/common/wired/default.nix index bc522eaa..2b3a7d2f 100644 --- a/nix/homeModules/common/wired/default.nix +++ b/nix/homeModules/common/wired/default.nix @@ -1,5 +1,6 @@ -{pkgs, ...}: { - home.packages = [pkgs.iosevka]; +{ pkgs, ... }: +{ + home.packages = [ pkgs.iosevka ]; services.wired = { config = "${./wired.ron}"; }; diff --git a/nix/homeModules/extra/tmux-fish-integration.nix b/nix/homeModules/extra/tmux-fish-integration.nix index 37061609..4480f567 100644 --- a/nix/homeModules/extra/tmux-fish-integration.nix +++ b/nix/homeModules/extra/tmux-fish-integration.nix @@ -4,7 +4,8 @@ lib, config, ... -}: { +}: +{ assertions = [ { assertion = config.programs.fish.enable; @@ -22,7 +23,9 @@ 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 '' # sessionizer binds bind -n C-f run-shell "tmux new-window tmux-sessionizer" diff --git a/nix/lib/mkNerdFont.nix b/nix/lib/mkNerdFont.nix index 1c9e72a2..9753577a 100644 --- a/nix/lib/mkNerdFont.nix +++ b/nix/lib/mkNerdFont.nix @@ -3,19 +3,20 @@ nerd-font-patcher, parallel, stdenvNoCC, -}: { +}: +{ font, - extraArgs ? [], + extraArgs ? [ ], useDefaultsArgs ? true, }: stdenvNoCC.mkDerivation { /* - Credits: - https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1231189572 - https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1544597422 + Credits: + https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1231189572 + https://github.com/NixOS/nixpkgs/issues/44329#issuecomment-1544597422 - long font names is not problematic: - https://github.com/ryanoasis/nerd-fonts/issues/1018#issuecomment-1953555781 + long font names is not problematic: + https://github.com/ryanoasis/nerd-fonts/issues/1018#issuecomment-1953555781 */ name = "${font.name}-NerdFont"; src = font; @@ -24,20 +25,22 @@ stdenvNoCC.mkDerivation { parallel ]; - buildPhase = let - args = - lib.optionals useDefaultsArgs [ - "--careful" - "--complete" - "--quiet" - "--no-progressbars" - ] - ++ extraArgs; - in '' - mkdir -p nerd-font - find \( -name \*.ttf -o -name \*.otf \) | parallel --jobs=$NIX_BUILD_CORES nerd-font-patcher {} \ - --outputdir nerd-font ${builtins.concatStringsSep " " args} - ''; + buildPhase = + let + args = + lib.optionals useDefaultsArgs [ + "--careful" + "--complete" + "--quiet" + "--no-progressbars" + ] + ++ extraArgs; + in + '' + 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 = '' exists() { [ -e "$1" ]; } diff --git a/nix/networks/list.nix b/nix/networks/list.nix index e87052ce..de5c9fc9 100644 --- a/nix/networks/list.nix +++ b/nix/networks/list.nix @@ -2,7 +2,8 @@ let preferredPriority = 20; privatePriority = 10; limitedPriority = -10; -in [ +in +[ { ssid = "~"; priority = preferredPriority; @@ -36,7 +37,7 @@ in [ priority = privatePriority; scanOnLowSignal = true; - authProtocols = ["WPA-EAP"]; + authProtocols = [ "WPA-EAP" ]; auth = '' pairwise=CCMP group=CCMP TKIP @@ -81,13 +82,13 @@ in [ randomizeMac = true; } - {ssid = "_SNCF_WIFI_INOUI";} - {ssid = "_WIFI_LYRIA";} - {ssid = "EurostarTrainsWiFi";} - {ssid = "SBB-FREE";} - {ssid = "AOT Airport Free Wi-Fi by NT";} - {ssid = "NewTaipei";} - {ssid = "Fami-WiFi";} + { ssid = "_SNCF_WIFI_INOUI"; } + { ssid = "_WIFI_LYRIA"; } + { ssid = "EurostarTrainsWiFi"; } + { ssid = "SBB-FREE"; } + { ssid = "AOT Airport Free Wi-Fi by NT"; } + { ssid = "NewTaipei"; } + { ssid = "Fami-WiFi"; } { ssid = "iPhone de Léana 江"; diff --git a/nix/networks/wpa_supplicant-compat.nix b/nix/networks/wpa_supplicant-compat.nix index 7b4424a2..02c2c26c 100644 --- a/nix/networks/wpa_supplicant-compat.nix +++ b/nix/networks/wpa_supplicant-compat.nix @@ -6,32 +6,39 @@ let lib = import (sources.nixpkgs + "/lib"); # wpa_supplicant uses `strchr` to seek to the first `=`, so the only forbidden character is `=`. - escapePwdKey = lib.replaceStrings ["="] ["_"]; + escapePwdKey = lib.replaceStrings [ "=" ] [ "_" ]; - go = networkArgs @ { - ssid, - # Custom fields wrapping nixpkgs module options - hasPassword ? false, - scanOnLowSignal ? false, - randomizeMac ? false, - ... - }: { - ${ssid} = lib.mkMerge [ - (builtins.removeAttrs networkArgs ["ssid" "hasPassword" "scanOnLowSignal" "randomizeMac"]) - (lib.optionalAttrs hasPassword { - pskRaw = "ext:${escapePwdKey ssid}"; - }) - (lib.optionalAttrs scanOnLowSignal { - extraConfig = '' - bgscan="simple:30:-70:3600" - ''; - }) - (lib.optionalAttrs randomizeMac { - extraConfig = '' - mac_addr=1 - ''; - }) - ]; - }; + go = + networkArgs@{ + ssid, + # Custom fields wrapping nixpkgs module options + hasPassword ? false, + scanOnLowSignal ? false, + randomizeMac ? false, + ... + }: + { + ${ssid} = lib.mkMerge [ + (builtins.removeAttrs networkArgs [ + "ssid" + "hasPassword" + "scanOnLowSignal" + "randomizeMac" + ]) + (lib.optionalAttrs hasPassword { + pskRaw = "ext:${escapePwdKey ssid}"; + }) + (lib.optionalAttrs scanOnLowSignal { + extraConfig = '' + bgscan="simple:30:-70:3600" + ''; + }) + (lib.optionalAttrs randomizeMac { + extraConfig = '' + mac_addr=1 + ''; + }) + ]; + }; in - ns: lib.mkMerge (map go ns) +ns: lib.mkMerge (map go ns) diff --git a/nix/nixosModules/common/disable-command-not-found.nix b/nix/nixosModules/common/disable-command-not-found.nix index f81c9a8b..89d6638a 100644 --- a/nix/nixosModules/common/disable-command-not-found.nix +++ b/nix/nixosModules/common/disable-command-not-found.nix @@ -1 +1 @@ -{programs.command-not-found.enable = false;} +{ programs.command-not-found.enable = false; } diff --git a/nix/nixosModules/common/fish.nix b/nix/nixosModules/common/fish.nix index af742154..be194799 100644 --- a/nix/nixosModules/common/fish.nix +++ b/nix/nixosModules/common/fish.nix @@ -5,15 +5,18 @@ config, lib, ... -}: let +}: +let fishNixOSEnabled = config.programs.fish.enable; fishHMEnabled = - if config ? home-manager - then lib.any (userConfig: userConfig.programs.fish.enable) (lib.attrValues config.home-manager.users) - else false; + if config ? home-manager then + lib.any (userConfig: userConfig.programs.fish.enable) (lib.attrValues config.home-manager.users) + else + false; fishEnabled = fishNixOSEnabled || fishHMEnabled; -in { +in +{ environment.pathsToLink = lib.mkIf fishEnabled [ "/share/fish/vendor_conf.d" "/share/fish/vendor_completions.d" diff --git a/nix/nixosModules/common/network.nix b/nix/nixosModules/common/network.nix index 0a52670b..6d36fbfb 100644 --- a/nix/nixosModules/common/network.nix +++ b/nix/nixosModules/common/network.nix @@ -1,4 +1,5 @@ -{hostname, ...}: { +{ hostname, ... }: +{ networking.hostName = hostname; services.openssh = { diff --git a/nix/nixosModules/common/sudo-conf.nix b/nix/nixosModules/common/sudo-conf.nix index af85bab6..35494b1b 100644 --- a/nix/nixosModules/common/sudo-conf.nix +++ b/nix/nixosModules/common/sudo-conf.nix @@ -1,4 +1,5 @@ -{pkgs, ...}: { +{ pkgs, ... }: +{ security.sudo.enable = false; environment.systemPackages = [ @@ -18,8 +19,8 @@ # 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. # Also, for some reason, the rule won't match. - users = [":wheel"]; - setEnv = ["PATH"]; + users = [ ":wheel" ]; + setEnv = [ "PATH" ]; } ]; }; diff --git a/nix/nixosModules/common/system-nixconf.nix b/nix/nixosModules/common/system-nixconf.nix index 637e7d71..9a0d8783 100644 --- a/nix/nixosModules/common/system-nixconf.nix +++ b/nix/nixosModules/common/system-nixconf.nix @@ -2,7 +2,8 @@ lib, pkgs, ... -}: { +}: +{ nix = { package = lib.mkDefault pkgs.nix; diff --git a/nix/nixosModules/common/xscreensaver.nix b/nix/nixosModules/common/xscreensaver.nix index 2d18a6a1..49aebbd0 100644 --- a/nix/nixosModules/common/xscreensaver.nix +++ b/nix/nixosModules/common/xscreensaver.nix @@ -5,14 +5,16 @@ config, lib, ... -}: let +}: +let cfg = config.services.xscreensaver; -in { +in +{ options = { services.xscreensaver.hooks = lib.mkOption { type = with lib.types; attrsOf str; description = "An attrset of events mapped a block of shell command to be run"; - default = {}; + default = { }; }; }; @@ -20,26 +22,29 @@ in { systemd.user.services = { "xscreensaver-hooks" = { description = "Run commands on xscreensaver events"; - after = ["graphical-session.target" "xscreensaver.service"]; - partOf = ["graphical-session.target"]; - wantedBy = ["graphical-session.target"]; - script = let - handlers = - lib.concatMapAttrsStringSep "\n" (event: action: '' + after = [ + "graphical-session.target" + "xscreensaver.service" + ]; + partOf = [ "graphical-session.target" ]; + wantedBy = [ "graphical-session.target" ]; + script = + let + handlers = lib.concatMapAttrsStringSep "\n" (event: action: '' "${event}") ( ${action} ) ;; - '') - cfg.hooks; - in '' - xscreensaver-command -watch | while read event rest; do - echo "The handler script got \"$event\"" - case $event in - ${handlers} - esac - done - ''; + '') cfg.hooks; + in + '' + xscreensaver-command -watch | while read event rest; do + echo "The handler script got \"$event\"" + case $event in + ${handlers} + esac + done + ''; path = [ cfg.package # contains xscreensaver-command ]; diff --git a/nix/nixosModules/extra/leana.nix b/nix/nixosModules/extra/leana.nix index d61e958b..1412fd3d 100644 --- a/nix/nixosModules/extra/leana.nix +++ b/nix/nixosModules/extra/leana.nix @@ -2,21 +2,22 @@ config, pkgs, ... -}: { +}: +{ # # My user # - nix.settings.trusted-users = ["leana"]; + nix.settings.trusted-users = [ "leana" ]; users.users."leana" = { isNormalUser = true; home = "/home/leana"; description = "Leana"; group = "leana"; - extraGroups = ["wheel"]; + extraGroups = [ "wheel" ]; shell = pkgs.bash; openssh.authorizedKeys.keys = config.users.users.root.openssh.authorizedKeys.keys; }; - users.groups.leana = {}; + users.groups.leana = { }; # # My nix binary cache diff --git a/nix/nixosModules/extra/macbook-pro-radeon.nix b/nix/nixosModules/extra/macbook-pro-radeon.nix index 0c664321..34de14fa 100644 --- a/nix/nixosModules/extra/macbook-pro-radeon.nix +++ b/nix/nixosModules/extra/macbook-pro-radeon.nix @@ -1,5 +1,5 @@ { # 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. - boot.kernelParams = ["radeon.modeset=0"]; + boot.kernelParams = [ "radeon.modeset=0" ]; } diff --git a/nix/nixosModules/extra/parrot.nix b/nix/nixosModules/extra/parrot.nix index c1ead149..0d491ddb 100644 --- a/nix/nixosModules/extra/parrot.nix +++ b/nix/nixosModules/extra/parrot.nix @@ -3,10 +3,12 @@ lib, config, ... -}: let +}: +let cfg = config.services.parrot; t = lib.types; -in { +in +{ options = { services.parrot = { enable = lib.mkEnableOption "parrot"; @@ -23,12 +25,12 @@ in { group = "parrot"; isSystemUser = true; }; - users.groups."parrot" = {}; + users.groups."parrot" = { }; systemd.services."parrot" = { description = " A hassle-free, highly performant, self-hosted Discord music bot with YouTube and Spotify support. Powered by yt-dlp."; - after = ["network.target"]; - wantedBy = ["multi-user.target"]; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; serviceConfig = { User = "parrot"; diff --git a/nix/nixosModules/extra/secure_dns.nix b/nix/nixosModules/extra/secure_dns.nix index 439090b4..321d8455 100644 --- a/nix/nixosModules/extra/secure_dns.nix +++ b/nix/nixosModules/extra/secure_dns.nix @@ -1,7 +1,11 @@ # https://nixos.wiki/wiki/Encrypted_DNS -{pkgs, ...}: { +{ pkgs, ... }: +{ networking = { - nameservers = ["127.0.0.1" "::1"]; + nameservers = [ + "127.0.0.1" + "::1" + ]; dhcpcd.extraConfig = "nohook resolv.conf"; # networkmanager.dns = "none"; }; @@ -13,7 +17,7 @@ # Settings reference: # https://github.com/DNSCrypt/dnscrypt-proxy/blob/master/dnscrypt-proxy/example-dnscrypt-proxy.toml settings = { - listen_addresses = ["127.0.0.1:53"]; + listen_addresses = [ "127.0.0.1:53" ]; ipv4_servers = true; require_dnssec = true; diff --git a/nix/nixosModules/extra/typst-bot.nix b/nix/nixosModules/extra/typst-bot.nix index dbadaea3..153fea31 100644 --- a/nix/nixosModules/extra/typst-bot.nix +++ b/nix/nixosModules/extra/typst-bot.nix @@ -3,10 +3,12 @@ config, lib, ... -}: let +}: +let cfg = config.services.typst-bot; t = lib.types; -in { +in +{ options = { services.typst-bot = { enable = lib.mkEnableOption "typst-bot"; @@ -30,7 +32,7 @@ in { isSystemUser = true; home = cfg.dataDir; }; - users.groups."typst-bot" = {}; + users.groups."typst-bot" = { }; systemd.tmpfiles.rules = [ "d ${cfg.dataDir}/cache 700 typst-bot typst-bot - -" @@ -39,15 +41,15 @@ in { systemd.services."typst-bot" = { description = "A discord bot to render Typst code"; - after = ["network.target"]; - wantedBy = ["multi-user.target"]; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; preStart = '' : >${cfg.dataDir}/sqlite/db.sqlite ''; # Don't pollute the global path - path = [pkgs.typst-bot]; + path = [ pkgs.typst-bot ]; script = "typst-bot"; serviceConfig = { diff --git a/nix/nixosModules/extra/zram.nix b/nix/nixosModules/extra/zram.nix index 0f13d841..bcf848ba 100644 --- a/nix/nixosModules/extra/zram.nix +++ b/nix/nixosModules/extra/zram.nix @@ -1 +1 @@ -{zramSwap.enable = true;} +{ zramSwap.enable = true; } diff --git a/nix/overlays/agenix.nix b/nix/overlays/agenix.nix index eded6cc7..33db93ab 100644 --- a/nix/overlays/agenix.nix +++ b/nix/overlays/agenix.nix @@ -1,7 +1,7 @@ let sources = import ../../npins; in - final: _: { - # Use flake so the package inputs is pinned - agenix = sources.agenix.asFlake.packages.${final.system}.default; - } +final: _: { + # Use flake so the package inputs is pinned + agenix = sources.agenix.asFlake.packages.${final.system}.default; +} diff --git a/nix/overlays/calibre-no-mime.nix b/nix/overlays/calibre-no-mime.nix index f6436085..bfc2d604 100644 --- a/nix/overlays/calibre-no-mime.nix +++ b/nix/overlays/calibre-no-mime.nix @@ -2,8 +2,8 @@ final: prev: { calibre = final.symlinkJoin { name = "calibre"; - paths = [prev.calibre]; - buildInputs = [final.makeWrapper]; + paths = [ prev.calibre ]; + buildInputs = [ final.makeWrapper ]; postBuild = '' rm -r $out/share/mime ''; diff --git a/nix/overlays/disko.nix b/nix/overlays/disko.nix index 038ae26d..cb013aad 100644 --- a/nix/overlays/disko.nix +++ b/nix/overlays/disko.nix @@ -1,6 +1,6 @@ let sources = import ../../npins; in - final: _: { - disko = sources.disko.asFlake.packages.${final.system}.default; - } +final: _: { + disko = sources.disko.asFlake.packages.${final.system}.default; +} diff --git a/nix/overlays/dix.nix b/nix/overlays/dix.nix index ada5e33a..60717e01 100644 --- a/nix/overlays/dix.nix +++ b/nix/overlays/dix.nix @@ -1,6 +1,6 @@ let sources = import ../../npins; in - final: _: { - dix = sources.dix.asFlake.packages.${final.system}.default; - } +final: _: { + dix = sources.dix.asFlake.packages.${final.system}.default; +} diff --git a/nix/overlays/eepy.nix b/nix/overlays/eepy.nix index 1c821d2b..70f4f78a 100644 --- a/nix/overlays/eepy.nix +++ b/nix/overlays/eepy.nix @@ -1,6 +1,6 @@ let sources = import ../../npins; in - final: _: { - eepy = sources.eepy.asFlake.packages.${final.system}.default; - } +final: _: { + eepy = sources.eepy.asFlake.packages.${final.system}.default; +} diff --git a/nix/overlays/fcitx5-table-extra-taiwanese.nix b/nix/overlays/fcitx5-table-extra-taiwanese.nix index b24003f8..af7e17df 100644 --- a/nix/overlays/fcitx5-table-extra-taiwanese.nix +++ b/nix/overlays/fcitx5-table-extra-taiwanese.nix @@ -1,18 +1,14 @@ let sources = import ../../npins; in - final: prev: { - fcitx5-table-extra = prev.fcitx5-table-extra.overrideAttrs (oldAttrs: { - src = sources.fcitx5-table-extra; - nativeBuildInputs = - oldAttrs.nativeBuildInputs or [] - ++ [ - final.python3 - ]; - preConfigure = - oldAttrs.preConfigure or "" - + '' - python3 ./generate.py - ''; - }); - } +final: prev: { + fcitx5-table-extra = prev.fcitx5-table-extra.overrideAttrs (oldAttrs: { + src = sources.fcitx5-table-extra; + nativeBuildInputs = oldAttrs.nativeBuildInputs or [ ] ++ [ + final.python3 + ]; + preConfigure = oldAttrs.preConfigure or "" + '' + python3 ./generate.py + ''; + }); +} diff --git a/nix/overlays/iosevka.nix b/nix/overlays/iosevka.nix index e5760ec1..2239f2ae 100644 --- a/nix/overlays/iosevka.nix +++ b/nix/overlays/iosevka.nix @@ -1,7 +1,8 @@ final: prev: rec { - nerd-fonts = let - mkNerdFont = final.callPackage ../lib/mkNerdFont.nix {}; - in + nerd-fonts = + let + mkNerdFont = final.callPackage ../lib/mkNerdFont.nix { }; + in prev.nerd-fonts // { iosevka = mkNerdFont { diff --git a/nix/overlays/nil.nix b/nix/overlays/nil.nix index ab05b204..4ada807b 100644 --- a/nix/overlays/nil.nix +++ b/nix/overlays/nil.nix @@ -2,21 +2,18 @@ let sources = import ../../npins; in - final: _: { - nil = let +final: _: { + nil = + let pkg = sources.nil.asFlake.packages.${final.system}.default; in - pkg.overrideAttrs ( - oldAttrs: { - patches = - oldAttrs.patches or [] - ++ [ - (final.fetchpatch { - name = "fix-handling-inherit-and-patfield-in-inline-assist"; - url = "https://github.com/oxalica/nil/pull/178.patch"; - hash = "sha256-4f7DeWJtt63IyOjqlwzz0f05rv1NBYZO4JWEkFeDimk="; - }) - ]; - } - ); - } + pkg.overrideAttrs (oldAttrs: { + patches = oldAttrs.patches or [ ] ++ [ + (final.fetchpatch { + name = "fix-handling-inherit-and-patfield-in-inline-assist"; + url = "https://github.com/oxalica/nil/pull/178.patch"; + hash = "sha256-4f7DeWJtt63IyOjqlwzz0f05rv1NBYZO4JWEkFeDimk="; + }) + ]; + }); +} diff --git a/nix/overlays/nix-monitored.nix b/nix/overlays/nix-monitored.nix index 91aa2cfd..ee3b06ac 100644 --- a/nix/overlays/nix-monitored.nix +++ b/nix/overlays/nix-monitored.nix @@ -1,12 +1,10 @@ let sources = import ../../npins; in - # The final nix is lix in this case - final: prev: { - nix-monitored = - sources.nix-monitored.asFlake.packages.${final.system}.default - .override { - inherit (final) nix; - withNotify = false; # noisy, spams "command completed" even for nix shells - }; - } +# The final nix is lix in this case +final: prev: { + nix-monitored = sources.nix-monitored.asFlake.packages.${final.system}.default.override { + inherit (final) nix; + withNotify = false; # noisy, spams "command completed" even for nix shells + }; +} diff --git a/nix/overlays/nix-tree.nix b/nix/overlays/nix-tree.nix index 36c30bfe..2fcc6cbf 100644 --- a/nix/overlays/nix-tree.nix +++ b/nix/overlays/nix-tree.nix @@ -3,6 +3,6 @@ let sources = import ../../npins; in - final: _: { - nix-tree = (import sources.nix-tree).packages.${final.system}.default; - } +final: _: { + nix-tree = (import sources.nix-tree).packages.${final.system}.default; +} diff --git a/nix/overlays/nur.nix b/nix/overlays/nur.nix index f0ff694f..e78d54fb 100644 --- a/nix/overlays/nur.nix +++ b/nix/overlays/nur.nix @@ -1,4 +1,4 @@ let sources = import ../../npins; in - sources.nur.asFlake.overlays.default +sources.nur.asFlake.overlays.default diff --git a/nix/overlays/pin-emacs28.nix b/nix/overlays/pin-emacs28.nix index f37787d7..11f1ed50 100644 --- a/nix/overlays/pin-emacs28.nix +++ b/nix/overlays/pin-emacs28.nix @@ -1,6 +1,6 @@ let sources = import ../../npins; in - _: _: { - unsafe-emacs28 = (import sources.pin-emacs28 {}).emacs; - } +_: _: { + unsafe-emacs28 = (import sources.pin-emacs28 { }).emacs; +} diff --git a/nix/overlays/pin-isabelle-2023.nix b/nix/overlays/pin-isabelle-2023.nix index 38a100c5..c5cbab6f 100644 --- a/nix/overlays/pin-isabelle-2023.nix +++ b/nix/overlays/pin-isabelle-2023.nix @@ -1,7 +1,7 @@ let sources = import ../../npins; in - _: _: { - # Isabelle version 2023 - isabelle-2023 = (import sources.pin-isabelle {}).isabelle; - } +_: _: { + # Isabelle version 2023 + isabelle-2023 = (import sources.pin-isabelle { }).isabelle; +} diff --git a/nix/overlays/pin-wireshark.nix b/nix/overlays/pin-wireshark.nix index dd9c800a..e1708117 100644 --- a/nix/overlays/pin-wireshark.nix +++ b/nix/overlays/pin-wireshark.nix @@ -1,8 +1,8 @@ let sources = import ../../npins; in - _: _: { - # Wireshark bug - # https://gitlab.com/wireshark/wireshark/-/issues/19574 - inherit (import sources.pin-wireshark {}) wireshark; - } +_: _: { + # Wireshark bug + # https://gitlab.com/wireshark/wireshark/-/issues/19574 + inherit (import sources.pin-wireshark { }) wireshark; +} diff --git a/nix/overlays/wallpapers.nix b/nix/overlays/wallpapers.nix index b25035b2..759b93ff 100644 --- a/nix/overlays/wallpapers.nix +++ b/nix/overlays/wallpapers.nix @@ -1,7 +1,7 @@ let sources = import ../../npins; in - _: _: rec { - wallpapers_source = sources.wallpapers; - wallpapers = import wallpapers_source {}; - } +_: _: rec { + wallpapers_source = sources.wallpapers; + wallpapers = import wallpapers_source { }; +} diff --git a/nix/overlays/wired-notify.nix b/nix/overlays/wired-notify.nix index 2e158aa5..05831369 100644 --- a/nix/overlays/wired-notify.nix +++ b/nix/overlays/wired-notify.nix @@ -1,4 +1,4 @@ let sources = import ../../npins; in - (import sources.wired-notify).overlays.default +(import sources.wired-notify).overlays.default diff --git a/nix/packages/by-name/ai_blocklist/package.nix b/nix/packages/by-name/ai_blocklist/package.nix index 0a683cbf..ecfd0db0 100644 --- a/nix/packages/by-name/ai_blocklist/package.nix +++ b/nix/packages/by-name/ai_blocklist/package.nix @@ -2,26 +2,27 @@ fetchFromGitHub, stdenvNoCC, lib, -}: let +}: +let rev = "9bb188e2701138e03f73bacebd6b19b181ca0012"; in - stdenvNoCC.mkDerivation { - pname = "ai_blocklist"; - version = "unstable-" + lib.substring 0 8 rev; +stdenvNoCC.mkDerivation { + pname = "ai_blocklist"; + version = "unstable-" + lib.substring 0 8 rev; - src = fetchFromGitHub { - owner = "laylavish"; - repo = "uBlockOrigin-HUGE-AI-Blocklist"; - inherit rev; - hash = "sha256-p3wfR28DH6V8BHn9DT10d09Yq3mdbBecWwlR1CdDYUA="; - }; + src = fetchFromGitHub { + owner = "laylavish"; + repo = "uBlockOrigin-HUGE-AI-Blocklist"; + inherit rev; + hash = "sha256-p3wfR28DH6V8BHn9DT10d09Yq3mdbBecWwlR1CdDYUA="; + }; - installPhase = '' - mkdir -p $out/share - cp noai_hosts.txt $out/share/hosts.txt + installPhase = '' + mkdir -p $out/share + cp noai_hosts.txt $out/share/hosts.txt - # drop domain names - cat $out/share/hosts.txt | - sed 's/^0.0.0.0 //' > $out/share/domains.txt - ''; - } + # drop domain names + cat $out/share/hosts.txt | + sed 's/^0.0.0.0 //' > $out/share/domains.txt + ''; +} diff --git a/nix/packages/by-name/audio-lint/package.nix b/nix/packages/by-name/audio-lint/package.nix index 5f95c4aa..e4aacdf6 100644 --- a/nix/packages/by-name/audio-lint/package.nix +++ b/nix/packages/by-name/audio-lint/package.nix @@ -2,20 +2,24 @@ rustPlatform, fetchFromGitea, }: -rustPlatform.buildRustPackage (finalAttrs: let - cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml")); - cargoLock = finalAttrs.src + "/Cargo.lock"; -in { - pname = "audio-lint"; - version = cargoToml.package.version; +rustPlatform.buildRustPackage ( + finalAttrs: + let + cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml")); + cargoLock = finalAttrs.src + "/Cargo.lock"; + in + { + pname = "audio-lint"; + version = cargoToml.package.version; - src = fetchFromGitea { - domain = "git.confusedcompiler.org"; - owner = "leana8959"; - repo = "audio-lint"; - rev = "3ea38c85c5f6135958e51ad4ff13a96ccd68a21c"; - hash = "sha256-h1SnWAh3FPL5GweOXVXXtp+swZApgecYaWjy7rM/J+w="; - }; + src = fetchFromGitea { + domain = "git.confusedcompiler.org"; + owner = "leana8959"; + repo = "audio-lint"; + rev = "3ea38c85c5f6135958e51ad4ff13a96ccd68a21c"; + hash = "sha256-h1SnWAh3FPL5GweOXVXXtp+swZApgecYaWjy7rM/J+w="; + }; - cargoLock.lockFile = cargoLock; -}) + cargoLock.lockFile = cargoLock; + } +) diff --git a/nix/packages/by-name/emoji-picker-rs/package.nix b/nix/packages/by-name/emoji-picker-rs/package.nix index 11d2d75c..3e96dc06 100644 --- a/nix/packages/by-name/emoji-picker-rs/package.nix +++ b/nix/packages/by-name/emoji-picker-rs/package.nix @@ -6,29 +6,33 @@ libxcb, fetchFromGitHub, }: -rustPlatform.buildRustPackage (finalAttrs: let - cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml")); - cargoLock = finalAttrs.src + "/Cargo.lock"; -in { - pname = "emoji-picker"; - version = cargoToml.package.version; +rustPlatform.buildRustPackage ( + finalAttrs: + let + cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml")); + cargoLock = finalAttrs.src + "/Cargo.lock"; + in + { + pname = "emoji-picker"; + version = cargoToml.package.version; - src = fetchFromGitHub { - owner = "leana8959"; - repo = "emoji-picker"; - rev = "d77c086bb3ed1ba55560c5027cc58e2c033c9ca7"; - hash = "sha256-gLsBhtSnrOdU/qH9WR3UnsclfptRAP0Wv+MJjY+wYGc="; - }; + src = fetchFromGitHub { + owner = "leana8959"; + repo = "emoji-picker"; + rev = "d77c086bb3ed1ba55560c5027cc58e2c033c9ca7"; + hash = "sha256-gLsBhtSnrOdU/qH9WR3UnsclfptRAP0Wv+MJjY+wYGc="; + }; - cargoLock.lockFile = cargoLock; + cargoLock.lockFile = cargoLock; - nativeBuildInputs = [ - python3 - pkg-config - ]; + nativeBuildInputs = [ + python3 + pkg-config + ]; - buildInputs = [ - openssl.dev - libxcb - ]; -}) + buildInputs = [ + openssl.dev + libxcb + ]; + } +) diff --git a/nix/packages/by-name/hategroup_blocklist/package.nix b/nix/packages/by-name/hategroup_blocklist/package.nix index 9f320335..d7fb0e86 100644 --- a/nix/packages/by-name/hategroup_blocklist/package.nix +++ b/nix/packages/by-name/hategroup_blocklist/package.nix @@ -2,25 +2,26 @@ fetchFromGitHub, stdenvNoCC, lib, -}: let +}: +let rev = "cc19c050997d5f54014bb20c764b131e003dfb17"; in - stdenvNoCC.mkDerivation { - pname = "hategroup_blocklist"; - version = "unstable-" + lib.substring 0 8 rev; +stdenvNoCC.mkDerivation { + pname = "hategroup_blocklist"; + version = "unstable-" + lib.substring 0 8 rev; - src = fetchFromGitHub { - owner = "chigh"; - repo = "hategroup-dnsbl"; - inherit rev; - hash = "sha256-SZBrjIBUw687MdrbOV7WrP5IhAAtKvPL2GqdcICHNvQ="; - }; + src = fetchFromGitHub { + owner = "chigh"; + repo = "hategroup-dnsbl"; + inherit rev; + hash = "sha256-SZBrjIBUw687MdrbOV7WrP5IhAAtKvPL2GqdcICHNvQ="; + }; - installPhase = '' - mkdir -p $out/share - cp blocklist.txt $out/share/domains.txt + installPhase = '' + mkdir -p $out/share + cp blocklist.txt $out/share/domains.txt - cat $out/share/domains.txt | - sed 's/^\([^#].*\)$/0.0.0.0 \1/' > $out/share/hosts.txt - ''; - } + cat $out/share/domains.txt | + sed 's/^\([^#].*\)$/0.0.0.0 \1/' > $out/share/hosts.txt + ''; +} diff --git a/nix/packages/by-name/hbrainfuck/package.nix b/nix/packages/by-name/hbrainfuck/package.nix index 2236c773..cf4859d3 100644 --- a/nix/packages/by-name/hbrainfuck/package.nix +++ b/nix/packages/by-name/hbrainfuck/package.nix @@ -3,31 +3,26 @@ haskell, fetchFromGitea, installShellFiles, -}: let +}: +let inherit (haskell.lib.compose) justStaticExecutables overrideCabal; - drv = - haskellPackages.callCabal2nix "hbrainfuck" - (fetchFromGitea { - domain = "git.confusedcompiler.org"; - owner = "leana8959"; - repo = "hbrainfuck"; - rev = "5eea5ff0d7efc0bd866a2273686032ba9cab5baa"; - hash = "sha256-/htXOULUJN8+PsAYaG281Ge/9ULZoWip63IUxuVbTSg="; - }) - {}; + drv = haskellPackages.callCabal2nix "hbrainfuck" (fetchFromGitea { + domain = "git.confusedcompiler.org"; + owner = "leana8959"; + repo = "hbrainfuck"; + rev = "5eea5ff0d7efc0bd866a2273686032ba9cab5baa"; + hash = "sha256-/htXOULUJN8+PsAYaG281Ge/9ULZoWip63IUxuVbTSg="; + }) { }; cabalOverrides = o: { - buildTools = o.buildTools or [] ++ [installShellFiles]; - postInstall = - o.postInstall or "" - + '' - installShellCompletion --cmd hbrainfuck \ - --bash <("$out/bin/hbf" --bash-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") - ''; + buildTools = o.buildTools or [ ] ++ [ installShellFiles ]; + postInstall = o.postInstall or "" + '' + installShellCompletion --cmd hbrainfuck \ + --bash <("$out/bin/hbf" --bash-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 - justStaticExecutables - (overrideCabal cabalOverrides drv) +justStaticExecutables (overrideCabal cabalOverrides drv) diff --git a/nix/packages/by-name/hutils/package.nix b/nix/packages/by-name/hutils/package.nix index f068bd8c..d5423044 100644 --- a/nix/packages/by-name/hutils/package.nix +++ b/nix/packages/by-name/hutils/package.nix @@ -2,18 +2,16 @@ haskellPackages, haskell, fetchFromGitea, -}: let +}: +let inherit (haskell.lib.compose) justStaticExecutables; - drv = - haskellPackages.callCabal2nix "hutils" - (fetchFromGitea { - domain = "git.confusedcompiler.org"; - owner = "leana8959"; - repo = "hutils"; - rev = "30b503bec011f8908e26c0e1e961936d56da74cc"; - hash = "sha256-lPwqxsz7WXdDMonjdWvTziR5HuE5HY2GyU2rQkwn0VU="; - }) - {}; + drv = haskellPackages.callCabal2nix "hutils" (fetchFromGitea { + domain = "git.confusedcompiler.org"; + owner = "leana8959"; + repo = "hutils"; + rev = "30b503bec011f8908e26c0e1e961936d56da74cc"; + hash = "sha256-lPwqxsz7WXdDMonjdWvTziR5HuE5HY2GyU2rQkwn0VU="; + }) { }; in - justStaticExecutables drv +justStaticExecutables drv diff --git a/nix/packages/by-name/maeel/package.nix b/nix/packages/by-name/maeel/package.nix index 54234d04..0d987aa5 100644 --- a/nix/packages/by-name/maeel/package.nix +++ b/nix/packages/by-name/maeel/package.nix @@ -14,7 +14,7 @@ stdenv.mkDerivation { hash = "sha256-Ee4/N2Q90xsbyGVtpE/yUFWC/ELt8nBAICkR/FlZQOo="; }; - nativeBuildInputs = [rustc]; + nativeBuildInputs = [ rustc ]; installPhase = '' mkdir -p "$out/bin" cp --reflink=auto ./maeel "$out/bin" diff --git a/nix/packages/by-name/necrolib/package.nix b/nix/packages/by-name/necrolib/package.nix index 3c85c9a5..9b8ac1c2 100644 --- a/nix/packages/by-name/necrolib/package.nix +++ b/nix/packages/by-name/necrolib/package.nix @@ -2,27 +2,28 @@ fetchFromGitLab, ocaml-ng, ocamlPackages ? ocaml-ng.ocamlPackages_5_1, -}: let +}: +let version = "v0.16.2"; in - ocamlPackages.buildDunePackage { - pname = "necrolib"; - inherit version; +ocamlPackages.buildDunePackage { + pname = "necrolib"; + inherit version; - minimalOCamlVersion = "5.1.1"; + minimalOCamlVersion = "5.1.1"; - src = fetchFromGitLab { - domain = "gitlab.inria.fr"; - owner = "skeletons"; - repo = "necro"; - rev = version; - hash = "sha256-KoSKJD5jy+GY5QKKMUTW5gc0V/5l/klHrJMdC8aPnj8="; - }; + src = fetchFromGitLab { + domain = "gitlab.inria.fr"; + owner = "skeletons"; + repo = "necro"; + rev = version; + hash = "sha256-KoSKJD5jy+GY5QKKMUTW5gc0V/5l/klHrJMdC8aPnj8="; + }; - duneVersion = "3"; - nativeBuildInputs = [ocamlPackages.menhir]; - buildInputs = [ - ocamlPackages.ocamlgraph - ocamlPackages.dune-build-info - ]; - } + duneVersion = "3"; + nativeBuildInputs = [ ocamlPackages.menhir ]; + buildInputs = [ + ocamlPackages.ocamlgraph + ocamlPackages.dune-build-info + ]; +} diff --git a/nix/packages/by-name/nix-which/package.nix b/nix/packages/by-name/nix-which/package.nix index 896ab411..a33f12b2 100644 --- a/nix/packages/by-name/nix-which/package.nix +++ b/nix/packages/by-name/nix-which/package.nix @@ -2,26 +2,27 @@ writeShellApplication, which, lib, -}: let +}: +let # Use this to not pollute the PATH inside # Otherwise nix-which which will be an edge case whichExe = "${lib.getExe which}"; in - writeShellApplication { - name = "nix-which"; - text = '' - if [ "$#" -ne 1 ]; then - echo "Must provide exactly one argument, the package to be dereferenced" - exit 1 - fi - target="$1" +writeShellApplication { + name = "nix-which"; + text = '' + if [ "$#" -ne 1 ]; then + echo "Must provide exactly one argument, the package to be dereferenced" + exit 1 + fi + target="$1" - target="$(${whichExe} "$target")" - echo "==> $target" + target="$(${whichExe} "$target")" + echo "==> $target" - while [ -L "$target" ]; do - target="$(readlink "$target")" - echo "==> $target" - done - ''; - } + while [ -L "$target" ]; do + target="$(readlink "$target")" + echo "==> $target" + done + ''; +} diff --git a/nix/packages/by-name/prop-solveur/package.nix b/nix/packages/by-name/prop-solveur/package.nix index c9200357..19ec5af4 100644 --- a/nix/packages/by-name/prop-solveur/package.nix +++ b/nix/packages/by-name/prop-solveur/package.nix @@ -3,31 +3,26 @@ haskell, fetchFromGitea, installShellFiles, -}: let +}: +let inherit (haskell.lib.compose) justStaticExecutables overrideCabal; - drv = - haskellPackages.callCabal2nix "prop-solveur" - (fetchFromGitea { - domain = "git.confusedcompiler.org"; - owner = "leana8959"; - repo = "prop_solveur"; - rev = "cc2430dc5a396b01d02bd925070ce5d009d05bc4"; - hash = "sha256-jwNfRBytf/w0d2CWczXp+rVRXYNzptkuFE3OKSdOhLc="; - }) - {}; + drv = haskellPackages.callCabal2nix "prop-solveur" (fetchFromGitea { + domain = "git.confusedcompiler.org"; + owner = "leana8959"; + repo = "prop_solveur"; + rev = "cc2430dc5a396b01d02bd925070ce5d009d05bc4"; + hash = "sha256-jwNfRBytf/w0d2CWczXp+rVRXYNzptkuFE3OKSdOhLc="; + }) { }; cabalOverrides = o: { - buildTools = o.buildTools or [] ++ [installShellFiles]; - postInstall = - o.postInstall or "" - + '' - installShellCompletion --cmd prop-solveur \ - --bash <("$out/bin/prop-solveur" --bash-completion-script "$out/bin/prop-solveur") \ - --fish <("$out/bin/prop-solveur" --fish-completion-script "$out/bin/prop-solveur") \ - --zsh <("$out/bin/prop-solveur" --zsh-completion-script "$out/bin/prop-solveur") - ''; + buildTools = o.buildTools or [ ] ++ [ installShellFiles ]; + postInstall = o.postInstall or "" + '' + installShellCompletion --cmd prop-solveur \ + --bash <("$out/bin/prop-solveur" --bash-completion-script "$out/bin/prop-solveur") \ + --fish <("$out/bin/prop-solveur" --fish-completion-script "$out/bin/prop-solveur") \ + --zsh <("$out/bin/prop-solveur" --zsh-completion-script "$out/bin/prop-solveur") + ''; }; in - justStaticExecutables - (overrideCabal cabalOverrides drv) +justStaticExecutables (overrideCabal cabalOverrides drv) diff --git a/nix/packages/by-name/ruler/package.nix b/nix/packages/by-name/ruler/package.nix index fb88291c..7ab3f55b 100644 --- a/nix/packages/by-name/ruler/package.nix +++ b/nix/packages/by-name/ruler/package.nix @@ -3,31 +3,26 @@ haskell, fetchFromGitea, installShellFiles, -}: let +}: +let inherit (haskell.lib.compose) justStaticExecutables overrideCabal; - drv = - haskellPackages.callCabal2nix "ruler" - (fetchFromGitea { - domain = "git.confusedcompiler.org"; - owner = "leana8959"; - repo = "ruler"; - rev = "f328620a52b25d4c9dea64425afe5995dfb8cb5a"; - hash = "sha256-8nSVFckWXkf9dRTdzjbHRhf/qPdbXHEkVI4DyW3zfSo="; - }) - {}; + drv = haskellPackages.callCabal2nix "ruler" (fetchFromGitea { + domain = "git.confusedcompiler.org"; + owner = "leana8959"; + repo = "ruler"; + rev = "f328620a52b25d4c9dea64425afe5995dfb8cb5a"; + hash = "sha256-8nSVFckWXkf9dRTdzjbHRhf/qPdbXHEkVI4DyW3zfSo="; + }) { }; cabalOverrides = o: { - buildTools = o.buildTools or [] ++ [installShellFiles]; - postInstall = - o.postInstall or "" - + '' - installShellCompletion --cmd ruler \ - --bash <("$out/bin/ruler" --bash-completion-script "$out/bin/ruler") \ - --fish <("$out/bin/ruler" --fish-completion-script "$out/bin/ruler") \ - --zsh <("$out/bin/ruler" --zsh-completion-script "$out/bin/ruler") - ''; + buildTools = o.buildTools or [ ] ++ [ installShellFiles ]; + postInstall = o.postInstall or "" + '' + installShellCompletion --cmd ruler \ + --bash <("$out/bin/ruler" --bash-completion-script "$out/bin/ruler") \ + --fish <("$out/bin/ruler" --fish-completion-script "$out/bin/ruler") \ + --zsh <("$out/bin/ruler" --zsh-completion-script "$out/bin/ruler") + ''; }; in - justStaticExecutables - (overrideCabal cabalOverrides drv) +justStaticExecutables (overrideCabal cabalOverrides drv) diff --git a/nix/packages/by-name/tmux-sessionizer/package.nix b/nix/packages/by-name/tmux-sessionizer/package.nix index e60e8a45..63ebfc67 100644 --- a/nix/packages/by-name/tmux-sessionizer/package.nix +++ b/nix/packages/by-name/tmux-sessionizer/package.nix @@ -6,10 +6,11 @@ gnused, lib, symlinkJoin, -}: let +}: +let tmux-register-session = writeShellApplication { name = "__tmux-register-session"; - runtimeInputs = [tmux]; + runtimeInputs = [ tmux ]; text = '' last=/tmp/TMUX_LAST @@ -27,7 +28,10 @@ tmux-maybe-create = writeShellApplication { name = "__tmux-maybe-create"; - runtimeInputs = [procps tmux]; + runtimeInputs = [ + procps + tmux + ]; text = '' session_name="$1" session_dir="$2" @@ -40,7 +44,7 @@ tmux-attach-or-switch = writeShellApplication { name = "__tmux-attach-or-switch"; - runtimeInputs = [tmux]; + runtimeInputs = [ tmux ]; text = '' session_name="$1" TMUX=''${TMUX:-} @@ -55,7 +59,10 @@ tmux-sessionizer = writeShellApplication { name = "tmux-sessionizer"; - runtimeInputs = [fzf gnused]; + runtimeInputs = [ + fzf + gnused + ]; text = '' selected=$( { @@ -93,12 +100,12 @@ ''; }; in - symlinkJoin { - name = "tmux-sessionizer"; - paths = [ - tmux-register-session - tmux-maybe-create - tmux-attach-or-switch - tmux-sessionizer - ]; - } +symlinkJoin { + name = "tmux-sessionizer"; + paths = [ + tmux-register-session + tmux-maybe-create + tmux-attach-or-switch + tmux-sessionizer + ]; +} diff --git a/nix/packages/by-name/tokei/package.nix b/nix/packages/by-name/tokei/package.nix index fbaee2fc..77399046 100644 --- a/nix/packages/by-name/tokei/package.nix +++ b/nix/packages/by-name/tokei/package.nix @@ -7,29 +7,33 @@ darwin, zlib, }: -rustPlatform.buildRustPackage (finalAttrs: let - cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml")); - cargoLock = finalAttrs.src + "/Cargo.lock"; -in { - pname = "tokei"; - version = cargoToml.package.version; +rustPlatform.buildRustPackage ( + finalAttrs: + let + cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml")); + cargoLock = finalAttrs.src + "/Cargo.lock"; + in + { + pname = "tokei"; + version = cargoToml.package.version; - src = fetchFromGitHub { - owner = "XAMPPRocky"; - repo = "tokei"; - rev = "v13.0.0-alpha.9"; - hash = "sha256-OSIJYSUwc8SvszEOMgt+d/ljCW2jtBkPw6buof4JpUc="; - }; + src = fetchFromGitHub { + owner = "XAMPPRocky"; + repo = "tokei"; + rev = "v13.0.0-alpha.9"; + hash = "sha256-OSIJYSUwc8SvszEOMgt+d/ljCW2jtBkPw6buof4JpUc="; + }; - cargoLock.lockFile = cargoLock; + cargoLock.lockFile = cargoLock; - buildInputs = lib.optionals stdenv.isDarwin [ - libiconv - darwin.Security - ]; + buildInputs = lib.optionals stdenv.isDarwin [ + libiconv + darwin.Security + ]; - checkInputs = lib.optionals stdenv.isDarwin [zlib]; + checkInputs = lib.optionals stdenv.isDarwin [ zlib ]; - # enable all output formats - buildFeatures = ["all"]; -}) + # enable all output formats + buildFeatures = [ "all" ]; + } +) diff --git a/nix/packages/by-name/typst-bot/package.nix b/nix/packages/by-name/typst-bot/package.nix index 184ac9ab..f7a50b00 100644 --- a/nix/packages/by-name/typst-bot/package.nix +++ b/nix/packages/by-name/typst-bot/package.nix @@ -2,36 +2,37 @@ lib, rustPlatform, fetchFromGitHub, -}: let +}: +let rev = "c9d4b164ff5dc2567bb0de3876460e51da62ba94"; in - rustPlatform.buildRustPackage (finalAttrs: { - pname = "typst-bot"; - version = lib.substring 0 8 rev; +rustPlatform.buildRustPackage (finalAttrs: { + pname = "typst-bot"; + version = lib.substring 0 8 rev; - src = fetchFromGitHub { - owner = "mattfbacon"; - repo = "typst-bot"; - inherit rev; - hash = "sha256-tB+zrE5p7zOloOgoP2fmFsajd4IBf94ET1v/0W3aNcM="; + src = fetchFromGitHub { + owner = "mattfbacon"; + repo = "typst-bot"; + inherit rev; + hash = "sha256-tB+zrE5p7zOloOgoP2fmFsajd4IBf94ET1v/0W3aNcM="; + }; + + preBuild = '' + # Don't use the upstream way of embedding the git rev + echo 'fn main() { println!("cargo:rustc-env=BUILD_SHA=${rev}"); }' > crates/bot/build.rs + + # Patch the command calling the worker by name. + substituteInPlace crates/bot/src/worker.rs --replace-fail \ + '"./worker"' \ + '"${placeholder "out"}/bin/worker"' + ''; + + cargoBuildFlags = [ "--workspace" ]; + + cargoLock = { + lockFile = "${finalAttrs.src}/Cargo.lock"; + outputHashes = { + "poise-0.6.1" = "sha256-iXyp9sR/vzPsexGPdRjfuKyFcGqvDdqiBAXnuw/HFo8="; }; - - preBuild = '' - # Don't use the upstream way of embedding the git rev - echo 'fn main() { println!("cargo:rustc-env=BUILD_SHA=${rev}"); }' > crates/bot/build.rs - - # Patch the command calling the worker by name. - substituteInPlace crates/bot/src/worker.rs --replace-fail \ - '"./worker"' \ - '"${placeholder "out"}/bin/worker"' - ''; - - cargoBuildFlags = ["--workspace"]; - - cargoLock = { - lockFile = "${finalAttrs.src}/Cargo.lock"; - outputHashes = { - "poise-0.6.1" = "sha256-iXyp9sR/vzPsexGPdRjfuKyFcGqvDdqiBAXnuw/HFo8="; - }; - }; - }) + }; +}) diff --git a/nix/packages/by-name/typst-mutilate/package.nix b/nix/packages/by-name/typst-mutilate/package.nix index 1b11b08e..cad4762b 100644 --- a/nix/packages/by-name/typst-mutilate/package.nix +++ b/nix/packages/by-name/typst-mutilate/package.nix @@ -3,27 +3,31 @@ fetchFromGitHub, fetchpatch, }: -rustPlatform.buildRustPackage (finalAttrs: let - cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml")); - cargoLock = finalAttrs.src + "/Cargo.lock"; -in { - pname = "typst-mutilate"; - version = cargoToml.package.version; +rustPlatform.buildRustPackage ( + finalAttrs: + let + cargoToml = fromTOML (builtins.readFile (finalAttrs.src + "/Cargo.toml")); + cargoLock = finalAttrs.src + "/Cargo.lock"; + in + { + pname = "typst-mutilate"; + version = cargoToml.package.version; - src = fetchFromGitHub { - owner = "frozolotl"; - repo = "typst-mutilate"; - rev = "9bf5ed1f8a2f91055a91077f0a8545ff1f229933"; - hash = "sha256-r4fkFv1np8xhff3m8yev1rU1vfKRz8zQMIKIc+fOjew="; - }; + src = fetchFromGitHub { + owner = "frozolotl"; + repo = "typst-mutilate"; + rev = "9bf5ed1f8a2f91055a91077f0a8545ff1f229933"; + hash = "sha256-r4fkFv1np8xhff3m8yev1rU1vfKRz8zQMIKIc+fOjew="; + }; - cargoLock.lockFile = cargoLock; + cargoLock.lockFile = cargoLock; - patches = [ - (fetchpatch { - name = "raw-block-fix"; - url = "https://github.com/frozolotl/typst-mutilate/pull/2/commits/223bc31abb2d5fef4e743a1582bb126a2ef47a45.patch"; - hash = "sha256-+6DMQo4cjVASgkX4gcYrEkwQ/uxttV/61fDnXBqbNcg="; - }) - ]; -}) + patches = [ + (fetchpatch { + name = "raw-block-fix"; + url = "https://github.com/frozolotl/typst-mutilate/pull/2/commits/223bc31abb2d5fef4e743a1582bb126a2ef47a45.patch"; + hash = "sha256-+6DMQo4cjVASgkX4gcYrEkwQ/uxttV/61fDnXBqbNcg="; + }) + ]; + } +) diff --git a/nix/packages/by-name/webtoon_downloader/package.nix b/nix/packages/by-name/webtoon_downloader/package.nix index 3ee408c1..c625ab1a 100644 --- a/nix/packages/by-name/webtoon_downloader/package.nix +++ b/nix/packages/by-name/webtoon_downloader/package.nix @@ -44,7 +44,7 @@ python3.pkgs.buildPythonApplication { "rich" ]; - pythonImportsCheck = ["webtoon_downloader"]; + pythonImportsCheck = [ "webtoon_downloader" ]; nativeCheckInputs = with python3.pkgs; [ pytestCheckHook diff --git a/nix/packages/by-name/xbrightness/package.nix b/nix/packages/by-name/xbrightness/package.nix index c2efe449..1977b4fb 100644 --- a/nix/packages/by-name/xbrightness/package.nix +++ b/nix/packages/by-name/xbrightness/package.nix @@ -4,7 +4,7 @@ }: writeShellApplication { name = "xbrightness"; - runtimeInputs = [bc]; + runtimeInputs = [ bc ]; text = '' device=$1 rel=$2 diff --git a/nix/packages/default.nix b/nix/packages/default.nix index 62311f0f..b72b05c0 100644 --- a/nix/packages/default.nix +++ b/nix/packages/default.nix @@ -1,11 +1,12 @@ -{sources ? import ../../npins}: let - scopeOverlay = overlay: final: prev: {export = prev.export or {} // overlay final prev;}; +{ + sources ? import ../../npins, +}: +let + scopeOverlay = overlay: final: prev: { export = prev.export or { } // overlay final prev; }; in - ( - import sources.nixpkgs { - overlays = map scopeOverlay [ - (import ./overlay.nix) - (import ../overlays/iosevka.nix) - ]; - } - ).export +(import sources.nixpkgs { + overlays = map scopeOverlay [ + (import ./overlay.nix) + (import ../overlays/iosevka.nix) + ]; +}).export diff --git a/nix/packages/overlay.nix b/nix/packages/overlay.nix index 2b635dc2..5ab57ec9 100644 --- a/nix/packages/overlay.nix +++ b/nix/packages/overlay.nix @@ -1,7 +1,7 @@ -final: prev: let +final: prev: +let inherit (prev) lib; in - lib.mapAttrs (name: _: final.callPackage (./by-name + "/${name}/package.nix") {}) - ( - lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./by-name) - ) +lib.mapAttrs (name: _: final.callPackage (./by-name + "/${name}/package.nix") { }) ( + lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./by-name) +) diff --git a/nix/secrets/secrets.nix b/nix/secrets/secrets.nix index 311e3b60..2ac15506 100644 --- a/nix/secrets/secrets.nix +++ b/nix/secrets/secrets.nix @@ -1,6 +1,7 @@ let all = import ../identities.nix; -in { +in +{ "wpa_password.age".publicKeys = all; "restic_backblaze_pwd.age".publicKeys = all; diff --git a/npins/default.nix b/npins/default.nix index 78ca0251..850b02ae 100644 --- a/npins/default.nix +++ b/npins/default.nix @@ -1,11 +1,11 @@ /* -This file is provided under the MIT licence: + This file is provided under the MIT licence: -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ # Generated by npins. Do not modify; will be overwritten regularly let @@ -13,10 +13,8 @@ let version = data.version; # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 - range = first: last: - if first > last - then [] - else builtins.genList (n: first + n) (last - first + 1); + range = + first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1); # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); @@ -29,137 +27,142 @@ let # If the environment variable NPINS_OVERRIDE_${name} is set, then use # the path directly as opposed to the fetched source. # (Taken from Niv for compatibility) - mayOverride = name: path: let - envVarName = "NPINS_OVERRIDE_${saneName}"; - saneName = stringAsChars (c: - if (builtins.match "[a-zA-Z0-9]" c) == null - then "_" - else c) - name; - ersatz = builtins.getEnv envVarName; - in - if ersatz == "" - then path + mayOverride = + name: path: + let + envVarName = "NPINS_OVERRIDE_${saneName}"; + saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name; + ersatz = builtins.getEnv envVarName; + in + if ersatz == "" then + path else # this turns the string into an actual Nix path (for both absolute and # relative paths) builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" ( - if builtins.substring 0 1 ersatz == "/" - then /. + ersatz - else /. + builtins.getEnv "PWD" + "/${ersatz}" + if builtins.substring 0 1 ersatz == "/" then + /. + ersatz + else + /. + builtins.getEnv "PWD" + "/${ersatz}" ); - mkSource = name: spec: - assert spec ? type; let + mkSource = + name: spec: + assert spec ? type; + let path = - if spec.type == "Git" - then mkGitSource spec - else if spec.type == "GitRelease" - then mkGitSource spec - else if spec.type == "PyPi" - then mkPyPiSource spec - else if spec.type == "Channel" - then mkChannelSource spec - else if spec.type == "Tarball" - then mkTarballSource spec - else builtins.throw "Unknown source type ${spec.type}"; + if spec.type == "Git" then + mkGitSource spec + else if spec.type == "GitRelease" then + mkGitSource spec + else if spec.type == "PyPi" then + mkPyPiSource spec + else if spec.type == "Channel" then + mkChannelSource spec + else if spec.type == "Tarball" then + mkTarballSource spec + else + builtins.throw "Unknown source type ${spec.type}"; in - spec - // rec { - outPath = mayOverride name path; + spec + // rec { + outPath = mayOverride name path; - # Waiting for discussion upstream - # https://github.com/andir/npins/issues/159 - asFlake = - if sources ? flake-compat - then (import sources.flake-compat {src = outPath;}).outputs - else throw ".asFlake needs flake-compat as a source"; - }; + # Waiting for discussion upstream + # https://github.com/andir/npins/issues/159 + asFlake = + if sources ? flake-compat then + (import sources.flake-compat { src = outPath; }).outputs + else + throw ".asFlake needs flake-compat as a source"; + }; - mkGitSource = { - repository, - revision, - url ? null, - submodules, - hash, - branch ? null, - ... - }: + mkGitSource = + { + repository, + revision, + url ? null, + submodules, + hash, + branch ? null, + ... + }: assert repository ? type; # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository # In the latter case, there we will always be an url to the tarball - if url != null && !submodules - then - builtins.fetchTarball { - inherit url; - sha256 = hash; # FIXME: check nix version & use SRI hashes - } - else let + if url != null && !submodules then + builtins.fetchTarball { + inherit url; + sha256 = hash; # FIXME: check nix version & use SRI hashes + } + else + let url = - if repository.type == "Git" - then repository.url - else if repository.type == "GitHub" - then "https://github.com/${repository.owner}/${repository.repo}.git" - else if repository.type == "GitLab" - then "${repository.server}/${repository.repo_path}.git" - else throw "Unrecognized repository type ${repository.type}"; - urlToName = url: rev: let - matched = builtins.match "^.*/([^/]*)(\\.git)?$" url; + if repository.type == "Git" then + repository.url + else if repository.type == "GitHub" then + "https://github.com/${repository.owner}/${repository.repo}.git" + else if repository.type == "GitLab" then + "${repository.server}/${repository.repo_path}.git" + else + throw "Unrecognized repository type ${repository.type}"; + urlToName = + url: rev: + let + matched = builtins.match "^.*/([^/]*)(\\.git)?$" url; - short = builtins.substring 0 7 rev; + short = builtins.substring 0 7 rev; - appendShort = - if (builtins.match "[a-f0-9]*" rev) != null - then "-${short}" - else ""; - in "${ - if matched == null - then "source" - else builtins.head matched - }${appendShort}"; + appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else ""; + in + "${if matched == null then "source" else builtins.head matched}${appendShort}"; name = urlToName url revision; in - builtins.fetchGit { - rev = revision; - inherit name; - # hash = hash; - inherit url submodules; - }; + builtins.fetchGit { + rev = revision; + inherit name; + # hash = hash; + inherit url submodules; + }; - mkPyPiSource = { - url, - hash, - ... - }: + mkPyPiSource = + { + url, + hash, + ... + }: builtins.fetchurl { inherit url; sha256 = hash; }; - mkChannelSource = { - url, - hash, - ... - }: + mkChannelSource = + { + url, + hash, + ... + }: builtins.fetchTarball { inherit url; sha256 = hash; }; - mkTarballSource = { - url, - locked_url ? url, - hash, - ... - }: + mkTarballSource = + { + url, + locked_url ? url, + hash, + ... + }: builtins.fetchTarball { url = locked_url; sha256 = hash; }; sources = - if version == 5 - then builtins.mapAttrs mkSource data.pins - else throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"; + if version == 5 then + builtins.mapAttrs mkSource data.pins + else + throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"; in - sources +sources diff --git a/shell.nix b/shell.nix index 292dd1f7..26e3e073 100644 --- a/shell.nix +++ b/shell.nix @@ -1,30 +1,31 @@ { sources ? import ./npins, - pkgs ? - import sources.nixpkgs { - overlays = map import [ - ./nix/overlays/disko.nix - ]; - }, + pkgs ? import sources.nixpkgs { + overlays = map import [ + ./nix/overlays/disko.nix + ]; + }, withGHC ? false, -}: let +}: +let inherit (pkgs) lib; in - pkgs.mkShell { - packages = with pkgs; - [ - just - jq - npins - disko - ] - ++ lib.optionals withGHC [ - (haskellPackages.ghcWithPackages (self: [ - self.xmonad-contrib - self.xmonad-extras - self.xmobar - ])) - haskell-language-server - cabal-install - ]; - } +pkgs.mkShell { + packages = + with pkgs; + [ + just + jq + npins + disko + ] + ++ lib.optionals withGHC [ + (haskellPackages.ghcWithPackages (self: [ + self.xmonad-contrib + self.xmonad-extras + self.xmobar + ])) + haskell-language-server + cabal-install + ]; +}