refac: use home as nixos module
This commit is contained in:
parent
3170700efe
commit
b9835b5c6f
14 changed files with 107 additions and 113 deletions
25
flake.nix
25
flake.nix
|
@ -38,18 +38,29 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = inputs @ { self, nixpkgs, ... }:
|
||||
outputs = inputs @ { self, nixpkgs, hardware, ... }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
in
|
||||
{
|
||||
homeConfigurations = import ./outputs/home.nix {
|
||||
inherit inputs system;
|
||||
};
|
||||
nixosConfigurations =
|
||||
nixpkgs.lib.mapAttrs
|
||||
(hostname: { system
|
||||
, specialArgs ? { }
|
||||
, extraModules ? [ ]
|
||||
, nixpkgs ? inputs.nixpkgs
|
||||
}:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
nixosConfigurations = import ./outputs/system.nix {
|
||||
inherit inputs system;
|
||||
};
|
||||
specialArgs = { inherit inputs; } // specialArgs;
|
||||
|
||||
modules =
|
||||
(with inputs; [ home-manager.nixosModule ])
|
||||
++ [ ./machines/${hostname} ]
|
||||
++ extraModules;
|
||||
})
|
||||
(import ./machines inputs);
|
||||
|
||||
devShells.${system} =
|
||||
let
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
secrets = import ../../../secrets.nix;
|
||||
secrets = import ../../secrets.nix;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
../common.nix
|
||||
];
|
||||
|
||||
# Use the systemd-boot EFI boot loader.
|
||||
boot = {
|
||||
loader = {
|
||||
systemd-boot.enable = true;
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
# Use latest kernel
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
# Use the systemd-boot EFI boot loader.
|
||||
boot.loader = {
|
||||
systemd-boot.enable = true;
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
|
||||
networking = {
|
||||
|
@ -33,7 +33,7 @@ in
|
|||
hardware.bluetooth.enable = true;
|
||||
services.blueman.enable = true;
|
||||
|
||||
# configure touchpad
|
||||
# configure mouse and touchpad
|
||||
services.xserver.libinput = {
|
||||
enable = true;
|
||||
mouse = {
|
|
@ -4,9 +4,6 @@
|
|||
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
secrets = import ../secrets.nix;
|
||||
in
|
||||
{
|
||||
networking = {
|
||||
networkmanager.enable = true;
|
||||
|
@ -56,9 +53,6 @@ in
|
|||
|
||||
# Enable the X11 windowing system.
|
||||
services = {
|
||||
# Enable the OpenSSH daemon.
|
||||
openssh.enable = true;
|
||||
|
||||
# Xmonad
|
||||
dbus = {
|
||||
enable = true;
|
||||
|
@ -95,17 +89,6 @@ in
|
|||
programs.zsh.enable = true;
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.me = {
|
||||
isNormalUser = true;
|
||||
name = secrets.mainUser.userName;
|
||||
home = secrets.mainUser.userDir;
|
||||
extraGroups = [
|
||||
"wheel" # Enable ‘sudo’ for the user.
|
||||
"networkmanager"
|
||||
"docker"
|
||||
];
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
|
@ -115,6 +98,9 @@ in
|
|||
wget
|
||||
];
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
# programs.mtr.enable = true;
|
||||
|
@ -131,7 +117,7 @@ in
|
|||
settings = {
|
||||
auto-optimise-store = true;
|
||||
|
||||
trusted-users = [ "root" secrets.mainUser.userName ];
|
||||
trusted-users = [ "root" ];
|
||||
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
|
30
machines/default.nix
Normal file
30
machines/default.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ dedsec-grub-theme, ... } @ inputs:
|
||||
|
||||
let
|
||||
hardware = inputs.hardware.nixosModules;
|
||||
in
|
||||
{
|
||||
home = {
|
||||
system = "x86_64-linux";
|
||||
|
||||
extraModules = [
|
||||
dedsec-grub-theme.nixosModule
|
||||
../modules/garbage-collector.nix
|
||||
../users/jan
|
||||
];
|
||||
};
|
||||
|
||||
asus_gl553vd = {
|
||||
system = "x86_64-linux";
|
||||
|
||||
specialArgs = {
|
||||
fontSize = 6.0;
|
||||
};
|
||||
|
||||
extraModules = [
|
||||
hardware.common-cpu-intel
|
||||
../users/jan
|
||||
];
|
||||
};
|
||||
|
||||
}
|
|
@ -1,12 +1,13 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
secrets = import ../../../secrets.nix;
|
||||
secrets = import ../../secrets.nix;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
# Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
../common.nix
|
||||
];
|
||||
|
||||
boot = {
|
11
makefile
11
makefile
|
@ -1,17 +1,10 @@
|
|||
switchHm = home-manager switch --flake
|
||||
switchSys = nixos-rebuild switch --flake
|
||||
|
||||
users-jan: fix-systemd
|
||||
${switchHm} .#users-jan
|
||||
|
||||
users-laptop-jan: fix-systemd
|
||||
${switchHm} .#users-laptop-jan
|
||||
|
||||
sys-home:
|
||||
sudo ${switchSys} .#system-home
|
||||
sudo ${switchSys} .#home
|
||||
|
||||
sys-asus-gl553vd:
|
||||
sudo ${switchSys} .#system-asus-gl553vd
|
||||
sudo ${switchSys} .#asus_gl553vd
|
||||
|
||||
fix-systemd:
|
||||
systemctl --user reset-failed
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
{ inputs, system, ... }:
|
||||
|
||||
with inputs;
|
||||
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
|
||||
overlays = [
|
||||
inputs.wired.overlays.default
|
||||
inputs.myneovim.overlays.default
|
||||
inputs.vnetod.overlay
|
||||
inputs.nil.overlays.default
|
||||
];
|
||||
};
|
||||
|
||||
mkUsersJan = mods: home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
|
||||
modules = [
|
||||
inputs.wired.homeManagerModules.default
|
||||
../users/jan/home.nix
|
||||
] ++ mods;
|
||||
};
|
||||
in
|
||||
{
|
||||
users-jan = mkUsersJan [ ];
|
||||
users-laptop-jan = mkUsersJan [
|
||||
({ config, ... }: {
|
||||
progs.alacritty.fontSize = 6.0;
|
||||
})
|
||||
];
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
{ inputs, system, ... }:
|
||||
|
||||
with inputs;
|
||||
{
|
||||
system-home = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
dedsec-grub-theme.nixosModule
|
||||
../system/configuration.nix
|
||||
../system/garbage-collector.nix
|
||||
../system/machine/home
|
||||
];
|
||||
};
|
||||
system-asus-gl553vd = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
hardware.nixosModules.common-cpu-intel
|
||||
../system/configuration.nix
|
||||
../system/machine/asus_gl553vd
|
||||
];
|
||||
};
|
||||
}
|
BIN
secrets.nix
BIN
secrets.nix
Binary file not shown.
42
users/jan/default.nix
Normal file
42
users/jan/default.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ config, pkgs, lib, inputs, fontSize ? null, ... }:
|
||||
|
||||
let
|
||||
secrets = import ./secrets.nix;
|
||||
in
|
||||
{
|
||||
nixpkgs.overlays = (import ../../overlays) ++ [
|
||||
inputs.wired.overlays.default
|
||||
inputs.myneovim.overlays.default
|
||||
inputs.vnetod.overlay
|
||||
inputs.nil.overlays.default
|
||||
];
|
||||
|
||||
users.users.jan = {
|
||||
isNormalUser = true;
|
||||
name = secrets.userName;
|
||||
home = secrets.userDir;
|
||||
extraGroups = [
|
||||
"wheel" # Enable ‘sudo’ for the user.
|
||||
"networkmanager"
|
||||
"docker"
|
||||
];
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
users.jan = { lib, ... }: {
|
||||
imports = [
|
||||
inputs.wired.homeManagerModules.default
|
||||
./home.nix
|
||||
];
|
||||
|
||||
progs.alacritty.fontSize = lib.mkIf (fontSize != null) fontSize;
|
||||
|
||||
home.stateVersion = config.system.stateVersion;
|
||||
};
|
||||
};
|
||||
|
||||
nix.settings.trusted-users = lib.mkForce [ "root" secrets.userName ];
|
||||
}
|
|
@ -6,8 +6,6 @@ in
|
|||
{
|
||||
imports = (import ./ui) ++ (import ./shell) ++ (import ./progs);
|
||||
|
||||
nixpkgs.overlays = import ../../overlays;
|
||||
|
||||
# Home Manager needs a bit of information about you and the
|
||||
# paths it should manage.
|
||||
home.username = secrets.userName;
|
||||
|
@ -136,16 +134,4 @@ in
|
|||
enable = true;
|
||||
config = ./wired.ron;
|
||||
};
|
||||
|
||||
# This value determines the Home Manager release that your
|
||||
# configuration is compatible with. This helps avoid breakage
|
||||
# when a new Home Manager release introduces backwards
|
||||
# incompatible changes.
|
||||
#
|
||||
# You can update Home Manager without changing this value. See
|
||||
# the Home Manager release notes for a list of state version
|
||||
# changes in each release.
|
||||
home.stateVersion = "21.11";
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue