Merge branch 'wip/home-manager-multi-user'
This commit is contained in:
commit
acaa3af476
21
flake.lock
generated
21
flake.lock
generated
@ -21,6 +21,26 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-index-database": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705806513,
|
||||
"narHash": "sha256-FcOmNjhHFfPz2udZbRpZ1sfyhVMr+C2O8kOxPj+HDDk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-index-database",
|
||||
"rev": "f8e04fbcebcc24cebc91989981bd45f69b963ed7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-index-database",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1705641746,
|
||||
@ -72,6 +92,7 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nix-index-database": "nix-index-database",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"pkg-android-tools": "pkg-android-tools"
|
||||
|
58
flake.nix
58
flake.nix
@ -14,6 +14,12 @@
|
||||
# 33.0.3p2 as suggested by https://xdaforums.com/t/guide-january-3-2024-root-pixel-7-pro-unlock-bootloader-pass-safetynet-both-slots-bootable-more.4505353/
|
||||
# android tools versions [ 34.0.0, 34.0.5 ) causes bootloops somehow and 34.0.5 isn't in nixpkgs yet
|
||||
pkg-android-tools.url = "github:NixOS/nixpkgs/55070e598e0e03d1d116c49b9eff322ef07c6ac6";
|
||||
|
||||
# provides an up-to-date database for comma
|
||||
nix-index-database = {
|
||||
url = "github:nix-community/nix-index-database";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, ... }@inputs:
|
||||
@ -47,7 +53,19 @@
|
||||
# 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
|
||||
# configuration
|
||||
homeManagerInit = {system, username ? _username , module}: { config, lib, pkgs, ... }: {
|
||||
homeManagerInit = {system, username ? _username , module ? _ : {}, rootModule ? (import ./home/root.nix), userModules ? { ${username} = [ module ] ; root = [ rootModule ]; }, stateVersion }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
mapUserModules = lib.attrsets.mapAttrs (user: modules: {...}:
|
||||
{
|
||||
imports = modules;
|
||||
config = {
|
||||
home = { inherit stateVersion; };
|
||||
};
|
||||
});
|
||||
users = mapUserModules userModules;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
];
|
||||
@ -55,7 +73,7 @@
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
users.${username} = module;
|
||||
inherit users;
|
||||
extraSpecialArgs = {
|
||||
inherit inputs outputs vars;
|
||||
extraPkgs = mkExtraPkgs system;
|
||||
@ -65,14 +83,23 @@
|
||||
|
||||
# This function produces a nixosSystem which imports configuration.nix and
|
||||
# a Home Manager home.nix for the given user from ./hosts/${hostname}/
|
||||
mkSystem = {system, hostname, username ? _username}:
|
||||
mkSystem = {system, hostname, username ? _username, stateVersion}:
|
||||
lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
({pkgs, config, lib, ...}@args:
|
||||
{
|
||||
# Values for every single system that would not conceivably need
|
||||
# to be made modular
|
||||
system.stateVersion = stateVersion;
|
||||
# not having the freedom to install unfree programs is unfree
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
nix.settings.experimental-features = ["nix-command" "flakes" ];
|
||||
})
|
||||
./hosts/${hostname}/configuration.nix
|
||||
(homeManagerInit {
|
||||
module = import ./hosts/${hostname}/home.nix;
|
||||
inherit username system;
|
||||
inherit username system stateVersion;
|
||||
})
|
||||
];
|
||||
specialArgs = {
|
||||
@ -95,26 +122,10 @@
|
||||
homeManagerModules = (import ./modules/home-manager) moduleInputs;
|
||||
|
||||
nixosConfigurations = {
|
||||
slab = lib.nixosSystem rec {
|
||||
slab = mkSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./hosts/slab/configuration.nix
|
||||
./hosts/slab/nvidia-optimus.nix
|
||||
./system/remote.nix
|
||||
./system/plasma.nix
|
||||
./system/fragments/opengl.nix
|
||||
./system/gaming.nix
|
||||
./system/android.nix
|
||||
# ./system/hyprland.nix
|
||||
(homeManagerInit {
|
||||
module = import ./hosts/slab/home.nix;
|
||||
inherit system;
|
||||
})
|
||||
];
|
||||
specialArgs = {
|
||||
inherit inputs outputs vars;
|
||||
extraPkgs = mkExtraPkgs system;
|
||||
};
|
||||
hostname = "slab";
|
||||
stateVersion = "23.11";
|
||||
};
|
||||
nullbox = lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
@ -127,6 +138,7 @@
|
||||
(homeManagerInit {
|
||||
module = import ./hosts/nullbox/home.nix;
|
||||
inherit system;
|
||||
stateVersion = "23.11";
|
||||
})
|
||||
];
|
||||
};
|
||||
|
10
home/comma.nix
Normal file
10
home/comma.nix
Normal file
@ -0,0 +1,10 @@
|
||||
{ lib, pkgs, config, inputs, ... } @args:
|
||||
{
|
||||
imports = [
|
||||
inputs.nix-index-database.hmModules.nix-index
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
comma
|
||||
];
|
||||
}
|
6
home/root.nix
Normal file
6
home/root.nix
Normal file
@ -0,0 +1,6 @@
|
||||
{ config, lib, pkgs, ... }@args:
|
||||
{
|
||||
imports = [
|
||||
./comma.nix
|
||||
];
|
||||
}
|
@ -16,6 +16,13 @@
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
|
||||
./nvidia-optimus.nix
|
||||
../../system/remote.nix
|
||||
../../system/plasma.nix
|
||||
../../system/fragments/opengl.nix
|
||||
../../system/gaming.nix
|
||||
../../system/android.nix
|
||||
];
|
||||
|
||||
networking.hostName = "slab";
|
||||
|
Loading…
x
Reference in New Issue
Block a user