refactor: massive refactor using flake-parts; use typos-cli and

keep-sorted
This commit is contained in:
2025-12-20 12:57:47 +08:00
parent d5f027f586
commit bc197eb3ca
21 changed files with 466 additions and 455 deletions

View File

@@ -9,7 +9,7 @@
};
share = {
path = "/mnt/nas/share";
browseable = "yes";
browsable = "yes";
"read only" = "no";
"guest ok" = "no";
"create mask" = "0664";

54
flake.lock generated
View File

@@ -292,6 +292,26 @@
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1765835352,
"narHash": "sha256-XswHlK/Qtjasvhd1nOa1e8MgZ8GS//jBoTqWtrS1Giw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "a34fae9c08a15ad73f295041fec82323541400a9",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_3": {
"inputs": {
"nixpkgs-lib": [
"go-musicfox",
@@ -314,7 +334,7 @@
"type": "github"
}
},
"flake-parts_3": {
"flake-parts_4": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
@@ -331,7 +351,7 @@
"type": "indirect"
}
},
"flake-parts_4": {
"flake-parts_5": {
"inputs": {
"nixpkgs-lib": [
"stylix",
@@ -473,7 +493,7 @@
"go-musicfox": {
"inputs": {
"devenv": "devenv",
"flake-parts": "flake-parts_3",
"flake-parts": "flake-parts_4",
"flake-root": "flake-root",
"mission-control": "mission-control",
"mk-shell-bin": "mk-shell-bin",
@@ -483,11 +503,11 @@
]
},
"locked": {
"lastModified": 1762961141,
"narHash": "sha256-q6B/qUbz2JvCLg3ZQKf24xsIICJz5Lh77Ki+fInfllU=",
"lastModified": 1766200280,
"narHash": "sha256-FGYAy+d0lJrsjvlnJi79jYBXm8NP1BLiYmYXze/3pRA=",
"owner": "imxyy1soope1",
"repo": "go-musicfox",
"rev": "266ae5f6a791e16a7afdc3d08b6294ceff0ec4d8",
"rev": "d7ac9fe76572eeef9fb4c8113d52243430497790",
"type": "github"
},
"original": {
@@ -713,7 +733,7 @@
"go-musicfox",
"devenv"
],
"flake-parts": "flake-parts_2",
"flake-parts": "flake-parts_3",
"libgit2": "libgit2",
"nixpkgs": "nixpkgs_2",
"nixpkgs-23-11": [
@@ -900,22 +920,6 @@
"type": "github"
}
},
"nixpkgs-working": {
"locked": {
"lastModified": 1762844143,
"narHash": "sha256-SlybxLZ1/e4T2lb1czEtWVzDCVSTvk9WLwGhmxFmBxI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"rev": "9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1717432640,
@@ -1049,6 +1053,7 @@
"catppuccin": "catppuccin",
"darkly": "darkly",
"fenix": "fenix",
"flake-parts": "flake-parts_2",
"go-musicfox": "go-musicfox",
"haumea": "haumea",
"home-manager": "home-manager",
@@ -1063,7 +1068,6 @@
"nixpkgs-master": "nixpkgs-master",
"nixpkgs-stable": "nixpkgs-stable_2",
"nixpkgs-unstable": "nixpkgs-unstable",
"nixpkgs-working": "nixpkgs-working",
"noctalia": "noctalia",
"plant": "plant",
"sops-nix": "sops-nix",
@@ -1117,7 +1121,7 @@
"base16-helix": "base16-helix",
"base16-vim": "base16-vim",
"firefox-gnome-theme": "firefox-gnome-theme",
"flake-parts": "flake-parts_4",
"flake-parts": "flake-parts_5",
"gnome-shell": "gnome-shell",
"nixpkgs": [
"nixpkgs"

290
flake.nix
View File

@@ -6,253 +6,115 @@
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/release-25.11";
nixpkgs-master.url = "github:nixos/nixpkgs/master";
nixpkgs-working.url = "github:nixos/nixpkgs/9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4";
# nixpkgs.follows = "nixpkgs-stable";
nixpkgs.follows = "nixpkgs-unstable";
# nixpkgs.follows = "nixpkgs-master";
# TODO: sops-nix: remove pr patch once merged
# https://github.com/Mic92/sops-nix/pull/779
sops-nix = {
url = "github:Mic92/sops-nix/pull/779/merge";
inputs.nixpkgs.follows = "nixpkgs";
};
# Home manager
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
# Impermanence
impermanence.url = "github:nix-community/impermanence";
# Niri
niri.url = "github:sodiboo/niri-flake";
darkly = {
url = "github:Bali10050/Darkly";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
url = "github:danth/stylix";
inputs.nixpkgs.follows = "nixpkgs";
};
# go-musicfox
go-musicfox = {
url = "github:imxyy1soope1/go-musicfox";
inputs.nixpkgs.follows = "nixpkgs";
};
# NixOS-WSL
nixos-wsl = {
url = "github:nix-community/NixOS-WSL";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
# Flake organization tools
# keep-sorted start block=yes
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
zen.url = "github:0xc000022070/zen-browser-flake";
zen.inputs.nixpkgs.follows = "nixpkgs";
noctalia = {
url = "github:noctalia-dev/noctalia-shell/v3.7.1";
inputs.nixpkgs.follows = "nixpkgs";
};
angrr = {
url = "github:linyinfeng/angrr";
inputs.nixpkgs.follows = "nixpkgs";
};
plant = {
url = "git+ssh://git@git.imxyy.top:2222/imxyy1soope1/HF-plant.git?rev=08dc0b3889797eb3618c7475c3c367ec0e5fdf40";
flake = false;
};
catppuccin = {
url = "github:catppuccin/nix";
inputs.nixpkgs.follows = "nixpkgs";
};
infuse = {
url = "git+https://codeberg.org/amjoseph/infuse.nix";
flake = false;
};
haumea = {
url = "github:nix-community/haumea/v0.2.2";
inputs.nixpkgs.follows = "nixpkgs";
};
infuse = {
url = "git+https://codeberg.org/amjoseph/infuse.nix";
flake = false;
};
# keep-sorted end
# Useful modules
# keep-sorted start block=yes
catppuccin = {
url = "github:catppuccin/nix";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence.url = "github:nix-community/impermanence";
# TODO: sops-nix: remove pr patch once merged
# https://github.com/Mic92/sops-nix/pull/779
sops-nix = {
url = "github:Mic92/sops-nix/pull/779/merge";
inputs.nixpkgs.follows = "nixpkgs";
};
stylix = {
url = "github:danth/stylix";
inputs.nixpkgs.follows = "nixpkgs";
};
# keep-sorted end
# Useful software
# keep-sorted start block=yes
angrr = {
url = "github:linyinfeng/angrr";
inputs.nixpkgs.follows = "nixpkgs";
};
darkly = {
url = "github:Bali10050/Darkly";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
go-musicfox = {
url = "github:imxyy1soope1/go-musicfox";
inputs.nixpkgs.follows = "nixpkgs";
};
niri.url = "github:sodiboo/niri-flake";
noctalia = {
url = "github:noctalia-dev/noctalia-shell/v3.7.1";
inputs.nixpkgs.follows = "nixpkgs";
};
zen.inputs.nixpkgs.follows = "nixpkgs";
zen.url = "github:0xc000022070/zen-browser-flake";
# keep-sorted end
# Misc
treefmt.url = "github:numtide/treefmt-nix";
plant = {
url = "git+ssh://git@git.imxyy.top:2222/imxyy1soope1/HF-plant.git?rev=08dc0b3889797eb3618c7475c3c367ec0e5fdf40";
flake = false;
};
my-templates.url = "git+https://git.imxyy.top/imxyy1soope1/flake-templates";
};
outputs =
{
self,
nixpkgs,
flake-parts,
...
}@inputs:
let
inherit (self) outputs;
vars = import ./vars.nix;
forAllSystems = lib.genAttrs lib.systems.flakeExposed;
forAllHosts =
mkSystem:
lib.mergeAttrsList (
builtins.map (hostname: {
${hostname} = mkSystem hostname;
}) (builtins.attrNames (builtins.readDir ./config/hosts))
);
lib = (import ./lib/stdlib-extended.nix nixpkgs.lib).extend (
final: prev: {
inherit (inputs.home-manager.lib) hm;
inherit infuse;
haumea = inputs.haumea.lib;
}
);
infuse = (import inputs.infuse { inherit (nixpkgs) lib; }).v1.infuse;
in
flake-parts.lib.mkFlake
{
packages = forAllSystems (
system:
lib.haumea.load {
src = ./pkgs;
loader = [
inherit inputs;
specialArgs.lib = import ./lib {
inherit (inputs.nixpkgs) lib;
inherit inputs;
};
}
{
matches = str: builtins.match ".*\\.nix" str != null;
loader = _: path: nixpkgs.legacyPackages.${system}.callPackage path { };
}
systems = [
"x86_64-linux"
];
transformer = lib.haumea.transformers.liftDefault;
}
);
formatter = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
treefmtEval = inputs.treefmt.lib.evalModule pkgs ./treefmt.nix;
in
treefmtEval.config.build.wrapper
);
check = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
treefmtEval = inputs.treefmt.lib.evalModule pkgs ./treefmt.nix;
in
{
formatting = treefmtEval.config.build.check self;
}
);
overlays = import ./overlays {
inherit inputs lib;
};
nixosConfigurations = forAllHosts (
hostname:
let
overlays = builtins.attrValues self.overlays ++ [
inputs.go-musicfox.overlays.default
inputs.niri.overlays.niri
inputs.fenix.overlays.default
inputs.angrr.overlays.default
(final: prev: {
darkly-qt5 = inputs.darkly.packages.${final.stdenv.hostPlatform.system}.darkly-qt5;
darkly-qt6 = inputs.darkly.packages.${final.stdenv.hostPlatform.system}.darkly-qt6;
noctalia-shell = inputs.noctalia.packages.${final.stdenv.hostPlatform.system}.default;
})
(final: prev: {
inherit lib;
})
];
home = {
home-manager = {
sharedModules = [
inputs.sops-nix.homeManagerModules.sops
inputs.impermanence.nixosModules.home-manager.impermanence
inputs.stylix.homeModules.stylix
inputs.noctalia.homeModules.default
inputs.zen.homeModules.beta
# workaround for annoying stylix
(
{ lib, ... }:
{
nixpkgs.overlays = lib.mkForce null;
}
)
];
useGlobalPkgs = true;
};
};
pkgsConf.nixpkgs = {
inherit overlays;
config.allowUnfree = true;
flake.setNixPath = false;
};
in
lib.nixosSystem {
specialArgs = {
inherit
inputs
outputs
hostname
;
assets =
with lib.haumea;
load {
src = ./assets;
loader = [
(matchers.always loaders.path)
];
};
secrets =
with lib.haumea;
load {
src = ./secrets;
loader = [
(matchers.always loaders.path)
imports = [
./nixos.nix
./treefmt.nix
./pkgs
./overlays
];
};
}
// vars;
modules =
(lib.umport {
paths = [ ./modules ];
exclude = [
./modules/virt/types
];
recursive = true;
})
++ (lib.umport {
paths = [ ./config/hosts/${hostname} ];
recursive = true;
})
++ [
(lib.mkAliasOptionModule [ "my" "hm" ] [ "home-manager" "users" vars.username ])
./config/base.nix
inputs.sops-nix.nixosModules.sops
inputs.impermanence.nixosModules.impermanence
inputs.home-manager.nixosModules.default
inputs.niri.nixosModules.niri
inputs.catppuccin.nixosModules.catppuccin
inputs.angrr.nixosModules.angrr
home
pkgsConf
];
}
);
};
}

View File

@@ -1,102 +1,10 @@
{ lib }:
{
makeSwitch =
{
default ? false,
config,
optionPath,
optionName,
config',
}:
let
cfg = lib.getAttrFromPath optionPath config.my;
in
{
options.my = lib.setAttrByPath optionPath {
enable = (lib.mkEnableOption optionName) // {
inherit default;
};
};
config = lib.mkIf cfg.enable config';
};
makeHomePackageConfig =
{
config,
pkgs,
packageName,
packagePath,
optionPath,
extraConfig ? { },
}:
lib.my.makeSwitch {
inherit config optionPath;
optionName = packageName;
config' = lib.mkMerge [
{
my.hm.home.packages = [ (lib.getAttrFromPath packagePath pkgs) ];
}
extraConfig
];
};
makeHomeProgramConfig =
{
config,
programName,
optionPath,
extraConfig ? { },
}:
lib.my.makeSwitch {
inherit config optionPath;
optionName = programName;
config' = lib.mkMerge [
{
my.hm.programs = lib.setAttrByPath [ programName "enable" ] true;
}
extraConfig
];
};
makeNixosPackageConfig =
{
config,
pkgs,
packageName,
packagePath,
optionPath,
extraConfig ? { },
}:
lib.my.makeSwitch {
inherit config optionPath;
optionName = packageName;
config' = lib.mkMerge [
{
environment.systemPackages = [ (lib.getAttrFromPath packagePath pkgs) ];
}
extraConfig
];
};
makeNixosProgramConfig =
{
config,
programName,
optionPath,
extraConfig ? { },
}:
lib.my.makeSwitch {
inherit config optionPath;
optionName = programName;
config' = lib.mkMerge [
{
programs = lib.setAttrByPath [ programName "enable" ] true;
}
extraConfig
];
};
{ lib, inputs }:
lib.extend (
self: super: {
my = import ./my.nix { lib = self; };
umport = import ./umport.nix { lib = self; };
inherit (inputs.home-manager.lib) hm;
haumea = inputs.haumea.lib;
infuse = (import inputs.infuse { inherit lib; }).v1.infuse;
}
)

102
lib/my.nix Normal file
View File

@@ -0,0 +1,102 @@
{ lib }:
{
makeSwitch =
{
default ? false,
config,
optionPath,
optionName,
config',
}:
let
cfg = lib.getAttrFromPath optionPath config.my;
in
{
options.my = lib.setAttrByPath optionPath {
enable = (lib.mkEnableOption optionName) // {
inherit default;
};
};
config = lib.mkIf cfg.enable config';
};
makeHomePackageConfig =
{
config,
pkgs,
packageName,
packagePath,
optionPath,
extraConfig ? { },
}:
lib.my.makeSwitch {
inherit config optionPath;
optionName = packageName;
config' = lib.mkMerge [
{
my.hm.home.packages = [ (lib.getAttrFromPath packagePath pkgs) ];
}
extraConfig
];
};
makeHomeProgramConfig =
{
config,
programName,
optionPath,
extraConfig ? { },
}:
lib.my.makeSwitch {
inherit config optionPath;
optionName = programName;
config' = lib.mkMerge [
{
my.hm.programs = lib.setAttrByPath [ programName "enable" ] true;
}
extraConfig
];
};
makeNixosPackageConfig =
{
config,
pkgs,
packageName,
packagePath,
optionPath,
extraConfig ? { },
}:
lib.my.makeSwitch {
inherit config optionPath;
optionName = packageName;
config' = lib.mkMerge [
{
environment.systemPackages = [ (lib.getAttrFromPath packagePath pkgs) ];
}
extraConfig
];
};
makeNixosProgramConfig =
{
config,
programName,
optionPath,
extraConfig ? { },
}:
lib.my.makeSwitch {
inherit config optionPath;
optionName = programName;
config' = lib.mkMerge [
{
programs = lib.setAttrByPath [ programName "enable" ] true;
}
extraConfig
];
};
}

