chore: clean up flake.nix, remove inputs from specialArgs

This commit is contained in:
xinyangli 2024-11-22 13:13:54 +08:00
parent f0bee7364a
commit 9bf25972e9
Signed by: xin
SSH key fingerprint: SHA256:UU5pRTl7NiLFJbWJZa+snLylZSXIz5rgHmwjzv8v4oE
8 changed files with 84 additions and 74 deletions

114
flake.nix
View file

@ -58,35 +58,56 @@
home-manager, home-manager,
nixpkgs, nixpkgs,
nixos-hardware, nixos-hardware,
sops-nix,
flake-utils, flake-utils,
nur, nur,
catppuccin, catppuccin,
my-nixvim, my-nixvim,
nix-vscode-extensions,
colmena,
nix-index-database,
... ...
}@inputs: }:
let let
nixvimOverlay = (final: prev: { nixvim = self.packages.${prev.stdenv.system}.nixvim; }); editorOverlay = (
final: prev: {
inherit (nix-vscode-extensions.extensions.${prev.stdenv.system}) vscode-marketplace;
inherit (self.packages.${prev.stdenv.system}) nixvim;
}
);
overlayModule = overlayModule =
{ ... }: { ... }:
{ {
nixpkgs.overlays = [ nixpkgs.overlays = [
nixvimOverlay editorOverlay
(import ./overlays/add-pkgs.nix) (import ./overlays/add-pkgs.nix)
]; ];
}; };
deploymentModule = { deploymentModule = {
deployment.targetUser = "xin"; deployment.targetUser = "xin";
}; };
sharedColmenaModules = [
self.nixosModules.default
deploymentModule
];
sharedHmModules = [ sharedHmModules = [
inputs.sops-nix.homeManagerModules.sops self.homeManagerModules.default
inputs.nix-index-database.hmModules.nix-index sops-nix.homeManagerModules.sops
nix-index-database.hmModules.nix-index
catppuccin.homeManagerModules.catppuccin catppuccin.homeManagerModules.catppuccin
self.homeManagerModules
]; ];
sharedNixosModules = [
self.nixosModules.default
sops-nix.nixosModules.sops
];
nodeNixosModules = {
calcite = [
nixos-hardware.nixosModules.asus-zephyrus-ga401
nur.nixosModules.nur
catppuccin.nixosModules.catppuccin
machines/calcite/configuration.nix
(mkHome "xin" "calcite")
];
};
sharedColmenaModules = [
deploymentModule
] ++ sharedNixosModules;
mkHome = mkHome =
user: host: user: host:
{ ... }: { ... }:
@ -98,43 +119,29 @@
sharedModules = sharedHmModules; sharedModules = sharedHmModules;
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = {
inherit inputs;
};
}; };
home-manager.users.${user} = (import ./home).${user}.${host}; home-manager.users.${user} = (import ./home).${user}.${host};
} }
]; ];
}; };
mkHomeConfiguration = user: host: {
name = user;
value = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs { system = "x86_64-linux"; };
modules = [
(import ./home).${user}.${host}
overlayModule
] ++ sharedHmModules;
extraSpecialArgs = {
inherit inputs;
};
};
};
mkNixos = mkNixos =
{ {
system, hostname,
modules, system ? null,
specialArgs ? { },
}: }:
nixpkgs.lib.nixosSystem { nixpkgs.lib.nixosSystem {
inherit system; modules = sharedNixosModules ++ nodeNixosModules.${hostname};
specialArgs = specialArgs // { };
inherit inputs system; # TODO:
mkColmenaHive =
{
hostname,
}:
colmena.lib.makeHive {
meta = {
# FIXME:
nixpkgs = import nixpkgs { system = "x86_64-linux"; };
}; };
modules = [
self.nixosModules.default
nur.nixosModules.nur
catppuccin.nixosModules.catppuccin
] ++ modules;
}; };
in in
{ {
@ -145,16 +152,12 @@
overlayModule overlayModule
]; ];
}; };
homeManagerModules = import ./modules/home-manager; homeManagerModules.default = import ./modules/home-manager;
homeConfigurations = builtins.listToAttrs [ (mkHomeConfiguration "xin" "calcite") ]; colmenaHive = colmena.lib.makeHive {
colmenaHive = inputs.colmena.lib.makeHive {
meta = { meta = {
# FIXME:
nixpkgs = import nixpkgs { system = "x86_64-linux"; }; nixpkgs = import nixpkgs { system = "x86_64-linux"; };
specialArgs = {
inherit inputs;
};
}; };
massicot = massicot =
@ -241,12 +244,7 @@
nixosConfigurations = { nixosConfigurations = {
calcite = mkNixos { calcite = mkNixos {
system = "x86_64-linux"; hostname = "calcite";
modules = [
nixos-hardware.nixosModules.asus-zephyrus-ga401
machines/calcite/configuration.nix
(mkHome "xin" "calcite")
];
}; };
} // self.colmenaHive.nodes; } // self.colmenaHive.nodes;
@ -255,6 +253,17 @@
system: system:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
mkHomeConfiguration = user: host: {
name = user;
value = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
(import ./home).${user}.${host}
overlayModule
] ++ sharedHmModules;
};
};
in in
{ {
devShells = { devShells = {
@ -262,16 +271,19 @@
packages = with pkgs; [ packages = with pkgs; [
nix nix
git git
inputs.colmena.packages.${system}.colmena colmena.packages.${system}.colmena
sops sops
nix-output-monitor nix-output-monitor
nil nil
nvd nvd
nh nh
(python3.withPackages (ps: with ps; [ requests ]))
]; ];
}; };
}; };
homeConfigurations = builtins.listToAttrs [ (mkHomeConfiguration "xin" "calcite") ];
packages = { packages = {
nixvim = my-nixvim.packages.${system}.default; nixvim = my-nixvim.packages.${system}.default;
}; };

View file

@ -219,6 +219,7 @@ in
services.smartd.enable = true; services.smartd.enable = true;
# Allow unfree packages # Allow unfree packages
nixpkgs.system = "x86_64-linux";
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
nixpkgs.config.permittedInsecurePackages = [ nixpkgs.config.permittedInsecurePackages = [
"openssl-1.1.1w" "openssl-1.1.1w"

View file

@ -1,12 +1,10 @@
{ {
inputs,
pkgs, pkgs,
... ...
}: }:
{ {
imports = [ imports = [
inputs.sops-nix.nixosModules.sops
./hardware-configuration.nix ./hardware-configuration.nix
./networking.nix ./networking.nix
./services.nix ./services.nix

View file

@ -101,7 +101,6 @@ in
services.matrix-conduit = { services.matrix-conduit = {
enable = true; enable = true;
# package = inputs.conduit.packages.${pkgs.system}.default;
package = pkgs.matrix-conduit; package = pkgs.matrix-conduit;
settings.global = { settings.global = {
server_name = "xinyang.life"; server_name = "xinyang.life";

View file

@ -1,11 +1,9 @@
{ {
inputs,
config, config,
lib, lib,
... ...
}: }:
{ {
imports = [ inputs.sops-nix.nixosModules.sops ];
config = { config = {
sops = { sops = {
defaultSopsFile = ./secrets.yaml; defaultSopsFile = ./secrets.yaml;

View file

@ -1,5 +1,4 @@
{ {
inputs,
config, config,
pkgs, pkgs,
lib, lib,
@ -9,7 +8,6 @@
{ {
imports = [ imports = [
inputs.sops-nix.nixosModules.sops
(modulesPath + "/profiles/qemu-guest.nix") (modulesPath + "/profiles/qemu-guest.nix")
./services ./services
]; ];

View file

@ -1,5 +1,4 @@
{ {
inputs,
config, config,
lib, lib,
pkgs, pkgs,
@ -16,7 +15,7 @@ let
nixd nixd
nixpkgs-fmt nixpkgs-fmt
]; ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [ extension = with pkgs.vscode-marketplace; [
jnoortheen.nix-ide jnoortheen.nix-ide
]; ];
settings = { settings = {
@ -30,13 +29,16 @@ let
clang-tools clang-tools
cmake-format cmake-format
]; ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [ extension =
with pkgs.vscode-marketplace;
[
llvm-vs-code-extensions.vscode-clangd llvm-vs-code-extensions.vscode-clangd
(ms-vscode.cmake-tools.overrideAttrs (_: { (ms-vscode.cmake-tools.overrideAttrs (_: {
sourceRoot = "extension"; sourceRoot = "extension";
})) }))
twxs.cmake twxs.cmake
] ++ (with pkgs.vscode-extensions; [ ms-vscode.cpptools ]); ]
++ (with pkgs.vscode-extensions; [ ms-vscode.cpptools ]);
settings = { settings = {
"cmake.configureOnEdit" = false; "cmake.configureOnEdit" = false;
"cmake.showOptionsMovedNotification" = false; "cmake.showOptionsMovedNotification" = false;
@ -50,7 +52,7 @@ let
}; };
pythonPackages = { pythonPackages = {
systemPackages = with pkgs; [ ]; systemPackages = with pkgs; [ ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [ extension = with pkgs.vscode-marketplace; [
ms-python.python ms-python.python
]; ];
settings = { }; settings = { };
@ -60,7 +62,7 @@ let
coursier coursier
metals metals
]; ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [ extension = with pkgs.vscode-marketplace; [
scala-lang.scala scala-lang.scala
scalameta.metals scalameta.metals
]; ];
@ -68,7 +70,7 @@ let
}; };
latexPackages = { latexPackages = {
systemPackages = with pkgs; [ texliveSmall ]; systemPackages = with pkgs; [ texliveSmall ];
extension = with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [ extension = with pkgs.vscode-marketplace; [
james-yu.latex-workshop james-yu.latex-workshop
]; ];
settings = { settings = {
@ -184,7 +186,7 @@ in
mutableExtensionsDir = false; mutableExtensionsDir = false;
extensions = lib.mkMerge ( extensions = lib.mkMerge (
[ [
(with inputs.nix-vscode-extensions.extensions.${pkgs.system}.vscode-marketplace; [ (with pkgs.vscode-marketplace; [
mkhl.direnv mkhl.direnv
ms-azuretools.vscode-docker ms-azuretools.vscode-docker

View file

@ -1,3 +1,5 @@
(final: prev: { (
oidc-agent = prev.callPackage ./pkgs/oidc-agent { }; final: prev:
}) {
}
)