Fix correct username not being set

Rather than set username in flake.nix, set a default value in
default.nix (since it's always called), and set appropriate values in
personal.nix (pixelifytica) and work.nix (elitherl), since the two
files are mutually exclusive and only one or the other will be
imported.
This commit is contained in:
Evie Litherland-Smith 2024-06-24 09:15:17 +01:00
parent dc2ccdc7ea
commit c6a8a7c34e
4 changed files with 75 additions and 62 deletions

View file

@ -1,4 +1,8 @@
{username, ...}: {
{
config,
lib,
...
}: {
imports = [
# Programs
./programs/desktop/default.nix
@ -14,8 +18,8 @@
programs.home-manager.enable = true;
nixpkgs.config.allowUnfree = true;
home = {
inherit username;
homeDirectory = "/home/${username}";
username = lib.mkDefault "pixelifytica";
homeDirectory = "/home/${config.home.username}";
stateVersion = "23.05";
};
}

View file

@ -38,12 +38,10 @@
...
}: let
defaultExtraSpecialArgs = {
system ? "x86_64-linux",
hostname ? "Atlas",
username ? "pixelifytica",
...
hostname,
system,
}: rec {
inherit hostname username;
inherit hostname;
inherit (plasma-manager.packages.${system}) rc2nix;
accentColourName = "base0D";
altAccentColourName = "base0C";
@ -90,53 +88,58 @@
};
homeConfigurations = {
# Server
"pixelifytica@Legion" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {system = "x86_64-linux";};
modules = defaultModules;
extraSpecialArgs = defaultExtraSpecialArgs {
system = "x86_64-linux";
hostname = "Legion";
"pixelifytica@Legion" = let
hostname = "Legion";
system = "x86_64-linux";
in
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {inherit system;};
modules = defaultModules;
extraSpecialArgs = defaultExtraSpecialArgs {inherit hostname system;};
};
};
# Personal
"pixelifytica@Northstar" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {system = "x86_64-linux";};
modules =
defaultModules
++ [
./personal.nix
{programs.plasma.configFile.kcminputrc."Libinput/1739/52759/SYNA32AA:00 06CB:CE17 Touchpad".NaturalScroll = true;}
];
extraSpecialArgs = defaultExtraSpecialArgs {
system = "x86_64-linux";
hostname = "Northstar";
"pixelifytica@Northstar" = let
hostname = "Northstar";
system = "x86_64-linux";
in
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {inherit system;};
modules =
defaultModules
++ [
./personal.nix
{programs.plasma.configFile.kcminputrc."Libinput/1739/52759/SYNA32AA:00 06CB:CE17 Touchpad".NaturalScroll = true;}
];
extraSpecialArgs = defaultExtraSpecialArgs {inherit hostname system;};
};
};
"pixelifytica@Vanguard" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {system = "x86_64-linux";};
modules = defaultModules ++ [./personal.nix];
extraSpecialArgs = defaultExtraSpecialArgs {
system = "x86_64-linux";
hostname = "Vanguard";
"pixelifytica@Vanguard" = let
hostname = "Vanguard";
system = "x86_64-linux";
in
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {inherit system;};
modules = defaultModules ++ [./personal.nix];
extraSpecialArgs = defaultExtraSpecialArgs {inherit hostname system;};
};
};
# Work
"elitherl@Tone" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {system = "x86_64-linux";};
modules = defaultModules ++ [./work.nix];
extraSpecialArgs = defaultExtraSpecialArgs {
system = "x86_64-linux";
hostname = "Tone";
"elitherl@Tone" = let
hostname = "Tone";
system = "x86_64-linux";
in
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {inherit system;};
modules = defaultModules ++ [./work.nix];
extraSpecialArgs = defaultExtraSpecialArgs {inherit hostname system;};
};
};
"elitherl@Scorch" = home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {system = "x86_64-linux";};
modules = defaultModules ++ [./work.nix];
extraSpecialArgs = defaultExtraSpecialArgs {
system = "x86_64-linux";
hostname = "Scorch";
"elitherl@Scorch" = let
hostname = "Scorch";
system = "x86_64-linux";
in
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {inherit system;};
modules = defaultModules ++ [./work.nix];
extraSpecialArgs = defaultExtraSpecialArgs {inherit hostname system;};
};
};
};
};
}

View file

@ -4,12 +4,15 @@
./programs/games/default.nix
./programs/streaming/default.nix
];
home.packages = with pkgs;
with kdePackages; [
blender
freecad
prusa-slicer
ktorrent
noson
];
home = {
username = "pixelifytica";
packages = with pkgs;
with kdePackages; [
blender
freecad
prusa-slicer
ktorrent
noson
];
};
}

View file

@ -4,12 +4,15 @@
pkgs,
...
}: {
home.packages = with pkgs; [
twinkle
teams-for-linux
(writeShellScriptBin "ukaea-vpn-connect"
"sudo ${openfortivpn}/bin/openfortivpn -c ${./ukaea-vpn.conf}")
];
home = {
username = "elitherl";
packages = with pkgs; [
twinkle
teams-for-linux
(writeShellScriptBin "ukaea-vpn-connect"
"sudo ${openfortivpn}/bin/openfortivpn -c ${./ukaea-vpn.conf}")
];
};
programs = {
git.userEmail = config.accounts.email.accounts.outlook.address;
firefox.policies.Homepage.URL = "https://nucleus.ukaea.uk";