Switch to single-user design

This commit is contained in:
GHOSCHT 2023-12-25 23:11:54 +01:00
parent e9540a5880
commit d446d04ad7
Signed by: ghoscht
GPG key ID: 2C2C1C62A5388E82
5 changed files with 18 additions and 5 deletions

View file

@ -38,6 +38,7 @@
# This is a function that generates an attribute by calling a function you # This is a function that generates an attribute by calling a function you
# pass to it, with each system as an argument # pass to it, with each system as an argument
forAllSystems = nixpkgs.lib.genAttrs systems; forAllSystems = nixpkgs.lib.genAttrs systems;
vars = import ./vars.nix;
in { in {
# Your custom packages # Your custom packages
# Accessible through 'nix build', 'nix shell', etc # Accessible through 'nix build', 'nix shell', etc
@ -59,7 +60,7 @@
# Available through 'nixos-rebuild --flake .#your-hostname' # Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = { nixosConfigurations = {
adalbert = nixpkgs.lib.nixosSystem { adalbert = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;}; specialArgs = {inherit inputs outputs vars;};
modules = [ modules = [
./hosts/adalbert ./hosts/adalbert
]; ];
@ -71,7 +72,7 @@
homeConfigurations = { homeConfigurations = {
"ghoscht@adalbert" = home-manager.lib.homeManagerConfiguration { "ghoscht@adalbert" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;}; extraSpecialArgs = {inherit inputs outputs vars;};
modules = [ modules = [
./home/ghoscht/adalbert.nix ./home/ghoscht/adalbert.nix
]; ];

View file

@ -25,7 +25,6 @@
./hardware-configuration.nix ./hardware-configuration.nix
../common/global ../common/global
../common/users/ghoscht
../common/optional/desktop/awesome.nix ../common/optional/desktop/awesome.nix
../common/optional/systemd-boot.nix ../common/optional/systemd-boot.nix

View file

@ -2,11 +2,13 @@
{ {
inputs, inputs,
outputs, outputs,
config,
... ...
}: { }: {
imports = imports =
[ [
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
./user.nix
./fish.nix ./fish.nix
./locale.nix ./locale.nix
./nix.nix ./nix.nix

View file

@ -1,11 +1,15 @@
{ {
inputs,
outputs,
pkgs, pkgs,
config, config,
vars,
... ...
}: let }: let
ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups;
in { in {
users.users.ghoscht = { imports = builtins.attrValues outputs.nixosModules; #propagates imports downwards
users.users.${vars.user} = {
isNormalUser = true; isNormalUser = true;
shell = pkgs.fish; shell = pkgs.fish;
extraGroups = extraGroups =
@ -38,5 +42,5 @@ in {
packages = [pkgs.home-manager]; packages = [pkgs.home-manager];
}; };
home-manager.users.ghoscht = import ../../../../home/ghoscht/${config.networking.hostName}.nix; home-manager.users.${vars.user} = import ../../../home/${vars.user}/${config.networking.hostName}.nix;
} }

7
vars.nix Normal file
View file

@ -0,0 +1,7 @@
{
# Global variables used in NixOS and HomeManager which will probably never change
user = "ghoscht";
location = "$HOME/.setup";
terminal = "alacritty";
editor = "nvim";
}