View File

@@ -1,14 +0,0 @@
# Just a convenience function that returns the given Nixpkgs standard
# library extended with the imxyy library.
stdlib:
let
mkMyLib = import ./.;
in
stdlib.extend (
self: super: {
my = mkMyLib { lib = self; };
umport = import ./umport.nix { lib = self; };
}
)

View File

@@ -16,7 +16,6 @@ lib.my.makeSwitch {
environment.systemPackages = with pkgs; [
vim
wget
git
file
gnused
@@ -39,8 +38,6 @@ lib.my.makeSwitch {
dnsutils
killall
comma
];
programs.dconf.enable = true;
@@ -51,16 +48,20 @@ lib.my.makeSwitch {
];
my.hm = {
home.packages = with pkgs; [
lsd
fd
neofetch
fastfetch
fzf
bat
ripgrep
# keep-sorted start
aria2
bat
comma
fastfetch
fd
fzf
keep-sorted
lsd
neofetch
ripgrep
socat
typos
# keep-sorted end
];
programs.tmux = {
enable = true;

View File

@@ -18,7 +18,7 @@ theme[main_fg]="#D8DEE9"
# Title color for boxes
theme[title]="#8FBCBB"
# Higlight color for keyboard shortcuts
# Highlight color for keyboard shortcuts
theme[hi_fg]="#5E81AC"
# Background color of selected item in processes box

View File

@@ -22,6 +22,7 @@ lib.my.makeSwitch {
url = "https://raw.githubusercontent.com/folke/tokyonight.nvim/refs/tags/v4.14.1/extras/fish_themes/tokyonight_storm.theme";
sha256 = "02n1w5x65683c8mlwg1rav06iqm3xk90zq45qmygpm7pzyn8dqh1";
};
programs.starship.enableFishIntegration = false;
programs.fish = {
enable = true;
plugins = [
@@ -34,6 +35,15 @@ lib.my.makeSwitch {
hash = "sha256-yef5NX4HdZ3ab/2AzNrvvhi0CbeTvXYKZmyH76gIpyk=";
};
}
{
name = "starship";
src = pkgs.fetchFromGitHub {
owner = "tyler-stefani";
repo = "starship";
rev = "fff9bc53ef9997775d31d860246af88cd7721ec8";
hash = "sha256-S/Vt/jfYTCrMXXfu6YUIv+d0RoT7GYG1isayhtHc7DA=";
};
}
];
shellAliases = {
la = "lsd -lah";

View File

@@ -29,6 +29,8 @@ lib.my.makeHomeProgramConfig {
gcc # treesitter
ripgrep # telescope
typos-lsp
];
};
};

View File

@@ -37,7 +37,7 @@ vim.g.autoread = true
vim.g.loaded_ruby_provider = 0
-- Hightlight on yank
-- Highlight on yank
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
vim.api.nvim_create_autocmd("TextYankPost", {
callback = function()
@@ -55,12 +55,12 @@ vim.cmd([[
\ endif
]])
-- Automaticly switch input method
-- Automatically switch input method
Last_input_method = 1
vim.api.nvim_create_augroup("AutoInputMethod", {})
vim.api.nvim_create_autocmd("InsertLeave", {
pattern = "*",
desc = "Automaticly switch input method",
desc = "Automatically switch input method",
callback = function()
Last_input_method = require("core.globals").switch_input_method(1)
end,
@@ -68,7 +68,7 @@ vim.api.nvim_create_autocmd("InsertLeave", {
})
vim.api.nvim_create_autocmd("CmdlineLeave", {
pattern = "*",
desc = "Automaticly switch input method",
desc = "Automatically switch input method",
callback = function()
require("core.globals").switch_input_method(1)
end,
@@ -76,7 +76,7 @@ vim.api.nvim_create_autocmd("CmdlineLeave", {
})
vim.api.nvim_create_autocmd("InsertEnter", {
pattern = "*",
desc = "Automaticly switch input method",
desc = "Automatically switch input method",
callback = function()
require("core.globals").switch_input_method(Last_input_method)
end,

View File

@@ -42,7 +42,16 @@ local servers = {
command = { "nixfmt" },
},
nixpkgs = {
expr = "import <nixpkgs> { }",
expr = [[
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
nodeName = lock.nodes.root.inputs.nixpkgs;
in
import (fetchTarball {
url = lock.nodes.${nodeName}.locked.url or "https://github.com/NixOS/nixpkgs/archive/${lock.nodes.${nodeName}.locked.rev}.tar.gz";
sha256 = lock.nodes.${nodeName}.locked.narHash;
}) { }
]],
},
},
},
@@ -54,14 +63,17 @@ local servers = {
qmlls = {
cmd = { "qmlls", "-E" },
},
pyright = {},
gopls = {},
-- keep-sorted start
clangd = {},
ts_ls = {},
jsonls = {},
cssls = {},
gopls = {},
html = {},
java_language_server = {},
jsonls = {},
pyright = {},
ts_ls = {},
typos_lsp = {},
-- keep-sorted end
}
local capabilities = require("cmp_nvim_lsp").default_capabilities()

View File

@@ -25,7 +25,7 @@ lib.my.makeSwitch {
settings = {
globalOptions = {
"PreeditEnabledByDefault"."0" = true;
"Hotkey"."EnumrateWithTriggerKeys" = false;
"Hotkey"."EnumerateWithTriggerKeys" = false;
"Hotkey/TriggerKeys"."0" = "";
"Hotkey/AltTriggerKeys"."0" = "Shift_L";
"Hotkey/EnumerateForwardKeys"."0" = "";

View File

@@ -1,5 +1,6 @@
{
inputs,
self,
config,
lib,
pkgs,
@@ -16,7 +17,7 @@ lib.my.makeSwitch {
# This will add each flake input as a registry
# To make nix3 commands consistent with your flake
nix.registry = (lib.mapAttrs (_: flake: { inherit flake; })) (
(lib.filterAttrs (_: lib.isType "flake")) inputs
((lib.filterAttrs (_: lib.isType "flake")) inputs) // { flake = self; }
);
# This will additionally add your inputs to the system's legacy channels

View File

@@ -2,7 +2,7 @@
{
options = {
grabKeyboard = lib.mkOption {
description = "Grab the keybaord in capture mode";
description = "Grab the keyboard in capture mode";
default = true;
type = lib.types.bool;
};

View File

@@ -38,7 +38,7 @@
};
clipboardToLocal = lib.mkOption {
description = "Allow the clipbaord to be synchronized FROM the VM";
description = "Allow the clipboard to be synchronized FROM the VM";
default = true;
type = lib.types.bool;
};
@@ -56,7 +56,7 @@
};
captureOnStart = lib.mkOption {
description = "Capture mouse and keybaord on start";
description = "Capture mouse and keyboard on start";
default = false;
type = lib.types.bool;
};

89
nixos.nix Normal file
View File

@@ -0,0 +1,89 @@
{
self,
withSystem,
lib,
inputs,
...
}:
let
forAllHosts =
mkSystem:
lib.mergeAttrsList (
builtins.map (hostname: {
${hostname} = mkSystem hostname;
}) (builtins.attrNames (builtins.readDir ./config/hosts))
);
pkgsModule =
{ config, ... }:
withSystem config.nixpkgs.hostPlatform.system (perSystem: {
nixpkgs.pkgs = perSystem.pkgs;
});
hmModule = {
home-manager = {
sharedModules = [
inputs.sops-nix.homeManagerModules.sops
inputs.impermanence.nixosModules.home-manager.impermanence
inputs.stylix.homeModules.stylix
inputs.noctalia.homeModules.default
inputs.zen.homeModules.beta
];
useGlobalPkgs = true;
};
};
vars = import ./vars.nix;
in
{
flake.nixosConfigurations = forAllHosts (
hostname:
lib.nixosSystem {
specialArgs = {
inherit
inputs
self
hostname
;
assets =
with lib.haumea;
load {
src = ./assets;
loader = [
(matchers.always loaders.path)
];
};
secrets =
with lib.haumea;
load {
src = ./secrets;
loader = [
(matchers.always loaders.path)
];
};
}
// vars;
modules =
(lib.umport {
paths = [ ./modules ];
exclude = [
./modules/virt/types
];
recursive = true;
})
++ (lib.umport {
paths = [ ./config/hosts/${hostname} ];
recursive = true;
})
++ [
(lib.mkAliasOptionModule [ "my" "hm" ] [ "home-manager" "users" vars.username ])
./config/base.nix
inputs.sops-nix.nixosModules.sops
inputs.impermanence.nixosModules.impermanence
inputs.home-manager.nixosModules.default
inputs.niri.nixosModules.niri
inputs.catppuccin.nixosModules.catppuccin
inputs.angrr.nixosModules.angrr
pkgsModule
hmModule
];
}
);
}

View File

@@ -1,69 +1,27 @@
{
inputs,
lib,
...
}:
{
additions =
final: prev:
lib.haumea.load {
src = ../pkgs;
loader = [
{
matches = str: builtins.match ".*\\.nix" str != null;
loader = _: path: final.callPackage path { };
}
];
transformer = lib.haumea.transformers.liftDefault;
let
mkPkgs = type: final: _prev: {
${type} = import inputs."nixpkgs-${type}" {
system = final.stdenv.hostPlatform.system;
config.allowUnfree = true;
};
};
in
{
flake.overlays = {
modifications =
final: prev:
lib.infuse prev {
cage.__output.patches.__append = [ ./cage-specify-output-name.patch ];
matrix-synapse.__assign = final.stable.matrix-synapse;
bottles.__input.removeWarningPopup.__assign = true;
sing-box.__assign = prev.sing-box.overrideAttrs (finalAttrs: {
version = "1.11.14";
src = final.fetchFromGitHub {
owner = "qjebbs";
repo = "sing-box";
# due to faulty tag generation
tag = "v${finalAttrs.version}+rev";
hash = "sha256-/p2PBTeeRJW3iq/BXJlw/Qn92Nrnw9fmUn5yNGl/o34=";
};
vendorHash = "sha256-C2HCNOzP1Jg3vz2i9uPmM1wC7Sw2YNt7MdYn939cu1Y=";
postInstall = "";
});
};
# this allows us to access specific version of nixpkgs
# by `pkgs.unstable`, `pkgs.stable` and `pkgs.master`
unstable-packages = final: _prev: {
unstable = import inputs.nixpkgs-unstable {
system = final.stdenv.hostPlatform.system;
config.allowUnfree = true;
};
};
stable-packages = final: _prev: {
stable = import inputs.nixpkgs-stable {
system = final.stdenv.hostPlatform.system;
config.allowUnfree = true;
};
};
master-packages = final: _prev: {
master = import inputs.nixpkgs-master {
system = final.stdenv.hostPlatform.system;
config.allowUnfree = true;
};
};
working-packages = final: _prev: {
working = import inputs.nixpkgs-working {
system = final.stdenv.hostPlatform.system;
config.allowUnfree = true;
};
};
}
//
# this allows us to access specific version of nixpkgs
# by `pkgs.unstable`, `pkgs.stable` and `pkgs.master`
lib.genAttrs [ "stable" "unstable" "master" ] mkPkgs;
}

52
pkgs/default.nix Normal file
View File

@@ -0,0 +1,52 @@
{
inputs,
lib,
config,
...
}:
{
perSystem =
{ system, pkgs, ... }:
{
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = builtins.attrValues config.flake.overlays ++ [
inputs.go-musicfox.overlays.default
inputs.niri.overlays.niri
inputs.fenix.overlays.default
inputs.angrr.overlays.default
(final: prev: {
darkly-qt5 = inputs.darkly.packages.${final.stdenv.hostPlatform.system}.darkly-qt5;
darkly-qt6 = inputs.darkly.packages.${final.stdenv.hostPlatform.system}.darkly-qt6;
noctalia-shell = inputs.noctalia.packages.${final.stdenv.hostPlatform.system}.default;
})
];
config.allowUnfree = true;
flake.setNixPath = false;
};
legacyPackages = pkgs;
packages = lib.genAttrs (builtins.attrNames (config.flake.overlays.additions pkgs pkgs)) (
pkg: pkgs.${pkg}
);
};
flake.overlays.additions =
final: prev:
let
paths = [
./fcitx5-lightly
./mono-gtk-theme.nix
./ttf-wps-fonts.nix
./wps-office-fonts.nix
];
in
builtins.listToAttrs (
map (path: {
name = builtins.elemAt (lib.splitString "." (builtins.baseNameOf path)) 0;
value = final.callPackage path { };
}) paths
);
}

View File

@@ -1,8 +1,16 @@
{ ... }:
{ inputs, ... }:
{
imports = [ inputs.treefmt.flakeModule ];
perSystem.treefmt = {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
stylua.enable = true;
keep-sorted.enable = true;
typos = {
enable = true;
configFile = "typos.toml";
};
};
};
}

16
typos.toml Normal file
View File

@@ -0,0 +1,16 @@
[files]
extend-exclude = [
"secrets"
]
[default.extend-words]
# noice.nvim
noice = "noice"
enew = "enew"
iif = "iif"
[default]
extend-ignore-identifiers-re = [
"KEY_102ND",
"VE_UE"
]