feat: split hm from system

Signed-off-by: jolheiser <john.olheiser@gmail.com>
teamcity
jolheiser 2024-04-03 16:57:19 -05:00
parent af5925da19
commit 6a5f3da703
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
3 changed files with 72 additions and 42 deletions

View File

@ -124,28 +124,22 @@
}) })
inputs.golink.overlay inputs.golink.overlay
]; ];
pkgs = import nixpkgs {
inherit overlays;
system = "x86_64-linux";
config.allowUnfree = true;
};
userSecret = path: { userSecret = path: {
file = path; file = path;
owner = username; owner = username;
}; };
commonConfig = {gui ? true}: {config, ...}: { commonConfig = {config, ...}: {
config = { config = {
nixpkgs.overlays = overlays; nixpkgs.overlays = overlays;
# TODO Remove when apps are updated # TODO Remove when apps are updated
nixpkgs.config.permittedInsecurePackages = [ nixpkgs.config.permittedInsecurePackages = [
"electron-25.9.0" "electron-25.9.0"
]; ];
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${username}.imports =
if gui
then [./apps/gui]
else [./apps/nogui];
extraSpecialArgs = {
flakePath = "/home/${username}/.config/nixpkgs";
};
};
age.secrets = { age.secrets = {
ssh-config = userSecret ./secrets/shared/ssh-config.age; ssh-config = userSecret ./secrets/shared/ssh-config.age;
ssh-config-work = userSecret ./secrets/shared/ssh-config-work.age; ssh-config-work = userSecret ./secrets/shared/ssh-config-work.age;
@ -166,9 +160,8 @@
}; };
}; };
workModules = [ workModules = [
home-manager.nixosModules.home-manager
agenix.nixosModules.default agenix.nixosModules.default
(commonConfig {}) commonConfig
({pkgs, ...}: { ({pkgs, ...}: {
config = { config = {
nixpkgs.overlays = [ nixpkgs.overlays = [
@ -176,10 +169,6 @@
py39 = import nixpkgs-py39 {inherit (pkgs) system;}; py39 = import nixpkgs-py39 {inherit (pkgs) system;};
}) })
]; ];
home-manager.users.${username}.programs = {
git.package = pkgs.gitSVN;
firefox.profiles.default.bookmarks = [(import ./apps/gui/firefox/work.nix)];
};
age.secrets = { age.secrets = {
netrc = { netrc = {
file = ./secrets/work/netrc.age; file = ./secrets/work/netrc.age;
@ -204,6 +193,40 @@
username = "jolheiser"; username = "jolheiser";
in in
{ {
homeConfigurations = let
commonModules = [
{
home = {
inherit username;
homeDirectory = "/home/${username}";
};
}
./apps/gui
];
in {
"jolheiser" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = commonModules;
};
"work" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules =
commonModules
++ [
{
nixpkgs.overlays = [
(_: _: {
py39 = import nixpkgs-py39 {inherit (pkgs) system;};
})
];
programs = {
git.package = pkgs.gitSVN;
firefox.profiles.default.bookmarks = [(import ./apps/gui/firefox/work.nix)];
};
}
];
};
};
nixosConfigurations = { nixosConfigurations = {
"chai" = nixpkgs.lib.nixosSystem { "chai" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
@ -233,29 +256,26 @@
"matcha" = nixpkgs.lib.nixosSystem { "matcha" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
home-manager.nixosModules.home-manager
agenix.nixosModules.default agenix.nixosModules.default
./machines/matcha ./machines/matcha
(commonConfig {}) commonConfig
]; ];
}; };
"genmaicha" = nixpkgs.lib.nixosSystem { "genmaicha" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
home-manager.nixosModules.home-manager
nixos-hardware.nixosModules.framework-13-7040-amd nixos-hardware.nixosModules.framework-13-7040-amd
agenix.nixosModules.default agenix.nixosModules.default
./machines/genmaicha ./machines/genmaicha
(commonConfig {}) commonConfig
]; ];
}; };
"sencha" = nixpkgs.lib.nixosSystem { "sencha" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
modules = [ modules = [
home-manager.nixosModules.home-manager
agenix.nixosModules.default agenix.nixosModules.default
./machines/sencha ./machines/sencha
(commonConfig {}) commonConfig
]; ];
}; };
}; };

View File

@ -11,6 +11,12 @@ rebuild *args:
switch *args: switch *args:
@just rebuild switch {{args}} @just rebuild switch {{args}}
hm:
@home-manager switch --flake .
work:
@home-manager switch --flake '.#work'
# Rebuild the current machine for next boot # Rebuild the current machine for next boot
boot *args: boot *args:
@just rebuild boot {{args}} @just rebuild boot {{args}}

View File

@ -1,11 +1,15 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ (modulesPath + "/installer/scan/not-detected.nix") ../common/cifs.nix lib,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
../common/cifs.nix
]; ];
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"]; boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod"];
@ -13,15 +17,15 @@
boot.kernelModules = ["kvm-amd"]; boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/e2274508-9989-4f6b-9bcf-a0d246f292f9"; device = "/dev/disk/by-uuid/e2274508-9989-4f6b-9bcf-a0d246f292f9";
fsType = "ext4"; fsType = "ext4";
}; };
boot.initrd.luks.devices."luks-1121cd25-7c4c-47ee-b04a-2cab0cd251ea".device = "/dev/disk/by-uuid/1121cd25-7c4c-47ee-b04a-2cab0cd251ea"; boot.initrd.luks.devices."luks-1121cd25-7c4c-47ee-b04a-2cab0cd251ea".device = "/dev/disk/by-uuid/1121cd25-7c4c-47ee-b04a-2cab0cd251ea";
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/86CA-6DF6"; device = "/dev/disk/by-uuid/86CA-6DF6";
fsType = "vfat"; fsType = "vfat";
}; };