Set up home-manager properly
This commit is contained in:
parent
aadf94c27e
commit
ba93800317
3 changed files with 54 additions and 3 deletions
22
flake.lock
22
flake.lock
|
@ -19,6 +19,27 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"home-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715077503,
|
||||||
|
"narHash": "sha256-AfHQshzLQfUqk/efMtdebHaQHqVntCMjhymQzVFLes0=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "6e277d9566de9976f47228dd8c580b97488734d4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"ref": "6e277d9566de9976f47228dd8c580b97488734d4",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1714532603,
|
"lastModified": 1714532603,
|
||||||
|
@ -69,6 +90,7 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
|
"home-manager": "home-manager",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"sops-nix": "sops-nix"
|
"sops-nix": "sops-nix"
|
||||||
}
|
}
|
||||||
|
|
11
flake.nix
11
flake.nix
|
@ -4,10 +4,16 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "nixpkgs/38c01297e7ec11f7b9e3f2cae7d6fcec6cc767ec";
|
nixpkgs.url = "nixpkgs/38c01297e7ec11f7b9e3f2cae7d6fcec6cc767ec";
|
||||||
flake-utils.url = "github:numtide/flake-utils?ref=b1d9ab70662946ef0850d488da1c9019f3a9752a";
|
flake-utils.url = "github:numtide/flake-utils?ref=b1d9ab70662946ef0850d488da1c9019f3a9752a";
|
||||||
|
|
||||||
|
home-manager = {
|
||||||
|
url = "github:nix-community/home-manager?ref=6e277d9566de9976f47228dd8c580b97488734d4";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
sops-nix.url = "github:Mic92/sops-nix?ref=f1b0adc27265274e3b0c9b872a8f476a098679bd";
|
sops-nix.url = "github:Mic92/sops-nix?ref=f1b0adc27265274e3b0c9b872a8f476a098679bd";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, flake-utils, sops-nix }: (
|
outputs = { self, nixpkgs, flake-utils, home-manager, sops-nix }: (
|
||||||
let
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
|
|
||||||
|
@ -83,6 +89,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
sops-nix.nixosModules.sops
|
sops-nix.nixosModules.sops
|
||||||
./lib/configuration.nix
|
./lib/configuration.nix
|
||||||
(tryFiles [ ./lib/machines/${name}.nix ] ./lib/hardware/base.nix)
|
(tryFiles [ ./lib/machines/${name}.nix ] ./lib/hardware/base.nix)
|
||||||
|
@ -109,7 +116,7 @@
|
||||||
in
|
in
|
||||||
lib.attrsets.concatMapAttrs (
|
lib.attrsets.concatMapAttrs (
|
||||||
username: user: {
|
username: user: {
|
||||||
"${username}@${hostname}" = {
|
"${username}@${hostname}" = home-manager.lib.homeManagerConfiguration {
|
||||||
modules =
|
modules =
|
||||||
let
|
let
|
||||||
getUserConfig = import ./lib/utils/user-config.nix { inherit lib; };
|
getUserConfig = import ./lib/utils/user-config.nix { inherit lib; };
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ hostname, machineConfig, ... }: {
|
{ hostname, lib, machineConfig, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
./modules/custom-build-vm.nix
|
./modules/custom-build-vm.nix
|
||||||
./modules/custom-sops-nix.nix
|
./modules/custom-sops-nix.nix
|
||||||
|
@ -29,6 +29,28 @@
|
||||||
|
|
||||||
users.myUsers = machineConfig.users;
|
users.myUsers = machineConfig.users;
|
||||||
|
|
||||||
|
home-manager = {
|
||||||
|
useUserPackages = true;
|
||||||
|
useGlobalPkgs = true;
|
||||||
|
|
||||||
|
users =
|
||||||
|
lib.attrsets.concatMapAttrs (username: user:
|
||||||
|
let
|
||||||
|
getUserConfig = import ./utils/user-config.nix { inherit lib; };
|
||||||
|
configPath = getUserConfig { inherit hostname username; };
|
||||||
|
in
|
||||||
|
if (configPath != null)
|
||||||
|
then {
|
||||||
|
${username} = { pkgs, ... }@args: import configPath ({
|
||||||
|
userConfig = {
|
||||||
|
inherit hostname username;
|
||||||
|
} // user;
|
||||||
|
} // args);
|
||||||
|
}
|
||||||
|
else {})
|
||||||
|
machineConfig.users;
|
||||||
|
};
|
||||||
|
|
||||||
# Networking
|
# Networking
|
||||||
networking.hostName = hostname;
|
networking.hostName = hostname;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue