Rewrite some flake functions
This commit is contained in:
parent
f15cfcf16b
commit
f05904f953
53
flake.nix
53
flake.nix
@ -21,7 +21,6 @@
|
|||||||
let
|
let
|
||||||
inherit (self) outputs;
|
inherit (self) outputs;
|
||||||
# inputs is already defined
|
# inputs is already defined
|
||||||
|
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
systems = [ "x86_64-linux" "aarch64-linux" ];
|
systems = [ "x86_64-linux" "aarch64-linux" ];
|
||||||
|
|
||||||
@ -31,15 +30,22 @@
|
|||||||
# My current timezone for any mobile devices (i.e., my laptop)
|
# My current timezone for any mobile devices (i.e., my laptop)
|
||||||
mobileTimeZone = "Europe/Amsterdam";
|
mobileTimeZone = "Europe/Amsterdam";
|
||||||
|
|
||||||
|
# define extra packages here
|
||||||
|
mkExtraPkgs = system: {
|
||||||
|
# android-tools = inputs.pkg-android-tools.legacyPackages.${system}.android-tools;
|
||||||
|
inherit (inputs.pkg-android-tools.legacyPackages.${system}) android-tools;
|
||||||
|
};
|
||||||
|
|
||||||
# Variables to be passed to NixOS modules in the vars attrset
|
# Variables to be passed to NixOS modules in the vars attrset
|
||||||
vars = {
|
vars = {
|
||||||
inherit username mobileTimeZone;
|
inherit username mobileTimeZone;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
# This function produces a module that adds the home-manager module to the
|
# This function produces a module that adds the home-manager module to the
|
||||||
# system and configures the given module to the user's Home Manager
|
# system and configures the given module to the user's Home Manager
|
||||||
# configuration
|
# configuration
|
||||||
homeManagerInit = user: module: { config, lib, pkgs, ... }: {
|
homeManagerInit = {system, username ? username , module}: { config, lib, pkgs, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
];
|
];
|
||||||
@ -47,28 +53,31 @@
|
|||||||
home-manager = {
|
home-manager = {
|
||||||
useGlobalPkgs = true;
|
useGlobalPkgs = true;
|
||||||
useUserPackages = true;
|
useUserPackages = true;
|
||||||
users.${user} = module;
|
users.${username} = module;
|
||||||
|
extraSpecialArgs = {
|
||||||
|
inherit inputs outputs vars;
|
||||||
|
extraPkgs = mkExtraPkgs system;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mkExtraPkgs = system: {
|
# This function produces a nixosSystem which imports configuration.nix and
|
||||||
android-tools = inputs.pkg-android-tools.legacyPackages.${system}.android-tools;
|
# a Home Manager home.nix for the given user from ./hosts/${hostname}/
|
||||||
};
|
mkSystem = {system, hostname, username ? username}:
|
||||||
|
lib.nixosSystem {
|
||||||
mkSystem = system: hostname:
|
inherit system;
|
||||||
let
|
modules = [
|
||||||
extraPkgs = mkExtraPkgs system;
|
./hosts/${hostname}/configuration.nix
|
||||||
in
|
(homeManagerInit {
|
||||||
lib.nixosSystem {
|
module = import ./hosts/${hostname}/home.nix;
|
||||||
inherit system;
|
inherit username system;
|
||||||
modules = [
|
})
|
||||||
./hosts/${hostname}/configuration.nix
|
];
|
||||||
(homeManagerInit username (import ./hosts/${hostname}/home.nix))
|
specialArgs = {
|
||||||
];
|
inherit inputs outputs vars;
|
||||||
specialArgs = {
|
extraPkgs = mkExtraPkgs system;
|
||||||
inherit inputs outputs vars extraPkgs;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
# for repl debugging via :lf .
|
# for repl debugging via :lf .
|
||||||
@ -88,7 +97,7 @@
|
|||||||
./system/fragments/opengl.nix
|
./system/fragments/opengl.nix
|
||||||
./system/gaming.nix
|
./system/gaming.nix
|
||||||
# ./system/hyprland.nix
|
# ./system/hyprland.nix
|
||||||
(homeManagerInit username (import ./hosts/slab/home.nix))
|
(homeManagerInit {module = import ./hosts/slab/home.nix;})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
nullbox = lib.nixosSystem {
|
nullbox = lib.nixosSystem {
|
||||||
@ -99,7 +108,7 @@
|
|||||||
./system/plasma.nix
|
./system/plasma.nix
|
||||||
./system/fragments/hardware/nvidia-modeset.nix
|
./system/fragments/hardware/nvidia-modeset.nix
|
||||||
./system/gaming.nix
|
./system/gaming.nix
|
||||||
(homeManagerInit username (import ./hosts/nullbox/home.nix))
|
(homeManagerInit {module = import ./hosts/nullbox/home.nix;})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user